- Timestamp:
- 09/02/08 09:07:45 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.h
r2892 r2894 1 #ifndef _ShadowMap ping_H__2 #define _ShadowMap ping_H__1 #ifndef _ShadowMap_H__ 2 #define _ShadowMap_H__ 3 3 4 4 #include "common.h" … … 20 20 class Light; 21 21 22 /** This class implements a shadow mapping algorithm22 /** This class implements a the computation of single shadow map 23 23 */ 24 class ShadowMap ping24 class ShadowMap 25 25 { 26 26 27 public: 27 /** constructor for a deferred shader taking the requested shadow size 28 /** Constructor taking the scene boundig box and the current camera. 29 The shadow map has resolution size * size. 28 30 */ 29 ShadowMap ping(const AxisAlignedBox3 &sceneBox, int size);31 ShadowMap(int size, const AxisAlignedBox3 &sceneBox, Camera *cam); 30 32 31 ~ShadowMap ping();32 /** Renders the shadowed scene33 ~ShadowMap(); 34 /** Computes the shadow map 33 35 */ 34 void Render(RenderTraverser *traverser, Camera *cam); 35 /** Initialises shadow mapping and loads the required shaders: 36 This function has to be called only once. 36 void ComputeShadowMap(Light *light, RenderTraverser *traverser); 37 /** Returns computed shadow texture. 37 38 */ 38 static void Init(CGcontext context); 39 unsigned int GetShadowTexture() const; 40 /** Returns computed texture matrix. It must be applied on the 41 the world space positions. 42 43 The texture matrix can be directly applied if the world space position 44 is available (deferred shading), otherwise it must be multiplied with 45 the inverse model matrix. 46 */ 47 void GetTextureMatrix(Matrix4x4 &m) const; 39 48 40 //protected:41 49 42 void ComputeShadowMap(Light *light, RenderTraverser *traverser); 50 protected: 43 51 44 //protected: 45 52 /// the scene bounding box 53 AxisAlignedBox3 mSceneBox; 54 /// fbo storing the shadow texture 46 55 FrameBufferObject *mFbo; 47 56 /// size of the shadow map 48 57 int mSize; 49 58 50 AxisAlignedBox3 mSceneBox;51 52 59 Camera *mShadowCam; 53 54 Matrix4x4 mLightViewMatrix; 55 Matrix4x4 mLightProjectionMatrix; 56 60 /// the texture matrix 61 Matrix4x4 mTextureMatrix; 62 /// the used light 57 63 Light *mLight; 64 /// the scene camera 65 Camera *mCamera; 58 66 }; 59 67 60 68 } // namespace 61 #endif // _ DeferredShader_H__69 #endif // _ShadowMapping_H__
Note: See TracChangeset
for help on using the changeset viewer.