Changeset 2919


Ignore:
Timestamp:
09/08/08 17:32:16 (16 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling/src
Files:
2 edited

Legend:

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

    r2917 r2919  
    8282        // create the rotation matrix that rotates 'vecFrom' to 'vecTo' 
    8383        friend Matrix4x4 RotationVectorsMatrix(const Vector3 &vecFrom, 
    84                 const Vector3 &vecTo); 
     84                                                   const Vector3 &vecTo); 
    8585 
    8686        friend Matrix4x4 ScaleMatrix(float X, float Y, float Z); 
    8787        friend Matrix4x4 GenRotation(const Vector3 &x, const Vector3 &y, 
    88                 const Vector3 &z); 
     88                                        const Vector3 &z); 
    8989        friend Matrix4x4 QuadricMatrix(float a, float b, float c, float d, float e, 
    90                 float f, float g, float h, float j, float k); 
     90                                           float f, float g, float h, float j, float k); 
    9191        // returns matrix for transforming normal 
    9292        friend Matrix4x4 NormalTransformMatrix(const Matrix4x4 &M); 
     
    115115 
    116116        // look from position into given direction with given up vector 
    117         Matrix4x4 LookAt(const Vector3 &pos, const Vector3 &dir, const Vector3& up); 
     117        friend Matrix4x4 LookAt(const Vector3 &pos, const Vector3 &dir, const Vector3& up); 
    118118 
    119119        // Overloaded output operator. 
     
    160160Matrix4x4 GetFrustum(float left, float right, float bottom, float top, float near, float far); 
    161161Matrix4x4 LookAt(const Vector3 &pos, const Vector3 &dir, const Vector3& up); 
     162 
     163 
    162164} 
    163165 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.cpp

    r2917 r2919  
    224224 
    225225 
     226Vector3 ShadowMap::GetProjViewDir(const Matrix4x4 &lightSpace) const  
     227{ 
     228        //get the point in the LVS volume that is nearest to the camera 
     229        const V3 e = getNearCameraPointE(fs); 
     230        //construct edge to transform into light-space 
     231        const V3 b = e+fs.getEyeDir(); 
     232        //transform to light-space 
     233        const V3 e_lp = lightSpace.mulHomogenPoint(e); 
     234        const V3 b_lp = lightSpace.mulHomogenPoint(b); 
     235        V3 projDir(b_lp-e_lp); 
     236        //project the view direction into the shadow map plane 
     237        projDir.y() = 0.0; 
     238        return projDir; 
     239} 
     240 
     241 
    226242bool ShadowMap::CalcLightProjection(Matrix4x4 &lightProj) 
    227243{ 
     
    267283        mShadowCam->GetModelViewMatrix(shadowView); 
    268284 
     285        Vector3 projViewDir =  
    269286        //do Light Space Perspective shadow mapping 
    270287        //rotate the lightspace so that the proj light view always points upwards 
    271288        //calculate a frame matrix that uses the projViewDir[light-space] as up vector 
    272289        //look(from position, into the direction of the projected direction, with unchanged up-vector) 
    273         //lightProj = Math::look<REAL>(M4(),V3::ZERO(),projViewDir,V3::UNIT_Y())*lightProj 
     290        Matrix4x4 frame = LookAt(Vector3(0), projViewDir, Vector3(0, 0, 1)); 
     291        lightProj *= frame; 
    274292 
    275293        const Matrix4x4 matLispSM =  
Note: See TracChangeset for help on using the changeset viewer.