VTK
|
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 "vtkRenderingOpenGLModule.h" // For export macro 00049 #include "vtkRenderPass.h" 00050 00051 class vtkOpenGLRenderWindow; 00052 class vtkInformationIntegerKey; 00053 class vtkCamera; 00054 class vtkLight; 00055 class vtkFrameBufferObject; 00056 class vtkShadowMapBakerPassTextures; // internal 00057 class vtkShadowMapBakerPassLightCameras; // internal 00058 00059 class VTKRENDERINGOPENGL_EXPORT vtkShadowMapBakerPass : public vtkRenderPass 00060 { 00061 public: 00062 static vtkShadowMapBakerPass *New(); 00063 vtkTypeMacro(vtkShadowMapBakerPass,vtkRenderPass); 00064 void PrintSelf(ostream& os, vtkIndent indent); 00065 00069 static vtkInformationIntegerKey *OCCLUDER(); 00070 00071 // If this key exists on the Propertykeys of a prop, the prop is viewed as a 00072 // light/shadow receiver. This key is not mutually exclusive with the 00073 // OCCLUDER() key. 00074 static vtkInformationIntegerKey *RECEIVER(); 00075 00076 //BTX 00078 00080 virtual void Render(const vtkRenderState *s); 00081 //ETX 00083 00086 void ReleaseGraphicsResources(vtkWindow *w); 00087 00089 00093 vtkGetObjectMacro(OpaquePass,vtkRenderPass); 00094 virtual void SetOpaquePass(vtkRenderPass *opaquePass); 00096 00098 00102 vtkGetObjectMacro(CompositeZPass,vtkRenderPass); 00103 virtual void SetCompositeZPass(vtkRenderPass *compositeZPass); 00105 00107 00110 vtkSetMacro(Resolution,unsigned int); 00111 vtkGetMacro(Resolution,unsigned int); 00113 00115 00123 vtkSetMacro(PolygonOffsetFactor,float); 00124 vtkGetMacro(PolygonOffsetFactor,float); 00126 00128 00137 vtkSetMacro(PolygonOffsetUnits,float); 00138 vtkGetMacro(PolygonOffsetUnits,float); 00140 00144 bool GetHasShadows(); 00145 00150 bool LightCreatesShadow(vtkLight *l); 00151 00152 //BTX 00155 vtkShadowMapBakerPassTextures *GetShadowMaps(); 00156 00158 00160 vtkShadowMapBakerPassLightCameras *GetLightCameras(); 00161 //ETX 00163 00168 bool GetNeedUpdate(); 00169 00170 // // Description: 00171 // INTERNAL USE ONLY. 00172 // Internally used by vtkShadowMapBakerPass and vtkShadowMapPass. 00173 // 00174 // Set NeedUpate to false. Called by vtkShadowMapPass. 00175 void SetUpToDate(); 00176 00177 protected: 00179 vtkShadowMapBakerPass(); 00180 00182 virtual ~vtkShadowMapBakerPass(); 00183 00185 00188 void PointNearFar(double *v, 00189 double *pt, 00190 double *dir, 00191 double &mNear, 00192 double &mFar, 00193 bool initialized); 00195 00197 00199 void BoxNearFar(double *bb, 00200 double *pt, 00201 double *dir, 00202 double &mNear, 00203 double &mFar); 00205 00206 //BTX 00208 00210 void BuildCameraLight(vtkLight *light, 00211 double *boundingBox, 00212 vtkCamera *lcamera); 00213 //ETX 00215 00218 void CheckSupport(vtkOpenGLRenderWindow *w); 00219 00220 vtkRenderPass *OpaquePass; 00221 00222 vtkRenderPass *CompositeZPass; 00223 00224 unsigned int Resolution; 00225 00226 float PolygonOffsetFactor; 00227 float PolygonOffsetUnits; 00228 00229 bool HasShadows; 00230 00232 vtkFrameBufferObject *FrameBufferObject; 00233 00234 vtkShadowMapBakerPassTextures *ShadowMaps; 00235 vtkShadowMapBakerPassLightCameras *LightCameras; 00236 00237 00238 vtkTimeStamp LastRenderTime; 00239 bool NeedUpdate; 00240 00241 private: 00242 vtkShadowMapBakerPass(const vtkShadowMapBakerPass&); // Not implemented. 00243 void operator=(const vtkShadowMapBakerPass&); // Not implemented. 00244 }; 00245 00246 #endif