Changeset 1300 for GTP/trunk/App/Demos/Vis
- Timestamp:
- 08/30/06 15:10:48 (18 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/KdTreeDemo
- Files:
-
- 5 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 { -
GTP/trunk/App/Demos/Vis/KdTreeDemo/README.txt
r1296 r1300 31 31 -b, --burnin 32 32 Run a burn-in demo, i.e. loop the demo until ESC is pressed. Requires 33 --demomode. If --logfile is specified, the result of each run will be saved. 33 --demomode. When --logfile is specified, the result of each run will be 34 saved. 34 35 35 36 -s <sm_id>, --scenemgr <sm_id> … … 52 53 no effect. For supported scene managers, render mode switching is also 53 54 available ingame (see INGAME COMMANDS). 55 56 -v [mode], --viewcells [mode] 57 Set view cell mode. Applies only to scenes where view cells can be loaded 58 (see CONFIG FILE), otherwise has no effect. [mode] is optional. 59 Valid values for [mode] are: 60 0 ... do not use view cells for visibility (same as ommiting -v) 61 1 ... use view cells for visibility (same as -v without parameter) 62 2 ... use view cells and visibility filter 63 These setting can also be changeg ingame (see INGAME COMMANDS). 54 64 55 65 --comment … … 107 117 following formats: 108 118 .iv, .wrl: Mesh files like the vienna scene. 109 .cfg: Config files for terrain creation. You need to specify110 an appropriate scene manager which supports terrain111 world geometry rendering (KTE, OCM, TER).119 .cfg: Config files for terrain creation. You need to 120 specify an appropriate scene manager which supports 121 terrain world geometry rendering (KTE, OCM, TER). 112 122 .txt: Text file created by the application which store 113 123 positions of entites (small movable objects) … … 134 144 on enables shadows 135 145 selectentities: 136 Sum up the following numbers to select which entities will appear in137 the scene:146 Sum up the following numbers to select which entities will appear 147 in the scene: 138 148 1 robots in grid 139 149 2 randomly placed robots … … 186 196 R Toggle OpenGL/Direct3D render mode (Full, Line, Point) 187 197 T Toggle OpenGL/Direct3D texture filtering (Bilinear, Trilinear, Aniso) 188 C Toggle use view cells from PVS ( need to load them first)198 C Toggle use view cells from PVS (load on demand) 189 199 X Toggle use visibility filter (whatever that is) 190 200 … … 212 222 If the demo shall be permanently stored, the program must be launched with 213 223 the --outfile option, specifying a file to which the demo will be saved. The 214 file name must have on of the above mentioned extensions. If the file allready215 exists and a demo is saved, it will be overwritten. To save a recorded demo,216 simply press F6 to store it in the file. If a demo has been allready stored in217 this session, it will be overwritten.224 file name must have on of the above mentioned extensions. If the file 225 allready exists and a demo is saved, it will be overwritten. To save a 226 recorded demo, simply press F6 to store it in the file. If a demo has been 227 allready stored in this session, it will be overwritten. 218 228 It is recommended to limit the framerate of the application (e.g. by enabling 219 229 vsync) when recording a demo, since it will produce smaller files. 220 230 To load a demo from a file, specify it with the --infile command line option. 221 231 To run a benchmark, a prerecorded demo must be loaded. Also, a logfile has to 222 be specified using the --logfile option. Finally the --demomode option must be223 set. The program starts with disabled user input and no overlays. After an232 be specified using the --logfile option. Finally the --demomode option must 233 be set. The program starts with disabled user input and no overlays. After an 224 234 initial 5 second delay, to stabilize the framerate and preload the scene, the 225 235 demo is played back and the framerate and other statistics are recored. Then … … 237 247 If the specified logfile does not exist, it is created including the headers. 238 248 If a log file with the specified name does exists, it is checked if the demo 239 file used in the logfile corresponds with the demo file used in this benchmark240 run. If the names do not match, or if the logfile cannot be read or written241 to, the demo is executed but no stats are written. Additionaly, an error242 message is written in "Ogre.log". However, if the log file exists and the demo243 name matches, the resulst are appended to the existing logfile, allowing for244 easy comparison of different settings and options.249 file used in the logfile corresponds with the demo file used in this 250 benchmark run. If the names do not match, or if the logfile cannot be read or 251 written to, the demo is executed but no stats are written. Additionaly, an 252 error message is written to "Ogre.log". However, if the log file exists and 253 the demo name matches, the resulst are appended to the existing logfile, 254 allowing for easy comparison of different settings and options. 245 255 246 256 BUGS 247 Kills my PC occasionally when running a long demo with KTE and CHC in the 248 terrain scene. Reason completely mysterious. Happend twice so far. 257 Mysterious and serious (sometimes bluescreen) crashes due to an error in the 258 nVidia display driver (nv4_disp.dll). Occur with the following combination: 259 Direct3D Render Manager + terrain rendering with OCM or KTE + 260 hardware occlusion culling enabled (CHC, possibly also SWC) + demo playback. 261 Not tested on other hardware (e.g. ATI cards). Not exactly repeatable, 262 crashes in different places during playback or not at all. 249 263 250 264 AUTHOR
Note: See TracChangeset
for help on using the changeset viewer.