VTK
dox/Rendering/vtkShadowMapBakerPass.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkShadowMapPass.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 =========================================================================*/
00045 #ifndef __vtkShadowMapBakerPass_h
00046 #define __vtkShadowMapBakerPass_h
00047 
00048 #include "vtkRenderPass.h"
00049 
00050 class vtkOpenGLRenderWindow;
00051 class vtkInformationIntegerKey;
00052 class vtkCamera;
00053 class vtkLight;
00054 class vtkFrameBufferObject;
00055 class vtkShadowMapBakerPassTextures; // internal
00056 class vtkShadowMapBakerPassLightCameras; // internal
00057 
00058 class VTK_RENDERING_EXPORT vtkShadowMapBakerPass : public vtkRenderPass
00059 {
00060 public:
00061   static vtkShadowMapBakerPass *New();
00062   vtkTypeMacro(vtkShadowMapBakerPass,vtkRenderPass);
00063   void PrintSelf(ostream& os, vtkIndent indent);
00064 
00068   static vtkInformationIntegerKey *OCCLUDER();
00069 
00070   // If this key exists on the Propertykeys of a prop, the prop is viewed as a
00071   // light/shadow receiver. This key is not mutually exclusive with the
00072   // OCCLUDER() key.
00073   static vtkInformationIntegerKey *RECEIVER();
00074 
00075   //BTX
00077 
00079   virtual void Render(const vtkRenderState *s);
00080   //ETX
00082 
00085   void ReleaseGraphicsResources(vtkWindow *w);
00086 
00088 
00092   vtkGetObjectMacro(OpaquePass,vtkRenderPass);
00093   virtual void SetOpaquePass(vtkRenderPass *opaquePass);
00095 
00097 
00101   vtkGetObjectMacro(CompositeZPass,vtkRenderPass);
00102   virtual void SetCompositeZPass(vtkRenderPass *compositeZPass);
00104 
00106 
00109   vtkSetMacro(Resolution,unsigned int);
00110   vtkGetMacro(Resolution,unsigned int);
00112 
00114 
00122   vtkSetMacro(PolygonOffsetFactor,float);
00123   vtkGetMacro(PolygonOffsetFactor,float);
00125 
00127 
00136   vtkSetMacro(PolygonOffsetUnits,float);
00137   vtkGetMacro(PolygonOffsetUnits,float);
00139 
00143   bool GetHasShadows();
00144 
00149   bool LightCreatesShadow(vtkLight *l);
00150 
00151 //BTX
00154   vtkShadowMapBakerPassTextures *GetShadowMaps();
00155 
00157 
00159   vtkShadowMapBakerPassLightCameras *GetLightCameras();
00160 //ETX
00162 
00167   bool GetNeedUpdate();
00168 
00169   // // Description:
00170   // INTERNAL USE ONLY.
00171   // Internally used by vtkShadowMapBakerPass and vtkShadowMapPass.
00172   //
00173   // Set NeedUpate to false. Called by vtkShadowMapPass.
00174   void SetUpToDate();
00175 
00176  protected:
00178   vtkShadowMapBakerPass();
00179 
00181   virtual ~vtkShadowMapBakerPass();
00182 
00184 
00187   void PointNearFar(double *v,
00188                     double *pt,
00189                     double *dir,
00190                     double &mNear,
00191                     double &mFar,
00192                     bool initialized);
00194 
00196 
00198   void BoxNearFar(double *bb,
00199                   double *pt,
00200                   double *dir,
00201                   double &mNear,
00202                   double &mFar);
00204 
00205   //BTX
00207 
00209   void BuildCameraLight(vtkLight *light,
00210                         double *boundingBox,
00211                         vtkCamera *lcamera);
00212   //ETX
00214 
00217   void CheckSupport(vtkOpenGLRenderWindow *w);
00218 
00219   vtkRenderPass *OpaquePass;
00220 
00221   vtkRenderPass *CompositeZPass;
00222 
00223   unsigned int Resolution;
00224 
00225   float PolygonOffsetFactor;
00226   float PolygonOffsetUnits;
00227 
00228   bool HasShadows;
00229 
00231   vtkFrameBufferObject *FrameBufferObject;
00232 
00233   vtkShadowMapBakerPassTextures *ShadowMaps;
00234   vtkShadowMapBakerPassLightCameras *LightCameras;
00235 
00236 
00237   vtkTimeStamp LastRenderTime;
00238   bool NeedUpdate;
00239 
00240 private:
00241   vtkShadowMapBakerPass(const vtkShadowMapBakerPass&);  // Not implemented.
00242   void operator=(const vtkShadowMapBakerPass&);  // Not implemented.
00243 };
00244 
00245 #endif