VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkDepthPeelingPass.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00041 #ifndef __vtkDepthPeelingPass_h 00042 #define __vtkDepthPeelingPass_h 00043 00044 #include "vtkRenderingOpenGLModule.h" // For export macro 00045 #include "vtkRenderPass.h" 00046 00047 class vtkOpenGLRenderWindow; 00048 class vtkDepthPeelingPassLayerList; // Pimpl 00049 class vtkShaderProgram2; 00050 class vtkShader2; 00051 00052 class VTKRENDERINGOPENGL_EXPORT vtkDepthPeelingPass : public vtkRenderPass 00053 { 00054 public: 00055 static vtkDepthPeelingPass *New(); 00056 vtkTypeMacro(vtkDepthPeelingPass,vtkRenderPass); 00057 void PrintSelf(ostream& os, vtkIndent indent); 00058 00059 //BTX 00061 00063 virtual void Render(const vtkRenderState *s); 00064 //ETX 00066 00069 void ReleaseGraphicsResources(vtkWindow *w); 00070 00072 00075 vtkGetObjectMacro(TranslucentPass,vtkRenderPass); 00076 virtual void SetTranslucentPass(vtkRenderPass *translucentPass); 00078 00080 00087 vtkSetClampMacro(OcclusionRatio,double,0.0,0.5); 00088 vtkGetMacro(OcclusionRatio,double); 00090 00092 00095 vtkSetMacro(MaximumNumberOfPeels,int); 00096 vtkGetMacro(MaximumNumberOfPeels,int); 00098 00100 00102 vtkGetMacro(LastRenderingUsedDepthPeeling,bool); 00104 00111 protected: 00113 vtkDepthPeelingPass(); 00114 00116 virtual ~vtkDepthPeelingPass(); 00117 00120 void CheckSupport(vtkOpenGLRenderWindow *w); 00121 00123 void CheckCompilation(unsigned int fragmentShader); 00124 00126 00130 int RenderPeel(const vtkRenderState *s, 00131 int layer); 00133 00134 vtkRenderPass *TranslucentPass; 00135 vtkTimeStamp CheckTime; 00136 bool IsChecked; 00137 bool IsSupported; 00138 00140 00141 int ViewportX; 00142 int ViewportY; 00143 int ViewportWidth; 00144 int ViewportHeight; 00146 00149 unsigned int DepthFormat; 00150 00158 double OcclusionRatio; 00159 00163 int MaximumNumberOfPeels; 00164 00165 bool LastRenderingUsedDepthPeeling; 00166 00168 vtkDepthPeelingPassLayerList *LayerList; 00169 00170 unsigned int OpaqueLayerZ; 00171 unsigned int TransparentLayerZ; 00172 // unsigned int ProgramShader; 00173 00174 // Is rendering at translucent geometry stage using depth peeling and 00175 // rendering a layer other than the first one? (Boolean value) 00176 // If so, the uniform variables UseTexture and Texture can be set. 00177 // (Used by vtkOpenGLProperty or vtkOpenGLTexture) 00178 int DepthPeelingHigherLayer; 00179 00180 vtkShaderProgram2 *Prog; 00181 vtkShader2 *Shader; 00182 00183 int ShadowTexUnit; // texture unit allocated for the shadow texture 00184 int OpaqueShadowTexUnit; // texture unit allocated for the opaque shadow tex. 00185 00186 private: 00187 vtkDepthPeelingPass(const vtkDepthPeelingPass&); // Not implemented. 00188 void operator=(const vtkDepthPeelingPass&); // Not implemented. 00189 }; 00190 00191 #endif