VTK  9.3.0
vtkCompositePolyDataMapper2.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
28 #ifndef vtkCompositePolyDataMapper2_h
29 #define vtkCompositePolyDataMapper2_h
30 
31 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_3_0
32 #include "vtkRenderingOpenGL2Module.h" // For export macro
33 #include "vtkSmartPointer.h" // for vtkSmartPointer
34 #include "vtk_glew.h" // for OpenGL enums
35 // clang-format off
36 // Must be included after vtk_glew.h for GL_ES_VERSION_3_0
37 #ifndef GL_ES_VERSION_3_0
39 #define vtkOpenGLPolyDataMapperImplementation vtkOpenGLPolyDataMapper
40 #else
42 #define vtkOpenGLPolyDataMapperImplementation vtkOpenGLES30PolyDataMapper
43 #endif
44 // clang-format on
45 
46 #include "vtkColor.h" // used for ivars
47 #include <map> // use for ivars
48 #include <stack> // used for ivars
49 #include <vector> // used for ivars
50 
51 VTK_ABI_NAMESPACE_BEGIN
55 
57  VTKRENDERINGOPENGL2_EXPORT vtkCompositePolyDataMapper2
59 {
60 public:
63  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
66 
71  bool HasOpaqueGeometry() override;
74 
76 
82 
84 
87  void SetBlockVisibility(unsigned int index, bool visible);
88  bool GetBlockVisibility(unsigned int index);
89  void RemoveBlockVisibility(unsigned int index);
92 
94 
97  void SetBlockColor(unsigned int index, const double color[3]);
98  void SetBlockColor(unsigned int index, double r, double g, double b)
99  {
100  double color[3] = { r, g, b };
101  this->SetBlockColor(index, color);
102  }
103  double* GetBlockColor(unsigned int index);
104  void RemoveBlockColor(unsigned int index);
107 
109 
112  void SetBlockOpacity(unsigned int index, double opacity);
113  double GetBlockOpacity(unsigned int index);
114  void RemoveBlockOpacity(unsigned int index);
117 
124  vtkSetMacro(ColorMissingArraysWithNanColor, bool);
125  vtkGetMacro(ColorMissingArraysWithNanColor, bool);
126  vtkBooleanMacro(ColorMissingArraysWithNanColor, bool);
135 
139  void Render(vtkRenderer* ren, vtkActor* act) override;
140 
144  void SetVBOShiftScaleMethod(int m) override;
145 
150  void SetPauseShiftScale(bool pauseShiftScale) override;
151 
153 
158  int idx, int port, int connection, int fieldAssociation, const char* name) override;
160  int idx, int port, int connection, int fieldAssociation, int fieldAttributeType) override;
161  void SetInputArrayToProcess(int idx, vtkInformation* info) override;
163 
167  std::vector<vtkPolyData*> GetRenderedList() { return this->RenderedList; }
168 
174  vtkHardwareSelector* sel, std::vector<unsigned int>& pixeloffsets, vtkProp* prop) override;
175 
179  vtkMTimeType GetMTime() override;
180 
181 protected:
184 
191 
196 
200  void ComputeBounds() override;
201 
207  vtkRenderer* vtkNotUsed(ren), vtkActor* vtkNotUsed(act))
208  {
209  }
210 
215 
216  // what "index" are we currently rendering, -1 means none
218  std::map<const std::string, vtkCompositeMapperHelper2*> Helpers;
219  std::map<vtkPolyData*, vtkCompositeMapperHelperData*> HelperDataMap;
221 
223 
224  // copy values to the helpers
226 
228  {
229  public:
230  std::stack<bool> Visibility;
231  std::stack<bool> Pickability;
232  std::stack<double> Opacity;
233  std::stack<vtkColor3d> AmbientColor;
234  std::stack<vtkColor3d> DiffuseColor;
235  std::stack<vtkColor3d> SpecularColor;
236  std::stack<vtkColor3d> SelectionColor;
237  std::stack<float> SelectionOpacity;
238  };
239 
240  bool RecursiveHasTranslucentGeometry(vtkDataObject* dobj, unsigned int& flat_index);
243 
245  vtkRenderer* renderer, vtkActor* actor, vtkDataObject* dobj, unsigned int& flat_index);
247 
250  vtkRenderer* renderer, vtkActor* actor, vtkDataObject* dobj, unsigned int& flat_index);
251 
256 
258 
264 
265  std::vector<vtkPolyData*> RenderedList;
266 
267 private:
268  double ColorResult[3];
269 
271  void operator=(const vtkCompositePolyDataMapper2&) = delete;
272 };
273 
274 VTK_ABI_NAMESPACE_END
275 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:50
virtual void SetInputArrayToProcess(int idx, int port, int connection, int fieldAssociation, const char *name)
Set the input data arrays that this algorithm will process.
Rendering attributes for a multi-block dataset.
Helper class for vtkCompositePolyDataMapper2 that is a subclass of vtkOpenGLPolyDataMapper.
mapper for composite dataset consisting of polygonal data.
void SetInputArrayToProcess(int idx, int port, int connection, int fieldAssociation, int fieldAttributeType) override
Call SetInputArrayToProcess on helpers.
void BuildRenderValues(vtkRenderer *renderer, vtkActor *actor, vtkDataObject *dobj, unsigned int &flat_index)
void RemoveBlockVisibility(unsigned int index)
Set/get the visibility for a block given its flat index.
vtkExecutive * CreateDefaultExecutive() override
We need to override this method because the standard streaming demand driven pipeline is not what we ...
int FillInputPortInformation(int port, vtkInformation *info) override
Need to define the type of data handled by this mapper.
~vtkCompositePolyDataMapper2() override
std::vector< vtkPolyData * > GetRenderedList()
Accessor to the ordered list of PolyData that we end last drew.
virtual vtkCompositeMapperHelper2 * CreateHelper()
void ProcessSelectorPixelBuffers(vtkHardwareSelector *sel, std::vector< unsigned int > &pixeloffsets, vtkProp *prop) override
allows a mapper to update a selections color buffers Called from a prop which in turn is called from ...
bool HasOpaqueGeometry() override
Some introspection on the type of data the mapper will render used by props to determine if they shou...
double GetBlockOpacity(unsigned int index)
Set/get the opacity for a block given its flat index.
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this mapper.
void SetBlockVisibility(unsigned int index, bool visible)
Set/get the visibility for a block given its flat index.
void SetInputArrayToProcess(int idx, int port, int connection, int fieldAssociation, const char *name) override
Call SetInputArrayToProcess on helpers.
vtkTimeStamp BoundsMTime
Time stamp for computation of bounds.
bool RecursiveHasTranslucentGeometry(vtkDataObject *dobj, unsigned int &flat_index)
void SetVBOShiftScaleMethod(int m) override
A convenience method for enabling/disabling the VBO's shift+scale transform.
std::map< vtkPolyData *, vtkCompositeMapperHelperData * > HelperDataMap
virtual void InitializeHelpersBeforeRendering(vtkRenderer *vtkNotUsed(ren), vtkActor *vtkNotUsed(act))
This method is called before RenderPiece is called on helpers.
void PrintSelf(ostream &os, vtkIndent indent) override
std::map< const std::string, vtkCompositeMapperHelper2 * > Helpers
void SetBlockOpacity(unsigned int index, double opacity)
Set/get the opacity for a block given its flat index.
void SetBlockColor(unsigned int index, const double color[3])
Set/get the color for a block given its flat index.
void SetPauseShiftScale(bool pauseShiftScale) override
Pause updates of shift-scale parameters based on camera position.
virtual void CopyMapperValuesToHelper(vtkCompositeMapperHelper2 *helper)
bool GetBlockVisibility(unsigned int index)
Set/get the visibility for a block given its flat index.
void RemoveBlockColor(unsigned int index)
Set/get the color for a block given its flat index.
static vtkCompositePolyDataMapper2 * New()
bool ColorMissingArraysWithNanColor
If the current 'color by' array is missing on some datasets, color these dataset by the LookupTable's...
void RemoveBlockVisibilities()
Set/get the visibility for a block given its flat index.
vtkCompositeDataDisplayAttributes * GetCompositeDataDisplayAttributes()
Set/get the composite data set attributes.
void SetInputArrayToProcess(int idx, vtkInformation *info) override
Call SetInputArrayToProcess on helpers.
void RemoveBlockColors()
Set/get the color for a block given its flat index.
vtkSmartPointer< vtkCompositeDataDisplayAttributes > CompositeAttributes
Composite data set attributes.
void RenderBlock(vtkRenderer *renderer, vtkActor *actor, vtkDataObject *dobj, unsigned int &flat_index)
bool HasTranslucentPolygonalGeometry() override
Some introspection on the type of data the mapper will render used by props to determine if they shou...
std::vector< vtkPolyData * > RenderedList
void Render(vtkRenderer *ren, vtkActor *act) override
This calls RenderPiece (in a for loop if streaming is necessary).
void SetBlockColor(unsigned int index, double r, double g, double b)
Set/get the color for a block given its flat index.
void RemoveBlockOpacity(unsigned int index)
Set/get the opacity for a block given its flat index.
void RemoveBlockOpacities()
Set/get the opacity for a block given its flat index.
double * GetBlockColor(unsigned int index)
Set/get the color for a block given its flat index.
void SetCompositeDataDisplayAttributes(vtkCompositeDataDisplayAttributes *attributes)
Set/get the composite data set attributes.
void ComputeBounds() override
Need to loop over the hierarchy to compute bounds.
vtkMTimeType GetMTime() override
Overridden to include vtkCompositeDataDisplayAttributes' mtime.
a class that renders hierarchical polygonal data
general representation of visualization data
Definition: vtkDataObject.h:64
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:48
a simple class to control print indentation
Definition: vtkIndent.h:38
Store vtkAlgorithm input/output information.
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:55
abstract specification for renderers
Definition: vtkRenderer.h:71
Class to make storing and comparing state quick and easy.
record modification and/or execution time
Definition: vtkTimeStamp.h:34
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447
@ color
Definition: vtkX3D.h:221
@ name
Definition: vtkX3D.h:219
@ index
Definition: vtkX3D.h:246
#define vtkOpenGLPolyDataMapperImplementation
#define VTK_DEPRECATED_IN_9_3_0(reason)
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270