VTK  9.4.20241103
vtkArrayRenderer.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
13#ifndef vtkArrayRenderer_h
14#define vtkArrayRenderer_h
15
16#include "vtkRenderingOpenGL2Module.h" // For export macro
17
18#include "vtkDrawTexturedElements.h" // Inherited helper class.
19#include "vtkMapper.h"
20
21#include <set>
22#include <string>
23#include <vector>
24
25VTK_ABI_NAMESPACE_BEGIN
26
27class VTKRENDERINGOPENGL2_EXPORT vtkArrayRenderer
28 : public vtkMapper
30{
31public:
33 void PrintSelf(ostream& os, vtkIndent indent) override;
35
43 void PrepareColormap(vtkScalarsToColors* cmap = nullptr);
44
46 double* GetBounds() VTK_SIZEHINT(6) override;
47
52 {
59 };
60
66
70 void Render(vtkRenderer* ren, vtkActor* a) override;
71
73 void ReleaseGraphicsResources(vtkWindow* window) override;
74
76 vtkGetMacro(HasOpaque, vtkTypeBool);
77 vtkSetMacro(HasOpaque, vtkTypeBool);
78
80 vtkGetMacro(HasTranslucent, vtkTypeBool);
81 vtkSetMacro(HasTranslucent, vtkTypeBool);
82
83 bool HasOpaqueGeometry() override { return this->HasOpaque; }
84 bool HasTranslucentPolygonalGeometry() override { return this->HasTranslucent; }
85
90 vtkSetStdStringFromCharMacro(VertexShaderSource);
91 vtkGetCharFromStdStringMacro(VertexShaderSource);
92
97 vtkSetStdStringFromCharMacro(FragmentShaderSource);
98 vtkGetCharFromStdStringMacro(FragmentShaderSource);
99
101 void AddMod(const std::string& className);
102 void AddMods(const std::vector<std::string>& classNames);
103 void RemoveMod(const std::string& className);
105
106protected:
108 ~vtkArrayRenderer() override = default;
109
110 int FillInputPortInformation(int port, vtkInformation* info) override;
111
113
114 bool IsUpToDate(vtkRenderer* renderer, vtkActor* actor);
115 void PrepareToRender(vtkRenderer* renderer, vtkActor* actor);
116
117 vtkTypeBool HasOpaque{ true };
118 vtkTypeBool HasTranslucent{ false };
119
123
127 std::vector<std::string> ModNames;
128 std::set<std::string> ModNamesUnique;
129 static std::vector<std::string> DefaultModNames;
130
131private:
132 vtkArrayRenderer(const vtkArrayRenderer&) = delete;
133 void operator=(const vtkArrayRenderer&) = delete;
134};
135
136VTK_ABI_NAMESPACE_END
137
138#endif // vtkArrayRenderer_h
139// VTK-HeaderTest-Exclude: vtkArrayRenderer.h
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:151
Render instanced elements textured with arrays from input data.
static std::vector< std::string > DefaultModNames
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
std::vector< std::string > ModNames
vtkGetCharFromStdStringMacro(FragmentShaderSource)
~vtkArrayRenderer() override=default
std::string FragmentShaderSource
void ResetModsToDefault()
bool IsUpToDate(vtkRenderer *renderer, vtkActor *actor)
void AddMods(const std::vector< std::string > &classNames)
std::string VertexShaderSource
bool HasTranslucentPolygonalGeometry() override
Some introspection on the type of data the mapper will render used by props to determine if they shou...
void CreateColormapTexture()
bool HasOpaqueGeometry() override
Some introspection on the type of data the mapper will render used by props to determine if they shou...
vtkGetCharFromStdStringMacro(VertexShaderSource)
void RemoveMod(const std::string &className)
vtkTimeStamp RenderTimeStamp
void PrepareToRender(vtkRenderer *renderer, vtkActor *actor)
double * GetBounds() override
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax,...
static vtkArrayRenderer * New()
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkSetStdStringFromCharMacro(VertexShaderSource)
Set/get the source for the vertex shader.
void AddMod(const std::string &className)
std::set< std::string > ModNamesUnique
void ReleaseGraphicsResources(vtkWindow *window) override
Release any graphics resources associated with the window.
vtkSetStdStringFromCharMacro(FragmentShaderSource)
Set/get the source for the fragment shader.
ElementShape
Declare a new enum that inherits values from the base class so that python wrappings are generated.
void Render(vtkRenderer *ren, vtkActor *a) override
Render geometry.
void PrepareColormap(vtkScalarsToColors *cmap=nullptr)
Prepare a colormap for use in a shader.
A base class for mappers or render responders that need to draw primitives via vertex-pulling.
@ Triangle
Send triangles to the shader.
@ TriangleStrip
Send triangles to the shader (moving window of 3 vertices).
@ TriangleFan
Send triangle fans to the shader (first vertex is constant).
@ Line
Send line segments to the shader.
@ LineStrip
Send line segments to the shader.
@ Point
Send points to the shader.
void BindArrayToTexture(vtkStringToken textureName, vtkDataArray *array, bool asScalars=false)
Bind a data array to the given textureName (used in shader program texelFetch calls).
virtual bool SetNumberOfInstances(vtkIdType numberOfInstances)
virtual bool SetElementType(int elementType)
vtkShader * GetShader(vtkShader::Type shaderType)
Return a shader of the given type (creating as needed).
virtual bool SetNumberOfElements(vtkIdType numberOfElements)
a simple class to control print indentation
Definition vtkIndent.h:108
Store vtkAlgorithm input/output information.
abstract class specifies interface to map data to graphics primitives
Definition vtkMapper.h:137
double * GetBounds() override
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax,...
abstract specification for renderers
Superclass for mapping scalar values to colors.
record modification and/or execution time
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_SIZEHINT(...)