VTK  9.4.20241222
vtkSSAOPass.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
20#ifndef vtkSSAOPass_h
21#define vtkSSAOPass_h
22
24#include "vtkRenderingOpenGL2Module.h" // For export macro
25#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
26
27#include "vtkTextureObject.h" // For texture format enum
28
29#include <vector> // For vector
30
31VTK_ABI_NAMESPACE_BEGIN
32class vtkMatrix4x4;
35
36class VTKRENDERINGOPENGL2_EXPORT VTK_MARSHALAUTO vtkSSAOPass : public vtkImageProcessingPass
37{
38public:
39 static vtkSSAOPass* New();
41 void PrintSelf(ostream& os, vtkIndent indent) override;
42
46 void Render(const vtkRenderState* s) override;
47
52
56 bool PreReplaceShaderValues(std::string& vertexShader, std::string& geometryShader,
57 std::string& fragmentShader, vtkAbstractMapper* mapper, vtkProp* prop) override;
58
62 bool PostReplaceShaderValues(std::string& vertexShader, std::string& geometryShader,
63 std::string& fragmentShader, vtkAbstractMapper* mapper, vtkProp* prop) override;
64
69 vtkOpenGLVertexArrayObject* VAO = nullptr) override;
70
72
76 vtkGetMacro(Radius, double);
77 vtkSetMacro(Radius, double);
79
81
85 vtkGetMacro(KernelSize, unsigned int);
86 vtkSetClampMacro(KernelSize, unsigned int, 1, 1000);
88
90
94 vtkGetMacro(Bias, double);
95 vtkSetMacro(Bias, double);
97
99
104 vtkGetMacro(Blur, bool);
105 vtkSetMacro(Blur, bool);
106 vtkBooleanMacro(Blur, bool);
108
113 vtkSetMacro(DepthFormat, int);
114
116
122 vtkGetMacro(VolumeOpacityThreshold, double);
123 vtkSetClampMacro(VolumeOpacityThreshold, double, 0.0, 1.0);
125
127
131 vtkGetMacro(IntensityScale, double);
132 vtkSetMacro(IntensityScale, double);
134
136
142 vtkGetMacro(IntensityShift, double);
143 vtkSetClampMacro(IntensityShift, double, 0.0, 1.0);
145
146protected:
147 vtkSSAOPass() = default;
148 ~vtkSSAOPass() override = default;
149
154 void PreRenderProp(vtkProp* prop) override;
158 void PostRenderProp(vtkProp* prop) override;
159
162
163 void RenderDelegate(const vtkRenderState* s, int w, int h);
164 void RenderSSAO(vtkOpenGLRenderWindow* renWin, vtkMatrix4x4* projection, int w, int h);
166
167 vtkTextureObject* ColorTexture = nullptr;
168 vtkTextureObject* PositionTexture = nullptr;
169 vtkTextureObject* NormalTexture = nullptr;
170 vtkTextureObject* SSAOTexture = nullptr;
171 vtkTextureObject* DepthTexture = nullptr;
172
173 int DepthFormat = vtkTextureObject::Float32;
174
175 vtkOpenGLFramebufferObject* FrameBufferObject = nullptr;
176
177 vtkOpenGLQuadHelper* SSAOQuadHelper = nullptr;
178 vtkOpenGLQuadHelper* CombineQuadHelper = nullptr;
179
180 std::vector<float> Kernel;
181 unsigned int KernelSize = 32;
182 double Radius = 0.5;
183 double Bias = 0.01;
184 bool Blur = false;
185
186 double VolumeOpacityThreshold = 0.9;
187
188 double IntensityScale = 1.0;
189 double IntensityShift = 0.0;
190
191private:
192 vtkSSAOPass(const vtkSSAOPass&) = delete;
193 void operator=(const vtkSSAOPass&) = delete;
194};
195
196VTK_ABI_NAMESPACE_END
197#endif
abstract class specifies interface to map data
Convenient class for post-processing passes.
a simple class to control print indentation
Definition vtkIndent.h:108
represent and manipulate 4x4 transformation matrices
Internal class which encapsulates OpenGL FramebufferObject.
Class to make rendering a full screen quad easier.
OpenGL rendering window.
The VertexArrayObject class uses, or emulates, vertex array objects.
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:66
Context in which a vtkRenderPass will render.
Implement a screen-space ambient occlusion pass.
Definition vtkSSAOPass.h:37
static vtkSSAOPass * New()
bool PostReplaceShaderValues(std::string &vertexShader, std::string &geometryShader, std::string &fragmentShader, vtkAbstractMapper *mapper, vtkProp *prop) override
Post replace shader values.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSSAOPass()=default
bool PreReplaceShaderValues(std::string &vertexShader, std::string &geometryShader, std::string &fragmentShader, vtkAbstractMapper *mapper, vtkProp *prop) override
Pre replace shader values.
~vtkSSAOPass() override=default
void RenderDelegate(const vtkRenderState *s, int w, int h)
void Render(const vtkRenderState *s) override
Perform rendering according to a render state.
void RenderCombine(vtkOpenGLRenderWindow *renWin)
void PostRenderProp(vtkProp *prop) override
Called in PostRender to clean the GLDepthMaskOverride information key on volumes.
void InitializeGraphicsResources(vtkOpenGLRenderWindow *renWin, int w, int h)
void ComputeKernel()
void ReleaseGraphicsResources(vtkWindow *w) override
Release graphics resources and ask components to release their own resources.
void PreRenderProp(vtkProp *prop) override
Called in PreRender to add the GLDepthMaskOverride information key to volumes, which allows them to w...
std::vector< float > Kernel
void RenderSSAO(vtkOpenGLRenderWindow *renWin, vtkMatrix4x4 *projection, int w, int h)
bool SetShaderParameters(vtkShaderProgram *program, vtkAbstractMapper *mapper, vtkProp *prop, vtkOpenGLVertexArrayObject *VAO=nullptr) override
Set shader parameters.
Computes the portion of a dataset which is inside a selection.
The ShaderProgram uses one or more Shader objects.
abstracts an OpenGL texture object.
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
#define VTK_MARSHALAUTO