VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkDepthPeelingPass.h,v $ 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 "vtkRenderPass.h" 00045 00046 class vtkOpenGLRenderWindow; 00047 class vtkDepthPeelingPassLayerList; // Pimpl 00048 class vtkShaderProgram2; 00049 class vtkShader2; 00050 00051 class VTK_RENDERING_EXPORT vtkDepthPeelingPass : public vtkRenderPass 00052 { 00053 public: 00054 static vtkDepthPeelingPass *New(); 00055 vtkTypeRevisionMacro(vtkDepthPeelingPass,vtkRenderPass); 00056 void PrintSelf(ostream& os, vtkIndent indent); 00057 00060 virtual void Render(const vtkRenderState *s); 00061 00064 void ReleaseGraphicsResources(vtkWindow *w); 00065 00067 00070 vtkGetObjectMacro(TranslucentPass,vtkRenderPass); 00071 virtual void SetTranslucentPass(vtkRenderPass *translucentPass); 00073 00075 00082 vtkSetClampMacro(OcclusionRatio,double,0.0,0.5); 00083 vtkGetMacro(OcclusionRatio,double); 00085 00087 00090 vtkSetMacro(MaximumNumberOfPeels,int); 00091 vtkGetMacro(MaximumNumberOfPeels,int); 00093 00095 00097 vtkGetMacro(LastRenderingUsedDepthPeeling,bool); 00099 00104 int GetDepthPeelingHigherLayer(); 00105 00106 protected: 00108 vtkDepthPeelingPass(); 00109 00111 virtual ~vtkDepthPeelingPass(); 00112 00115 void CheckSupport(vtkOpenGLRenderWindow *w); 00116 00118 void CheckCompilation(unsigned int fragmentShader); 00119 00121 00125 int RenderPeel(const vtkRenderState *s, 00126 int layer); 00128 00129 vtkRenderPass *TranslucentPass; 00130 vtkTimeStamp CheckTime; 00131 bool IsChecked; 00132 bool IsSupported; 00133 00135 00136 int ViewportX; 00137 int ViewportY; 00138 int ViewportWidth; 00139 int ViewportHeight; 00141 00144 unsigned int DepthFormat; 00145 00153 double OcclusionRatio; 00154 00158 int MaximumNumberOfPeels; 00159 00160 bool LastRenderingUsedDepthPeeling; 00161 00163 vtkDepthPeelingPassLayerList *LayerList; 00164 00165 unsigned int OpaqueLayerZ; 00166 unsigned int TransparentLayerZ; 00167 // unsigned int ProgramShader; 00168 00169 // Is rendering at translucent geometry stage using depth peeling and 00170 // rendering a layer other than the first one? (Boolean value) 00171 // If so, the uniform variables UseTexture and Texture can be set. 00172 // (Used by vtkOpenGLProperty or vtkOpenGLTexture) 00173 int DepthPeelingHigherLayer; 00174 00175 vtkShaderProgram2 *Prog; 00176 vtkShader2 *Shader; 00177 00178 int ShadowTexUnit; // texture unit allocated for the shadow texture 00179 int OpaqueShadowTexUnit; // texture unit allocated for the opaque shadow tex. 00180 00181 private: 00182 vtkDepthPeelingPass(const vtkDepthPeelingPass&); // Not implemented. 00183 void operator=(const vtkDepthPeelingPass&); // Not implemented. 00184 }; 00185 00186 #endif