VTK  9.2.5
vtkDepthPeelingPass.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkDepthPeelingPass.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 =========================================================================*/
53 #ifndef vtkDepthPeelingPass_h
54 #define vtkDepthPeelingPass_h
55 
56 #include "vtkOpenGLRenderPass.h"
57 #include "vtkRenderingOpenGL2Module.h" // For export macro
58 #include <vector> // STL Header
59 
61 class vtkTextureObject;
63 class vtkOpenGLState;
65 
66 class VTKRENDERINGOPENGL2_EXPORT vtkDepthPeelingPass : public vtkOpenGLRenderPass
67 {
68 public:
71  void PrintSelf(ostream& os, vtkIndent indent) override;
72 
77  void Render(const vtkRenderState* s) override;
78 
85 
87 
93  vtkGetObjectMacro(TranslucentPass, vtkRenderPass);
94  virtual void SetTranslucentPass(vtkRenderPass* translucentPass);
96 
98 
107  vtkSetClampMacro(OcclusionRatio, double, 0.0, 0.5);
108  vtkGetMacro(OcclusionRatio, double);
110 
112 
117  vtkSetMacro(MaximumNumberOfPeels, int);
118  vtkGetMacro(MaximumNumberOfPeels, int);
120 
121  // vtkOpenGLRenderPass virtuals:
122  bool PostReplaceShaderValues(std::string& vertexShader, std::string& geometryShader,
123  std::string& fragmentShader, vtkAbstractMapper* mapper, vtkProp* prop) override;
125  vtkOpenGLVertexArrayObject* VAO = nullptr) override;
126 
127  // Set Opaque Z texture, this must be set from the outer FO
129 
130  // Set Opaque RGBA texture, this must be set from the outer FO
132 
137  vtkSetMacro(DepthFormat, int);
138 
139 protected:
144 
149 
152 
154 
162 
173 
180 
182 
185 
186  // obtained from the outer FO, we read from them
191 
192  // each peel merges two color buffers into one result
193  vtkTextureObject* TranslucentRGBATexture[3];
196 
197  // each peel compares a prior Z and writes to next
198  vtkTextureObject* TranslucentZTexture[2];
200 
203 
204  // useful to store
206 
207 private:
208  vtkDepthPeelingPass(const vtkDepthPeelingPass&) = delete;
209  void operator=(const vtkDepthPeelingPass&) = delete;
210 };
211 
212 #endif
abstract class specifies interface to map data
Implement Depth Peeling for use within a framebuffer pass.
vtkOpenGLQuadHelper * FinalBlend
virtual void SetTranslucentPass(vtkRenderPass *translucentPass)
Delegate for rendering the translucent polygonal geometry.
void SetOpaqueRGBATexture(vtkTextureObject *)
bool PostReplaceShaderValues(std::string &vertexShader, std::string &geometryShader, std::string &fragmentShader, vtkAbstractMapper *mapper, vtkProp *prop) override
Use vtkShaderProgram::Substitute to replace.
vtkDepthPeelingPass()
Default constructor.
void BlendFinalPeel(vtkOpenGLRenderWindow *renWin)
~vtkDepthPeelingPass() override
Destructor.
int MaximumNumberOfPeels
In case of depth peeling, define the maximum number of peeling layers.
double OcclusionRatio
In case of use of depth peeling technique for rendering translucent material, define the threshold un...
static vtkDepthPeelingPass * New()
void SetOpaqueZTexture(vtkTextureObject *)
vtkTextureObject * OpaqueZTexture
int ViewportY
Cache viewport values for depth peeling.
bool SetShaderParameters(vtkShaderProgram *program, vtkAbstractMapper *mapper, vtkProp *prop, vtkOpenGLVertexArrayObject *VAO=nullptr) override
Update the uniforms of the shader program.
vtkOpenGLQuadHelper * IntermediateBlend
int ViewportX
Cache viewport values for depth peeling.
vtkTextureObject * OpaqueRGBATexture
vtkOpenGLFramebufferObject * Framebuffer
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int ViewportHeight
Cache viewport values for depth peeling.
void BlendIntermediatePeels(vtkOpenGLRenderWindow *renWin, bool)
vtkOpenGLState * State
int ViewportWidth
Cache viewport values for depth peeling.
void ReleaseGraphicsResources(vtkWindow *w) override
Release graphics resources and ask components to release their own resources.
vtkRenderPass * TranslucentPass
void Render(const vtkRenderState *s) override
Perform rendering according to a render state s.
a simple class to control print indentation
Definition: vtkIndent.h:119
Internal class which encapsulates OpenGL FramebufferObject.
Class to make rendering a full screen quad easier.
Abstract render pass with shader modifications.
OpenGL rendering window.
OpenGL state storage.
The VertexArrayObject class uses, or emulates, vertex array objects.
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:76
Perform part of the rendering of a vtkRenderer.
Definition: vtkRenderPass.h:60
Context in which a vtkRenderPass will render.
The ShaderProgram uses one or more Shader objects.
abstracts an OpenGL texture object.
record modification and/or execution time
Definition: vtkTimeStamp.h:55
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
@ string
Definition: vtkX3D.h:496