Changeset 1639


Ignore:
Timestamp:
10/18/06 15:21:46 (18 years ago)
Author:
szirmay
Message:
 
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  
    7373        bool useVSM; 
    7474        bool blurSM; 
     75        bool focusingSM; 
    7576        unsigned int phaseTextureSize; 
    7677        std::map<RenderingRunType,float> maxRads; 
     
    308309        bool getUseLISPSM(){return useLISPSM;} 
    309310        bool getUseVSM(){return useVSM;} 
     311        bool getFocusingShadowMap(){return focusingSM;} 
    310312        bool getBlurShadowMap(){return blurSM;} 
    311313        void setUseLISPSM(bool use){useLISPSM = use;} 
    312314        void setUseVSM(bool use){useVSM = use;} 
     315        void setFocusingSM(bool use){focusingSM = use;} 
    313316        void setBlurShadowMap(bool use){blurSM = use;} 
    314317}; 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/OgreIlluminationManager.cpp

    r1628 r1639  
    8585        useVSM = false; 
    8686        blurSM = false; 
     87        focusingSM = true; 
    8788         
    8889        for(int i = 0; i < RUN_TYPE_COUNT; i++) 
  • GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderingRuns/OgreDepthShadowMapRenderingRun.cpp

    r1628 r1639  
    119119        { 
    120120                bool uselispsm = OgreIlluminationManager::getSingleton().getUseLISPSM(); 
     121                bool usefocusing = OgreIlluminationManager::getSingleton().getFocusingShadowMap(); 
    121122                if(light->getType() == Light::LT_DIRECTIONAL) 
    122123                { 
     
    317318                        } 
    318319                         
    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                                } 
    346353                        } 
    347354                } 
Note: See TracChangeset for help on using the changeset viewer.