VTK  9.3.20240425
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
38#ifndef vtkCompositePolyDataMapper2_h
39#define vtkCompositePolyDataMapper2_h
40
42
43#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_3_0
44#include "vtkRenderingOpenGL2Module.h" // For export macro
45#include "vtkSmartPointer.h" // for vtkSmartPointer
46#include "vtk_glew.h" // for OpenGL enums
47
48#include "vtkColor.h" // used for ivars
49#include <map> // use for ivars
50#include <stack> // used for ivars
51#include <vector> // used for ivars
52
53VTK_ABI_NAMESPACE_BEGIN
57
58class VTK_DEPRECATED_IN_9_3_0("Please use vtkCompositePolyDataMapper instead")
59 VTKRENDERINGOPENGL2_EXPORT vtkCompositePolyDataMapper2 : public vtkOpenGLPolyDataMapper
60{
61public:
64 void PrintSelf(ostream& os, vtkIndent indent) override;
65
67
72 bool HasOpaqueGeometry() override;
75
77
83
85
88 void SetBlockVisibility(unsigned int index, bool visible);
89 bool GetBlockVisibility(unsigned int index);
90 void RemoveBlockVisibility(unsigned int index);
93
95
98 void SetBlockColor(unsigned int index, const double color[3]);
99 void SetBlockColor(unsigned int index, double r, double g, double b)
100 {
101 double color[3] = { r, g, b };
102 this->SetBlockColor(index, color);
103 }
104 double* GetBlockColor(unsigned int index);
105 void RemoveBlockColor(unsigned int index);
108
110
113 void SetBlockOpacity(unsigned int index, double opacity);
114 double GetBlockOpacity(unsigned int index);
115 void RemoveBlockOpacity(unsigned int index);
118
125 vtkSetMacro(ColorMissingArraysWithNanColor, bool);
126 vtkGetMacro(ColorMissingArraysWithNanColor, bool);
127 vtkBooleanMacro(ColorMissingArraysWithNanColor, bool);
136
140 void Render(vtkRenderer* ren, vtkActor* act) override;
141
145 void SetVBOShiftScaleMethod(int m) override;
146
151 void SetPauseShiftScale(bool pauseShiftScale) override;
152
154
159 int idx, int port, int connection, int fieldAssociation, const char* name) override;
161 int idx, int port, int connection, int fieldAssociation, int fieldAttributeType) override;
162 void SetInputArrayToProcess(int idx, vtkInformation* info) override;
164
168 std::vector<vtkPolyData*> GetRenderedList() { return this->RenderedList; }
169
175 vtkHardwareSelector* sel, std::vector<unsigned int>& pixeloffsets, vtkProp* prop) override;
176
181
182protected:
185
192
196 int FillInputPortInformation(int port, vtkInformation* info) override;
197
201 void ComputeBounds() override;
202
208 vtkRenderer* vtkNotUsed(ren), vtkActor* vtkNotUsed(act))
209 {
210 }
211
216
217 // what "index" are we currently rendering, -1 means none
219 std::map<const std::string, vtkCompositeMapperHelper2*> Helpers;
220 std::map<vtkPolyData*, vtkCompositeMapperHelperData*> HelperDataMap;
222
224
225 // copy values to the helpers
227
229 {
230 public:
231 std::stack<bool> Visibility;
232 std::stack<bool> Pickability;
233 std::stack<double> Opacity;
234 std::stack<vtkColor3d> AmbientColor;
235 std::stack<vtkColor3d> DiffuseColor;
236 std::stack<vtkColor3d> SpecularColor;
237 std::stack<vtkColor3d> SelectionColor;
238 std::stack<float> SelectionOpacity;
239 };
240
241 bool RecursiveHasTranslucentGeometry(vtkDataObject* dobj, unsigned int& flat_index);
244
246 vtkRenderer* renderer, vtkActor* actor, vtkDataObject* dobj, unsigned int& flat_index);
248
251 vtkRenderer* renderer, vtkActor* actor, vtkDataObject* dobj, unsigned int& flat_index);
252
257
259
265
266 std::vector<vtkPolyData*> RenderedList;
267
268private:
269 double ColorResult[3];
270
272 void operator=(const vtkCompositePolyDataMapper2&) = delete;
273};
274
275VTK_ABI_NAMESPACE_END
276#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:151
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.
int FillInputPortInformation(int port, vtkInformation *info) override
Need to define the type of data handled by this mapper.
~vtkCompositePolyDataMapper2() override
static vtkCompositePolyDataMapper2 * New()
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.
std::vector< vtkPolyData * > GetRenderedList()
Accessor to the ordered list of PolyData that we end last drew.
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.
double * GetBlockColor(unsigned int index)
Set/get the color for a block given its flat index.
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
Methods invoked by print to print information about the object including superclasses.
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.
vtkCompositeDataDisplayAttributes * GetCompositeDataDisplayAttributes()
Set/get the composite data set attributes.
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.
bool ColorMissingArraysWithNanColor
If the current 'color by' array is missing on some datasets, color these dataset by the LookupTable's...
virtual vtkCompositeMapperHelper2 * CreateHelper()
void RemoveBlockVisibilities()
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 ...
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.
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.
general representation of visualization data
Superclass for all pipeline executives in VTK.
a simple class to control print indentation
Definition vtkIndent.h:108
Store vtkAlgorithm input/output information.
PolyDataMapper using OpenGL to render.
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:66
abstract specification for renderers
Hold a reference to a vtkObjectBase instance.
Class to make storing and comparing state quick and easy.
record modification and/or execution time
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
#define VTK_DEPRECATED_IN_9_3_0(reason)
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270