/usr/include/vtk-7.1/vtkDualDepthPeelingPass.h is in libvtk7-dev 7.1.1+dfsg1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkDualDepthPeelingPass.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* @class vtkDualDepthPeelingPass
* @brief Implements the dual depth peeling algorithm.
*
*
* Dual depth peeling is an augmentatation of the standard depth peeling
* algorithm that peels two layers (front and back) for each render pass. The
* technique is described in "Order independent transparency with dual depth
* peeling" (February 2008) by L. Bavoil, K. Myers.
*
* The pass occurs in several stages:
*
* 1. Copy the current (opaque geometry) depth buffer into a texture.
* 2. Initialize the min-max depth buffer from the opaque depth texture and the
* translucent geometry.
* 3. Peel the nearest and farthest fragments:
* 3a. Blend fragments that match the nearest depth of the min-max depth buffer
* into the front buffer.
* 3b. Write the far depth fragments into a temporary buffer.
* 3c. Extract the next set of min/max depth values for the next peel.
* 3d. Blend the temporary far fragment texture (3b) into an accumulation
* texture.
* 3e. Go back to 3a and repeat until the maximum number of peels is met, or
* the desired occlusion ratio is satisfied.
* 4. If the occlusion ratio != 0 (i.e. we hit the maximum number of peels
* before finishing), alpha blend the remaining fragments in-between the
* near and far accumulation textures.
* 5. Blend all accumulation buffers over the opaque color buffer to produce the
* final image.
*/
#ifndef vtkDualDepthPeelingPass_h
#define vtkDualDepthPeelingPass_h
#include "vtkRenderingOpenGL2Module.h" // For export macro
#include "vtkDepthPeelingPass.h"
class vtkFrameBufferObject2;
class vtkOpenGLBufferObject;
class vtkOpenGLVertexArrayObject;
class vtkShaderProgram;
class vtkTextureObject;
class VTKRENDERINGOPENGL2_EXPORT vtkDualDepthPeelingPass:
public vtkDepthPeelingPass
{
public:
static vtkDualDepthPeelingPass* New();
vtkTypeMacro(vtkDualDepthPeelingPass, vtkDepthPeelingPass)
virtual void PrintSelf(ostream &os, vtkIndent indent);
virtual void Render(const vtkRenderState *s);
virtual void ReleaseGraphicsResources(vtkWindow *w);
// vtkOpenGLRenderPass virtuals:
virtual bool ReplaceShaderValues(std::string &vertexShader,
std::string &geometryShader,
std::string &fragmentShader,
vtkAbstractMapper *mapper,
vtkProp *prop);
virtual bool SetShaderParameters(vtkShaderProgram *program,
vtkAbstractMapper *mapper, vtkProp *prop);
virtual vtkMTimeType GetShaderStageMTime();
protected:
// Name the textures used by this render pass. These are indexes into
// this->Textures
enum TextureName
{
BackTemp = 0, // RGBA8 back-to-front peeling buffer
Back, // RGBA8 back-to-front accumulation buffer
FrontA, // RGBA8 front-to-back accumulation buffer
FrontB, // RGBA8 front-to-back accumulation buffer
DepthA, // RG32F min-max depth buffer
DepthB, // RG32F min-max depth buffer
OpaqueDepth, // Stores the depth map from the opaque passes
NumberOfTextures
};
// The stages of this multipass render pass:
enum ShaderStage
{
InitializingDepth,
Peeling,
AlphaBlending,
NumberOfPasses,
Inactive = -1,
};
vtkDualDepthPeelingPass();
~vtkDualDepthPeelingPass();
void SetCurrentStage(ShaderStage stage);
/**
* Release all FBOs and textures.
*/
void FreeGLObjects();
/**
* Render the translucent pass geometry, counting number of render calls.
*/
void RenderTranslucentPass();
/**
* Allocate and configure FBOs and textures.
*/
void Initialize(const vtkRenderState *s);
//@{
/**
* Initialize helpers.
*/
void InitColorTexture(vtkTextureObject *tex, const vtkRenderState *s);
void InitDepthTexture(vtkTextureObject *tex, const vtkRenderState *s);
void InitOpaqueDepthTexture(vtkTextureObject *tex, const vtkRenderState *s);
void InitFramebuffer(const vtkRenderState *s);
//@}
//@{
/**
* Fill textures with initial values, bind the framebuffer.
*/
void Prepare();
void InitializeOcclusionQuery();
void CopyOpaqueDepthBuffer();
void InitializeDepth();
//@}
bool PeelingDone();
/**
* Render the scene to produce the next set of peels.
*/
void Peel();
void InitializeTargets();
void PeelRender();
void BlendBackBuffer();
void StartOcclusionQuery();
void EndOcclusionQuery();
/**
* Swap the src/dest render targets:
*/
void SwapTargets();
void Finalize();
void AlphaBlendRender();
void BlendFinalImage();
void DeleteOcclusionQueryId();
const vtkRenderState *RenderState;
vtkShaderProgram *CopyDepthProgram;
vtkOpenGLVertexArrayObject *CopyDepthVAO;
vtkOpenGLBufferObject *CopyDepthVBO;
vtkShaderProgram *BackBlendProgram;
vtkOpenGLVertexArrayObject *BackBlendVAO;
vtkOpenGLBufferObject *BackBlendVBO;
vtkShaderProgram *BlendProgram;
vtkOpenGLVertexArrayObject *BlendVAO;
vtkOpenGLBufferObject *BlendVBO;
vtkFrameBufferObject2 *Framebuffer;
vtkTextureObject *Textures[NumberOfTextures];
TextureName FrontSource; // The current front source buffer
TextureName FrontDestination; // The current front destination buffer
TextureName DepthSource; // The current depth source buffer
TextureName DepthDestination; // The current depth destination buffer
ShaderStage CurrentStage;
vtkTimeStamp CurrentStageTimeStamp;
int CurrentPeel;
unsigned int OcclusionQueryId;
unsigned int WrittenPixels;
unsigned int OcclusionThreshold;
int RenderCount; // Debug info, counts number of geometry passes.
private:
vtkDualDepthPeelingPass(const vtkDualDepthPeelingPass&) VTK_DELETE_FUNCTION;
void operator=(const vtkDualDepthPeelingPass&) VTK_DELETE_FUNCTION;
};
#endif // vtkDualDepthPeelingPass_h
|