VTK  9.4.20241222
vtkDepthPeelingPass.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
41#ifndef vtkDepthPeelingPass_h
42#define vtkDepthPeelingPass_h
43
44#include "vtkOpenGLRenderPass.h"
45#include "vtkRenderingOpenGL2Module.h" // For export macro
46#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
47#include <vector> // STL Header
48
49VTK_ABI_NAMESPACE_BEGIN
53class vtkOpenGLState;
55
56class VTKRENDERINGOPENGL2_EXPORT VTK_MARSHALAUTO vtkDepthPeelingPass : public vtkOpenGLRenderPass
57{
58public:
61 void PrintSelf(ostream& os, vtkIndent indent) override;
62
67 void Render(const vtkRenderState* s) override;
68
75
77
83 vtkGetObjectMacro(TranslucentPass, vtkRenderPass);
84 virtual void SetTranslucentPass(vtkRenderPass* translucentPass);
86
88
97 vtkSetClampMacro(OcclusionRatio, double, 0.0, 0.5);
98 vtkGetMacro(OcclusionRatio, double);
100
102
107 vtkSetMacro(MaximumNumberOfPeels, int);
108 vtkGetMacro(MaximumNumberOfPeels, int);
110
111 // vtkOpenGLRenderPass virtuals:
112 bool PostReplaceShaderValues(std::string& vertexShader, std::string& geometryShader,
113 std::string& fragmentShader, vtkAbstractMapper* mapper, vtkProp* prop) override;
115 vtkOpenGLVertexArrayObject* VAO = nullptr) override;
116
117 // Set Opaque Z texture, this must be set from the outer FO
119
120 // Set Opaque RGBA texture, this must be set from the outer FO
122
127 vtkSetMacro(DepthFormat, int);
128
129protected:
134
139
142
144
152
163
170
172
175
176 // obtained from the outer FO, we read from them
181
182 // each peel merges two color buffers into one result
183 vtkTextureObject* TranslucentRGBATexture[3];
186
187 // each peel compares a prior Z and writes to next
188 vtkTextureObject* TranslucentZTexture[2];
190
193
194 // useful to store
196
197private:
199 void operator=(const vtkDepthPeelingPass&) = delete;
200};
201
202VTK_ABI_NAMESPACE_END
203#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)
static vtkDepthPeelingPass * New()
~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...
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)
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:108
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:66
Perform part of the rendering of a vtkRenderer.
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
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
#define VTK_MARSHALAUTO