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 =========================================================================*/
50 #ifndef vtkDepthPeelingPass_h
51 #define vtkDepthPeelingPass_h
52 
53 #include "vtkRenderingOpenGL2Module.h" // For export macro
54 #include "vtkOpenGLRenderPass.h"
55 #include <vector> // STL Header
56 
58 class vtkTextureObject;
60 class vtkOpenGLHelper;
61 
62 class VTKRENDERINGOPENGL2_EXPORT vtkDepthPeelingPass
63  : public vtkOpenGLRenderPass
64 {
65 public:
66  static vtkDepthPeelingPass *New();
68  void PrintSelf(ostream& os, vtkIndent indent) override;
69 
74  void Render(const vtkRenderState *s) override;
75 
81  void ReleaseGraphicsResources(vtkWindow *w) override;
82 
84 
90  vtkGetObjectMacro(TranslucentPass,vtkRenderPass);
91  virtual void SetTranslucentPass(vtkRenderPass *translucentPass);
93 
95 
104  vtkSetClampMacro(OcclusionRatio,double,0.0,0.5);
105  vtkGetMacro(OcclusionRatio,double);
107 
109 
114  vtkSetMacro(MaximumNumberOfPeels,int);
115  vtkGetMacro(MaximumNumberOfPeels,int);
117 
118  // vtkOpenGLRenderPass virtuals:
119  bool PostReplaceShaderValues(std::string &vertexShader,
120  std::string &geometryShader,
121  std::string &fragmentShader,
122  vtkAbstractMapper *mapper,
123  vtkProp *prop) override;
125  vtkAbstractMapper *mapper, vtkProp *prop,
126  vtkOpenGLVertexArrayObject* VAO = nullptr) override;
127 
128  // Set Opaque Z texture, this must be set from the outer FO
129  void SetOpaqueZTexture(vtkTextureObject *);
130 
131  // Set Opaque RGBA texture, this must be set from the outer FO
132  void SetOpaqueRGBATexture(vtkTextureObject *);
133 
138  vtkSetMacro(DepthFormat, int);
139 
140  protected:
145 
149  ~vtkDepthPeelingPass() override;
150 
151  vtkRenderPass *TranslucentPass;
152  vtkTimeStamp CheckTime;
153 
155 
158  int ViewportX;
159  int ViewportY;
160  int ViewportWidth;
161  int ViewportHeight;
163 
173  double OcclusionRatio;
174 
180  int MaximumNumberOfPeels;
181 
183 
186 
187  // obtained from the outer FO, we read from them
192 
193  // each peel merges two color buffers into one result
194  vtkTextureObject *TranslucentRGBATexture[3];
197 
198  // each peel compares a prior Z and writes to next
199  vtkTextureObject *TranslucentZTexture[2];
201 
202  void BlendIntermediatePeels(vtkOpenGLRenderWindow *renWin, bool);
203  void BlendFinalPeel(vtkOpenGLRenderWindow *renWin);
204 
205  private:
206  vtkDepthPeelingPass(const vtkDepthPeelingPass&) = delete;
207  void operator=(const vtkDepthPeelingPass&) = delete;
208 };
209 
210 #endif
OpenGL rendering window.
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:50
Implement an Order Independent Transparency render pass.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkOpenGLHelper * IntermediateBlendProgram
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
Context in which a vtkRenderPass will render.
vtkTextureObject * OpaqueZTexture
vtkOpenGLFramebufferObject * Framebuffer
a simple class to control print indentation
Definition: vtkIndent.h:39
The VertexArrayObject class uses, or emulates, vertex array objects.
Internal class which encapsulates OpenGL FramebufferObject.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
abstract class specifies interface to map data
abstracts an OpenGL texture object.
virtual void Render(const vtkRenderState *s)=0
Perform rendering according to a render state s.
vtkTextureObject * OpaqueRGBATexture
virtual void ReleaseGraphicsResources(vtkWindow *w)
Release graphics resources and ask components to release their own resources.
vtkOpenGLHelper * FinalBlendProgram
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
Perform part of the rendering of a vtkRenderer.
Definition: vtkRenderPass.h:58
virtual bool SetShaderParameters(vtkShaderProgram *program, vtkAbstractMapper *mapper, vtkProp *prop, vtkOpenGLVertexArrayObject *VAO=nullptr)
Update the uniforms of the shader program.
Abstract render pass with shader modifications.
virtual bool PostReplaceShaderValues(std::string &vertexShader, std::string &geometryShader, std::string &fragmentShader, vtkAbstractMapper *mapper, vtkProp *prop)
Use vtkShaderProgram::Substitute to replace //VTK::XXX:YYY declarations in the shader sources.
The ShaderProgram uses one or more Shader objects.