Changeset 119 for trunk/VUT/Ogre/src


Ignore:
Timestamp:
05/31/05 00:57:01 (19 years ago)
Author:
mattausch
Message:
 
Location:
trunk/VUT/Ogre/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp

    r118 r119  
    3434        // TODO: find reasonable value for max depth 
    3535        mMaxDepth = 50; 
    36  
    37         CreateDepthPass(); 
    38 } 
    39 //----------------------------------------------------------------------- 
    40 void VisibilityOctreeSceneManager::CreateDepthPass() 
     36} 
     37//----------------------------------------------------------------------- 
     38void VisibilityOctreeSceneManager::InitDepthPass() 
    4139{ 
    4240        MaterialPtr depthMat = MaterialManager::getSingleton().getByName("Visibility/DepthPass"); 
     
    6967        // setting vertex program is not efficient 
    7068        //Pass *usedPass = ((mIsDepthPass && !pass->hasVertexProgram()) ? mDepthPass : pass);            
    71         Pass *usedPass = (mIsDepthPass ? mDepthPass : pass);     
     69        // set depth fill pass only if depth write enabled 
     70        Pass *usedPass = (mIsDepthPass && pass->getDepthWriteEnabled() ? mDepthPass : pass); 
    7271 
    7372        if (mIsDepthPass) 
     
    166165void VisibilityOctreeSceneManager::_renderVisibleObjects() 
    167166{ 
     167        // create material for depth pass 
     168        InitDepthPass(); 
     169 
    168170        // visualization: apply standard rendering 
    169171        if (mShowVisualization) 
  • trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp

    r118 r119  
    3232        // TODO: set maxdepth to reasonable value 
    3333        mMaxDepth = 50; 
    34         // create material for depth pass 
    35         CreateDepthPass(); 
    36 } 
    37 //----------------------------------------------------------------------- 
    38 void VisibilityTerrainSceneManager::CreateDepthPass() 
     34} 
     35//----------------------------------------------------------------------- 
     36void VisibilityTerrainSceneManager::InitDepthPass() 
    3937{ 
    4038        MaterialPtr depthMat = MaterialManager::getSingleton().getByName("Visibility/DepthPass"); 
     
    6462Pass *VisibilityTerrainSceneManager::setPass(Pass* pass) 
    6563{ 
    66         // setting vertex program is not efficient 
    67         //Pass *usedPass = ((mIsDepthPass && !pass->hasVertexProgram()) ? mDepthPass : pass);            
    68         Pass *usedPass = (mIsDepthPass ? mDepthPass : pass);     
     64        // set depth fill pass only if depth write enabled 
     65        Pass *usedPass = (mIsDepthPass && pass->getDepthWriteEnabled() ? mDepthPass : pass); 
    6966 
    7067        if (mIsDepthPass) 
    7168        { 
     69                //if (pass->isTransparent())    return pass; 
     70 
    7271                // set vertex program of current pass 
    73         if (pass->hasVertexProgram()) 
     72        if (pass->hasVertexProgram() && (pass->getVertexProgramName() != mDepthPass->getVertexProgramName())) 
    7473                { 
    7574                        mDepthPass->setVertexProgram(pass->getVertexProgramName()); 
     
    7978                                const GpuProgramPtr& prg = mDepthPass->getVertexProgram(); 
    8079                                // Load this program if not done already 
    81                                 if (!prg->isLoaded()) 
    82                                         prg->load(); 
     80                                if (!prg->isLoaded()) prg->load(); 
    8381                                // Copy params 
    8482                                mDepthPass->setVertexProgramParameters(pass->getVertexProgramParameters()); 
     
    163161void VisibilityTerrainSceneManager::_renderVisibleObjects() 
    164162{ 
     163        // create material for depth pass 
     164        InitDepthPass(); 
     165 
    165166        // visualization: apply standard rendering 
    166167        if (mShowVisualization) 
     
    225226        if (mUseDepthPass) 
    226227        { 
    227                 for (NodeList::iterator it = mVisible.begin(); it != mVisible.end(); ++it) 
     228                /*for (NodeList::iterator it = mVisible.begin(); it != mVisible.end(); ++it) 
    228229                { 
    229230                        (*it)->_addToRenderQueue(mCameraInProgress, getRenderQueue(), false); 
    230                 } 
     231                }*/ 
    231232                mIsDepthPass = false; 
    232233        } 
Note: See TracChangeset for help on using the changeset viewer.