VTK
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 "vtkRenderingOpenGL2Module.h" // For export macro
57 #include "vtkOpenGLRenderPass.h"
58 #include <vector> // STL Header
59 
61 class vtkTextureObject;
63 class vtkOpenGLState;
65 
66 class VTKRENDERINGOPENGL2_EXPORT vtkDepthPeelingPass
67  : public vtkOpenGLRenderPass
68 {
69 public:
72  void PrintSelf(ostream& os, vtkIndent indent) override;
73 
78  void Render(const vtkRenderState *s) override;
79 
86 
88 
94  vtkGetObjectMacro(TranslucentPass,vtkRenderPass);
95  virtual void SetTranslucentPass(vtkRenderPass *translucentPass);
97 
99 
108  vtkSetClampMacro(OcclusionRatio,double,0.0,0.5);
109  vtkGetMacro(OcclusionRatio,double);
111 
113 
118  vtkSetMacro(MaximumNumberOfPeels,int);
119  vtkGetMacro(MaximumNumberOfPeels,int);
121 
122  // vtkOpenGLRenderPass virtuals:
124  std::string &geometryShader,
125  std::string &fragmentShader,
126  vtkAbstractMapper *mapper,
127  vtkProp *prop) override;
129  vtkAbstractMapper *mapper, vtkProp *prop,
130  vtkOpenGLVertexArrayObject* VAO = nullptr) override;
131 
132  // Set Opaque Z texture, this must be set from the outer FO
134 
135  // Set Opaque RGBA texture, this must be set from the outer FO
137 
142  vtkSetMacro(DepthFormat, int);
143 
144  protected:
149 
154 
157 
159 
167 
178 
185 
187 
190 
191  // obtained from the outer FO, we read from them
196 
197  // each peel merges two color buffers into one result
198  vtkTextureObject *TranslucentRGBATexture[3];
201 
202  // each peel compares a prior Z and writes to next
203  vtkTextureObject *TranslucentZTexture[2];
205 
208 
209  // useful to store
211 
212  private:
213  vtkDepthPeelingPass(const vtkDepthPeelingPass&) = delete;
214  void operator=(const vtkDepthPeelingPass&) = delete;
215 };
216 
217 #endif
vtkDepthPeelingPass::OpaqueZTexture
vtkTextureObject * OpaqueZTexture
Definition: vtkDepthPeelingPass.h:192
vtkDepthPeelingPass::BlendIntermediatePeels
void BlendIntermediatePeels(vtkOpenGLRenderWindow *renWin, bool)
vtkDepthPeelingPass::~vtkDepthPeelingPass
~vtkDepthPeelingPass() override
Destructor.
vtkDepthPeelingPass::New
static vtkDepthPeelingPass * New()
vtkDepthPeelingPass
Implement Depth Peeling for use within a framebuffer pass.
Definition: vtkDepthPeelingPass.h:68
vtkDepthPeelingPass::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *w) override
Release graphics resources and ask components to release their own resources.
vtkDepthPeelingPass::ViewportHeight
int ViewportHeight
Definition: vtkDepthPeelingPass.h:165
vtkDepthPeelingPass::PeelCount
int PeelCount
Definition: vtkDepthPeelingPass.h:200
vtkDepthPeelingPass::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:36
vtkOpenGLFramebufferObject
Internal class which encapsulates OpenGL FramebufferObject.
Definition: vtkOpenGLFramebufferObject.h:183
vtkDepthPeelingPass::Framebuffer
vtkOpenGLFramebufferObject * Framebuffer
Definition: vtkDepthPeelingPass.h:186
vtkDepthPeelingPass::vtkDepthPeelingPass
vtkDepthPeelingPass()
Default constructor.
vtkOpenGLQuadHelper
Class to make rendering a full screen quad easier.
Definition: vtkOpenGLQuadHelper.h:55
vtkDepthPeelingPass::BlendFinalPeel
void BlendFinalPeel(vtkOpenGLRenderWindow *renWin)
vtkDepthPeelingPass::DepthFormat
int DepthFormat
Definition: vtkDepthPeelingPass.h:204
vtkDepthPeelingPass::OwnOpaqueZTexture
bool OwnOpaqueZTexture
Definition: vtkDepthPeelingPass.h:194
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
vtkDepthPeelingPass::State
vtkOpenGLState * State
Definition: vtkDepthPeelingPass.h:210
vtkDepthPeelingPass::ColorDrawCount
int ColorDrawCount
Definition: vtkDepthPeelingPass.h:199
vtkDepthPeelingPass::SetOpaqueZTexture
void SetOpaqueZTexture(vtkTextureObject *)
vtkDepthPeelingPass::ViewportY
int ViewportY
Definition: vtkDepthPeelingPass.h:163
vtkShaderProgram
The ShaderProgram uses one or more Shader objects.
Definition: vtkShaderProgram.h:48
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkTextureObject
abstracts an OpenGL texture object.
Definition: vtkTextureObject.h:45
vtkDepthPeelingPass::PostReplaceShaderValues
bool PostReplaceShaderValues(std::string &vertexShader, std::string &geometryShader, std::string &fragmentShader, vtkAbstractMapper *mapper, vtkProp *prop) override
Use vtkShaderProgram::Substitute to replace //VTK::XXX:YYY declarations in the shader sources.
vtkDepthPeelingPass::ViewportX
int ViewportX
Cache viewport values for depth peeling.
Definition: vtkDepthPeelingPass.h:162
vtkDepthPeelingPass::Render
void Render(const vtkRenderState *s) override
Perform rendering according to a render state s.
vtkDepthPeelingPass::TranslucentPass
vtkRenderPass * TranslucentPass
Definition: vtkDepthPeelingPass.h:155
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:53
vtkX3D::string
@ string
Definition: vtkX3D.h:490
vtkDepthPeelingPass::IntermediateBlend
vtkOpenGLQuadHelper * IntermediateBlend
Definition: vtkDepthPeelingPass.h:189
vtkDepthPeelingPass::FinalBlend
vtkOpenGLQuadHelper * FinalBlend
Definition: vtkDepthPeelingPass.h:188
vtkOpenGLRenderPass
Abstract render pass with shader modifications.
Definition: vtkOpenGLRenderPass.h:39
vtkDepthPeelingPass::ViewportWidth
int ViewportWidth
Definition: vtkDepthPeelingPass.h:164
vtkOpenGLRenderPass.h
vtkDepthPeelingPass::SetShaderParameters
bool SetShaderParameters(vtkShaderProgram *program, vtkAbstractMapper *mapper, vtkProp *prop, vtkOpenGLVertexArrayObject *VAO=nullptr) override
Update the uniforms of the shader program.
vtkOpenGLRenderWindow
OpenGL rendering window.
Definition: vtkOpenGLRenderWindow.h:54
vtkRenderState
Context in which a vtkRenderPass will render.
Definition: vtkRenderState.h:41
vtkDepthPeelingPass::OpaqueRGBATexture
vtkTextureObject * OpaqueRGBATexture
Definition: vtkDepthPeelingPass.h:193
vtkDepthPeelingPass::SetOpaqueRGBATexture
void SetOpaqueRGBATexture(vtkTextureObject *)
vtkDepthPeelingPass::SetTranslucentPass
virtual void SetTranslucentPass(vtkRenderPass *translucentPass)
vtkDepthPeelingPass::OwnOpaqueRGBATexture
bool OwnOpaqueRGBATexture
Definition: vtkDepthPeelingPass.h:195
vtkOpenGLState
OpenGL state storage.
Definition: vtkOpenGLState.h:68
vtkOpenGLVertexArrayObject
The VertexArrayObject class uses, or emulates, vertex array objects.
Definition: vtkOpenGLVertexArrayObject.h:37
vtkDepthPeelingPass::MaximumNumberOfPeels
int MaximumNumberOfPeels
In case of depth peeling, define the maximum number of peeling layers.
Definition: vtkDepthPeelingPass.h:184
vtkAbstractMapper
abstract class specifies interface to map data
Definition: vtkAbstractMapper.h:56
vtkDepthPeelingPass::CheckTime
vtkTimeStamp CheckTime
Definition: vtkDepthPeelingPass.h:156
vtkDepthPeelingPass::OcclusionRatio
double OcclusionRatio
In case of use of depth peeling technique for rendering translucent material, define the threshold un...
Definition: vtkDepthPeelingPass.h:177
vtkRenderPass
Perform part of the rendering of a vtkRenderer.
Definition: vtkRenderPass.h:59