VTK  9.2.6
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 =========================================================================*/
31 #ifndef vtkCompositePolyDataMapper2_h
32 #define vtkCompositePolyDataMapper2_h
33 
35 #include "vtkRenderingOpenGL2Module.h" // For export macro
36 #include "vtkSmartPointer.h" // for vtkSmartPointer
37 
38 #include "vtkColor.h" // used for ivars
39 #include <map> // use for ivars
40 #include <stack> // used for ivars
41 #include <vector> // used for ivars
42 
46 
47 class VTKRENDERINGOPENGL2_EXPORT vtkCompositePolyDataMapper2 : public vtkOpenGLPolyDataMapper
48 {
49 public:
52  void PrintSelf(ostream& os, vtkIndent indent) override;
53 
55 
60  bool HasOpaqueGeometry() override;
61  bool HasTranslucentPolygonalGeometry() override;
63 
65 
68  void SetCompositeDataDisplayAttributes(vtkCompositeDataDisplayAttributes* attributes);
69  vtkCompositeDataDisplayAttributes* GetCompositeDataDisplayAttributes();
71 
73 
76  void SetBlockVisibility(unsigned int index, bool visible);
77  bool GetBlockVisibility(unsigned int index);
78  void RemoveBlockVisibility(unsigned int index);
79  void RemoveBlockVisibilities();
81 
83 
86  void SetBlockColor(unsigned int index, const double color[3]);
87  void SetBlockColor(unsigned int index, double r, double g, double b)
88  {
89  double color[3] = { r, g, b };
90  this->SetBlockColor(index, color);
91  }
92  double* GetBlockColor(unsigned int index);
93  void RemoveBlockColor(unsigned int index);
94  void RemoveBlockColors();
96 
98 
101  void SetBlockOpacity(unsigned int index, double opacity);
102  double GetBlockOpacity(unsigned int index);
103  void RemoveBlockOpacity(unsigned int index);
104  void RemoveBlockOpacities();
106 
113  vtkSetMacro(ColorMissingArraysWithNanColor, bool);
114  vtkGetMacro(ColorMissingArraysWithNanColor, bool);
115  vtkBooleanMacro(ColorMissingArraysWithNanColor, bool);
123  void ReleaseGraphicsResources(vtkWindow*) override;
124 
128  void Render(vtkRenderer* ren, vtkActor* act) override;
129 
133  void SetVBOShiftScaleMethod(int m) override;
134 
139  void SetPauseShiftScale(bool pauseShiftScale) override;
140 
142 
147  int idx, int port, int connection, int fieldAssociation, const char* name) override;
149  int idx, int port, int connection, int fieldAssociation, int fieldAttributeType) override;
150  void SetInputArrayToProcess(int idx, vtkInformation* info) override;
152 
156  std::vector<vtkPolyData*> GetRenderedList() { return this->RenderedList; }
157 
163  vtkHardwareSelector* sel, std::vector<unsigned int>& pixeloffsets, vtkProp* prop) override;
164 
168  vtkMTimeType GetMTime() override;
169 
170 protected:
172  ~vtkCompositePolyDataMapper2() override;
173 
180 
184  int FillInputPortInformation(int port, vtkInformation* info) override;
185 
189  void ComputeBounds() override;
190 
196  vtkRenderer* vtkNotUsed(ren), vtkActor* vtkNotUsed(act))
197  {
198  }
199 
204 
205  // what "index" are we currently rendering, -1 means none
207  std::map<const std::string, vtkCompositeMapperHelper2*> Helpers;
208  std::map<vtkPolyData*, vtkCompositeMapperHelperData*> HelperDataMap;
210 
211  virtual vtkCompositeMapperHelper2* CreateHelper();
212 
213  // copy values to the helpers
214  virtual void CopyMapperValuesToHelper(vtkCompositeMapperHelper2* helper);
215 
217  {
218  public:
219  std::stack<bool> Visibility;
220  std::stack<bool> Pickability;
221  std::stack<double> Opacity;
222  std::stack<vtkColor3d> AmbientColor;
223  std::stack<vtkColor3d> DiffuseColor;
224  std::stack<vtkColor3d> SpecularColor;
225  std::stack<vtkColor3d> SelectionColor;
226  std::stack<float> SelectionOpacity;
227  };
228 
229  bool RecursiveHasTranslucentGeometry(vtkDataObject* dobj, unsigned int& flat_index);
232 
233  void BuildRenderValues(
234  vtkRenderer* renderer, vtkActor* actor, vtkDataObject* dobj, unsigned int& flat_index);
236 
238  void RenderBlock(
239  vtkRenderer* renderer, vtkActor* actor, vtkDataObject* dobj, unsigned int& flat_index);
240 
245 
247 
253 
254  std::vector<vtkPolyData*> RenderedList;
255 
256 private:
257  double ColorResult[3];
258 
260  void operator=(const vtkCompositePolyDataMapper2&) = delete;
261 };
262 
263 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:56
PolyDataMapper using OpenGL to render.
void ComputeBounds() override
Called in GetBounds().
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
static vtkOpenGLPolyDataMapper * New()
virtual vtkExecutive * CreateDefaultExecutive()
Create a default executive.
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
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:35
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:72
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:49
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:38
std::map< const std::string, vtkCompositeMapperHelper2 * > Helpers
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual void SetVBOShiftScaleMethod(int m)
A convenience method for enabling/disabling the VBO's shift+scale transform.
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 ...
virtual void SetPauseShiftScale(bool pauseShiftScale)
Pause per-render updates to VBO shift+scale parameters.
void Render(vtkRenderer *ren, vtkActor *act) override
This calls RenderPiece (in a for loop if streaming is necessary).
Helper class for vtkCompositePolyDataMapper2 that is a subclass of vtkOpenGLPolyDataMapper.
vtkMTimeType GetMTime() override
Overload standard modified time function.
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 'color by' array is missing on some datasets, color these dataset by the LookupTable'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:65
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.