VTK  9.7.1
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 
25 VTK_ABI_NAMESPACE_BEGIN
26 
27 class VTKRENDERINGOPENGL2_EXPORT vtkArrayRenderer
28  : public vtkMapper
30 {
31 public:
32  vtkTypeMacro(vtkArrayRenderer, vtkMapper);
33  void PrintSelf(ostream& os, vtkIndent indent) override;
34  static vtkArrayRenderer* New();
35 
43  void PrepareColormap(vtkScalarsToColors* cmap = nullptr);
44 
46  double* GetBounds() VTK_SIZEHINT(6) override;
47 
52  {
53  Point = vtkDrawTexturedElements::ElementShape::Point,
54  Line = vtkDrawTexturedElements::ElementShape::Line,
55  LineStrip = vtkDrawTexturedElements::ElementShape::LineStrip,
56  Triangle = vtkDrawTexturedElements::ElementShape::Triangle,
57  TriangleStrip = vtkDrawTexturedElements::ElementShape::TriangleStrip,
58  TriangleFan = vtkDrawTexturedElements::ElementShape::TriangleFan
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 
100  void ResetModsToDefault();
101  void AddMod(const std::string& className);
102  void AddMods(const std::vector<std::string>& classNames);
103  void RemoveMod(const std::string& className);
104  void RemoveAllMods();
105 
106 protected:
108  ~vtkArrayRenderer() override = default;
109 
110  int FillInputPortInformation(int port, vtkInformation* info) override;
111 
112  void CreateColormapTexture();
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 
131 private:
132  vtkArrayRenderer(const vtkArrayRenderer&) = delete;
133  void operator=(const vtkArrayRenderer&) = delete;
134 };
135 
136 VTK_ABI_NAMESPACE_END
137 
138 #endif // vtkArrayRenderer_h
139 // VTK-HeaderTest-Exclude: vtkArrayRenderer.h
vtkTimeStamp RenderTimeStamp
std::set< std::string > ModNamesUnique
void GetBounds(T a, double bds[6])
virtual bool SetNumberOfElements(vtkIdType numberOfElements)
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:41
Store vtkAlgorithm input/output information.
record modification and/or execution time
Definition: vtkTimeStamp.h:24
vtkShader * GetShader(vtkShader::Type shaderType)
Return a shader of the given type (creating as needed).
abstract specification for renderers
Definition: vtkRenderer.h:63
static std::vector< std::string > DefaultModNames
std::vector< std::string > ModNames
int vtkTypeBool
Definition: vtkABI.h:64
Superclass for mapping scalar values to colors.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:41
virtual bool SetNumberOfInstances(vtkIdType numberOfInstances)
Render instanced elements textured with arrays from input data.
a simple class to control print indentation
Definition: vtkIndent.h:28
ElementShape
Declare a new enum that inherits values from the base class so that python wrappings are generated...
bool HasOpaqueGeometry() override
Some introspection on the type of data the mapper will render used by props to determine if they shou...
std::string FragmentShaderSource
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
#define VTK_SIZEHINT(...)
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:77
A base class for mappers or render responders that need to draw primitives via vertex-pulling.
void BindArrayToTexture(vtkStringToken textureName, vtkDataArray *array, bool asScalars=false)
Bind a data array to the given textureName (used in shader program texelFetch calls).
std::string VertexShaderSource
virtual bool SetElementType(int elementType)
static vtkAlgorithm * New()
double * GetBounds() override
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax, zmin,zmax).
virtual void Render(vtkRenderer *ren, vtkActor *a)=0
Method initiates the mapping process.
bool HasTranslucentPolygonalGeometry() override
Some introspection on the type of data the mapper will render used by props to determine if they shou...
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this mapper.
Definition: vtkMapper.h:105