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:
63  static vtkDualDepthPeelingPass* New();
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 
111  void SetCurrentStage(ShaderStage stage);
112 
116  void FreeGLObjects();
117 
121  void RenderTranslucentPass();
122 
126  void Initialize(const vtkRenderState *s);
127 
129 
132  void InitColorTexture(vtkTextureObject *tex, const vtkRenderState *s);
133  void InitDepthTexture(vtkTextureObject *tex, const vtkRenderState *s);
134  void InitOpaqueDepthTexture(vtkTextureObject *tex, const vtkRenderState *s);
135  void InitFramebuffer(const vtkRenderState *s);
137 
139 
142  void Prepare();
143  void InitializeOcclusionQuery();
144  void CopyOpaqueDepthBuffer();
145  void InitializeDepth();
147 
148  bool PeelingDone();
149 
153  void Peel();
154 
155  void InitializeTargets();
156 
157  void PeelRender();
158 
159  void BlendBackBuffer();
160  void StartOcclusionQuery();
161  void EndOcclusionQuery();
162 
166  void SwapTargets();
167 
168  void Finalize();
169 
170  void AlphaBlendRender();
171 
172  void BlendFinalImage();
173  void DeleteOcclusionQueryId();
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 superclass for all actors, volumes and annotations
Definition: vtkProp.h:50
Implement an Order Independent Transparency render pass.
const vtkRenderState * RenderState
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkShaderProgram * CopyDepthProgram
vtkOpenGLBufferObject * BackBlendVBO
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248
vtkOpenGLBufferObject * BlendVBO
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkFrameBufferObject2 * Framebuffer
Context in which a vtkRenderPass will render.
vtkOpenGLVertexArrayObject * CopyDepthVAO
a simple class to control print indentation
Definition: vtkIndent.h:39
The VertexArrayObject class uses, or emulates, vertex array objects.
static vtkDepthPeelingPass * New()
vtkShaderProgram * BackBlendProgram
abstract class specifies interface to map data
abstracts an OpenGL texture object.
Implements the dual depth peeling algorithm.
OpenGL buffer object.
vtkOpenGLVertexArrayObject * BackBlendVAO
Interface to OpenGL framebuffer object.
vtkOpenGLBufferObject * CopyDepthVBO
vtkOpenGLVertexArrayObject * BlendVAO
The ShaderProgram uses one or more Shader objects.