VTK
vtkGenericCompositePolyDataMapper2.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGenericCompositePolyDataMapper2.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 =========================================================================*/
24 #ifndef vtkGenericCompositePolyDataMapper2_h
25 #define vtkGenericCompositePolyDataMapper2_h
26 
27 #include "vtkRenderingOpenGL2Module.h" // For export macro
28 #include "vtkSmartPointer.h" // for vtkSmartPointer
30 
31 #include "vtkColor.h" // used for ivars
32 #include <map> // use for ivars
33 #include <stack> // used for ivars
34 
36 class vtkCompositeMapperHelper;
37 
39 {
40 public:
43  void PrintSelf(ostream& os, vtkIndent indent);
44 
53  virtual bool GetIsOpaque();
54 
56 
57  void SetCompositeDataDisplayAttributes(vtkCompositeDataDisplayAttributes *attributes);
58  vtkCompositeDataDisplayAttributes* GetCompositeDataDisplayAttributes();
60 
62 
63  void SetBlockVisibility(unsigned int index, bool visible);
64  bool GetBlockVisibility(unsigned int index) const;
65  void RemoveBlockVisibility(unsigned int index);
66  void RemoveBlockVisibilites();
68 
70 
71  void SetBlockColor(unsigned int index, double color[3]);
72  void SetBlockColor(unsigned int index, double r, double g, double b)
73  {
74  double color[3] = {r, g, b};
75  this->SetBlockColor(index, color);
76  }
77  double* GetBlockColor(unsigned int index);
78  void RemoveBlockColor(unsigned int index);
79  void RemoveBlockColors();
81 
83 
84  void SetBlockOpacity(unsigned int index, double opacity);
85  double GetBlockOpacity(unsigned int index);
86  void RemoveBlockOpacity(unsigned int index);
87  void RemoveBlockOpacities();
89 
94 
95 //BTX
96 protected:
99 
104 
107 
109  virtual void ComputeBounds();
110 
113 
114  // what "index" are we currently rendering, -1 means none
116  std::map<const vtkShaderProgram *, bool> ShadersInitialized;
117  std::map<const vtkDataSet *, vtkCompositeMapperHelper *> Helpers;
119 
120  // save resending uniforms every time
121  bool GetShaderInitialized(vtkShaderProgram *);
122  void SetShaderInitialized(vtkShaderProgram *, bool);
123 
124  // copy values to the helpers
125  void CopyMapperValuesToHelper(vtkCompositeMapperHelper *helper);
126 
127  // free up memory
128  void FreeGenericStructures();
129 
131  {
132  public:
133  std::stack<bool> Visibility;
134  std::stack<double> Opacity;
135  std::stack<vtkColor3d> AmbientColor;
136  std::stack<vtkColor3d> DiffuseColor;
137  std::stack<vtkColor3d> SpecularColor;
138  };
139 
141  void RenderBlock(vtkRenderer *renderer,
142  vtkActor *actor,
143  vtkDataObject *dobj,
144  unsigned int &flat_index);
145 
147  virtual void RenderGeneric(vtkRenderer *ren, vtkActor *act);
148 
151 
152  friend class vtkCompositeMapperHelper;
153 
154 private:
155  unsigned long int LastOpaqueCheckTime;
156  bool LastOpaqueCheckValue;
157  double ColorResult[3];
158 
160  void operator=(const vtkGenericCompositePolyDataMapper2&); // Not implemented.
161 //ETX
162 };
163 
164 #endif
a PolyDataMapper for the OpenGL library
std::map< const vtkDataSet *, vtkCompositeMapperHelper * > Helpers
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:50
virtual int FillInputPortInformation(int, vtkInformation *)
static vtkOpenGLPolyDataMapper * New()
virtual vtkExecutive * CreateDefaultExecutive()
Store vtkAlgorithm input/output information.
mapper for composite dataset consisting of polygonal data.
#define VTKRENDERINGOPENGL2_EXPORT
record modification and/or execution time
Definition: vtkTimeStamp.h:34
rendering attributes for a multi-block dataset.
abstract specification for renderers
Definition: vtkRenderer.h:62
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:48
virtual void ComputeBounds()
void SetBlockColor(unsigned int index, double r, double g, double b)
virtual bool GetIsOpaque()
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
std::map< const vtkShaderProgram *, bool > ShadersInitialized
a simple class to control print indentation
Definition: vtkIndent.h:38
void ReleaseGraphicsResources(vtkWindow *)
general representation of visualization data
Definition: vtkDataObject.h:64
virtual void PrintSelf(ostream &os, vtkIndent indent)
vtkSmartPointer< vtkCompositeDataDisplayAttributes > CompositeAttributes
The ShaderProgram uses one or more Shader objects.