Changeset 1300 for GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE
- Timestamp:
- 08/30/06 15:10:48 (18 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/include/TestKdTree.h
r1296 r1300 50 50 void createTerrainScene(Real max_x, Real max_y, Real max_z); 51 51 Vector3 clampToGround(const Vector3& vect, Real offset, Real cap); 52 53 const String& getViewCellsFileName() const { return mViewCells; } 52 54 protected: 53 55 KdTreeAppListener *mFrameListener; -
GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/include/TestKdTreeAppListener.h
r1296 r1300 100 100 }; 101 101 102 enum ViewCellsMode 103 { 104 VCM_OFF, 105 VCM_ON, 106 VCM_FILTER, 107 VCM_SIZE, 108 VCM_NOTSET 109 }; 110 102 111 enum ShowTree 103 112 { … … 128 137 mBuildMethod(KdTree::KDBM_PRIORITYQUEUE), 129 138 mSceneType(ST_SIMPLE), 139 mViewCells(VCM_OFF), 130 140 mFastStart(false), 131 141 mBurnIn(false), … … 153 163 int mBuildMethod; 154 164 int mSceneType; 165 int mViewCells; 155 166 bool mFastStart; 156 167 bool mBurnIn; … … 248 259 249 260 // view cells 261 bool mViewCellsLoaded; 250 262 bool mUseViewCells; 251 263 bool mUseVisibilityFilter; … … 268 280 Overlay *mDebugOverlay; 269 281 Overlay *mKdTreeOverlay; 270 282 Overlay *mLoadingOverlay; 283 284 OverlayElement *mMyLoadingInfo; 271 285 OverlayElement *mDemoStatus; 272 286 TextAreaOverlayElement *mDemoTime; -
GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTree.cpp
r1296 r1300 41 41 .addOpt("","savesceneto", ARGUMENT_REQUIRED) 42 42 .addOpt("f","faststart", ARGUMENT_NONE) 43 .addOpt("b","burnin", ARGUMENT_NONE); 43 .addOpt("b","burnin", ARGUMENT_NONE) 44 .addOpt("v","viewcells", ARGUMENT_OPTIONAL); 44 45 45 46 … … 135 136 } 136 137 138 if (cmdparser.getOpt("v",tmp)) 139 { 140 if (tmp == "0") 141 options.mViewCells = KdTreeAppListener::VCM_OFF; 142 else if (tmp == "" || tmp == "1") 143 options.mViewCells = KdTreeAppListener::VCM_ON; 144 else if (tmp == "2") 145 options.mViewCells = KdTreeAppListener::VCM_FILTER; 146 else 147 { 148 MessageBox(NULL, ("Invalid argument for option --viewcells: " + tmp).c_str(), "Error", MB_OK | MB_ICONERROR ); 149 return -1; 150 } 151 152 } 137 153 } 138 154 catch (std::string s) … … 328 344 mTopCam->setPosition(Vector3(1232, 3990, -1477)); 329 345 330 // try loading view cells if specified and if scene manager supports it331 if (!mViewCells.empty())332 mSceneMgr->setOption("LoadViewCells", mViewCells.c_str());346 //// try loading view cells if specified and if scene manager supports it 347 //if (!mViewCells.empty()) 348 // mSceneMgr->setOption("LoadViewCells", mViewCells.c_str()); 333 349 334 350 // sky box -
GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTreeAppListener.cpp
r1296 r1300 114 114 mShowTree(SHOWTREE_OFF), 115 115 // view cells 116 mViewCellsLoaded(false), 116 117 mUseViewCells(false), 117 118 mUseVisibilityFilter(false), … … 167 168 mCamNode = sm->getSceneNode("PlayerCamNode"); 168 169 169 sm->getOption("UseViewCells", &mUseViewCells);170 sm->getOption("UseVisibilityFilter", &mUseVisibilityFilter);171 172 170 mRaySceneQuery = mSceneMgr->createRayQuery(Ray(mCamNode->getPosition(), Vector3::NEGATIVE_UNIT_Y)); 173 171 … … 178 176 mDemoTime = 0; 179 177 178 // loading view cells overlay 179 mLoadingOverlay = OverlayManager::getSingleton().getByName("Example/Visibility/LoadingOverlay"); 180 mMyLoadingInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/Loading/MyLoadingInfo"); 181 mMyLoadingInfo->setCaption("loading view cells ..."); 182 183 mLoadingOverlay->hide(); 184 180 185 initKdTreeOverlay(); 181 186 initStatsOverlay(); 187 188 // set view cells 189 if (mOptions.mSceneType == ST_GEOMETRY) 190 { 191 switch(mOptions.mViewCells) 192 { 193 case VCM_ON: 194 toggleUseViewCells(); 195 break; 196 case VCM_FILTER: 197 toggleUseViewCells(); 198 toggleUseVisibilityFilter(); 199 break; 200 } 201 } 182 202 183 203 if (!mOptions.mDemoInfileName.empty()) … … 326 346 sTC = ": Free"; 327 347 328 if (mSceneMgr->getOption("UseViewCells", &mUseViewCells) )348 if (mSceneMgr->getOption("UseViewCells", &mUseViewCells) && mOptions.mSceneType == ST_GEOMETRY) 329 349 { 330 350 if (mUseViewCells) … … 335 355 else 336 356 { 337 sVC = NA; 338 } 339 340 if (mSceneMgr->getOption("UseVisibilityFilter", &mUseVisibilityFilter)) 357 if (mOptions.mSceneType == ST_GEOMETRY && mOptions.myApp->getViewCellsFileName() != "" && 358 (mOptions.mSceneManager == SM_KDT || 359 mOptions.mSceneManager == SM_KTE || 360 mOptions.mSceneManager == SM_OCM)) 361 { 362 sVC = ": off"; 363 } 364 else 365 { 366 sVC = NA; 367 } 368 } 369 370 if (mSceneMgr->getOption("UseVisibilityFilter", &mUseVisibilityFilter) && mOptions.mSceneType == ST_GEOMETRY) 341 371 { 342 372 if (mUseVisibilityFilter) … … 347 377 else 348 378 { 349 sVF = NA; 379 if (mOptions.mSceneType == ST_GEOMETRY && mOptions.myApp->getViewCellsFileName() != "" && 380 (mOptions.mSceneManager == SM_KDT || 381 mOptions.mSceneManager == SM_KTE || 382 mOptions.mSceneManager == SM_OCM)) 383 { 384 sVF = ": off"; 385 } 386 else 387 { 388 sVF = NA; 389 } 350 390 } 351 391 … … 387 427 void KdTreeAppListener::toggleUseViewCells() 388 428 { 429 // viewcells apply only for scenes loaded from geometry 430 if (mOptions.mSceneType != ST_GEOMETRY) 431 return; 432 389 433 mUseViewCells = !mUseViewCells; 434 435 436 // load on demand 437 if (mUseViewCells && !mViewCellsLoaded) 438 { 439 mLoadingOverlay->show(); 440 441 // call once to load view cell loading overlay 442 mWindow->update(); 443 mViewCellsLoaded = mSceneMgr->setOption("LoadViewCells", mOptions.myApp->getViewCellsFileName().c_str()); 444 445 if (!mViewCellsLoaded) 446 { 447 LogManager::getSingleton().logMessage("#@#@ Error: loading view cells from " + 448 mOptions.myApp->getViewCellsFileName() + " failed."); 449 } 450 451 mLoadingOverlay->hide(); 452 } 453 390 454 if (mSceneMgr->setOption("UseViewCells", &mUseViewCells)) 391 455 {
Note: See TracChangeset
for help on using the changeset viewer.