VTK
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 
31 #include "vtkRenderingOpenGL2Module.h" // For export macro
32 #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 
40 class vtkCompositeMapperHelper2;
41 class vtkCompositeMapperHelperData;
42 
43 class VTKRENDERINGOPENGL2_EXPORT vtkCompositePolyDataMapper2 : public vtkOpenGLPolyDataMapper
44 {
45 public:
48  void PrintSelf(ostream& os, vtkIndent indent);
49 
60  virtual bool GetIsOpaque();
61 
63 
69 
71 
74  void SetBlockVisibility(unsigned int index, bool visible);
75  bool GetBlockVisibility(unsigned int index) const;
76  void RemoveBlockVisibility(unsigned int index);
79 
81 
84  void SetBlockColor(unsigned int index, double color[3]);
85  void SetBlockColor(unsigned int index, double r, double g, double b)
86  {
87  double color[3] = {r, g, b};
88  this->SetBlockColor(index, color);
89  }
90  double* GetBlockColor(unsigned int index);
91  void RemoveBlockColor(unsigned int index);
94 
96 
99  void SetBlockOpacity(unsigned int index, double opacity);
100  double GetBlockOpacity(unsigned int index);
101  void RemoveBlockOpacity(unsigned int index);
104 
111 
115  virtual void Render(vtkRenderer *ren, vtkActor *act);
116 
117 protected:
120 
127 
132 
136  virtual void ComputeBounds();
137 
141  vtkTimeStamp BoundsMTime;
142 
143  // what "index" are we currently rendering, -1 means none
145  std::map<const std::string, vtkCompositeMapperHelper2 *> Helpers;
146  std::map<vtkPolyData *, vtkCompositeMapperHelperData *> HelperDataMap;
148 
149  // copy values to the helpers
150  void CopyMapperValuesToHelper(vtkCompositeMapperHelper2 *helper);
151 
153  {
154  public:
155  std::stack<bool> Visibility;
156  std::stack<double> Opacity;
157  std::stack<vtkColor3d> AmbientColor;
158  std::stack<vtkColor3d> DiffuseColor;
159  std::stack<vtkColor3d> SpecularColor;
160  };
161 
163  vtkActor *actor,
164  vtkDataObject *dobj,
165  unsigned int &flat_index);
167 
169  void RenderBlock(vtkRenderer *renderer,
170  vtkActor *actor,
171  vtkDataObject *dobj,
172  unsigned int &flat_index);
173 
178 
179  friend class vtkCompositeMapperHelper2;
180 
181 private:
182  vtkMTimeType LastOpaqueCheckTime;
183  bool LastOpaqueCheckValue;
184  double ColorResult[3];
185 
186  vtkCompositePolyDataMapper2(const vtkCompositePolyDataMapper2&) VTK_DELETE_FUNCTION;
187  void operator=(const vtkCompositePolyDataMapper2&) VTK_DELETE_FUNCTION;
188 
189 };
190 
191 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:52
rendering attributes for a multi-block dataset.
mapper for composite dataset consisting of polygonal data.
void BuildRenderValues(vtkRenderer *renderer, vtkActor *actor, vtkDataObject *dobj, unsigned int &flat_index)
void RemoveBlockVisibility(unsigned int index)
void SetBlockColor(unsigned int index, double color[3])
Set/get the color for a block given its flat index.
virtual void ComputeBounds()
Need to loop over the hierarchy to compute bounds.
virtual bool GetIsOpaque()
Returns if the mapper does not expect to have translucent geometry.
double GetBlockOpacity(unsigned int index)
void SetBlockVisibility(unsigned int index, bool visible)
Set/get the visibility for a block given its flat index.
vtkExecutive * CreateDefaultExecutive()
We need to override this method because the standard streaming demand driven pipeline is not what we ...
bool GetBlockVisibility(unsigned int index) const
std::map< vtkPolyData *, vtkCompositeMapperHelperData * > HelperDataMap
void SetBlockOpacity(unsigned int index, double opacity)
Set/get the opacity for a block given its flat index.
std::map< const std::string, vtkCompositeMapperHelper2 * > Helpers
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
void RemoveBlockColor(unsigned int index)
static vtkCompositePolyDataMapper2 * New()
void CopyMapperValuesToHelper(vtkCompositeMapperHelper2 *helper)
vtkCompositeDataDisplayAttributes * GetCompositeDataDisplayAttributes()
virtual int FillInputPortInformation(int port, vtkInformation *info)
Need to define the type of data handled by this mapper.
void RenderBlock(vtkRenderer *renderer, vtkActor *actor, vtkDataObject *dobj, unsigned int &flat_index)
void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this mapper.
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.
virtual void Render(vtkRenderer *ren, vtkActor *act)
This calls RenderPiece (in a for loop if streaming is necessary).
general representation of visualization data
Definition: vtkDataObject.h:65
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:50
a simple class to control print indentation
Definition: vtkIndent.h:40
Store vtkAlgorithm input/output information.
a PolyDataMapper for the OpenGL library
abstract specification for renderers
Definition: vtkRenderer.h:64
record modification and/or execution time
Definition: vtkTimeStamp.h:36
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447
@ color
Definition: vtkX3D.h:221
@ index
Definition: vtkX3D.h:246
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248