VTK  9.1.0
vtkCompositePolyDataMapper2.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkCompositePolyDataMapper2.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
50#ifndef vtkCompositePolyDataMapper2_h
51#define vtkCompositePolyDataMapper2_h
52
54#include "vtkRenderingOpenGL2Module.h" // For export macro
55#include "vtkSmartPointer.h" // for vtkSmartPointer
56
57#include "vtkColor.h" // used for ivars
58#include <map> // use for ivars
59#include <stack> // used for ivars
60#include <vector> // used for ivars
61
65
66class VTKRENDERINGOPENGL2_EXPORT vtkCompositePolyDataMapper2 : public vtkOpenGLPolyDataMapper
67{
68public:
71 void PrintSelf(ostream& os, vtkIndent indent) override;
72
74
79 bool HasOpaqueGeometry() override;
82
84
90
92
95 void SetBlockVisibility(unsigned int index, bool visible);
96 bool GetBlockVisibility(unsigned int index);
97 void RemoveBlockVisibility(unsigned int index);
100
102
105 void SetBlockColor(unsigned int index, const double color[3]);
106 void SetBlockColor(unsigned int index, double r, double g, double b)
107 {
108 double color[3] = { r, g, b };
109 this->SetBlockColor(index, color);
110 }
111 double* GetBlockColor(unsigned int index);
112 void RemoveBlockColor(unsigned int index);
115
117
120 void SetBlockOpacity(unsigned int index, double opacity);
121 double GetBlockOpacity(unsigned int index);
122 void RemoveBlockOpacity(unsigned int index);
125
132 vtkSetMacro(ColorMissingArraysWithNanColor, bool);
133 vtkGetMacro(ColorMissingArraysWithNanColor, bool);
134 vtkBooleanMacro(ColorMissingArraysWithNanColor, bool);
143
147 void Render(vtkRenderer* ren, vtkActor* act) override;
148
152 void SetVBOShiftScaleMethod(int m) override;
153
158 void SetPauseShiftScale(bool pauseShiftScale) override;
159
161
166 int idx, int port, int connection, int fieldAssociation, const char* name) override;
168 int idx, int port, int connection, int fieldAssociation, int fieldAttributeType) override;
169 void SetInputArrayToProcess(int idx, vtkInformation* info) override;
171
175 std::vector<vtkPolyData*> GetRenderedList() { return this->RenderedList; }
176
182 vtkHardwareSelector* sel, std::vector<unsigned int>& pixeloffsets, vtkProp* prop) override;
183
188
189protected:
192
199
203 int FillInputPortInformation(int port, vtkInformation* info) override;
204
208 void ComputeBounds() override;
209
215 vtkRenderer* vtkNotUsed(ren), vtkActor* vtkNotUsed(act))
216 {
217 }
218
223
224 // what "index" are we currently rendering, -1 means none
226 std::map<const std::string, vtkCompositeMapperHelper2*> Helpers;
227 std::map<vtkPolyData*, vtkCompositeMapperHelperData*> HelperDataMap;
229
231
232 // copy values to the helpers
234
236 {
237 public:
238 std::stack<bool> Visibility;
239 std::stack<bool> Pickability;
240 std::stack<double> Opacity;
241 std::stack<vtkColor3d> AmbientColor;
242 std::stack<vtkColor3d> DiffuseColor;
243 std::stack<vtkColor3d> SpecularColor;
244 std::stack<vtkColor3d> SelectionColor;
245 std::stack<float> SelectionOpacity;
246 };
247
248 bool RecursiveHasTranslucentGeometry(vtkDataObject* dobj, unsigned int& flat_index);
251
253 vtkRenderer* renderer, vtkActor* actor, vtkDataObject* dobj, unsigned int& flat_index);
255
258 vtkRenderer* renderer, vtkActor* actor, vtkDataObject* dobj, unsigned int& flat_index);
259
264
266
272
273 std::vector<vtkPolyData*> RenderedList;
274
275private:
276 double ColorResult[3];
277
279 void operator=(const vtkCompositePolyDataMapper2&) = delete;
280};
281
282#endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:155
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.
Definition: vtkExecutive.h:76
a simple class to control print indentation
Definition: vtkIndent.h:113
Store vtkAlgorithm input/output information.
PolyDataMapper using OpenGL to render.
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:76
abstract specification for renderers
Definition: vtkRenderer.h:182
Hold a reference to a vtkObjectBase instance.
Class to make storing and comparing state quick and easy.
record modification and/or execution time
Definition: vtkTimeStamp.h:52
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287