VTK
vtkDualDepthPeelingPass.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkDualDepthPeelingPass.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 =========================================================================*/
15 
47 #ifndef vtkDualDepthPeelingPass_h
48 #define vtkDualDepthPeelingPass_h
49 
50 #include "vtkRenderingOpenGL2Module.h" // For export macro
51 #include "vtkDepthPeelingPass.h"
52 
56 class vtkShaderProgram;
57 class vtkTextureObject;
58 
59 class VTKRENDERINGOPENGL2_EXPORT vtkDualDepthPeelingPass:
60  public vtkDepthPeelingPass
61 {
62 public:
65  virtual void PrintSelf(ostream &os, vtkIndent indent);
66 
67  virtual void Render(const vtkRenderState *s);
68  virtual void ReleaseGraphicsResources(vtkWindow *w);
69 
70  // vtkOpenGLRenderPass virtuals:
71  virtual bool ReplaceShaderValues(std::string &vertexShader,
72  std::string &geometryShader,
73  std::string &fragmentShader,
74  vtkAbstractMapper *mapper,
75  vtkProp *prop);
76  virtual bool SetShaderParameters(vtkShaderProgram *program,
77  vtkAbstractMapper *mapper, vtkProp *prop);
78  virtual vtkMTimeType GetShaderStageMTime();
79 
80 protected:
81 
82  // Name the textures used by this render pass. These are indexes into
83  // this->Textures
85  {
86  BackTemp = 0, // RGBA8 back-to-front peeling buffer
87  Back, // RGBA8 back-to-front accumulation buffer
88  FrontA, // RGBA8 front-to-back accumulation buffer
89  FrontB, // RGBA8 front-to-back accumulation buffer
90  DepthA, // RG32F min-max depth buffer
91  DepthB, // RG32F min-max depth buffer
92  OpaqueDepth, // Stores the depth map from the opaque passes
93 
94  NumberOfTextures
95  };
96 
97  // The stages of this multipass render pass:
99  {
103 
105  Inactive = -1,
106  };
107 
110 
112 
117 
122 
126  void Initialize(const vtkRenderState *s);
127 
129 
137 
139 
142  void Prepare();
147 
148  bool PeelingDone();
149 
153  void Peel();
154 
156 
157  void PeelRender();
158 
162 
166  void SwapTargets();
167 
168  void Finalize();
169 
171 
174 
176 
180 
184 
188 
190  vtkTextureObject *Textures[NumberOfTextures];
191 
192  TextureName FrontSource; // The current front source buffer
193  TextureName FrontDestination; // The current front destination buffer
194  TextureName DepthSource; // The current depth source buffer
195  TextureName DepthDestination; // The current depth destination buffer
196 
199 
201  unsigned int OcclusionQueryId;
202  unsigned int WrittenPixels;
203  unsigned int OcclusionThreshold;
204 
205  int RenderCount; // Debug info, counts number of geometry passes.
206 
207 private:
208  vtkDualDepthPeelingPass(const vtkDualDepthPeelingPass&) VTK_DELETE_FUNCTION;
209  void operator=(const vtkDualDepthPeelingPass&) VTK_DELETE_FUNCTION;
210 };
211 
212 #endif // vtkDualDepthPeelingPass_h
vtkDualDepthPeelingPass::AlphaBlendRender
void AlphaBlendRender()
vtkDualDepthPeelingPass::FrontDestination
TextureName FrontDestination
Definition: vtkDualDepthPeelingPass.h:193
vtkDualDepthPeelingPass
Implements the dual depth peeling algorithm.
Definition: vtkDualDepthPeelingPass.h:61
vtkDepthPeelingPass.h
vtkDualDepthPeelingPass::DeleteOcclusionQueryId
void DeleteOcclusionQueryId()
vtkDepthPeelingPass
Implement an Order Independent Transparency render pass.
Definition: vtkDepthPeelingPass.h:51
vtkDualDepthPeelingPass::DepthB
@ DepthB
Definition: vtkDualDepthPeelingPass.h:91
vtkOpenGLBufferObject
OpenGL buffer object.
Definition: vtkOpenGLBufferObject.h:33
vtkDualDepthPeelingPass::RenderState
const vtkRenderState * RenderState
Definition: vtkDualDepthPeelingPass.h:175
vtkDualDepthPeelingPass::EndOcclusionQuery
void EndOcclusionQuery()
vtkDualDepthPeelingPass::InitializeOcclusionQuery
void InitializeOcclusionQuery()
vtkDualDepthPeelingPass::InitializingDepth
@ InitializingDepth
Definition: vtkDualDepthPeelingPass.h:100
vtkDualDepthPeelingPass::TextureName
TextureName
Definition: vtkDualDepthPeelingPass.h:85
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:36
vtkDualDepthPeelingPass::CopyDepthProgram
vtkShaderProgram * CopyDepthProgram
Definition: vtkDualDepthPeelingPass.h:177
vtkDualDepthPeelingPass::CurrentStageTimeStamp
vtkTimeStamp CurrentStageTimeStamp
Definition: vtkDualDepthPeelingPass.h:198
vtkDualDepthPeelingPass::FreeGLObjects
void FreeGLObjects()
Release all FBOs and textures.
vtkDualDepthPeelingPass::NumberOfPasses
@ NumberOfPasses
Definition: vtkDualDepthPeelingPass.h:104
vtkDualDepthPeelingPass::BackBlendVBO
vtkOpenGLBufferObject * BackBlendVBO
Definition: vtkDualDepthPeelingPass.h:183
vtkDualDepthPeelingPass::CopyOpaqueDepthBuffer
void CopyOpaqueDepthBuffer()
vtkDualDepthPeelingPass::RenderCount
int RenderCount
Definition: vtkDualDepthPeelingPass.h:205
vtkDualDepthPeelingPass::InitColorTexture
void InitColorTexture(vtkTextureObject *tex, const vtkRenderState *s)
Initialize helpers.
vtkDualDepthPeelingPass::FrontA
@ FrontA
Definition: vtkDualDepthPeelingPass.h:88
vtkDualDepthPeelingPass::RenderTranslucentPass
void RenderTranslucentPass()
Render the translucent pass geometry, counting number of render calls.
vtkDualDepthPeelingPass::StartOcclusionQuery
void StartOcclusionQuery()
vtkDualDepthPeelingPass::~vtkDualDepthPeelingPass
~vtkDualDepthPeelingPass()
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
vtkDualDepthPeelingPass::InitFramebuffer
void InitFramebuffer(const vtkRenderState *s)
vtkDualDepthPeelingPass::BlendFinalImage
void BlendFinalImage()
vtkDualDepthPeelingPass::WrittenPixels
unsigned int WrittenPixels
Definition: vtkDualDepthPeelingPass.h:202
vtkMTimeType
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248
vtkDualDepthPeelingPass::DepthDestination
TextureName DepthDestination
Definition: vtkDualDepthPeelingPass.h:195
vtkDualDepthPeelingPass::InitOpaqueDepthTexture
void InitOpaqueDepthTexture(vtkTextureObject *tex, const vtkRenderState *s)
vtkDualDepthPeelingPass::Back
@ Back
Definition: vtkDualDepthPeelingPass.h:87
vtkDualDepthPeelingPass::Finalize
void Finalize()
vtkDualDepthPeelingPass::PeelRender
void PeelRender()
vtkDualDepthPeelingPass::BlendVBO
vtkOpenGLBufferObject * BlendVBO
Definition: vtkDualDepthPeelingPass.h:187
vtkDualDepthPeelingPass::Peel
void Peel()
Render the scene to produce the next set of peels.
vtkDualDepthPeelingPass::BlendBackBuffer
void BlendBackBuffer()
vtkDualDepthPeelingPass::OcclusionThreshold
unsigned int OcclusionThreshold
Definition: vtkDualDepthPeelingPass.h:203
vtkDualDepthPeelingPass::Framebuffer
vtkFrameBufferObject2 * Framebuffer
Definition: vtkDualDepthPeelingPass.h:189
vtkDualDepthPeelingPass::CurrentStage
ShaderStage CurrentStage
Definition: vtkDualDepthPeelingPass.h:197
vtkDualDepthPeelingPass::BlendProgram
vtkShaderProgram * BlendProgram
Definition: vtkDualDepthPeelingPass.h:185
vtkDualDepthPeelingPass::CopyDepthVAO
vtkOpenGLVertexArrayObject * CopyDepthVAO
Definition: vtkDualDepthPeelingPass.h:178
vtkShaderProgram
The ShaderProgram uses one or more Shader objects.
Definition: vtkShaderProgram.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkTextureObject
abstracts an OpenGL texture object.
Definition: vtkTextureObject.h:41
vtkDualDepthPeelingPass::DepthA
@ DepthA
Definition: vtkDualDepthPeelingPass.h:90
vtkDualDepthPeelingPass::BackBlendProgram
vtkShaderProgram * BackBlendProgram
Definition: vtkDualDepthPeelingPass.h:181
vtkDualDepthPeelingPass::InitializeDepth
void InitializeDepth()
vtkDualDepthPeelingPass::InitDepthTexture
void InitDepthTexture(vtkTextureObject *tex, const vtkRenderState *s)
vtkDualDepthPeelingPass::SwapTargets
void SwapTargets()
Swap the src/dest render targets:
vtkDualDepthPeelingPass::Initialize
void Initialize(const vtkRenderState *s)
Allocate and configure FBOs and textures.
vtkDualDepthPeelingPass::SetCurrentStage
void SetCurrentStage(ShaderStage stage)
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:48
vtkDualDepthPeelingPass::Prepare
void Prepare()
Fill textures with initial values, bind the framebuffer.
vtkDualDepthPeelingPass::AlphaBlending
@ AlphaBlending
Definition: vtkDualDepthPeelingPass.h:102
vtkDualDepthPeelingPass::FrontSource
TextureName FrontSource
Definition: vtkDualDepthPeelingPass.h:192
vtkDualDepthPeelingPass::Peeling
@ Peeling
Definition: vtkDualDepthPeelingPass.h:101
vtkDualDepthPeelingPass::OcclusionQueryId
unsigned int OcclusionQueryId
Definition: vtkDualDepthPeelingPass.h:201
vtkDualDepthPeelingPass::OpaqueDepth
@ OpaqueDepth
Definition: vtkDualDepthPeelingPass.h:92
vtkDualDepthPeelingPass::CurrentPeel
int CurrentPeel
Definition: vtkDualDepthPeelingPass.h:200
vtkDualDepthPeelingPass::FrontB
@ FrontB
Definition: vtkDualDepthPeelingPass.h:89
vtkDualDepthPeelingPass::DepthSource
TextureName DepthSource
Definition: vtkDualDepthPeelingPass.h:194
vtkDualDepthPeelingPass::New
static vtkDualDepthPeelingPass * New()
vtkRenderState
Context in which a vtkRenderPass will render.
Definition: vtkRenderState.h:41
vtkDualDepthPeelingPass::InitializeTargets
void InitializeTargets()
vtkDualDepthPeelingPass::CopyDepthVBO
vtkOpenGLBufferObject * CopyDepthVBO
Definition: vtkDualDepthPeelingPass.h:179
vtkFrameBufferObject2
Interface to OpenGL framebuffer object.
Definition: vtkFrameBufferObject2.h:87
vtkDualDepthPeelingPass::BlendVAO
vtkOpenGLVertexArrayObject * BlendVAO
Definition: vtkDualDepthPeelingPass.h:186
vtkOpenGLVertexArrayObject
The VertexArrayObject class uses, or emulates, vertex array objects.
Definition: vtkOpenGLVertexArrayObject.h:36
vtkDualDepthPeelingPass::PeelingDone
bool PeelingDone()
vtkDualDepthPeelingPass::BackBlendVAO
vtkOpenGLVertexArrayObject * BackBlendVAO
Definition: vtkDualDepthPeelingPass.h:182
vtkAbstractMapper
abstract class specifies interface to map data
Definition: vtkAbstractMapper.h:56
vtkDualDepthPeelingPass::ShaderStage
ShaderStage
Definition: vtkDualDepthPeelingPass.h:99
vtkDualDepthPeelingPass::vtkDualDepthPeelingPass
vtkDualDepthPeelingPass()