Changeset 1639 for GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule
- Timestamp:
- 10/18/06 15:21:46 (18 years ago)
- Location:
- GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/OgreIlluminationManager.h
r1628 r1639 73 73 bool useVSM; 74 74 bool blurSM; 75 bool focusingSM; 75 76 unsigned int phaseTextureSize; 76 77 std::map<RenderingRunType,float> maxRads; … … 308 309 bool getUseLISPSM(){return useLISPSM;} 309 310 bool getUseVSM(){return useVSM;} 311 bool getFocusingShadowMap(){return focusingSM;} 310 312 bool getBlurShadowMap(){return blurSM;} 311 313 void setUseLISPSM(bool use){useLISPSM = use;} 312 314 void setUseVSM(bool use){useVSM = use;} 315 void setFocusingSM(bool use){focusingSM = use;} 313 316 void setBlurShadowMap(bool use){blurSM = use;} 314 317 }; -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/OgreIlluminationManager.cpp
r1628 r1639 85 85 useVSM = false; 86 86 blurSM = false; 87 focusingSM = true; 87 88 88 89 for(int i = 0; i < RUN_TYPE_COUNT; i++) -
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.