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
abstract class specifies interface to map data
Implement an Order Independent Transparency render pass.
Implements the dual depth peeling algorithm.
vtkOpenGLBufferObject * CopyDepthVBO
vtkOpenGLBufferObject * BackBlendVBO
void Initialize(const vtkRenderState *s)
Allocate and configure FBOs and textures.
vtkOpenGLVertexArrayObject * CopyDepthVAO
void InitDepthTexture(vtkTextureObject *tex, const vtkRenderState *s)
void SwapTargets()
Swap the src/dest render targets:
vtkOpenGLVertexArrayObject * BlendVAO
void Prepare()
Fill textures with initial values, bind the framebuffer.
vtkOpenGLVertexArrayObject * BackBlendVAO
vtkOpenGLBufferObject * BlendVBO
void SetCurrentStage(ShaderStage stage)
void FreeGLObjects()
Release all FBOs and textures.
void Peel()
Render the scene to produce the next set of peels.
vtkFrameBufferObject2 * Framebuffer
static vtkDualDepthPeelingPass * New()
void RenderTranslucentPass()
Render the translucent pass geometry, counting number of render calls.
vtkShaderProgram * CopyDepthProgram
const vtkRenderState * RenderState
void InitOpaqueDepthTexture(vtkTextureObject *tex, const vtkRenderState *s)
void InitColorTexture(vtkTextureObject *tex, const vtkRenderState *s)
Initialize helpers.
void InitFramebuffer(const vtkRenderState *s)
vtkShaderProgram * BackBlendProgram
Interface to OpenGL framebuffer object.
a simple class to control print indentation
Definition: vtkIndent.h:40
OpenGL buffer object.
The VertexArrayObject class uses, or emulates, vertex array objects.
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:48
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:36
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248