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 "vtkNew.h" // For vtkNew
25 #include "vtkOpenGLBufferObject.h" // For vtkOpenGLBufferObject
26 #include "vtkOpenGLHelper.h" // For vtkOpenGLHelper
27 #include "vtkOpenGLInstanceCulling.h" // For vtkOpenGLInstanceCulling
29 #include "vtkRenderingOpenGL2Module.h" // For export macro
30 
31 class vtkBitArray;
32 
33 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLGlyph3DHelper : public vtkOpenGLPolyDataMapper
34 {
35 public:
36  static vtkOpenGLGlyph3DHelper* New();
38  void PrintSelf(ostream& os, vtkIndent indent) override;
39 
44  void GlyphRender(vtkRenderer* ren, vtkActor* actor, vtkIdType numPts,
45  std::vector<unsigned char> &colors, std::vector<float> &matrices,
46  std::vector<float> &normalMatrices, std::vector<vtkIdType> &pickIds,
47  vtkMTimeType pointMTime, bool culling);
48 
49  void SetLODs(std::vector<std::pair<float, float> >& lods);
50 
51  void SetLODColoring(bool val);
52 
58  void ReleaseGraphicsResources(vtkWindow *window) override;
59 
60 protected:
62  ~vtkOpenGLGlyph3DHelper() override = default;
63 
64  // special opengl 32 version that uses instances
65  void GlyphRenderInstances(vtkRenderer* ren, vtkActor* actor, vtkIdType numPts,
66  std::vector<unsigned char> &colors, std::vector<float> &matrices,
67  std::vector<float> &normalMatrices,
68  vtkMTimeType pointMTime, bool culling);
69 
73  void GetShaderTemplate(
74  std::map<vtkShader::Type, vtkShader *> shaders,
75  vtkRenderer *ren, vtkActor *act) override;
76 
78 
81  void ReplaceShaderPicking(
82  std::map<vtkShader::Type, vtkShader *> shaders,
83  vtkRenderer *ren, vtkActor *act) override;
84  void ReplaceShaderColor(
85  std::map<vtkShader::Type, vtkShader *> shaders,
86  vtkRenderer *ren, vtkActor *act) override;
87  void ReplaceShaderNormal(
88  std::map<vtkShader::Type, vtkShader *> shaders,
89  vtkRenderer *ren, vtkActor *act) override;
90  void ReplaceShaderClip(
91  std::map<vtkShader::Type, vtkShader *> shaders,
92  vtkRenderer *ren, vtkActor *act) override;
93  void ReplaceShaderPositionVC(
94  std::map<vtkShader::Type, vtkShader *> shaders,
95  vtkRenderer *ren, vtkActor *act) override;
97 
101  void SetMapperShaderParameters(
102  vtkOpenGLHelper &cellBO, vtkRenderer *ren, vtkActor *act) override;
103 
104  void BuildCullingShaders(vtkRenderer* ren, vtkActor* actor, vtkIdType numPts, bool withNormals);
105 
106  bool UsingInstancing;
107 
108  vtkNew<vtkOpenGLBufferObject> NormalMatrixBuffer;
111  vtkTimeStamp InstanceBuffersBuildTime;
112  vtkTimeStamp InstanceBuffersLoadTime;
113 
114  std::vector<std::pair<float, float> > LODs;
116 
117 private:
118  vtkOpenGLGlyph3DHelper(const vtkOpenGLGlyph3DHelper&) = delete;
119  void operator=(const vtkOpenGLGlyph3DHelper&) = delete;
120 };
121 
122 #endif
PolyDataMapper using OpenGL to render.
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
static vtkOpenGLPolyDataMapper * New()
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302
record modification and/or execution time
Definition: vtkTimeStamp.h:35
abstract specification for renderers
Definition: vtkRenderer.h:63
int vtkIdType
Definition: vtkType.h:347
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
a simple class to control print indentation
Definition: vtkIndent.h:39
Frustum culling and LOD management.
PolyDataMapper using OpenGL to render.
dynamic, self-adjusting array of bits
Definition: vtkBitArray.h:36
Vertex or Fragment shader, combined into a ShaderProgram.
Definition: vtkShader.h:40
Allocate and hold a VTK object.
Definition: vtkNew.h:58
OpenGL buffer object.