VTK  9.1.0
vtkSSAOPass.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkSSAOPass.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
29#ifndef vtkSSAOPass_h
30#define vtkSSAOPass_h
31
33#include "vtkRenderingOpenGL2Module.h" // For export macro
34
35#include <vector> // For vector
36
37class vtkMatrix4x4;
41
42class VTKRENDERINGOPENGL2_EXPORT vtkSSAOPass : public vtkImageProcessingPass
43{
44public:
45 static vtkSSAOPass* New();
47 void PrintSelf(ostream& os, vtkIndent indent) override;
48
52 void Render(const vtkRenderState* s) override;
53
58
62 bool PreReplaceShaderValues(std::string& vertexShader, std::string& geometryShader,
63 std::string& fragmentShader, vtkAbstractMapper* mapper, vtkProp* prop) override;
64
68 bool PostReplaceShaderValues(std::string& vertexShader, std::string& geometryShader,
69 std::string& fragmentShader, vtkAbstractMapper* mapper, vtkProp* prop) override;
70
75 vtkOpenGLVertexArrayObject* VAO = nullptr) override;
76
78
82 vtkGetMacro(Radius, double);
83 vtkSetMacro(Radius, double);
85
87
91 vtkGetMacro(KernelSize, unsigned int);
92 vtkSetClampMacro(KernelSize, unsigned int, 1, 1000);
94
96
100 vtkGetMacro(Bias, double);
101 vtkSetMacro(Bias, double);
103
105
110 vtkGetMacro(Blur, bool);
111 vtkSetMacro(Blur, bool);
112 vtkBooleanMacro(Blur, bool);
114
115protected:
116 vtkSSAOPass() = default;
117 ~vtkSSAOPass() override = default;
118
121
122 void RenderDelegate(const vtkRenderState* s, int w, int h);
123 void RenderSSAO(vtkOpenGLRenderWindow* renWin, vtkMatrix4x4* projection, int w, int h);
125
126 vtkTextureObject* ColorTexture = nullptr;
127 vtkTextureObject* PositionTexture = nullptr;
128 vtkTextureObject* NormalTexture = nullptr;
129 vtkTextureObject* SSAOTexture = nullptr;
130 vtkTextureObject* DepthTexture = nullptr;
131
132 vtkOpenGLFramebufferObject* FrameBufferObject = nullptr;
133
134 vtkOpenGLQuadHelper* SSAOQuadHelper = nullptr;
135 vtkOpenGLQuadHelper* CombineQuadHelper = nullptr;
136
137 std::vector<float> Kernel;
138 unsigned int KernelSize = 32;
139 double Radius = 0.5;
140 double Bias = 0.01;
141 bool Blur = false;
142
143private:
144 vtkSSAOPass(const vtkSSAOPass&) = delete;
145 void operator=(const vtkSSAOPass&) = delete;
146};
147
148#endif
abstract class specifies interface to map data
vtkFrustumSelector is a vtkSelector that selects elements based on whether they are inside or interse...
Convenient class for post-processing passes.
a simple class to control print indentation
Definition: vtkIndent.h:113
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:145
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:67
Context in which a vtkRenderPass will render.
Implement a screen-space ambient occlusion pass.
Definition: vtkSSAOPass.h:43
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
Definition: vtkSSAOPass.h:137
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.
The ShaderProgram uses one or more Shader objects.
abstracts an OpenGL texture object.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
@ string
Definition: vtkX3D.h:496