VTK
vtkOpenGLGlyph3DHelper.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 =========================================================================*/
21 #ifndef vtkOpenGLGlyph3DHelper_h
22 #define vtkOpenGLGlyph3DHelper_h
23 
24 #include "vtkRenderingOpenGL2Module.h" // For export macro
26 
27 class vtkBitArray;
28 
29 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLGlyph3DHelper : public vtkOpenGLPolyDataMapper
30 {
31 public:
32  static vtkOpenGLGlyph3DHelper* New();
34  void PrintSelf(ostream& os, vtkIndent indent);
35 
36  void SetModelTransform(float *matrix)
37  {
38  this->ModelTransformMatrix = matrix;
39  }
40 
41  void SetModelNormalTransform(float *matrix)
42  {
43  this->ModelNormalMatrix = matrix;
44  }
45 
46  void SetModelColor(unsigned char *color)
47  {
48  this->ModelColor = color;
49  }
50 
51  void SetUseFastPath(bool fastpath)
52  {
53  this->UseFastPath = fastpath;
54  this->UsingInstancing = false;
55  }
56 
60  void GlyphRender(vtkRenderer* ren, vtkActor* actor, vtkIdType numPts,
61  std::vector<unsigned char> &colors, std::vector<float> &matrices,
62  std::vector<float> &normalMatrices, std::vector<vtkIdType> &pickIds,
63  vtkMTimeType pointMTime);
64 
70  virtual void ReleaseGraphicsResources(vtkWindow *window);
71 
72 protected:
75 
76  // special opengl 32 version that uses instances
77 #if GL_ES_VERSION_2_0 != 1 || GL_ES_VERSION_3_0 == 1
78  void GlyphRenderInstances(vtkRenderer* ren, vtkActor* actor, vtkIdType numPts,
79  std::vector<unsigned char> &colors, std::vector<float> &matrices,
80  std::vector<float> &normalMatrices,
81  vtkMTimeType pointMTime);
82 #endif
83 
87  virtual void GetShaderTemplate(
88  std::map<vtkShader::Type, vtkShader *> shaders,
89  vtkRenderer *ren, vtkActor *act);
90 
92 
95  virtual void ReplaceShaderPicking(
96  std::map<vtkShader::Type, vtkShader *> shaders,
97  vtkRenderer *ren, vtkActor *act);
98  virtual void ReplaceShaderColor(
99  std::map<vtkShader::Type, vtkShader *> shaders,
100  vtkRenderer *ren, vtkActor *act);
101  virtual void ReplaceShaderNormal(
102  std::map<vtkShader::Type, vtkShader *> shaders,
103  vtkRenderer *ren, vtkActor *act);
104  virtual void ReplaceShaderClip(
105  std::map<vtkShader::Type, vtkShader *> shaders,
106  vtkRenderer *ren, vtkActor *act);
107  virtual void ReplaceShaderPositionVC(
108  std::map<vtkShader::Type, vtkShader *> shaders,
109  vtkRenderer *ren, vtkActor *act);
111 
115  virtual void SetCameraShaderParameters(
116  vtkOpenGLHelper &cellBO, vtkRenderer *ren, vtkActor *act);
117 
121  virtual void SetPropertyShaderParameters(
122  vtkOpenGLHelper &cellBO, vtkRenderer *ren, vtkActor *act);
123 
127  virtual void SetMapperShaderParameters(
128  vtkOpenGLHelper &cellBO, vtkRenderer *ren, vtkActor *act);
129 
132 
135  unsigned char* ModelColor;
136 
141 
142 
143 private:
144  vtkOpenGLGlyph3DHelper(const vtkOpenGLGlyph3DHelper&) VTK_DELETE_FUNCTION;
145  void operator=(const vtkOpenGLGlyph3DHelper&) VTK_DELETE_FUNCTION;
146 };
147 
148 #endif
a PolyDataMapper for the OpenGL library
virtual void ReplaceShaderPositionVC(std::map< vtkShader::Type, vtkShader * > shaders, vtkRenderer *ren, vtkActor *act)
Perform string replacments on the shader templates, called from ReplaceShaderValues.
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
static vtkOpenGLPolyDataMapper * New()
record modification and/or execution time
Definition: vtkTimeStamp.h:35
virtual void ReplaceShaderClip(std::map< vtkShader::Type, vtkShader * > shaders, vtkRenderer *ren, vtkActor *act)
Perform string replacments on the shader templates, called from ReplaceShaderValues.
abstract specification for renderers
Definition: vtkRenderer.h:63
virtual void SetPropertyShaderParameters(vtkOpenGLHelper &cellBO, vtkRenderer *ren, vtkActor *act)
Set the shader parameteres related to the property, called by UpdateShader.
int vtkIdType
Definition: vtkType.h:287
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248
vtkOpenGLBufferObject * NormalMatrixBuffer
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
void SetModelColor(unsigned char *color)
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual void ReplaceShaderNormal(std::map< vtkShader::Type, vtkShader * > shaders, vtkRenderer *ren, vtkActor *act)
Perform string replacments on the shader templates, called from ReplaceShaderValues.
virtual void ReplaceShaderPicking(std::map< vtkShader::Type, vtkShader * > shaders, vtkRenderer *ren, vtkActor *act)
Perform string replacments on the shader templates, called from ReplaceShaderValues.
void SetModelNormalTransform(float *matrix)
vtkOpenGLBufferObject * ColorBuffer
virtual void GetShaderTemplate(std::map< vtkShader::Type, vtkShader * > shaders, vtkRenderer *ren, vtkActor *act)
Create the basic shaders before replacement.
PolyDataMapper using OpenGL to render.
virtual void SetMapperShaderParameters(vtkOpenGLHelper &cellBO, vtkRenderer *ren, vtkActor *act)
Set the shader parameters related to the mapper/input data, called by UpdateShader.
vtkOpenGLBufferObject * MatrixBuffer
void SetUseFastPath(bool fastpath)
virtual void ReplaceShaderColor(std::map< vtkShader::Type, vtkShader * > shaders, vtkRenderer *ren, vtkActor *act)
Perform string replacments on the shader templates, called from ReplaceShaderValues.
dynamic, self-adjusting array of bits
Definition: vtkBitArray.h:36
virtual void SetCameraShaderParameters(vtkOpenGLHelper &cellBO, vtkRenderer *ren, vtkActor *act)
Set the shader parameteres related to the Camera, called by UpdateShader.
void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this mapper.
OpenGL buffer object.