Ignore:
Timestamp:
06/14/07 17:24:08 (17 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE
Files:
3 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: 
  • GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TerrainFrameListener.h

    r2359 r2455  
    224224        void changeAssumedVisibility(int incr); 
    225225        void changeVizScale(const int incr); 
     226         
    226227        void setTestGeometryForVisibleLeaves(bool testGeometryForVisibleLeaves); 
     228         
     229        void setTestGeometryBounds(bool testGeometryBounds); 
     230 
    227231        /** Shows visualization of octree hierarchy nodes. 
    228232        */ 
    229233        void toggleShowOctree(); 
     234 
    230235        /** Shows visualization of the view cells. 
    231236        */ 
    232237        void toggleShowViewCells(); 
     238         
    233239        /** Toggles between view cells / no view cells. 
    234240        */ 
    235241        void toggleUseViewCells(); 
    236  
    237         void toggleUseVisibilityFilter(); 
    238242 
    239243        /** Toggles whether we use the initial depth pass. 
     
    372376        OverlayElement *mQueryGeometryVisibilityInfo; 
    373377        OverlayElement *mQueryPatchVisibilityInfo; 
    374         //OverlayElement *mHelpInfo; 
    375378 
    376379        RayQueryExecutor *mRayQueryExecutor; 
     
    378381 
    379382        bool mTestGeometryForVisibleLeaves; 
     383        bool mTestGeometryBounds; 
     384 
    380385        bool mShowOctree; 
    381386        bool mShowViewCells; 
     
    389394        bool mShowHelp; 
    390395        bool mStatsOn; 
     396         
     397 
     398        //////// 
     399        //-- true if the mouse buttons are down 
     400         
    391401        bool mLMouseDown; 
    392         // True if the mouse buttons are down 
    393402        bool mRMouseDown;     
    394403        bool mShutdownRequested; 
     
    397406        bool mUseAnimation; 
    398407         
     408 
    399409        int mItemBufferMode; 
    400410 
     
    410420         
    411421        Real mReplayTimeElapsed; 
    412         //EventProcessor* mEventProcessor; 
    413422    InputReader* mInputDevice; 
    414423    Camera* mCamera; 
     
    446455        bool mShowQueryStats; 
    447456         
    448         //bool mUseBufferedInputKeys, mUseBufferedInputMouse, mInputTypeSwitchingOn; 
    449457        PlatformQueryManager *mQueryManager; 
    450458 
     
    467475        bool mUseViewCells; 
    468476        bool mViewCellsLoaded; 
    469         bool mUseVisibilityFilter; 
    470477 
    471478        float mFloorDist; 
  • GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TestCullingTerrainApplication.cpp

    r2401 r2455  
    2525 
    2626 
    27 //using namespace GtpVisibility; 
    2827 
    2928/*************************************************************/ 
     
    478477                if (0) generateScene(1000, 2); // create trees 
    479478        } 
    480         int MaxDepth=30; 
    481         mSceneMgr->setOption("BiHierarchyMaxDepth", &MaxDepth); 
    482         int Mode=1; 
    483         mSceneMgr->setOption("EnhancedVisibility", &Mode); 
     479 
     480        int maxDepth = 30; 
     481         
     482        mSceneMgr->setOption("BiHierarchyMaxDepth", &maxDepth); 
     483         
     484        int mode = 1; 
     485         
     486        mSceneMgr->setOption("EnhancedVisibility", &mode); 
    484487        mSceneMgr->setOption("RebuildBiHierarchy", NULL); 
    485488        mSceneMgr->setOption("RebuildKdTree", NULL); 
     
    509512        //-- add animation state for new robots (located at the end of the list) 
    510513         
    511         for (int i = (int)entList->size() - num; i < (int)entList->size(); ++i) 
     514        for (size_t i = entList->size() - (unsigned int)num; i < entList->size(); ++ i) 
    512515        { 
    513516                mEntityStates.push_back(new EntityState((*entList)[i],  
Note: See TracChangeset for help on using the changeset viewer.