VTK
vtkOpenGLPolyDataMapper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4 
5  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
6  All rights reserved.
7  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
23 #ifndef vtkOpenGLPolyDataMapper_h
24 #define vtkOpenGLPolyDataMapper_h
25 
26 #include "vtkRenderingOpenGL2Module.h" // For export macro
27 #include "vtkPolyDataMapper.h"
28 #include "vtkglVBOHelper.h" // used for ivars
29 
30 class vtkOpenGLTexture;
31 class vtkMatrix4x4;
32 class vtkMatrix3x3;
33 
34 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLPolyDataMapper : public vtkPolyDataMapper
35 {
36 public:
37  static vtkOpenGLPolyDataMapper* New();
39  void PrintSelf(ostream& os, vtkIndent indent);
40 
42  virtual void RenderPiece(vtkRenderer *ren, vtkActor *act);
43 
45 
46  virtual void RenderPieceStart(vtkRenderer *ren, vtkActor *act);
47  virtual void RenderPieceDraw(vtkRenderer *ren, vtkActor *act);
48  virtual void RenderPieceFinish(vtkRenderer *ren, vtkActor *act);
49  virtual void RenderEdges(vtkRenderer *ren, vtkActor *act);
51 
55  void ReleaseGraphicsResources(vtkWindow *);
56 
57  vtkGetMacro(PopulateSelectionSettings,int);
58  void SetPopulateSelectionSettings(int v) { this->PopulateSelectionSettings = v; };
59 
64  virtual bool GetSupportsSelection() { return true; }
65 
74  virtual bool GetIsOpaque();
75 
76  // used by RenderPiece and functions it calls to reduce
77  // calls to get the input and allow for rendering of
78  // other polydata (not the input)
80 
84  virtual vtkIdType GetConvertedPickValue(vtkIdType idIn, int fieldassociation, vtkActor *act);
85 
86 protected:
89 
94  virtual void ComputeBounds();
95 
99  virtual void UpdateShader(vtkgl::CellBO &cellBO, vtkRenderer *ren, vtkActor *act);
100 
102  virtual bool GetNeedToRebuildShader(vtkgl::CellBO &cellBO, vtkRenderer *ren, vtkActor *act);
103 
105 
106  virtual void BuildShader(std::string &VertexCode,
107  std::string &fragmentCode,
108  std::string &geometryCode,
109  int lightComplexity,
110  vtkRenderer *ren, vtkActor *act);
112 
114 
115  virtual void GetShaderTemplate(std::string &VertexCode,
116  std::string &fragmentCode,
117  std::string &geometryCode,
118  int lightComplexity,
119  vtkRenderer *ren, vtkActor *act);
121 
123 
124  virtual void ReplaceShaderValues(std::string &VertexCode,
125  std::string &fragmentCode,
126  std::string &geometryCode,
127  int lightComplexity,
128  vtkRenderer *ren, vtkActor *act);
130 
132 
134  virtual void ReplaceShaderColorMaterialValues(std::string &VertexCode,
135  std::string &fragmentCode,
136  std::string &geometryCode,
137  int lightComplexity,
138  vtkRenderer *ren, vtkActor *act);
140 
143  virtual void SetMapperShaderParameters(vtkgl::CellBO &cellBO, vtkRenderer *ren, vtkActor *act);
144 
147  virtual void SetLightingShaderParameters(vtkgl::CellBO &cellBO, vtkRenderer *ren, vtkActor *act);
148 
151  virtual void SetCameraShaderParameters(vtkgl::CellBO &cellBO, vtkRenderer *ren, vtkActor *act);
152 
155  virtual void SetPropertyShaderParameters(vtkgl::CellBO &cellBO, vtkRenderer *ren, vtkActor *act);
156 
158  virtual void UpdateBufferObjects(vtkRenderer *ren, vtkActor *act);
159 
161  virtual bool GetNeedToRebuildBufferObjects(vtkRenderer *ren, vtkActor *act);
162 
164  virtual void BuildBufferObjects(vtkRenderer *ren, vtkActor *act);
165 
166  // The VBO and its layout.
169 
170  // Structures for the various cell types we render.
179 
180  // values we use to determine if we need to rebuild
183 
186 
189 
191  vtkTimeStamp VBOBuildTime; // When was the OpenGL VBO updated?
192  vtkOpenGLTexture* InternalColorTexture;
193 
196 
199 
200  // this vector can be used while building
201  // the shader program to record specific variables
202  // that are being used by the program. This is
203  // useful later on when setting uniforms. At
204  // that point IsShaderVariableUsed can be called
205  // to see if the uniform should be set or not.
206  std::vector<std::string> ShaderVariablesUsed;
207 
208  // used to see if the shader building code indicated that
209  // a specific variable is being used. Only some variables
210  // are currently populated.
211  bool IsShaderVariableUsed(const char *);
212 
213 private:
214  vtkOpenGLPolyDataMapper(const vtkOpenGLPolyDataMapper&); // Not implemented.
215  void operator=(const vtkOpenGLPolyDataMapper&); // Not implemented.
216 };
217 
218 #endif
OpenGL buffer object.
a PolyDataMapper for the OpenGL library
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:50
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:38
const GLdouble * v
Definition: vtkgl.h:11595
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:83
record modification and/or execution time
Definition: vtkTimeStamp.h:34
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
abstract specification for renderers
Definition: vtkRenderer.h:63
int vtkIdType
Definition: vtkType.h:281
virtual bool GetIsOpaque()
Definition: vtkMapper.h:421
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:83
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:632
OpenGL texture map.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:33
std::vector< std::string > ShaderVariablesUsed
a simple class to control print indentation
Definition: vtkIndent.h:38
virtual void ComputeBounds()
map vtkPolyData to graphics primitives
static vtkPolyDataMapper * New()
represent and manipulate 3x3 transformation matrices
Definition: vtkMatrix3x3.h:35
GLsizei const GLchar ** string
Definition: vtkgl.h:12011