VTK
dox/Rendering/vtkDepthPeelingPass.h
Go to the documentation of this file.
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 "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   vtkTypeMacro(vtkDepthPeelingPass,vtkRenderPass);
00056   void PrintSelf(ostream& os, vtkIndent indent);
00057 
00058   //BTX
00060 
00062   virtual void Render(const vtkRenderState *s);
00063   //ETX
00065   
00068   void ReleaseGraphicsResources(vtkWindow *w);
00069   
00071 
00074   vtkGetObjectMacro(TranslucentPass,vtkRenderPass);
00075   virtual void SetTranslucentPass(vtkRenderPass *translucentPass);
00077 
00079 
00086   vtkSetClampMacro(OcclusionRatio,double,0.0,0.5);
00087   vtkGetMacro(OcclusionRatio,double);
00089   
00091 
00094   vtkSetMacro(MaximumNumberOfPeels,int);
00095   vtkGetMacro(MaximumNumberOfPeels,int);
00097 
00099 
00101   vtkGetMacro(LastRenderingUsedDepthPeeling,bool);
00103 
00110  protected:
00112   vtkDepthPeelingPass();
00113 
00115   virtual ~vtkDepthPeelingPass();
00116 
00119   void CheckSupport(vtkOpenGLRenderWindow *w);
00120 
00122   void CheckCompilation(unsigned int fragmentShader);
00123   
00125 
00129   int RenderPeel(const vtkRenderState *s,
00130                  int layer);
00132 
00133   vtkRenderPass *TranslucentPass;
00134   vtkTimeStamp CheckTime;
00135   bool IsChecked;
00136   bool IsSupported;
00137 
00139 
00140   int ViewportX;
00141   int ViewportY;
00142   int ViewportWidth;
00143   int ViewportHeight;
00145   
00148   unsigned int DepthFormat;
00149 
00157   double OcclusionRatio;
00158    
00162   int MaximumNumberOfPeels;
00163 
00164   bool LastRenderingUsedDepthPeeling;
00165 
00167   vtkDepthPeelingPassLayerList *LayerList;
00168   
00169   unsigned int OpaqueLayerZ;
00170   unsigned int TransparentLayerZ;
00171 //  unsigned int ProgramShader;
00172 
00173   // Is rendering at translucent geometry stage using depth peeling and
00174   // rendering a layer other than the first one? (Boolean value)
00175   // If so, the uniform variables UseTexture and Texture can be set.
00176   // (Used by vtkOpenGLProperty or vtkOpenGLTexture)
00177   int DepthPeelingHigherLayer;
00178   
00179   vtkShaderProgram2 *Prog;
00180   vtkShader2 *Shader;
00181   
00182   int ShadowTexUnit; // texture unit allocated for the shadow texture
00183   int OpaqueShadowTexUnit; // texture unit allocated for the opaque shadow tex.
00184   
00185  private:
00186   vtkDepthPeelingPass(const vtkDepthPeelingPass&);  // Not implemented.
00187   void operator=(const vtkDepthPeelingPass&);  // Not implemented.
00188 };
00189 
00190 #endif