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 =========================================================================*/ 00038 #ifndef vtkDepthPeelingPass_h 00039 #define vtkDepthPeelingPass_h 00040 00041 #include "vtkRenderingOpenGL2Module.h" // For export macro 00042 #include "vtkRenderPass.h" 00043 #include <vector> // STL Header 00044 00045 class vtkTextureObject; 00046 class vtkOpenGLRenderWindow; 00047 class vtkInformationIntegerKey; 00048 class vtkInformationIntegerVectorKey; 00049 namespace vtkgl 00050 { 00051 class CellBO; 00052 } 00053 00054 class VTKRENDERINGOPENGL2_EXPORT vtkDepthPeelingPass : public vtkRenderPass 00055 { 00056 public: 00057 static vtkDepthPeelingPass *New(); 00058 vtkTypeMacro(vtkDepthPeelingPass,vtkRenderPass); 00059 void PrintSelf(ostream& os, vtkIndent indent); 00060 00061 //BTX 00063 00065 virtual void Render(const vtkRenderState *s); 00066 //ETX 00068 00071 void ReleaseGraphicsResources(vtkWindow *w); 00072 00074 00077 vtkGetObjectMacro(TranslucentPass,vtkRenderPass); 00078 virtual void SetTranslucentPass(vtkRenderPass *translucentPass); 00080 00082 00089 vtkSetClampMacro(OcclusionRatio,double,0.0,0.5); 00090 vtkGetMacro(OcclusionRatio,double); 00092 00094 00097 vtkSetMacro(MaximumNumberOfPeels,int); 00098 vtkGetMacro(MaximumNumberOfPeels,int); 00100 00102 00104 vtkGetMacro(LastRenderingUsedDepthPeeling,bool); 00106 00115 static vtkInformationIntegerKey *OpaqueZTextureUnit(); 00116 00119 static vtkInformationIntegerKey *TranslucentZTextureUnit(); 00120 00122 static vtkInformationIntegerVectorKey *DestinationSize(); 00123 00124 protected: 00126 vtkDepthPeelingPass(); 00127 00129 virtual ~vtkDepthPeelingPass(); 00130 00131 vtkRenderPass *TranslucentPass; 00132 vtkTimeStamp CheckTime; 00133 bool IsSupported; 00134 00136 00137 int ViewportX; 00138 int ViewportY; 00139 int ViewportWidth; 00140 int ViewportHeight; 00142 00145 unsigned int DepthFormat; 00146 00154 double OcclusionRatio; 00155 00159 int MaximumNumberOfPeels; 00160 00161 bool LastRenderingUsedDepthPeeling; 00162 00163 // Is rendering at translucent geometry stage using depth peeling and 00164 // rendering a layer other than the first one? (Boolean value) 00165 // If so, the uniform variables UseTexture and Texture can be set. 00166 // (Used by vtkOpenGLProperty or vtkOpenGLTexture) 00167 int DepthPeelingHigherLayer; 00168 00169 vtkgl::CellBO *FinalBlendProgram; 00170 vtkgl::CellBO *IntermediateBlendProgram; 00171 00172 vtkTextureObject *OpaqueZTexture; 00173 vtkTextureObject *OpaqueRGBATexture; 00174 vtkTextureObject *TranslucentRGBATexture; 00175 vtkTextureObject *TranslucentZTexture; 00176 vtkTextureObject *CurrentRGBATexture; 00177 std::vector<float> *DepthZData; 00178 00179 void BlendIntermediatePeels(vtkOpenGLRenderWindow *renWin); 00180 void BlendFinalPeel(vtkOpenGLRenderWindow *renWin); 00181 00182 private: 00183 vtkDepthPeelingPass(const vtkDepthPeelingPass&); // Not implemented. 00184 void operator=(const vtkDepthPeelingPass&); // Not implemented. 00185 }; 00186 00187 #endif