Ignore:
Timestamp:
08/26/05 23:24:31 (19 years ago)
Author:
mattausch
Message:

added some hack for video recording

File:
1 edited

Legend:

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

    r202 r254  
    99#include <OgreEntity.h> 
    1010#include <OgreSubEntity.h> 
    11  
     11#include <OgreConfigFile.h> 
    1212 
    1313namespace Ogre { 
     
    2424mLeavePassesInQueue(0), 
    2525mDelayRenderTransparents(true), 
     26//mDelayRenderTransparents(false), 
     27//mUseDepthPass(true), 
    2628mUseDepthPass(false), 
    27 mRenderDepthPass(false), 
     29mIsDepthPassPhase(false), 
    2830mUseItemBuffer(false), 
    2931//mUseItemBuffer(true), 
    30 mRenderItemBuffer(false), 
     32mIsItemBufferPhase(false), 
    3133mCurrentEntityId(1), 
    3234mEnableDepthWrite(true), 
     
    4446        // TODO: set maxdepth to reasonable value 
    4547        mMaxDepth = 50; 
     48 
     49        //loadVisibilityConfig("GtpVisibility.cfg"); 
    4650} 
    4751//----------------------------------------------------------------------- 
     
    145149{ 
    146150        // set depth fill pass if we currently do not make an aabb occlusion query 
    147         Pass *usedPass = (mRenderDepthPass && !mHierarchyInterface->IsBoundingBoxQuery() ?  
     151        Pass *usedPass = (mIsDepthPassPhase && !mHierarchyInterface->IsBoundingBoxQuery() ?  
    148152                                          mDepthPass : pass); 
    149153 
     
    152156        // set illumination stage to NONE so no shadow material is used  
    153157        // for depth pass or for occlusion query 
    154         if (mRenderDepthPass || mHierarchyInterface->IsBoundingBoxQuery()) 
     158        if (mIsDepthPassPhase || mHierarchyInterface->IsBoundingBoxQuery()) 
    155159        { 
    156160                mIlluminationStage = IRS_NONE; 
     
    158162 
    159163        //-- set vertex program of current pass in order to set correct depth 
    160         if (mRenderDepthPass && mExecuteVertexProgramForAllPasses && pass->hasVertexProgram()) 
     164        if (mIsDepthPassPhase && mExecuteVertexProgramForAllPasses && pass->hasVertexProgram()) 
    161165    { 
    162166                // add vertex program of current pass to depth pass 
     
    311315 
    312316                //-- reset parameters 
    313                 mRenderDepthPass = false; 
    314                 mRenderItemBuffer = false; 
     317                mIsDepthPassPhase = false; 
     318                mIsItemBufferPhase = false; 
    315319                mSkipTransparents = false; 
    316320                mIsHierarchicalCulling = false; 
     
    498502{ 
    499503        // skip all but first pass if we are doing the depth pass 
    500         if ((mRenderDepthPass || mRenderItemBuffer) && pass->getIndex() > 0) 
     504        if ((mIsDepthPassPhase || mIsItemBufferPhase) && pass->getIndex() > 0) 
    501505        { 
    502506                return false; 
     
    507511void VisibilityOctreeSceneManager::renderQueueGroupObjects(RenderQueueGroup* pGroup) 
    508512{ 
    509         if (!mRenderItemBuffer) 
     513        if (!mIsItemBufferPhase) 
    510514        { 
    511515                OctreeSceneManager::renderQueueGroupObjects(pGroup); 
     
    513517        } 
    514518 
    515         // --- item buffer 
     519        //-- renders item buffer 
    516520 
    517521    // Iterate through priorities 
     
    559563        } 
    560564 
    561         // -- TRANSPARENT LOOP: must be handled differently  
     565        //-- TRANSPARENT LOOP: must be handled differently  
    562566 
    563567        // transparents are treated either as solids or completely discarded 
     
    637641 
    638642        // set depth pass flag before rendering 
    639         mRenderDepthPass = mUseDepthPass; 
     643        mIsDepthPassPhase = mUseDepthPass; 
    640644 
    641645        mIsHierarchicalCulling = true; // during hierarchical culling 
     
    644648        if (mUseItemBuffer)  
    645649        { 
    646                 mRenderItemBuffer = true; 
     650                mIsItemBufferPhase = true; 
    647651                setAmbientLight(ColourValue(1,1,1,1)); 
    648652        } 
     
    739743                } 
    740744        } 
    741         else 
     745        else // render the rest of the passes 
    742746        { 
    743747                OctreeSceneManager::renderAdditiveStencilShadowedQueueGroupObjects(pGroup); 
    744  
    745                 /*RenderQueueGroup::PriorityMapIterator groupIt = pGroup->getIterator(); 
    746             LightList lightList; 
    747                  
    748                 while (groupIt.hasMoreElements()) 
    749                 { 
    750                  
    751                         RenderPriorityGroup* pPriorityGrp = groupIt.getNext(); 
    752  
    753                         // Sort the queue first 
    754                         pPriorityGrp->sort(mCameraInProgress); 
    755  
    756                         // Clear light list 
    757                         lightList.clear(); 
    758  
    759                         // Now iterate per light 
    760                         mIlluminationStage = IRS_PER_LIGHT; 
    761          
    762                     // Iterate over lights, render all volumes to stencil 
    763                 LightList::const_iterator li, liend; 
    764                     liend = mLightsAffectingFrustum.end(); 
    765          
    766                     for (li = mLightsAffectingFrustum.begin(); li != liend; ++li) 
    767                         { 
    768                                 LogManager::getSingleton().logMessage("iterating over lights"); 
    769                                 Light* l = *li; 
    770                                 // Set light state 
    771  
    772                                 if (l->getCastShadows()) 
    773                                 { 
    774                                         // Clear stencil 
    775                                         mDestRenderSystem->clearFrameBuffer(FBT_STENCIL); 
    776                                         renderShadowVolumesToStencil(l, mCameraInProgress); 
    777                                         // turn stencil check on 
    778                                         mDestRenderSystem->setStencilCheckEnabled(true); 
    779                                         // NB we render where the stencil is equal to zero to render lit areas 
    780                                         mDestRenderSystem->setStencilBufferParams(CMPF_EQUAL, 0); 
    781                                 } 
    782  
    783                                 // render lighting passes for this light 
    784                                 if (lightList.empty()) 
    785                                         lightList.push_back(l); 
    786                                 else 
    787                                         lightList[0] = l; 
    788                                 OctreeSceneManager::renderObjects(pPriorityGrp->_getSolidPassesDiffuseSpecular(), false, &lightList); 
    789  
    790                                 // Reset stencil params 
    791                                 mDestRenderSystem->setStencilBufferParams(); 
    792                                 mDestRenderSystem->setStencilCheckEnabled(false); 
    793                                 mDestRenderSystem->_setDepthBufferParams(); 
    794  
    795                         }// for each light 
    796  
    797                         // Now render decal passes, no need to set lights as lighting will be disabled 
    798                         mIlluminationStage = IRS_DECAL; 
    799                         OctreeSceneManager::renderObjects(pPriorityGrp->_getSolidPassesDecal(), false); 
    800             }// for each priority 
    801          
    802                 // reset lighting stage 
    803             mIlluminationStage = IRS_NONE;*/ 
    804748        } 
    805749} 
     
    828772   } 
    829773} 
    830 }   // namespace Ogre 
     774//------------------------------------------------------------------------- 
     775void VisibilityOctreeSceneManager::loadVisibilityConfig(const String& filename) 
     776{ 
     777        /// Set up the options 
     778        ConfigFile config; 
     779        String val; 
     780 
     781        config.load(filename); 
     782 
     783        val = config.getSetting("Algorithm"); 
     784 
     785    if (!val.empty()) 
     786        { 
     787                 VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface).setOption("Algorithm", val.c_str()); 
     788        } 
     789 
     790        val = config.getSetting("UseDepthPass"); 
     791 
     792        if (!val.empty()) 
     793        { 
     794                 setOption("UseDepthPass", val.c_str()); 
     795        } 
     796} 
     797}  // namespace Ogre 
Note: See TracChangeset for help on using the changeset viewer.