VTK  9.0.3
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 =========================================================================*/
25 #ifndef vtkCompositePolyDataMapper2_h
26 #define vtkCompositePolyDataMapper2_h
27 
29 #include "vtkRenderingOpenGL2Module.h" // For export macro
30 #include "vtkSmartPointer.h" // for vtkSmartPointer
31 
32 #include "vtkColor.h" // used for ivars
33 #include <map> // use for ivars
34 #include <stack> // used for ivars
35 #include <vector> // used for ivars
36 
40 
41 class VTKRENDERINGOPENGL2_EXPORT vtkCompositePolyDataMapper2 : public vtkOpenGLPolyDataMapper
42 {
43 public:
46  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
49 
54  bool HasOpaqueGeometry() override;
57 
59 
65 
67 
70  void SetBlockVisibility(unsigned int index, bool visible);
71  bool GetBlockVisibility(unsigned int index);
72  void RemoveBlockVisibility(unsigned int index);
74  // This method is deprecated and will be removed in VTK 8.2. It is misspelled.
75  VTK_LEGACY(void RemoveBlockVisibilites());
77 
79 
82  void SetBlockColor(unsigned int index, double color[3]);
83  void SetBlockColor(unsigned int index, double r, double g, double b)
84  {
85  double color[3] = { r, g, b };
86  this->SetBlockColor(index, color);
87  }
88  double* GetBlockColor(unsigned int index);
89  void RemoveBlockColor(unsigned int index);
92 
94 
97  void SetBlockOpacity(unsigned int index, double opacity);
98  double GetBlockOpacity(unsigned int index);
99  void RemoveBlockOpacity(unsigned int index);
102 
109  vtkSetMacro(ColorMissingArraysWithNanColor, bool);
110  vtkGetMacro(ColorMissingArraysWithNanColor, bool);
111  vtkBooleanMacro(ColorMissingArraysWithNanColor, bool);
120 
124  void Render(vtkRenderer* ren, vtkActor* act) override;
125 
127 
132  int idx, int port, int connection, int fieldAssociation, const char* name) override;
134  int idx, int port, int connection, int fieldAssociation, int fieldAttributeType) override;
135  void SetInputArrayToProcess(int idx, vtkInformation* info) override;
137 
141  std::vector<vtkPolyData*> GetRenderedList() { return this->RenderedList; }
142 
148  vtkHardwareSelector* sel, std::vector<unsigned int>& pixeloffsets, vtkProp* prop) override;
149 
150 protected:
153 
160 
165 
169  void ComputeBounds() override;
170 
176  vtkRenderer* vtkNotUsed(ren), vtkActor* vtkNotUsed(act))
177  {
178  }
179 
184 
185  // what "index" are we currently rendering, -1 means none
187  std::map<const std::string, vtkCompositeMapperHelper2*> Helpers;
188  std::map<vtkPolyData*, vtkCompositeMapperHelperData*> HelperDataMap;
190 
192 
193  // copy values to the helpers
195 
197  {
198  public:
199  std::stack<bool> Visibility;
200  std::stack<bool> Pickability;
201  std::stack<double> Opacity;
202  std::stack<vtkColor3d> AmbientColor;
203  std::stack<vtkColor3d> DiffuseColor;
204  std::stack<vtkColor3d> SpecularColor;
205  };
206 
207  bool RecursiveHasTranslucentGeometry(vtkDataObject* dobj, unsigned int& flat_index);
210 
212  vtkRenderer* renderer, vtkActor* actor, vtkDataObject* dobj, unsigned int& flat_index);
214 
217  vtkRenderer* renderer, vtkActor* actor, vtkDataObject* dobj, unsigned int& flat_index);
218 
223 
225 
231 
232  std::vector<vtkPolyData*> RenderedList;
233 
234 private:
235  double ColorResult[3];
236 
238  void operator=(const vtkCompositePolyDataMapper2&) = delete;
239 };
240 
241 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:46
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.
mapper for composite dataset consisting of polygonal data.
void SetInputArrayToProcess(int idx, int port, int connection, int fieldAssociation, int fieldAttributeType) override
void BuildRenderValues(vtkRenderer *renderer, vtkActor *actor, vtkDataObject *dobj, unsigned int &flat_index)
void RemoveBlockVisibility(unsigned int index)
vtkExecutive * CreateDefaultExecutive() override
We need to override this method because the standard streaming demand driven pipeline is not what we ...
void SetBlockColor(unsigned int index, double color[3])
Set/get the color 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
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)
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
Set the input data arrays that this algorithm will process.
vtkTimeStamp BoundsMTime
Time stamp for computation of bounds.
bool RecursiveHasTranslucentGeometry(vtkDataObject *dobj, unsigned int &flat_index)
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.
virtual void CopyMapperValuesToHelper(vtkCompositeMapperHelper2 *helper)
bool GetBlockVisibility(unsigned int index)
void RemoveBlockColor(unsigned int index)
static vtkCompositePolyDataMapper2 * New()
bool ColorMissingArraysWithNanColor
If the current 'color by' array is missing on some datasets, color these dataset by the LookupTable's...
vtkCompositeDataDisplayAttributes * GetCompositeDataDisplayAttributes()
void SetInputArrayToProcess(int idx, vtkInformation *info) override
vtkSmartPointer< vtkCompositeDataDisplayAttributes > CompositeAttributes
Composite data set attributes.
void RenderBlock(vtkRenderer *renderer, vtkActor *actor, vtkDataObject *dobj, unsigned int &flat_index)
bool HasTranslucentPolygonalGeometry() override
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)
void RemoveBlockOpacity(unsigned int index)
double * GetBlockColor(unsigned int index)
void SetCompositeDataDisplayAttributes(vtkCompositeDataDisplayAttributes *attributes)
Set/get the composite data set attributes.
void ComputeBounds() override
Need to loop over the hierarchy to compute bounds.
general representation of visualization data
Definition: vtkDataObject.h:60
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:47
a simple class to control print indentation
Definition: vtkIndent.h:34
Store vtkAlgorithm input/output information.
PolyDataMapper using OpenGL to render.
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:48
abstract specification for renderers
Definition: vtkRenderer.h:59
Class to make storing and comparing state quick and easy.
record modification and/or execution time
Definition: vtkTimeStamp.h:33
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453
@ color
Definition: vtkX3D.h:227
@ name
Definition: vtkX3D.h:225
@ index
Definition: vtkX3D.h:252