VTK  9.0.1
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 =========================================================================*/
28 #ifndef vtkCompositePolyDataMapper2_h
29 #define vtkCompositePolyDataMapper2_h
30 
32 #include "vtkRenderingOpenGL2Module.h" // For export macro
33 #include "vtkSmartPointer.h" // for vtkSmartPointer
34 
35 #include "vtkColor.h" // used for ivars
36 #include <map> // use for ivars
37 #include <stack> // used for ivars
38 #include <vector> // used for ivars
39 
43 
44 class VTKRENDERINGOPENGL2_EXPORT vtkCompositePolyDataMapper2 : public vtkOpenGLPolyDataMapper
45 {
46 public:
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
52 
57  bool HasOpaqueGeometry() override;
58  bool HasTranslucentPolygonalGeometry() override;
60 
62 
65  void SetCompositeDataDisplayAttributes(vtkCompositeDataDisplayAttributes* attributes);
66  vtkCompositeDataDisplayAttributes* GetCompositeDataDisplayAttributes();
68 
70 
73  void SetBlockVisibility(unsigned int index, bool visible);
74  bool GetBlockVisibility(unsigned int index);
75  void RemoveBlockVisibility(unsigned int index);
76  void RemoveBlockVisibilities();
77  // This method is deprecated and will be removed in VTK 8.2. It is misspelled.
78  VTK_LEGACY(void RemoveBlockVisibilites());
80 
82 
85  void SetBlockColor(unsigned int index, double color[3]);
86  void SetBlockColor(unsigned int index, double r, double g, double b)
87  {
88  double color[3] = { r, g, b };
89  this->SetBlockColor(index, color);
90  }
91  double* GetBlockColor(unsigned int index);
92  void RemoveBlockColor(unsigned int index);
93  void RemoveBlockColors();
95 
97 
100  void SetBlockOpacity(unsigned int index, double opacity);
101  double GetBlockOpacity(unsigned int index);
102  void RemoveBlockOpacity(unsigned int index);
103  void RemoveBlockOpacities();
105 
112  vtkSetMacro(ColorMissingArraysWithNanColor, bool);
113  vtkGetMacro(ColorMissingArraysWithNanColor, bool);
114  vtkBooleanMacro(ColorMissingArraysWithNanColor, bool);
122  void ReleaseGraphicsResources(vtkWindow*) override;
123 
127  void Render(vtkRenderer* ren, vtkActor* act) override;
128 
130 
135  int idx, int port, int connection, int fieldAssociation, const char* name) override;
137  int idx, int port, int connection, int fieldAssociation, int fieldAttributeType) override;
138  void SetInputArrayToProcess(int idx, vtkInformation* info) override;
140 
144  std::vector<vtkPolyData*> GetRenderedList() { return this->RenderedList; }
145 
151  vtkHardwareSelector* sel, std::vector<unsigned int>& pixeloffsets, vtkProp* prop) override;
152 
153 protected:
155  ~vtkCompositePolyDataMapper2() override;
156 
163 
167  int FillInputPortInformation(int port, vtkInformation* info) override;
168 
172  void ComputeBounds() override;
173 
179  vtkRenderer* vtkNotUsed(ren), vtkActor* vtkNotUsed(act))
180  {
181  }
182 
187 
188  // what "index" are we currently rendering, -1 means none
190  std::map<const std::string, vtkCompositeMapperHelper2*> Helpers;
191  std::map<vtkPolyData*, vtkCompositeMapperHelperData*> HelperDataMap;
193 
194  virtual vtkCompositeMapperHelper2* CreateHelper();
195 
196  // copy values to the helpers
197  virtual void CopyMapperValuesToHelper(vtkCompositeMapperHelper2* helper);
198 
200  {
201  public:
202  std::stack<bool> Visibility;
203  std::stack<bool> Pickability;
204  std::stack<double> Opacity;
205  std::stack<vtkColor3d> AmbientColor;
206  std::stack<vtkColor3d> DiffuseColor;
207  std::stack<vtkColor3d> SpecularColor;
208  };
209 
210  bool RecursiveHasTranslucentGeometry(vtkDataObject* dobj, unsigned int& flat_index);
213 
214  void BuildRenderValues(
215  vtkRenderer* renderer, vtkActor* actor, vtkDataObject* dobj, unsigned int& flat_index);
217 
219  void RenderBlock(
220  vtkRenderer* renderer, vtkActor* actor, vtkDataObject* dobj, unsigned int& flat_index);
221 
226 
228 
234 
235  std::vector<vtkPolyData*> RenderedList;
236 
237 private:
238  double ColorResult[3];
239 
241  void operator=(const vtkCompositePolyDataMapper2&) = delete;
242 };
243 
244 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:50
PolyDataMapper using OpenGL to render.
void ComputeBounds() override
Called in GetBounds().
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
static vtkOpenGLPolyDataMapper * New()
virtual vtkExecutive * CreateDefaultExecutive()
Create a default executive.
Store vtkAlgorithm input/output information.
mapper for composite dataset consisting of polygonal data.
std::vector< vtkPolyData * > GetRenderedList()
Accessor to the ordered list of PolyData that we end last drew.
record modification and/or execution time
Definition: vtkTimeStamp.h:32
Rendering attributes for a multi-block dataset.
virtual bool HasOpaqueGeometry()
Some introspection on the type of data the mapper will render used by props to determine if they shou...
virtual bool HasTranslucentPolygonalGeometry()
Some introspection on the type of data the mapper will render used by props to determine if they shou...
abstract specification for renderers
Definition: vtkRenderer.h:61
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:46
void SetBlockColor(unsigned int index, double r, double g, double b)
Set/get the color for a block given its flat index.
virtual void InitializeHelpersBeforeRendering(vtkRenderer *vtkNotUsed(ren), vtkActor *vtkNotUsed(act))
This method is called before RenderPiece is called on helpers.
virtual void SetInputArrayToProcess(int idx, int port, int connection, int fieldAssociation, const char *name)
Set the input data arrays that this algorithm will process.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
std::map< const std::string, vtkCompositeMapperHelper2 * > Helpers
a simple class to control print indentation
Definition: vtkIndent.h:33
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 ...
void Render(vtkRenderer *ren, vtkActor *act) override
This calls RenderPiece (in a for loop if streaming is necessary).
vtkSmartPointer< vtkCompositeDataDisplayAttributes > CompositeAttributes
Composite data set attributes.
std::map< vtkPolyData *, vtkCompositeMapperHelperData * > HelperDataMap
int FillInputPortInformation(int, vtkInformation *) override
Fill the input port information objects for this algorithm.
std::vector< vtkPolyData * > RenderedList
bool ColorMissingArraysWithNanColor
If the current &#39;color by&#39; array is missing on some datasets, color these dataset by the LookupTable&#39;s...
vtkTimeStamp BoundsMTime
Time stamp for computation of bounds.
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this mapper.
general representation of visualization data
Definition: vtkDataObject.h:59
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Class to make storing and comparing state quick and easy.