VTK: Rendering/OpenGL2/vtkOpenGLGlyph3DHelper.h Source File

| VTK 9.3.1

vtkOpenGLGlyph3DHelper.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
10 #ifndef vtkOpenGLGlyph3DHelper_h
11 #define vtkOpenGLGlyph3DHelper_h
12
13 #include "vtkNew.h" // For vtkNew
14 #include "vtkOpenGLBufferObject.h" // For vtkOpenGLBufferObject
15 #include "vtkOpenGLHelper.h" // For vtkOpenGLHelper
16 #include "vtkOpenGLInstanceCulling.h" // For vtkOpenGLInstanceCulling
17 #include "vtkOpenGLPolyDataMapper.h"
18 #include "vtkRenderingOpenGL2Module.h" // For export macro
19
20 VTK_ABI_NAMESPACE_BEGIN
21 class vtkBitArray;
22
23 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLGlyph3DHelper : public vtkOpenGLPolyDataMapper
24 {
25 public:
26 static vtkOpenGLGlyph3DHelper* New();
27 vtkTypeMacro(vtkOpenGLGlyph3DHelper, vtkOpenGLPolyDataMapper);
28 void PrintSelf(ostream& os, vtkIndent indent) override;
29
34 void GlyphRender(vtkRenderer* ren, vtkActor* actor, vtkIdType numPts,
35 std::vector<unsigned char>& colors, std::vector<float>& matrices,
36 std::vector<float>& normalMatrices, std::vector<vtkIdType>& pickIds, vtkMTimeType pointMTime,
37 bool culling);
38
39 void SetLODs(std::vector<std::pair<float, float>>& lods);
40
41 void SetLODColoring(bool val);
42
48 void ReleaseGraphicsResources(vtkWindow* window) override;
49
50 protected:
51 vtkOpenGLGlyph3DHelper();
52 ~vtkOpenGLGlyph3DHelper() override = default;
53
54 // special opengl 32 version that uses instances
55 void GlyphRenderInstances(vtkRenderer* ren, vtkActor* actor, vtkIdType numPts,
56 std::vector<unsigned char>& colors, std::vector<float>& matrices,
57 std::vector<float>& normalMatrices, vtkMTimeType pointMTime, bool culling);
58
62 void GetShaderTemplate(
63 std::map<vtkShader::Type, vtkShader*> shaders, vtkRenderer* ren, vtkActor* act) override;
64
66
69 void ReplaceShaderValues(
70 std::map<vtkShader::Type, vtkShader*> shaders, vtkRenderer* ren, vtkActor* actor) override;
71 void ReplaceShaderPicking(
72 std::map<vtkShader::Type, vtkShader*> shaders, vtkRenderer* ren, vtkActor* act) override;
73 void ReplaceShaderColor(
74 std::map<vtkShader::Type, vtkShader*> shaders, vtkRenderer* ren, vtkActor* act) override;
75 void ReplaceShaderNormal(
76 std::map<vtkShader::Type, vtkShader*> shaders, vtkRenderer* ren, vtkActor* act) override;
77 void ReplaceShaderClip(
78 std::map<vtkShader::Type, vtkShader*> shaders, vtkRenderer* ren, vtkActor* act) override;
79 void ReplaceShaderPositionVC(
80 std::map<vtkShader::Type, vtkShader*> shaders, vtkRenderer* ren, vtkActor* act) override;
81 void ReplaceShaderPointSize(
82 std::map<vtkShader::Type, vtkShader*> shaders, vtkRenderer* ren, vtkActor* act);
84
88 void SetMapperShaderParameters(vtkOpenGLHelper& cellBO, vtkRenderer* ren, vtkActor* act) override;
89
90 void BuildCullingShaders(vtkRenderer* ren, vtkActor* actor, vtkIdType numPts, bool withNormals);
91
92 bool UsingInstancing;
93
94 vtkNew<vtkOpenGLBufferObject> NormalMatrixBuffer;
95 vtkNew<vtkOpenGLBufferObject> MatrixBuffer;
96 vtkNew<vtkOpenGLBufferObject> ColorBuffer;
97 vtkTimeStamp InstanceBuffersBuildTime;
98 vtkTimeStamp InstanceBuffersLoadTime;
99
100 std::vector<std::pair<float, float>> LODs;
101 vtkNew<vtkOpenGLInstanceCulling> InstanceCulling;
102
103 private:
104 vtkOpenGLGlyph3DHelper(const vtkOpenGLGlyph3DHelper&) = delete;
105 void operator=(const vtkOpenGLGlyph3DHelper&) = delete;
106 };
107
108 VTK_ABI_NAMESPACE_END
109 #endif
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:50
vtkBitArray
dynamic, self-adjusting array of bits
Definition: vtkBitArray.h:29
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkNew< vtkOpenGLBufferObject >
vtkOpenGLGlyph3DHelper
PolyDataMapper using OpenGL to render.
Definition: vtkOpenGLGlyph3DHelper.h:24
vtkOpenGLGlyph3DHelper::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *window) override
Release any graphics resources that are being consumed by this mapper.
vtkOpenGLGlyph3DHelper::InstanceBuffersBuildTime
vtkTimeStamp InstanceBuffersBuildTime
Definition: vtkOpenGLGlyph3DHelper.h:97
vtkOpenGLGlyph3DHelper::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkOpenGLGlyph3DHelper::InstanceBuffersLoadTime
vtkTimeStamp InstanceBuffersLoadTime
Definition: vtkOpenGLGlyph3DHelper.h:98
vtkOpenGLGlyph3DHelper::ReplaceShaderPicking
void ReplaceShaderPicking(std::map< vtkShader::Type, vtkShader * > shaders, vtkRenderer *ren, vtkActor *act) override
Perform string replacements on the shader templates.
vtkOpenGLGlyph3DHelper::GetShaderTemplate
void GetShaderTemplate(std::map< vtkShader::Type, vtkShader * > shaders, vtkRenderer *ren, vtkActor *act) override
Create the basic shaders before replacement.
vtkOpenGLGlyph3DHelper::SetLODColoring
void SetLODColoring(bool val)
vtkOpenGLGlyph3DHelper::ReplaceShaderPositionVC
void ReplaceShaderPositionVC(std::map< vtkShader::Type, vtkShader * > shaders, vtkRenderer *ren, vtkActor *act) override
Perform string replacements on the shader templates.
vtkOpenGLGlyph3DHelper::UsingInstancing
bool UsingInstancing
Definition: vtkOpenGLGlyph3DHelper.h:92
vtkOpenGLGlyph3DHelper::GlyphRender
void GlyphRender(vtkRenderer *ren, vtkActor *actor, vtkIdType numPts, std::vector< unsigned char > &colors, std::vector< float > &matrices, std::vector< float > &normalMatrices, std::vector< vtkIdType > &pickIds, vtkMTimeType pointMTime, bool culling)
Fast path for rendering glyphs comprised of only one type of primitive Must set this->CurrentInput ex...
vtkOpenGLGlyph3DHelper::InstanceCulling
vtkNew< vtkOpenGLInstanceCulling > InstanceCulling
Definition: vtkOpenGLGlyph3DHelper.h:101
vtkOpenGLGlyph3DHelper::ReplaceShaderValues
void ReplaceShaderValues(std::map< vtkShader::Type, vtkShader * > shaders, vtkRenderer *ren, vtkActor *actor) override
Perform string replacements on the shader templates.
vtkOpenGLGlyph3DHelper::SetMapperShaderParameters
void SetMapperShaderParameters(vtkOpenGLHelper &cellBO, vtkRenderer *ren, vtkActor *act) override
Set the shader parameters related to the actor/mapper.
vtkOpenGLGlyph3DHelper::vtkOpenGLGlyph3DHelper
vtkOpenGLGlyph3DHelper()
vtkOpenGLGlyph3DHelper::ColorBuffer
vtkNew< vtkOpenGLBufferObject > ColorBuffer
Definition: vtkOpenGLGlyph3DHelper.h:96
vtkOpenGLGlyph3DHelper::New
static vtkOpenGLGlyph3DHelper * New()
vtkOpenGLGlyph3DHelper::ReplaceShaderColor
void ReplaceShaderColor(std::map< vtkShader::Type, vtkShader * > shaders, vtkRenderer *ren, vtkActor *act) override
Perform string replacements on the shader templates.
vtkOpenGLGlyph3DHelper::ReplaceShaderNormal
void ReplaceShaderNormal(std::map< vtkShader::Type, vtkShader * > shaders, vtkRenderer *ren, vtkActor *act) override
Perform string replacements on the shader templates.
vtkOpenGLGlyph3DHelper::GlyphRenderInstances
void GlyphRenderInstances(vtkRenderer *ren, vtkActor *actor, vtkIdType numPts, std::vector< unsigned char > &colors, std::vector< float > &matrices, std::vector< float > &normalMatrices, vtkMTimeType pointMTime, bool culling)
vtkOpenGLGlyph3DHelper::SetLODs
void SetLODs(std::vector< std::pair< float, float >> &lods)
vtkOpenGLGlyph3DHelper::ReplaceShaderClip
void ReplaceShaderClip(std::map< vtkShader::Type, vtkShader * > shaders, vtkRenderer *ren, vtkActor *act) override
Perform string replacements on the shader templates.
vtkOpenGLGlyph3DHelper::MatrixBuffer
vtkNew< vtkOpenGLBufferObject > MatrixBuffer
Definition: vtkOpenGLGlyph3DHelper.h:95
vtkOpenGLGlyph3DHelper::NormalMatrixBuffer
vtkNew< vtkOpenGLBufferObject > NormalMatrixBuffer
Definition: vtkOpenGLGlyph3DHelper.h:94
vtkOpenGLGlyph3DHelper::~vtkOpenGLGlyph3DHelper
~vtkOpenGLGlyph3DHelper() override=default
vtkOpenGLGlyph3DHelper::ReplaceShaderPointSize
void ReplaceShaderPointSize(std::map< vtkShader::Type, vtkShader * > shaders, vtkRenderer *ren, vtkActor *act)
Perform string replacements on the shader templates.
vtkOpenGLGlyph3DHelper::LODs
std::vector< std::pair< float, float > > LODs
Definition: vtkOpenGLGlyph3DHelper.h:100
vtkOpenGLGlyph3DHelper::BuildCullingShaders
void BuildCullingShaders(vtkRenderer *ren, vtkActor *actor, vtkIdType numPts, bool withNormals)
vtkOpenGLHelper
Definition: vtkOpenGLHelper.h:21
vtkOpenGLPolyDataMapper
PolyDataMapper using OpenGL to render.
Definition: vtkOpenGLPolyDataMapper.h:58
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:71
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:34
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkX3D::vector
@ vector
Definition: vtkX3D.h:237
vtkNew.h
vtkOpenGLBufferObject.h
vtkOpenGLHelper.h
vtkOpenGLInstanceCulling.h
vtkOpenGLPolyDataMapper.h
vtkIdType
int vtkIdType
Definition: vtkType.h:315
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270