- Timestamp:
- 09/08/08 17:32:16 (16 years ago)
- 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 82 82 // create the rotation matrix that rotates 'vecFrom' to 'vecTo' 83 83 friend Matrix4x4 RotationVectorsMatrix(const Vector3 &vecFrom, 84 const Vector3 &vecTo);84 const Vector3 &vecTo); 85 85 86 86 friend Matrix4x4 ScaleMatrix(float X, float Y, float Z); 87 87 friend Matrix4x4 GenRotation(const Vector3 &x, const Vector3 &y, 88 const Vector3 &z);88 const Vector3 &z); 89 89 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); 91 91 // returns matrix for transforming normal 92 92 friend Matrix4x4 NormalTransformMatrix(const Matrix4x4 &M); … … 115 115 116 116 // 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); 118 118 119 119 // Overloaded output operator. … … 160 160 Matrix4x4 GetFrustum(float left, float right, float bottom, float top, float near, float far); 161 161 Matrix4x4 LookAt(const Vector3 &pos, const Vector3 &dir, const Vector3& up); 162 163 162 164 } 163 165 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.cpp
r2917 r2919 224 224 225 225 226 Vector3 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 226 242 bool ShadowMap::CalcLightProjection(Matrix4x4 &lightProj) 227 243 { … … 267 283 mShadowCam->GetModelViewMatrix(shadowView); 268 284 285 Vector3 projViewDir = 269 286 //do Light Space Perspective shadow mapping 270 287 //rotate the lightspace so that the proj light view always points upwards 271 288 //calculate a frame matrix that uses the projViewDir[light-space] as up vector 272 289 //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; 274 292 275 293 const Matrix4x4 matLispSM =
Note: See TracChangeset
for help on using the changeset viewer.