VTK  9.0.20200604
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, 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 
131 
136  int idx, int port, int connection, int fieldAssociation, const char* name) override;
138  int idx, int port, int connection, int fieldAssociation, int fieldAttributeType) override;
139  void SetInputArrayToProcess(int idx, vtkInformation* info) override;
141 
145  std::vector<vtkPolyData*> GetRenderedList() { return this->RenderedList; }
146 
152  vtkHardwareSelector* sel, std::vector<unsigned int>& pixeloffsets, vtkProp* prop) override;
153 
154 protected:
156  ~vtkCompositePolyDataMapper2() override;
157 
164 
168  int FillInputPortInformation(int port, vtkInformation* info) override;
169 
173  void ComputeBounds() override;
174 
180  vtkRenderer* vtkNotUsed(ren), vtkActor* vtkNotUsed(act))
181  {
182  }
183 
188 
189  // what "index" are we currently rendering, -1 means none
191  std::map<const std::string, vtkCompositeMapperHelper2*> Helpers;
192  std::map<vtkPolyData*, vtkCompositeMapperHelperData*> HelperDataMap;
194 
195  virtual vtkCompositeMapperHelper2* CreateHelper();
196 
197  // copy values to the helpers
198  virtual void CopyMapperValuesToHelper(vtkCompositeMapperHelper2* helper);
199 
201  {
202  public:
203  std::stack<bool> Visibility;
204  std::stack<bool> Pickability;
205  std::stack<double> Opacity;
206  std::stack<vtkColor3d> AmbientColor;
207  std::stack<vtkColor3d> DiffuseColor;
208  std::stack<vtkColor3d> SpecularColor;
209  std::stack<vtkColor3d> SelectionColor;
210  std::stack<float> SelectionOpacity;
211  };
212 
213  bool RecursiveHasTranslucentGeometry(vtkDataObject* dobj, unsigned int& flat_index);
216 
217  void BuildRenderValues(
218  vtkRenderer* renderer, vtkActor* actor, vtkDataObject* dobj, unsigned int& flat_index);
220 
222  void RenderBlock(
223  vtkRenderer* renderer, vtkActor* actor, vtkDataObject* dobj, unsigned int& flat_index);
224 
229 
231 
237 
238  std::vector<vtkPolyData*> RenderedList;
239 
240 private:
241  double ColorResult[3];
242 
244  void operator=(const vtkCompositePolyDataMapper2&) = delete;
245 };
246 
247 #endif
vtkAlgorithm::CreateDefaultExecutive
virtual vtkExecutive * CreateDefaultExecutive()
Create a default executive.
vtkCompositePolyDataMapper2::HasTranslucentGeometry
bool HasTranslucentGeometry
Definition: vtkCompositePolyDataMapper2.h:215
vtkCompositePolyDataMapper2::RenderedList
std::vector< vtkPolyData * > RenderedList
Definition: vtkCompositePolyDataMapper2.h:238
vtkCompositePolyDataMapper2::ColorMissingArraysWithNanColor
bool ColorMissingArraysWithNanColor
If the current 'color by' array is missing on some datasets, color these dataset by the LookupTable's...
Definition: vtkCompositePolyDataMapper2.h:236
vtkStateStorage
Class to make storing and comparing state quick and easy.
Definition: vtkStateStorage.h:131
vtkCompositePolyDataMapper2::CurrentFlatIndex
int CurrentFlatIndex
Definition: vtkCompositePolyDataMapper2.h:190
vtkCompositePolyDataMapper2::RenderBlockState::Opacity
std::stack< double > Opacity
Definition: vtkCompositePolyDataMapper2.h:205
vtkCompositePolyDataMapper2::RenderBlockState::Visibility
std::stack< bool > Visibility
Definition: vtkCompositePolyDataMapper2.h:203
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:32
vtkCompositePolyDataMapper2::CompositeAttributes
vtkSmartPointer< vtkCompositeDataDisplayAttributes > CompositeAttributes
Composite data set attributes.
Definition: vtkCompositePolyDataMapper2.h:228
vtkSmartPointer< vtkCompositeDataDisplayAttributes >
vtkOpenGLPolyDataMapper::New
static vtkOpenGLPolyDataMapper * New()
vtkCompositePolyDataMapper2::BoundsMTime
vtkTimeStamp BoundsMTime
Time stamp for computation of bounds.
Definition: vtkCompositePolyDataMapper2.h:187
vtkCompositePolyDataMapper2::RenderBlockState::SelectionColor
std::stack< vtkColor3d > SelectionColor
Definition: vtkCompositePolyDataMapper2.h:209
vtkCompositePolyDataMapper2
mapper for composite dataset consisting of polygonal data.
Definition: vtkCompositePolyDataMapper2.h:47
vtkCompositeMapperHelperData
Definition: vtkCompositePolyDataMapper2Internal.h:31
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkCompositeDataDisplayAttributes
Rendering attributes for a multi-block dataset.
Definition: vtkCompositeDataDisplayAttributes.h:39
vtkCompositePolyDataMapper2::Helpers
std::map< const std::string, vtkCompositeMapperHelper2 * > Helpers
Definition: vtkCompositePolyDataMapper2.h:191
vtkCompositePolyDataMapper2::RenderBlockState::AmbientColor
std::stack< vtkColor3d > AmbientColor
Definition: vtkCompositePolyDataMapper2.h:206
vtkCompositePolyDataMapper2::RenderBlockState::Pickability
std::stack< bool > Pickability
Definition: vtkCompositePolyDataMapper2.h:204
vtkX3D::color
Definition: vtkX3D.h:227
vtkX3D::port
Definition: vtkX3D.h:453
vtkExecutive
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:46
vtkCompositePolyDataMapper2::RenderBlockState::SelectionOpacity
std::stack< float > SelectionOpacity
Definition: vtkCompositePolyDataMapper2.h:210
vtkCompositeMapperHelper2
Definition: vtkCompositePolyDataMapper2Internal.h:61
vtkCompositePolyDataMapper2::HelperMTime
vtkTimeStamp HelperMTime
Definition: vtkCompositePolyDataMapper2.h:193
vtkMapper::HasTranslucentPolygonalGeometry
virtual bool HasTranslucentPolygonalGeometry()
vtkCompositePolyDataMapper2::RenderBlockState
Definition: vtkCompositePolyDataMapper2.h:200
vtkHardwareSelector
Definition: vtkHardwareSelector.h:123
vtkColor.h
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
vtkCompositePolyDataMapper2::HelperDataMap
std::map< vtkPolyData *, vtkCompositeMapperHelperData * > HelperDataMap
Definition: vtkCompositePolyDataMapper2.h:192
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkPolyDataMapper::Render
void Render(vtkRenderer *ren, vtkActor *act) override
This calls RenderPiece (in a for loop if streaming is necessary).
vtkSmartPointer.h
vtkCompositePolyDataMapper2::SetBlockColor
void SetBlockColor(unsigned int index, double r, double g, double b)
Definition: vtkCompositePolyDataMapper2.h:87
vtkOpenGLPolyDataMapper::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this mapper.
vtkCompositePolyDataMapper2::TranslucentState
vtkStateStorage TranslucentState
Definition: vtkCompositePolyDataMapper2.h:214
vtkPolyDataMapper::FillInputPortInformation
int FillInputPortInformation(int, vtkInformation *) override
Fill the input port information objects for this algorithm.
vtkX3D::name
Definition: vtkX3D.h:225
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:73
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:56
vtkCompositePolyDataMapper2::InitializeHelpersBeforeRendering
virtual void InitializeHelpersBeforeRendering(vtkRenderer *vtkNotUsed(ren), vtkActor *vtkNotUsed(act))
This method is called before RenderPiece is called on helpers.
Definition: vtkCompositePolyDataMapper2.h:179
vtkX3D::info
Definition: vtkX3D.h:382
vtkCompositePolyDataMapper2::RenderBlockState::SpecularColor
std::stack< vtkColor3d > SpecularColor
Definition: vtkCompositePolyDataMapper2.h:208
vtkCompositePolyDataMapper2::RenderBlockState::DiffuseColor
std::stack< vtkColor3d > DiffuseColor
Definition: vtkCompositePolyDataMapper2.h:207
vtkOpenGLPolyDataMapper::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:67
vtkOpenGLPolyDataMapper::ProcessSelectorPixelBuffers
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 ...
vtkOpenGLPolyDataMapper::ComputeBounds
void ComputeBounds() override
Called in GetBounds().
vtkMapper::HasOpaqueGeometry
virtual bool HasOpaqueGeometry()
Some introspection on the type of data the mapper will render used by props to determine if they shou...
vtkCompositePolyDataMapper2::RenderValuesState
vtkStateStorage RenderValuesState
Definition: vtkCompositePolyDataMapper2.h:219
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:59
vtkX3D::index
Definition: vtkX3D.h:252
vtkOpenGLPolyDataMapper.h
vtkOpenGLPolyDataMapper
PolyDataMapper using OpenGL to render.
Definition: vtkOpenGLPolyDataMapper.h:58
vtkAlgorithm::SetInputArrayToProcess
virtual void SetInputArrayToProcess(int idx, int port, int connection, int fieldAssociation, const char *name)
Set the input data arrays that this algorithm will process.
vtkCompositePolyDataMapper2::BlockState
RenderBlockState BlockState
Definition: vtkCompositePolyDataMapper2.h:221
vtkCompositePolyDataMapper2::GetRenderedList
std::vector< vtkPolyData * > GetRenderedList()
Accessor to the ordered list of PolyData that we end last drew.
Definition: vtkCompositePolyDataMapper2.h:145