VTK  9.3.1
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 <vector> // STL Header
47 
48 VTK_ABI_NAMESPACE_BEGIN
50 class vtkTextureObject;
52 class vtkOpenGLState;
54 
55 class VTKRENDERINGOPENGL2_EXPORT vtkDepthPeelingPass : public vtkOpenGLRenderPass
56 {
57 public:
58  static vtkDepthPeelingPass* New();
60  void PrintSelf(ostream& os, vtkIndent indent) override;
61 
66  void Render(const vtkRenderState* s) override;
67 
73  void ReleaseGraphicsResources(vtkWindow* w) override;
74 
76 
82  vtkGetObjectMacro(TranslucentPass, vtkRenderPass);
83  virtual void SetTranslucentPass(vtkRenderPass* translucentPass);
85 
87 
96  vtkSetClampMacro(OcclusionRatio, double, 0.0, 0.5);
97  vtkGetMacro(OcclusionRatio, double);
99 
101 
106  vtkSetMacro(MaximumNumberOfPeels, int);
107  vtkGetMacro(MaximumNumberOfPeels, int);
109 
110  // vtkOpenGLRenderPass virtuals:
111  bool PostReplaceShaderValues(std::string& vertexShader, std::string& geometryShader,
112  std::string& fragmentShader, vtkAbstractMapper* mapper, vtkProp* prop) override;
113  bool SetShaderParameters(vtkShaderProgram* program, vtkAbstractMapper* mapper, vtkProp* prop,
114  vtkOpenGLVertexArrayObject* VAO = nullptr) override;
115 
116  // Set Opaque Z texture, this must be set from the outer FO
117  void SetOpaqueZTexture(vtkTextureObject*);
118 
119  // Set Opaque RGBA texture, this must be set from the outer FO
120  void SetOpaqueRGBATexture(vtkTextureObject*);
121 
126  vtkSetMacro(DepthFormat, int);
127 
128 protected:
133 
137  ~vtkDepthPeelingPass() override;
138 
141 
143 
151 
162 
169 
171 
174 
175  // obtained from the outer FO, we read from them
180 
181  // each peel merges two color buffers into one result
182  vtkTextureObject* TranslucentRGBATexture[3];
185 
186  // each peel compares a prior Z and writes to next
187  vtkTextureObject* TranslucentZTexture[2];
189 
190  void BlendIntermediatePeels(vtkOpenGLRenderWindow* renWin, bool);
191  void BlendFinalPeel(vtkOpenGLRenderWindow* renWin);
192 
193  // useful to store
195 
196 private:
197  vtkDepthPeelingPass(const vtkDepthPeelingPass&) = delete;
198  void operator=(const vtkDepthPeelingPass&) = delete;
199 };
200 
201 VTK_ABI_NAMESPACE_END
202 #endif
OpenGL rendering window.
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:45
Implement Depth Peeling for use within a framebuffer pass.
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.
vtkOpenGLQuadHelper * FinalBlend
record modification and/or execution time
Definition: vtkTimeStamp.h:24
int ViewportX
Cache viewport values for depth peeling.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:27
double OcclusionRatio
In case of use of depth peeling technique for rendering translucent material, define the threshold un...
Context in which a vtkRenderPass will render.
vtkTextureObject * OpaqueZTexture
OpenGL state storage.
vtkOpenGLFramebufferObject * Framebuffer
vtkOpenGLQuadHelper * IntermediateBlend
a simple class to control print indentation
Definition: vtkIndent.h:28
The VertexArrayObject class uses, or emulates, vertex array objects.
int ViewportWidth
Cache viewport values for depth peeling.
Internal class which encapsulates OpenGL FramebufferObject.
abstract class specifies interface to map data
abstracts an OpenGL texture object.
int MaximumNumberOfPeels
In case of depth peeling, define the maximum number of peeling layers.
virtual void Render(const vtkRenderState *s)=0
Perform rendering according to a render state s.
vtkTextureObject * OpaqueRGBATexture
Class to make rendering a full screen quad easier.
virtual void ReleaseGraphicsResources(vtkWindow *w)
Release graphics resources and ask components to release their own resources.
int ViewportY
Cache viewport values for depth peeling.
vtkRenderPass * TranslucentPass
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
Perform part of the rendering of a vtkRenderer.
Definition: vtkRenderPass.h:48
virtual bool SetShaderParameters(vtkShaderProgram *program, vtkAbstractMapper *mapper, vtkProp *prop, vtkOpenGLVertexArrayObject *VAO=nullptr)
Update the uniforms of the shader program.
vtkOpenGLState * State
Abstract render pass with shader modifications.
virtual bool PostReplaceShaderValues(std::string &vertexShader, std::string &geometryShader, std::string &fragmentShader, vtkAbstractMapper *mapper, vtkProp *prop)
Use vtkShaderProgram::Substitute to replace.
The ShaderProgram uses one or more Shader objects.