VTK  9.2.6
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 =========================================================================*/
32 #ifndef vtkSSAOPass_h
33 #define vtkSSAOPass_h
34 
35 #include "vtkImageProcessingPass.h"
36 #include "vtkRenderingOpenGL2Module.h" // For export macro
37 
38 #include <vector> // For vector
39 
40 class vtkMatrix4x4;
43 class vtkTextureObject;
44 
45 class VTKRENDERINGOPENGL2_EXPORT vtkSSAOPass : public vtkImageProcessingPass
46 {
47 public:
48  static vtkSSAOPass* New();
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
55  void Render(const vtkRenderState* s) override;
56 
61 
65  bool PreReplaceShaderValues(std::string& vertexShader, std::string& geometryShader,
66  std::string& fragmentShader, vtkAbstractMapper* mapper, vtkProp* prop) override;
67 
71  bool PostReplaceShaderValues(std::string& vertexShader, std::string& geometryShader,
72  std::string& fragmentShader, vtkAbstractMapper* mapper, vtkProp* prop) override;
73 
78  vtkOpenGLVertexArrayObject* VAO = nullptr) override;
79 
81 
85  vtkGetMacro(Radius, double);
86  vtkSetMacro(Radius, double);
88 
90 
94  vtkGetMacro(KernelSize, unsigned int);
95  vtkSetClampMacro(KernelSize, unsigned int, 1, 1000);
97 
99 
103  vtkGetMacro(Bias, double);
104  vtkSetMacro(Bias, double);
106 
108 
113  vtkGetMacro(Blur, bool);
114  vtkSetMacro(Blur, bool);
115  vtkBooleanMacro(Blur, bool);
117 
118 protected:
119  vtkSSAOPass() = default;
120  ~vtkSSAOPass() override = default;
121 
124 
125  void RenderDelegate(const vtkRenderState* s, int w, int h);
126  void RenderSSAO(vtkOpenGLRenderWindow* renWin, vtkMatrix4x4* projection, int w, int h);
128 
129  vtkTextureObject* ColorTexture = nullptr;
130  vtkTextureObject* PositionTexture = nullptr;
131  vtkTextureObject* NormalTexture = nullptr;
132  vtkTextureObject* SSAOTexture = nullptr;
133  vtkTextureObject* DepthTexture = nullptr;
134 
135  vtkOpenGLFramebufferObject* FrameBufferObject = nullptr;
136 
137  vtkOpenGLQuadHelper* SSAOQuadHelper = nullptr;
138  vtkOpenGLQuadHelper* CombineQuadHelper = nullptr;
139 
140  std::vector<float> Kernel;
141  unsigned int KernelSize = 32;
142  double Radius = 0.5;
143  double Bias = 0.01;
144  bool Blur = false;
145 
146 private:
147  vtkSSAOPass(const vtkSSAOPass&) = delete;
148  void operator=(const vtkSSAOPass&) = delete;
149 };
150 
151 #endif
abstract class specifies interface to map data
Convenient class for post-processing passes.
a simple class to control print indentation
Definition: vtkIndent.h:119
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:151
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:76
Context in which a vtkRenderPass will render.
Implement a screen-space ambient occlusion pass.
Definition: vtkSSAOPass.h:46
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.
static vtkSSAOPass * New()
std::vector< float > Kernel
Definition: vtkSSAOPass.h:140
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:39
@ string
Definition: vtkX3D.h:496