Ignore:
Timestamp:
09/02/08 09:07:45 (16 years ago)
Author:
mattausch
Message:

shadow mapping almost working (but ulgy!!)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.h

    r2892 r2894  
    1 #ifndef _ShadowMapping_H__ 
    2 #define _ShadowMapping_H__ 
     1#ifndef _ShadowMap_H__ 
     2#define _ShadowMap_H__ 
    33 
    44#include "common.h" 
     
    2020class Light; 
    2121 
    22 /** This class implements a shadow mapping algorithm 
     22/** This class implements a the computation of single shadow map 
    2323*/ 
    24 class ShadowMapping 
     24class ShadowMap 
    2525{ 
     26 
    2627public: 
    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. 
    2830        */ 
    29         ShadowMapping(const AxisAlignedBox3 &sceneBox, int size); 
     31        ShadowMap(int size, const AxisAlignedBox3 &sceneBox, Camera *cam); 
    3032 
    31         ~ShadowMapping(); 
    32         /** Renders the shadowed scene 
     33        ~ShadowMap(); 
     34        /** Computes the shadow map 
    3335        */ 
    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. 
    3738        */ 
    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; 
    3948 
    40 //protected: 
    4149 
    42         void ComputeShadowMap(Light *light, RenderTraverser *traverser); 
     50protected: 
    4351 
    44 //protected: 
    45  
     52        /// the scene bounding box 
     53        AxisAlignedBox3 mSceneBox; 
     54        /// fbo storing the shadow texture 
    4655        FrameBufferObject *mFbo; 
    47  
     56        /// size of the shadow map 
    4857        int mSize; 
    4958 
    50         AxisAlignedBox3 mSceneBox; 
    51  
    5259        Camera *mShadowCam; 
    53  
    54         Matrix4x4 mLightViewMatrix; 
    55         Matrix4x4 mLightProjectionMatrix; 
    56  
     60        /// the texture matrix 
     61        Matrix4x4 mTextureMatrix; 
     62        /// the used light 
    5763        Light *mLight; 
     64        /// the scene camera 
     65        Camera *mCamera; 
    5866}; 
    5967 
    6068} // namespace  
    61 #endif // _DeferredShader_H__ 
     69#endif // _ShadowMapping_H__ 
Note: See TracChangeset for help on using the changeset viewer.