Ignore:
Timestamp:
06/14/07 17:24:08 (17 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TerrainFrameListener.cpp

    r2359 r2455  
    135135mUseDepthPass(false), 
    136136mTestGeometryForVisibleLeaves(false), 
     137mTestGeometryBounds(false), 
    137138mShowVisualization(false), 
    138139mCullCamera(false), 
     
    165166mUseViewCells(false), 
    166167mViewCellsLoaded(false), 
    167 mUseVisibilityFilter(false), 
    168168mFloorDist(2), 
    169169mFlushQueue(false), 
     
    171171m_iBoundingBoxLevel(0) 
    172172{ 
    173         //mInputDevice = PlatformManager::getSingleton().createInputReader(); 
    174         //mInputDevice->initialise(win, true, true); 
    175  
    176173        mEventProcessor = new EventProcessor(); 
    177174         
     
    242239        // the scale factor for the visualized bounding boxes 
    243240        mSceneMgr->setOption("NodeVizScale", &mVizScale); 
    244          
    245         ///////// 
    246         //-- set the current culling algorithm type 
    247         //setAlgorithm(mApplication->mAlgorithm); 
     241 
     242        int assumedIncr; 
     243        mSceneMgr->getOption("AssumedVisibility", &assumedIncr); 
     244        changeAssumedVisibility(assumedIncr); 
     245 
     246        ///// 
     247        // test geometry boundaries instead bounding box 
     248        mSceneMgr->getOption("TestGeometryBounds", &mTestGeometryBounds); 
     249        setTestGeometryBounds(mTestGeometryBounds); 
     250 
     251        ///////////////////////////////// 
     252        // culling algorithm 
    248253 
    249254        bool isNormalExecution; 
    250255                 
    251256        mSceneMgr->getOption("NormalExecution", &isNormalExecution); 
     257         
    252258        if (isNormalExecution) 
    253259        { 
    254260                // no algorithm 
    255                 mCurrentAlgorithm =  
    256                         GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS; 
     261                mCurrentAlgorithm = GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS; 
    257262        } 
    258263        else 
     
    261266        } 
    262267         
     268        // apply the chosen culling algorithm 
    263269        applyCurrentAlgorithm(); 
    264270         
     271 
    265272        /////////////////////////////// 
    266  
    267273        // set scene manager options 
     274         
     275        ////////// 
     276        mSceneMgr->getOption("TestGeometryForVisibleLeaves", &mTestGeometryForVisibleLeaves); 
    268277        setTestGeometryForVisibleLeaves(mTestGeometryForVisibleLeaves); 
    269278 
    270         //mSceneMgr->setOption("UseDepthPass", &mUseDepthPass); 
     279        ///////////// 
    271280        mSceneMgr->getOption("UseDepthPass", &mUseDepthPass); 
    272281 
     
    278287        mSceneMgr->getOption("FlushQueue", &mFlushQueue); 
    279288         
     289        ////////// 
    280290        if (mFlushQueue) 
    281291                LogManager::getSingleton().logMessage("initial setting: flushing queue"); 
     
    283293                LogManager::getSingleton().logMessage("initial setting: not flushing queue"); 
    284294 
     295        ///////////// 
    285296        mSceneMgr->setOption("ShowOctree", &mShowOctree); 
    286297        mSceneMgr->setOption("ShowViewCells", &mShowViewCells); 
     
    290301        applyObjectType(); 
    291302 
    292         // initialise timer 
     303 
     304        /////////////// 
     305        // initialize timer 
     306 
    293307        mTimer = Root::getSingleton().getTimer(); 
    294308        mTimeFrameEnded = mTimeFrameStarted = mTimer->getMilliseconds(); 
    295309         
    296         // init view cell parameters 
    297         mSceneMgr->setOption("UseVisibilityFilter", &mUseVisibilityFilter); 
    298  
    299310        // reset statistics 
    300311        mWalkthroughStats.Reset(); 
     
    863874                mFrameInfo.push_back(info); 
    864875                 
    865                 // std::stringstream d; d << StringConverter::toString(info.position) << " " << StringConverter::toString(info.orientation); 
    866                 // LogManager::getSingleton().logMessage(d.str()); 
    867876                ++ i; 
    868877        } 
     
    892901                // we produced precomputed fps during the last replay => 
    893902                // save them to file 
    894                 if (mSavePrecomputedFps) //!mPrecomputedFpsFrameInfo.empty()) 
     903                if (mSavePrecomputedFps) 
    895904                { 
    896905                        std::string filename = msApprevAlgorithmCaptions[mCurrentAlgorithm] + "_frames.out"; 
     
    9971006 
    9981007        if (mAssumedVisibility < 0)  
    999         {        
    10001008                mAssumedVisibility = 0; 
    1001         } 
    10021009 
    10031010        char str[100]; sprintf(str,": %d", mAssumedVisibility); 
     
    12291236        mSceneMgr->setOption("TestGeometryForVisibleLeaves", &mTestGeometryForVisibleLeaves); 
    12301237         
    1231         /* disable optimization which tests geometry instead of aabb 
    1232          * for "delayed" rendering of transparents (i.e., render transparents after all the solids) 
    1233          * because otherwise visible transparents could be skipped 
    1234          */ 
    1235         bool delayedRendering = !mTestGeometryForVisibleLeaves; 
    1236  
    1237         mSceneMgr->setOption("DelayRenderTransparents", &delayedRendering); 
    1238  
     1238        // disable optimization for transparent objects, becaue otherwise visible  
     1239        // transparents could be skipped 
    12391240        if (mTestGeometryForVisibleLeaves) 
    1240         { 
    12411241                mTestGeometryForVisibleLeavesInfo->setCaption(": true"); 
    1242         } 
    12431242        else 
    1244         { 
    12451243                mTestGeometryForVisibleLeavesInfo->setCaption(": false"); 
    1246         } 
    1247 } 
     1244} 
     1245//----------------------------------------------------------------------- 
     1246void TerrainFrameListener::setTestGeometryBounds(bool testGeometryBounds) 
     1247{ 
     1248        mSceneMgr->setOption("TestGeometryBounds", &mTestGeometryBounds); 
     1249         
     1250        if (mTestGeometryBounds) 
     1251                LogManager::getSingleton().logMessage("Testing geometry boundaries"); 
     1252        else 
     1253                LogManager::getSingleton().logMessage("Testing bounding box of hierarchy node"); 
     1254} 
     1255 
    12481256//----------------------------------------------------------------------- 
    12491257void TerrainFrameListener::toggleShowOctree() 
     
    12931301} 
    12941302//----------------------------------------------------------------------- 
    1295 void TerrainFrameListener::toggleUseVisibilityFilter() 
    1296 { 
    1297         mUseVisibilityFilter = !mUseVisibilityFilter; 
    1298         mSceneMgr->setOption("UseVisibilityFilter", &mUseVisibilityFilter); 
    1299 } 
    1300 //----------------------------------------------------------------------- 
    13011303void TerrainFrameListener::toggleUseDepthPass() 
    13021304{ 
     
    14851487                break; 
    14861488        case KC_Q: 
    1487                 toggleUseVisibilityFilter(); 
     1489                mTestGeometryBounds = !mTestGeometryBounds; 
     1490                setTestGeometryBounds(mTestGeometryBounds); 
    14881491                break; 
    14891492        case KC_R: 
Note: See TracChangeset for help on using the changeset viewer.