- Timestamp:
- 10/18/06 15:21:46 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderingRuns/OgreDepthShadowMapRenderingRun.cpp
r1628 r1639 119 119 { 120 120 bool uselispsm = OgreIlluminationManager::getSingleton().getUseLISPSM(); 121 bool usefocusing = OgreIlluminationManager::getSingleton().getFocusingShadowMap(); 121 122 if(light->getType() == Light::LT_DIRECTIONAL) 122 123 { … … 317 318 } 318 319 319 320 Matrix4 lightMatrix = depthMapCamera->getViewMatrix(); 321 frun->setLightMatrix(lightMatrix); 322 323 OgreIlluminationManager::getSingleton().updateGlobalRun( ILLUMRUN_FOCUSING_MAP, 324 frameNum); 325 326 frun->getMinMax(min, max); 327 328 if(min.z < 0) 329 { 330 float farP= -1.5 * min.z; 331 if(farP < 0.2) farP = 0.2; 332 depthMapCamera->setFarClipDistance(farP); 333 334 Vector3 scale = (max - min); 335 scale *= 1.5; // just for safety 336 337 Matrix4 projection = Matrix4::IDENTITY; 338 Matrix4 trans = Matrix4::IDENTITY; 339 trans.setTrans(Vector3(-(max.x + min.x) / 2.0, 340 -(max.y + min.y) / 2.0, 341 0)); 342 Matrix4 scaleM = Matrix4::IDENTITY; 343 scaleM.setScale(Vector3(2.0 / scale.x, 2.0 / scale.y, 1)); 344 projection = scaleM * trans; 345 depthMapCamera->setCustomProjectionMatrix(true, projection * depthMapCamera->getProjectionMatrix()); 320 if(!usefocusing) 321 { 322 depthMapCamera->setFarClipDistance(light->getAttenuationRange() ); 323 } 324 else 325 { 326 Matrix4 lightMatrix = depthMapCamera->getViewMatrix(); 327 frun->setLightMatrix(lightMatrix); 328 329 OgreIlluminationManager::getSingleton().updateGlobalRun( ILLUMRUN_FOCUSING_MAP, 330 frameNum); 331 332 frun->getMinMax(min, max); 333 334 if(min.z < 0) 335 { 336 float farP= -1.5 * min.z; 337 if(farP < 0.2) farP = 0.2; 338 depthMapCamera->setFarClipDistance(farP); 339 340 Vector3 scale = (max - min); 341 scale *= 1.5; // just for safety 342 343 Matrix4 projection = Matrix4::IDENTITY; 344 Matrix4 trans = Matrix4::IDENTITY; 345 trans.setTrans(Vector3(-(max.x + min.x) / 2.0, 346 -(max.y + min.y) / 2.0, 347 0)); 348 Matrix4 scaleM = Matrix4::IDENTITY; 349 scaleM.setScale(Vector3(2.0 / scale.x, 2.0 / scale.y, 1)); 350 projection = scaleM * trans; 351 depthMapCamera->setCustomProjectionMatrix(true, projection * depthMapCamera->getProjectionMatrix()); 352 } 346 353 } 347 354 }
Note: See TracChangeset
for help on using the changeset viewer.