- Timestamp:
- 09/08/08 17:32:16 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.