VTK  9.3.0
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
26#include <vector> // For vector
27
28VTK_ABI_NAMESPACE_BEGIN
29class vtkMatrix4x4;
33
34class VTKRENDERINGOPENGL2_EXPORT vtkSSAOPass : public vtkImageProcessingPass
35{
36public:
37 static vtkSSAOPass* New();
39 void PrintSelf(ostream& os, vtkIndent indent) override;
40
44 void Render(const vtkRenderState* s) override;
45
50
54 bool PreReplaceShaderValues(std::string& vertexShader, std::string& geometryShader,
55 std::string& fragmentShader, vtkAbstractMapper* mapper, vtkProp* prop) override;
56
60 bool PostReplaceShaderValues(std::string& vertexShader, std::string& geometryShader,
61 std::string& fragmentShader, vtkAbstractMapper* mapper, vtkProp* prop) override;
62
67 vtkOpenGLVertexArrayObject* VAO = nullptr) override;
68
70
74 vtkGetMacro(Radius, double);
75 vtkSetMacro(Radius, double);
77
79
83 vtkGetMacro(KernelSize, unsigned int);
84 vtkSetClampMacro(KernelSize, unsigned int, 1, 1000);
86
88
92 vtkGetMacro(Bias, double);
93 vtkSetMacro(Bias, double);
95
97
102 vtkGetMacro(Blur, bool);
103 vtkSetMacro(Blur, bool);
104 vtkBooleanMacro(Blur, bool);
106
107protected:
108 vtkSSAOPass() = default;
109 ~vtkSSAOPass() override = default;
110
113
114 void RenderDelegate(const vtkRenderState* s, int w, int h);
115 void RenderSSAO(vtkOpenGLRenderWindow* renWin, vtkMatrix4x4* projection, int w, int h);
117
118 vtkTextureObject* ColorTexture = nullptr;
119 vtkTextureObject* PositionTexture = nullptr;
120 vtkTextureObject* NormalTexture = nullptr;
121 vtkTextureObject* SSAOTexture = nullptr;
122 vtkTextureObject* DepthTexture = nullptr;
123
124 vtkOpenGLFramebufferObject* FrameBufferObject = nullptr;
125
126 vtkOpenGLQuadHelper* SSAOQuadHelper = nullptr;
127 vtkOpenGLQuadHelper* CombineQuadHelper = nullptr;
128
129 std::vector<float> Kernel;
130 unsigned int KernelSize = 32;
131 double Radius = 0.5;
132 double Bias = 0.01;
133 bool Blur = false;
134
135private:
136 vtkSSAOPass(const vtkSSAOPass&) = delete;
137 void operator=(const vtkSSAOPass&) = delete;
138};
139
140VTK_ABI_NAMESPACE_END
141#endif
abstract class specifies interface to map data
Convenient class for post-processing passes.
a simple class to control print indentation
Definition vtkIndent.h:29
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:43
Context in which a vtkRenderPass will render.
Implement a screen-space ambient occlusion pass.
Definition vtkSSAOPass.h:35
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 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.
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:25