- Timestamp:
- 07/08/05 01:53:01 (19 years ago)
- Location:
- trunk/VUT
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/Ogre/include/OgrePlatformOcclusionQuery.h
r87 r160 21 21 22 22 virtual bool GetQueryResult(unsigned int &queryResult, 23 23 const bool waitForResult) const; 24 24 virtual void BeginQuery(); 25 25 virtual void EndQuery(); -
trunk/VUT/Ogre/include/OgreSceneContentGenerator.h
r130 r160 7 7 8 8 namespace Ogre { 9 10 typedef std::vector<SceneNode *> SceneNodeList; 11 typedef std::vector<Entity *> EntityList; 9 12 10 13 /** Class which fills a scene with content in a random fashion. … … 20 23 */ 21 24 void GenerateScene(int numObjects, const String &objName); 25 22 26 /** Generates a new object in the scene using ray scene queries 23 27 and inserts it into thr scene hierarchy. … … 31 35 const Vector3 &rotation, const String &objName); 32 36 37 /** Minimum angle for the random orientation. 38 */ 33 39 void SetMinAngle(Vector3 minAngle); 40 41 /** Maximum angle for the random orientation. 42 */ 34 43 void SetMaxAngle(Vector3 maxAngle); 44 45 /** Minimum possible random position. 46 */ 35 47 void SetMinPos(Vector3 minPos); 48 /** Maximum possible random position. 49 */ 36 50 void SetMaxPos(Vector3 maxPos); 51 /** Scale factor applied to each generated object. 52 */ 37 53 void SetScale(Vector3 scale); 38 54 39 /** The number of created objects */ 55 /** The number of created objects. 56 */ 40 57 int GetObjectCount(); 41 58 42 /** Writes scene nodes to file */ 59 /** Writes scene nodes to file. 60 */ 43 61 bool WriteObjects(const std::string &filename); 44 62 45 /** Loads scene nodes from file */ 63 /** Loads scene nodes from file. 64 */ 46 65 bool LoadObjects(const std::string &filename); 66 47 67 /** Generates a scene object with the specified parameters 48 68 @param position the position of the scene object … … 53 73 SceneNode *GenerateSceneObject(const Vector3 &position, 54 74 const Quaternion &orientation, const String &objName); 75 76 /** Gets pointer to list of generated scene nodes. 77 */ 78 SceneNodeList *GetGeneratedSceneNodes(); 79 80 /** Gets pointer to list of entities. 81 */ 82 EntityList *GetGeneratedEntities(); 83 84 /** Removes generated object from scene graph. 85 */ 86 void RemoveGeneratedObjects(); 55 87 56 88 protected: … … 64 96 SceneManager *mSceneMgr; 65 97 66 std::vector<SceneNode *> mSceneObjects; 98 SceneNodeList mSceneNodes; 99 EntityList mEntities; 67 100 }; 68 101 -
trunk/VUT/Ogre/resources/VisibilityDemo.overlay
r159 r160 12 12 } 13 13 14 Example/Visibility/ DemoOverlay14 Example/Visibility/CullStatsOverlay 15 15 { 16 16 zorder 500 … … 40 40 { 41 41 left 5 42 top 543 42 width 180 44 43 caption [SPACE] Algorithm … … 47 46 { 48 47 left 210 49 top 550 48 width 120 51 49 height 30 … … 56 54 { 57 55 left 5 58 top 2059 56 width 120 60 57 height 30 … … 64 61 { 65 62 left 210 66 top 2067 63 width 120 68 64 height 30 … … 72 68 { 73 69 left 5 74 top 3575 70 width 120 76 71 height 30 … … 80 75 { 81 76 left 210 82 top 3583 77 width 120 84 78 height 30 … … 88 82 { 89 83 left 5 90 top 5091 84 width 120 92 85 height 30 … … 96 89 { 97 90 left 210 98 top 5099 91 width 120 100 92 height 30 … … 104 96 { 105 97 left 5 106 top 65107 98 width 120 108 99 height 30 … … 113 104 { 114 105 left 210 115 top 65 116 width 120 117 height 30 118 caption : 119 } 106 width 120 107 height 30 108 caption : 109 } 110 element TextArea(Example/Visibility/CurrentObjectType): Example/Visibility/Templates/BasicText 111 { 112 left 5 113 width 120 114 height 30 115 caption [F7] Object type 116 } 117 element TextArea(Example/Visibility/CurrentObjectTypeInfo): Example/Visibility/Templates/BasicText 118 { 119 left 210 120 width 90 121 font_name TrebuchetMSBold 122 caption : 123 } 120 124 } 121 125 … … 128 132 top 5 129 133 width 320 130 height 1 50134 height 135 131 135 material Core/StatsBlockCenter 132 136 border_size 1 1 1 1 … … 144 148 { 145 149 left 5 146 top 5147 150 width 180 148 151 height 30 … … 152 155 { 153 156 left 180 154 top 5155 157 width 90 156 158 height 30 … … 160 162 { 161 163 left 5 162 top 20163 164 width 180 164 165 height 30 … … 168 169 { 169 170 left 180 170 top 20171 171 width 90 172 172 height 30 … … 176 176 { 177 177 left 5 178 top 35179 178 width 180 180 179 height 30 … … 184 183 { 185 184 left 180 186 top 35187 185 width 90 188 186 height 30 … … 192 190 { 193 191 left 5 194 top 50195 192 width 180 196 193 height 30 … … 200 197 { 201 198 left 180 202 top 50203 199 width 90 204 200 height 30 … … 208 204 { 209 205 left 5 210 top 65211 206 width 180 212 207 height 30 … … 216 211 { 217 212 left 180 218 top 65 219 width 90 220 height 30 221 caption : 222 } 223 element TextArea(Example/Visibility/Objects): Example/Visibility/Templates/BasicText 224 { 225 left 5 226 top 80 213 width 90 214 height 30 215 caption : 216 } 217 element TextArea(Example/Visibility/ObjectsCount): Example/Visibility/Templates/BasicText 218 { 219 left 5 227 220 width 180 228 221 height 30 229 222 caption Number of objects 230 223 } 231 element TextArea(Example/Visibility/ObjectsInfo): Example/Visibility/Templates/BasicText 232 { 233 left 180 234 top 80 224 element TextArea(Example/Visibility/ObjectsCountInfo): Example/Visibility/Templates/BasicText 225 { 226 left 180 235 227 width 90 236 228 height 30 … … 240 232 { 241 233 left 5 242 top 95243 234 width 180 244 235 height 30 … … 248 239 { 249 240 left 180 250 top 95251 241 width 90 252 242 font_name TrebuchetMSBold 253 243 caption : 254 } 255 element TextArea(Example/Visibility/DelayedQueriesIssued): Example/Visibility/Templates/BasicText 256 { 257 left 5 258 top 110 259 width 180 260 height 30 261 caption Avg. queries issued 262 } 263 element TextArea(Example/Visibility/DelayedQueriesIssuedInfo): Example/Visibility/Templates/BasicText 264 { 265 left 180 266 top 110 267 width 90 268 font_name TrebuchetMSBold 269 caption : 270 } 271 element TextArea(Example/Visibility/DelayedTraversedNodes): Example/Visibility/Templates/BasicText 272 { 273 left 5 274 top 125 275 width 180 276 height 30 277 caption Avg. traversed Nodes 278 } 279 element TextArea(Example/Visibility/DelayedTraversedNodesInfo): Example/Visibility/Templates/BasicText 280 { 281 left 180 282 top 125 283 width 90 284 font_name TrebuchetMSBold 285 caption : 286 } 244 } 245 287 246 } 288 247 } … … 334 293 font_name TrebuchetMSBold 335 294 char_height 19 336 caption Additional Options295 caption Help: Additional Options 337 296 colour_top 1 1 0.7 338 297 colour_bottom 1 1 0.7 339 298 } 340 299 341 element TextArea(Example/Visibility/Help/ShowHelpInfo): Example/Visibility/Templates/BasicText 342 { 343 left 5 344 top 30 300 element TextArea(Example/Visibility/Help/ShowHelp): Example/Visibility/Templates/BasicText 301 { 302 left 5 345 303 width 180 346 304 height 30 347 305 caption [F1] Show / Hide this screen 348 306 } 349 element TextArea(Example/Visibility/Help/StatsInfo): Example/Visibility/Templates/BasicText 350 { 351 left 5 352 top 45 307 element TextArea(Example/Visibility/Help/Stats): Example/Visibility/Templates/BasicText 308 { 309 left 5 353 310 width 180 354 311 height 30 355 312 caption [F2] Show / Hide stats 356 313 } 357 element TextArea(Example/Visibility/Help/AppStateInfo): Example/Visibility/Templates/BasicText 358 { 359 left 5 360 top 75 314 element TextArea(Example/Visibility/Help/AppState): Example/Visibility/Templates/BasicText 315 { 316 left 5 361 317 width 180 362 318 height 30 363 319 caption [F3] Toggle between interactive / recorded walkthrough 364 320 } 365 element TextArea(Example/Visibility/Help/RecordedInfo): Example/Visibility/Templates/BasicText 366 { 367 left 5 368 top 60 321 element TextArea(Example/Visibility/Help/Recorded): Example/Visibility/Templates/BasicText 322 { 323 left 5 369 324 width 180 370 325 height 30 371 326 caption [F4] Start / End frame recording 372 327 } 373 element TextArea(Example/Visibility/Help/ScreenshotsInfo): Example/Visibility/Templates/BasicText 374 { 375 left 5 376 top 105 328 element TextArea(Example/Visibility/Help/Screenshots): Example/Visibility/Templates/BasicText 329 { 330 left 5 377 331 width 180 378 332 height 30 379 333 caption [F11] Screenshot 380 334 } 381 element TextArea(Example/Visibility/Help/WriteOut Info): Example/Visibility/Templates/BasicText382 { 383 left 5 384 top 120385 width 180386 height 30387 caption [F12] Write screen objects to file388 }335 element TextArea(Example/Visibility/Help/WriteOut): Example/Visibility/Templates/BasicText 336 { 337 left 5 338 width 180 339 height 30 340 caption [F12] Write scene entities to file 341 } 342 389 343 //-- visualization 390 element TextArea(Example/Visibility/Help/VizInfo): Example/Visibility/Templates/BasicText 391 { 392 left 5 393 top 150 344 element TextArea(Example/Visibility/Help/VizSection): Example/Visibility/Templates/BasicText 345 { 346 left 5 347 width 180 348 height 30 349 caption ****** Visualization ****** 350 } 351 element TextArea(Example/Visibility/Help/Viz): Example/Visibility/Templates/BasicText 352 { 353 left 5 394 354 width 180 395 355 height 30 396 356 caption [1] Show / hide visualization 397 357 } 398 element TextArea(Example/Visibility/Help/NextVizModeInfo): Example/Visibility/Templates/BasicText 399 { 400 left 5 401 top 165 358 element TextArea(Example/Visibility/Help/NextVizMode): Example/Visibility/Templates/BasicText 359 { 360 left 5 402 361 width 175 403 362 height 30 404 363 caption [2] Toggle visualization mode 405 364 } 406 element TextArea(Example/Visibility/Help/ZoomVizInfo): Example/Visibility/Templates/BasicText 407 { 408 left 5 409 top 180 365 element TextArea(Example/Visibility/Help/ZoomViz): Example/Visibility/Templates/BasicText 366 { 367 left 5 410 368 width 190 411 369 height 30 412 370 caption [3][4] Zoom in / out of visualization 413 371 } 414 element TextArea(Example/Visibility/Help/SceneDetailInfo): Example/Visibility/Templates/BasicText 415 { 416 left 5 417 top 210 372 element TextArea(Example/Visibility/Help/SceneDetail): Example/Visibility/Templates/BasicText 373 { 374 left 5 418 375 width 180 419 376 height 30 420 377 caption [R] Toggle between solid / wireframe / point based rendering 421 378 } 422 element TextArea(Example/Visibility/Help/DisplayCameraDetailsInfo): Example/Visibility/Templates/BasicText 423 { 424 left 5 425 top 225 379 element TextArea(Example/Visibility/Help/DisplayCameraDetails): Example/Visibility/Templates/BasicText 380 { 381 left 5 426 382 width 180 427 383 height 30 428 384 caption [P] Show / hide camera details 429 385 } 430 element TextArea(Example/Visibility/Help/DisplayOctreeInfo): Example/Visibility/Templates/BasicText 431 { 432 left 5 433 top 240 386 element TextArea(Example/Visibility/Help/DisplayOctree): Example/Visibility/Templates/BasicText 387 { 388 left 5 434 389 width 180 435 390 height 30 436 391 caption [T] Show / hide octree 437 392 } 438 element TextArea(Example/Visibility/Help/UseShadowsInfo): Example/Visibility/Templates/BasicText 439 { 440 left 5 441 top 255 393 element TextArea(Example/Visibility/Help/UseShadows): Example/Visibility/Templates/BasicText 394 { 395 left 5 442 396 width 180 443 397 height 30 444 398 caption [S] Show / hide shadows 445 399 } 446 element TextArea(Example/Visibility/Help/FilterInfo): Example/Visibility/Templates/BasicText 447 { 448 left 5 449 top 270 400 element TextArea(Example/Visibility/Help/Filter): Example/Visibility/Templates/BasicText 401 { 402 left 5 450 403 width 180 451 404 height 30 452 405 caption [F] toggle filtering method (trilinear, anisotropic, bilinear) 453 406 } 454 element TextArea(Example/Visibility/Help/FromCameraQueryInfo): Example/Visibility/Templates/BasicText 455 { 456 left 5 457 top 285 407 element TextArea(Example/Visibility/Help/VisQuery): Example/Visibility/Templates/BasicText 408 { 409 left 5 410 width 180 411 height 30 412 caption ****** Visibility Queries ****** 413 } 414 element TextArea(Example/Visibility/Help/FromCameraQuery): Example/Visibility/Templates/BasicText 415 { 416 left 5 458 417 width 180 459 418 height 30 460 419 caption [F5] From camera visible pixels (+ SHIFT: relative visibility) 461 420 } 462 element TextArea(Example/Visibility/Help/FromPointQueryInfo): Example/Visibility/Templates/BasicText 463 { 464 left 5 465 top 60 466 width 300 421 element TextArea(Example/Visibility/Help/FromPointQuery): Example/Visibility/Templates/BasicText 422 { 423 left 5 424 width 180 467 425 height 30 468 426 caption [F6] From camera visible pixels (+ SHIFT: relative visibility) 427 } 428 element TextArea(Example/Visibility/Help/QueryType): Example/Visibility/Templates/BasicText 429 { 430 left 5 431 width 180 432 height 30 433 caption [I] Change between occlusion query / item buffer visibility query 434 } 435 element TextArea(Example/Visibility/Help/QueryTarget): Example/Visibility/Templates/BasicText 436 { 437 left 5 438 width 180 439 height 30 440 caption [C] Mesh / Patch visibility (only item buffer) 441 } 442 element TextArea(Example/Visibility/Help/SceneObjects): Example/Visibility/Templates/BasicText 443 { 444 left 5 445 width 180 446 height 30 447 caption ******* Generation / Destruction of scene objects ****** 448 } 449 element TextArea(Example/Visibility/Help/GenerateObjects): Example/Visibility/Templates/BasicText 450 { 451 left 5 452 width 180 453 height 30 454 caption [F8] Generate 500 objects 455 } 456 element TextArea(Example/Visibility/Help/RemoveObjects): Example/Visibility/Templates/BasicText 457 { 458 left 5 459 width 180 460 height 30 461 caption [DEL] Remove generated objects 462 } 463 element TextArea(Example/Visibility/Help/DropObject): Example/Visibility/Templates/BasicText 464 { 465 left 5 466 width 180 467 height 30 468 caption [MOUSE LEFT] Drop object on terrain 469 469 } 470 470 } … … 524 524 { 525 525 left 5 526 top 30527 526 width 90 528 527 height 30 … … 534 533 { 535 534 left 180 536 top 30537 535 width 90 538 536 height 30 … … 543 541 { 544 542 left 5 545 top 45546 543 width 90 547 544 height 30 … … 551 548 { 552 549 left 180 553 top 45554 550 width 90 555 551 height 30 … … 560 556 { 561 557 left 5 562 top 60563 558 width 90 564 559 height 30 … … 568 563 { 569 564 left 180 570 top 60571 565 width 90 572 566 height 30 … … 578 572 { 579 573 left 5 580 top 75581 574 width 90 582 575 height 30 583 576 caption Visible patches 584 577 } 585 element TextArea(Example/Visibility/Query/VisiblePatchInfo): Example/Visibility/Templates/BasicText 586 { 587 left 180 588 top 75 578 element TextArea(Example/Visibility/Query/VisiblePatchesInfo): Example/Visibility/Templates/BasicText 579 { 580 left 180 589 581 width 90 590 582 height 30 … … 595 587 { 596 588 left 5 597 top 90598 589 width 90 599 590 height 30 … … 604 595 { 605 596 left 180 606 top 90607 597 width 90 608 598 height 30 … … 613 603 { 614 604 left 5 615 top 105616 605 width 90 617 606 height 30 … … 622 611 { 623 612 left 180 624 top 105625 613 width 90 626 614 height 30 … … 630 618 { 631 619 left 5 632 top 120633 620 width 90 634 621 height 30 … … 639 626 { 640 627 left 180 641 top 120642 628 width 90 643 629 height 30 -
trunk/VUT/Ogre/src/OgreSceneContentGenerator.cpp
r159 r160 12 12 namespace Ogre { 13 13 14 /******************************************************* /15 /* SceneContentGenerator implementation */16 /******************************************************* /14 /*************************************************************/ 15 /* SceneContentGenerator implementation */ 16 /*************************************************************/ 17 17 18 18 //----------------------------------------------------------------------- … … 23 23 mMinAngle(Vector3(0.0f, 0.0f, 0.0f)), 24 24 mMaxAngle(Vector3(360, 360, 360)), 25 mScale(0.1, 0.1, 0.1) 26 //, mObjectCount(0) 25 mScale(0.1, 0.1, 0.1)//, mObjectCount(0) 27 26 { 28 27 } … … 36 35 Vector3 translationRatio; 37 36 38 int old_count = GetObjectCount();37 int new_size = GetObjectCount() + numObjects; 39 38 int failed_attempts = 0; // counter used to avoid invinite loop 40 39 41 40 //-- create random values between zero and one 42 while ((GetObjectCount() < numObjects + old_count) &&41 while ((GetObjectCount() < new_size) && 43 42 (failed_attempts < MAX_FAILED_ATTEMPTS)) 44 43 { … … 70 69 Entity *ent = mSceneMgr->createEntity(name, objName + ".mesh"); 71 70 72 SceneNode * currentObject= mSceneMgr->getRootSceneNode()->71 SceneNode *node = mSceneMgr->getRootSceneNode()-> 73 72 createChildSceneNode(String(name) + "Node", position); 74 73 75 74 //ent->setCastShadows(false); 76 currentObject->attachObject(ent); 77 currentObject->setScale(mScale); 78 currentObject->setOrientation(orientation); 79 80 //-- store pointer to object 81 mSceneObjects.push_back(currentObject); 82 83 return currentObject; 75 node->attachObject(ent); 76 node->setScale(mScale); 77 node->setOrientation(orientation); 78 79 // store pointer to node and object 80 mSceneNodes.push_back(node); 81 mEntities.push_back(ent); 82 83 return node; 84 84 } 85 85 //----------------------------------------------------------------------- … … 116 116 int SceneContentGenerator::GetObjectCount() 117 117 { 118 return (int)mScene Objects.size();118 return (int)mSceneNodes.size(); 119 119 } 120 120 //----------------------------------------------------------------------- … … 129 129 std::vector<SceneNode *>::const_iterator it, it_end; 130 130 131 it_end = mScene Objects.end();131 it_end = mSceneNodes.end(); 132 132 133 133 if(!ofstr.is_open()) … … 136 136 char str[100]; 137 137 138 for(it = mScene Objects.begin(); it < it_end; ++it)138 for(it = mSceneNodes.begin(); it < it_end; ++it) 139 139 { 140 140 SceneNode *node = (*it); … … 164 164 return false; 165 165 166 //mScene Objects.clear(); // reset list of objects166 //mSceneNodes.clear(); // reset list of objects 167 167 168 168 while (!ifstr.eof()) … … 173 173 &orientation.w, &orientation.x, &orientation.y, &orientation.z, 174 174 &mScale.x, &mScale.y, &mScale.z); 175 176 /*Vector3 rot(orientation.getYaw().valueDegrees(),177 orientation.getPitch().valueDegrees(),178 orientation.getRoll().valueDegrees());*/179 175 180 176 GenerateSceneObject(position, orientation, objName); … … 187 183 return true; 188 184 } 189 185 //----------------------------------------------------------------------- 186 SceneNodeList *SceneContentGenerator::GetGeneratedSceneNodes() 187 { 188 return &mSceneNodes; 189 } 190 //----------------------------------------------------------------------- 191 EntityList *SceneContentGenerator::GetGeneratedEntities() 192 { 193 return &mEntities; 194 } 195 //----------------------------------------------------------------------- 196 void SceneContentGenerator::RemoveGeneratedObjects() 197 { 198 //-- destroy scene nodes and detach entities 199 while (!mSceneNodes.empty()) 200 { 201 SceneNode *node = mSceneNodes.back(); 202 mSceneNodes.pop_back(); 203 204 //node->detachAllObjects(); 205 mSceneMgr->destroySceneNode(node->getName()); 206 } 207 //-- remove and destroy entities 208 while (!mEntities.empty()) 209 { 210 Entity *ent = mEntities.back(); 211 mEntities.pop_back(); 212 213 mSceneMgr->removeEntity(ent); 214 } 215 } 190 216 } // namespace Ogre -
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r159 r160 40 40 //mShowBoundingBoxes = true; 41 41 //mShowBoxes = true; 42 //mShowBoxes = true;43 42 44 43 // TODO: set maxdepth to reasonable value -
trunk/VUT/work/TestCulling/TestCullingApplication.cpp
r155 r160 31 31 32 32 // Position it at 500 in Z direction 33 mCamera->setPosition(Vector3(128, 25,128));33 mCamera->setPosition(Vector3(128, 25, 128)); 34 34 35 35 // Look back along -Z 36 mCamera->lookAt(Vector3(0, 0,-300));37 mCamera->setNearClipDistance( 1);38 mCamera->setFarClipDistance( 1000);36 mCamera->lookAt(Vector3(0, 0, -300)); 37 mCamera->setNearClipDistance(1); 38 mCamera->setFarClipDistance(1000); 39 39 }*/ 40 40 //----------------------------------------------------------------------- … … 67 67 void TestCullingApplication::setupGui() 68 68 { 69 mGUIRenderer = new CEGUI::OgreCEGUIRenderer(mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, ST_EXTERIOR_CLOSE); 69 mGUIRenderer = new CEGUI::OgreCEGUIRenderer(mWindow, 70 Ogre::RENDER_QUEUE_OVERLAY, false, 3000, ST_EXTERIOR_CLOSE); 70 71 mGUISystem = new CEGUI::System(mGUIRenderer); 71 72 … … 93 94 94 95 95 /*********************************************** /96 /* TerrainFrameListener implementation */97 /*********************************************** /96 /*****************************************************/ 97 /* TerrainFrameListener implementation */ 98 /*****************************************************/ 98 99 //----------------------------------------------------------------------- 99 100 TerrainFrameListener::TerrainFrameListener(RenderWindow* win, Camera* cam, 100 101 SceneManager *sceneManager, 101 102 CEGUI::Renderer *renderer, 102 SceneContentGenerator *sceneContentGenerator) 103 :ExampleFrameListener(win, cam, false, true),103 SceneContentGenerator *sceneContentGenerator): 104 ExampleFrameListener(win, cam, false, true), 104 105 mSceneMgr(sceneManager), 105 106 mGUIRenderer(renderer), … … 136 137 mHierarchyNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/HierarchyNodesInfo"); 137 138 mRenderedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/RenderedNodesInfo"); 138 mObjects Info = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/ObjectsInfo");139 mObjectsCountInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/ObjectsInfo"); 139 140 mTestGeometryForVisibleLeavesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/TestGeometryForVisibleLeavesInfo"); 140 141 mQueriesIssuedInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/QueriesIssuedInfo"); … … 148 149 mHierarchyNodesInfo->setCaption(": 0"); 149 150 mRenderedNodesInfo->setCaption(": 0"); 150 mObjects Info->setCaption(": 0");151 mObjectsCountInfo->setCaption(": 0"); 151 152 mTestGeometryForVisibleLeavesInfo->setCaption(": true"); 152 153 mQueriesIssuedInfo->setCaption(": 0"); … … 330 331 331 332 sprintf(str,": %d", mSceneContentGenerator->GetObjectCount()); 332 mObjects Info->setCaption(str);333 mObjectsCountInfo->setCaption(str); 333 334 } 334 335 //----------------------------------------------------------------------- -
trunk/VUT/work/TestCulling/TestCullingApplication.h
r155 r160 1 /** 2 \file 3 TestCullingApplication.h 4 */ 1 #ifndef _TerrainFrameListener_H__ 2 #define _TerrainFrameListener_H__ 3 5 4 #include "CEGUIForwardRefs.h" 6 5 #include "ExampleApplication.h" … … 29 28 public: 30 29 31 TerrainFrameListener(RenderWindow* win, Camera* cam, SceneManager *sceneManager, 32 CEGUI::Renderer *renderer, SceneContentGenerator *sceneContentGenerator); 30 TerrainFrameListener(RenderWindow* win, 31 Camera* cam, 32 SceneManager *sceneManager, 33 CEGUI::Renderer *renderer, 34 SceneContentGenerator *sceneContentGenerator); 33 35 34 36 35 ~TerrainFrameListener( 37 ~TerrainFrameListener(); 36 38 37 39 bool frameStarted(const FrameEvent& evt); … … 86 88 OverlayElement *mHierarchyNodesInfo; 87 89 OverlayElement *mRenderedNodesInfo; 88 OverlayElement *mObjects Info;90 OverlayElement *mObjectsCountInfo; 89 91 OverlayElement *mTestGeometryForVisibleLeavesInfo; 90 92 OverlayElement *mQueriesIssuedInfo; … … 130 132 }; 131 133 134 #endif // _TerrainFrameListener_H__ -
trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp
r159 r160 11 11 #include "OgreItemBufferQueryManager.h" 12 12 #include "OgreOcclusionQueriesQueryManager.h" 13 14 15 13 #include "TestCullingTerrainApplication.h" 16 14 17 15 // output file for frame info … … 48 46 }; 49 47 48 Real currentObjectTerrainOffsets[] = 49 { 50 0, 51 7, 52 0 53 }; 54 Real currentObjectScales[] = 55 { 56 0.1, 57 0.1, 58 0.07 59 }; 50 60 //----------------------------------------------------------------------- 51 61 TerrainFrameListener::TerrainFrameListener(RenderWindow* win, Camera* cam, … … 55 65 Camera *vizCamera, 56 66 SceneNode *camNode, 57 Light *sunLight): 67 Light *sunLight, 68 TestCullingTerrainApplication *app): 58 69 mCamera(cam), 59 70 mWindow(win), … … 79 90 mAppState(WALKTHROUGH), 80 91 mCurrentFrame(0), 81 m TimeElapsed(0),92 mReplayTimeElapsed(0), 82 93 mRotateSpeed(72), 83 94 mMoveSpeed(50), … … 105 116 mDelayedTraversedNodes(0.0), 106 117 mUseItemBuffer(false), 107 mRenderPatchesForItemBuffer(false) 118 mRenderPatchesForItemBuffer(false), 119 mCurrentObjectType(0), 120 mApplication(app) 108 121 { 109 122 //mInputDevice = PlatformManager::getSingleton().createInputReader(); … … 118 131 mEventProcessor->addKeyListener(this); 119 132 120 mInputDevice = mEventProcessor->getInputReader(); 121 133 mInputDevice = mEventProcessor->getInputReader(); 122 134 123 135 // create ray query executor, used to place objects in terrain 124 136 mRayQueryExecutor = new RayQueryExecutor(mSceneMgr); 125 137 138 //-- overlays 139 mDebugOverlay = OverlayManager::getSingleton().getByName("Core/DebugOverlay"); 126 140 mHelpOverlay = OverlayManager::getSingleton().getByName("Example/Visibility/HelpOverlay"); 127 mDebugOverlay = OverlayManager::getSingleton().getByName("Core/DebugOverlay");128 141 mQueryOverlay = OverlayManager::getSingleton().getByName("Example/Visibility/QueryOverlay"); 129 130 //-- visibility culling stats overlay 131 mCullStatsOverlay = OverlayManager::getSingleton().getByName("Example/Visibility/DemoOverlay"); 132 133 mAlgorithmInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/AlgorithmInfo"); 134 mThresholdInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/ThresholdInfo"); 135 mTestGeometryForVisibleLeavesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/TestGeometryForVisibleLeavesInfo"); 136 mUseDepthPassInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/UseDepthPassInfo"); 137 mAssumedVisibilityInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/AssumedVisibilityInfo"); 138 139 mFrustumCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/FrustumCulledNodesInfo"); 140 mQueryCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/QueryCulledNodesInfo"); 141 mTraversedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/TraversedNodesInfo"); 142 mHierarchyNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/HierarchyNodesInfo"); 143 mRenderedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/RenderedNodesInfo"); 144 mObjectsInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/ObjectsInfo"); 145 mQueriesIssuedInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/QueriesIssuedInfo"); 146 mDelayedQueriesIssuedInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/DelayedQueriesIssuedInfo"); 147 mDelayedTraversedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/DelayedTraversedNodesInfo"); 148 149 mAlgorithmInfo->setCaption(": " + currentAlgorithmCaptions[mCurrentAlgorithm]); 150 mThresholdInfo->setCaption(": 0"); 151 mFrustumCulledNodesInfo->setCaption(": 0"); 152 mQueryCulledNodesInfo->setCaption(": 0"); 153 mTraversedNodesInfo->setCaption(": 0"); 154 mHierarchyNodesInfo->setCaption(": 0"); 155 mRenderedNodesInfo->setCaption(": 0"); 156 mObjectsInfo->setCaption(": 0"); 157 mTestGeometryForVisibleLeavesInfo->setCaption(": true"); 158 mUseDepthPassInfo->setCaption(": false"); 159 mQueriesIssuedInfo->setCaption(": 0"); 160 mAssumedVisibilityInfo->setCaption(": 0"); 161 mDelayedQueriesIssuedInfo->setCaption(": 0"); 162 mDelayedTraversedNodesInfo->setCaption(": 0"); 163 164 //-- visibility query stats overlay 165 mQueryTypeInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/Query/QueryTypeInfo"); 166 167 mQueryVisibleNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/Query/VisibleNodesInfo"); 168 mQueryVisibleGeometryInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/Query/VisibleGeometryInfo"); 169 mQueryVisiblePatchInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/Query/VisiblePatchInfo"); 170 171 mQueryNodeVisibilityInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/Query/NodeVisibilityInfo"); 172 mQueryGeometryVisibilityInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/Query/GeometryVisibilityInfo"); 173 mQueryPatchVisibilityInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/Query/PatchVisibilityInfo"); 142 mCullStatsOverlay = OverlayManager::getSingleton().getByName("Example/Visibility/CullStatsOverlay"); 143 144 initVisStatsOverlay(); // visibility stats overlay 145 initHelpOverlay(); // help overlay 146 initQueryOverlay(); // visibility query stats overlay 174 147 175 148 // show stats overlays 176 149 showStats(true); 177 //mHelpOverlay->show(); 178 150 179 151 // set culling algorithm type 180 152 setAlgorithm(mCurrentAlgorithm); … … 193 165 mSceneMgr->setOption("CullCamera", &mCullCamera); 194 166 mSceneMgr->setOption("PrepareVisualization", &mShowVisualization); 167 168 setObjectType(mCurrentObjectType); 195 169 196 170 // reset statistics … … 229 203 //Vector3 queryResult; mRayQueryExecutor->executeRayQuery(&queryResult, mouseRay); 230 204 231 // Get results, create a node/entity on the position205 // get results, create a node/entity on the position 232 206 mCurrentObject = mTerrainContentGenerator->GenerateSceneObject( 233 mouseRay.getOrigin()/*queryResult*/, Vector3::ZERO, "robot"); 207 mouseRay.getOrigin()/*queryResult*/, Vector3::ZERO, 208 mApplication->getCurrentObjectCaption(mCurrentObjectType)); 234 209 210 if (mCurrentObjectType == 0) // only robot has animation phases 211 { 212 Entity *ent = mTerrainContentGenerator->GetGeneratedEntities()->back(); 213 AnimationState *st = ent->getAnimationState("Walk"); 214 215 st->setLoop(true); 216 st->setEnabled(true); 217 218 mApplication->getAnimationStates().push_back(st); 219 mApplication->getAnimationSpeed().push_back(Math::RangeRandom(0.5, 1.5)); 220 } 221 235 222 mLMouseDown = true; 236 223 } … … 271 258 if (mCurrentObject) 272 259 { 260 // apply offset so object is ON terrain 261 queryResult.y += currentObjectTerrainOffsets[mCurrentObjectType]; 262 273 263 mCurrentObject->setPosition(queryResult); 274 264 } … … 292 282 } 293 283 284 for (int i = 0; i < (int)mApplication->getAnimationStates().size(); ++i) 285 { 286 mApplication->getAnimationStates()[i]->addTime(evt.timeSinceLastFrame * 287 mApplication->getAnimationSpeed()[i]); 288 } 289 294 290 if (mDisplayCameraDetails) 295 291 { … … 299 295 } 300 296 301 //-- IMPORTANT: must be set, otherwise terrain is not rendered correctly302 mSceneMgr->endFrame();303 304 297 //-- setup what is needed for immediate mouse/key movement 305 298 if (mTimeDelay >= 0) … … 307 300 mTimeDelay -= evt.timeSinceLastFrame; 308 301 } 309 302 310 303 // If this is the first frame, pick a speed 311 304 if (evt.timeSinceLastFrame == 0) … … 387 380 } 388 381 //----------------------------------------------------------------------- 389 void TerrainFrameListener:: ApplyVisibilityQuery(bool fromPoint, bool relativeVisibility,382 void TerrainFrameListener::applyVisibilityQuery(bool fromPoint, bool relativeVisibility, 390 383 bool useItemBuffer) 391 384 { … … 523 516 524 517 // show the results 525 if (!mShowQueryStats )518 if (!mShowQueryStats && !mShowHelp) 526 519 { 527 520 mQueryOverlay->show(); … … 552 545 553 546 updateStats(); 547 548 //-- IMPORTANT: must be set, otherwise terrain is not rendered correctly 549 mSceneMgr->endFrame(); 550 551 if (mTimeDelay <= 0) // approx. one second 552 mTimeDelay = 1.0; 554 553 555 554 return true; … … 660 659 661 660 //-- initialise frame data 662 m TimeElapsed = 0;661 mReplayTimeElapsed = 0; 663 662 664 663 mCamNode->setPosition(mFrameInfo[0].position); … … 716 715 } 717 716 //----------------------------------------------------------------------- 717 void TerrainFrameListener::setObjectType(int objectType) 718 { 719 if (mCurrentObjectType >= 3) 720 mCurrentObjectType = 0; 721 722 // parameters for new object 723 mTerrainContentGenerator->SetOffset(currentObjectTerrainOffsets[mCurrentObjectType]); 724 Real scale = currentObjectScales[mCurrentObjectType]; 725 mTerrainContentGenerator->SetScale(Vector3(scale, scale, scale)); 726 727 mCurrentObjectTypeInfo->setCaption(": " + 728 mApplication->getCurrentObjectCaption(mCurrentObjectType)); 729 } 730 //----------------------------------------------------------------------- 718 731 void TerrainFrameListener::setAlgorithm(int algorithm) 719 732 { … … 739 752 static String trisString = "Triangle Count: "; 740 753 754 // HACK: compute average fps ourselfs, because ogre avg. fps is wrong 755 // TODO: update only once per second 741 756 mAvgFps += mWindow->getStatistics().lastFPS; 742 757 ++ mFrameCount; … … 755 770 756 771 //guiAvg->setCaption(avgFps + StringConverter::toString(stats.avgFPS)); 757 guiAvg->setCaption(avgFpsString + StringConverter::toString(avgFps)); 772 if (mTimeDelay < 0) // only update once per second 773 guiAvg->setCaption(avgFpsString + StringConverter::toString(avgFps) + " ms"); 758 774 guiCurr->setCaption(currFpsString + StringConverter::toString(stats.lastFPS)); 759 775 guiBest->setCaption(bestFpsString + StringConverter::toString(stats.bestFPS) 760 +" "+StringConverter::toString(stats.bestFrameTime) +" ms");776 +" "+StringConverter::toString(stats.bestFrameTime) + " ms"); 761 777 guiWorst->setCaption(worstFpsString + StringConverter::toString(stats.worstFPS) 762 +" "+StringConverter::toString(stats.worstFrameTime) +" ms");778 +" "+StringConverter::toString(stats.worstFrameTime) + " ms"); 763 779 764 780 OverlayElement* guiTris = OverlayManager::getSingleton().getOverlayElement("Core/NumTris"); … … 772 788 mFrustumCulledNodesInfo->setCaption(str); 773 789 774 // delay so there is no jump775 mSceneMgr->getOption("NumQueriesIssued", &opt);776 sprintf(str,": %d", (int)opt);777 mQueriesIssuedInfo->setCaption(str);778 779 790 mSceneMgr->getOption("NumQueryCulledNodes", &opt); sprintf(str,": %d", opt); 780 791 mQueryCulledNodesInfo->setCaption(str); 781 792 782 mSceneMgr->getOption("NumTraversedNodes", &opt); sprintf(str,": %d", opt);783 mTraversedNodesInfo->setCaption(str);784 785 793 mSceneMgr->getOption("NumHierarchyNodes", &opt); sprintf(str,": %d", opt); 786 794 mHierarchyNodesInfo->setCaption(str); … … 790 798 791 799 sprintf(str,": %d", mTerrainContentGenerator->GetObjectCount()); 792 mObjects Info->setCaption(str);793 794 // delay so there is no jump800 mObjectsCountInfo->setCaption(str); 801 802 // take old value into account in order to create no sudden changes 795 803 mSceneMgr->getOption("NumQueriesIssued", &opt); 796 804 mDelayedQueriesIssued = mDelayedQueriesIssued * 0.8 + (float)opt * 0.2; 797 805 sprintf(str,": %d", (int)mDelayedQueriesIssued); 798 m DelayedQueriesIssuedInfo->setCaption(str);806 mQueriesIssuedInfo->setCaption(str); 799 807 800 808 mSceneMgr->getOption("NumTraversedNodes", &opt); 801 809 mDelayedTraversedNodes = mDelayedTraversedNodes * 0.8 + (float)opt * 0.2; 802 810 sprintf(str,": %d", (int)mDelayedTraversedNodes); 803 m DelayedTraversedNodesInfo->setCaption(str);811 mTraversedNodesInfo->setCaption(str); 804 812 805 813 } … … 815 823 mSceneMgr->setOption("TestGeometryForVisibleLeaves", &mTestGeometryForVisibleLeaves); 816 824 817 // disable optimization which tests geometry instead of aabb 818 // for delayed rendering (i.e., render transparents after all the solids) 819 // because otherwise visible transparents could be skipped 825 /* disable optimization which tests geometry instead of aabb 826 * for "delayed" rendering of transparents (i.e., render transparents after all the solids) 827 * because otherwise visible transparents could be skipped 828 */ 820 829 bool delayedRendering = !mTestGeometryForVisibleLeaves; 821 830 … … 928 937 void TerrainFrameListener::keyPressed(KeyEvent* e) 929 938 { 939 // hide exact visibility query overlay 940 if (mShowQueryStats) 941 { 942 mQueryOverlay->hide(); 943 mShowQueryStats = false; 944 } 945 930 946 switch(e->getKey()) 931 947 { … … 997 1013 break; 998 1014 case KC_F5: 999 ApplyVisibilityQuery(false, mShiftPressed, mUseItemBuffer);1015 applyVisibilityQuery(false, mShiftPressed, mUseItemBuffer); 1000 1016 break; 1001 1017 case KC_F6: 1002 ApplyVisibilityQuery(true, mShiftPressed, mUseItemBuffer); 1018 applyVisibilityQuery(true, mShiftPressed, mUseItemBuffer); 1019 break; 1020 1021 case KC_F7: 1022 setObjectType(++mCurrentObjectType); 1023 break; 1024 case KC_F8: 1025 mApplication->generateScene(500, mCurrentObjectType); 1003 1026 break; 1004 1027 … … 1018 1041 case KC_LSHIFT: 1019 1042 mShiftPressed = true; 1043 break; 1044 case KC_DELETE: 1045 mTerrainContentGenerator->RemoveGeneratedObjects(); 1046 mApplication->getAnimationStates().clear(); 1047 mApplication->getAnimationSpeed().clear(); 1020 1048 break; 1021 1049 //KEY_PRESSED(KC_F3, 0.3, writeFrames()); … … 1060 1088 { 1061 1089 //-- find current frame relative to elapsed frame time 1062 m TimeElapsed -= timeElapsed;1063 1064 while ((m TimeElapsed <= 0) && (mCurrentFrame < (int)mFrameInfo.size() - 1))1065 { 1066 m TimeElapsed += mFrameInfo[mCurrentFrame ++].timeElapsed;1090 mReplayTimeElapsed -= timeElapsed; 1091 1092 while ((mReplayTimeElapsed <= 0) && (mCurrentFrame < (int)mFrameInfo.size() - 1)) 1093 { 1094 mReplayTimeElapsed += mFrameInfo[mCurrentFrame ++].timeElapsed; 1067 1095 } 1068 1096 … … 1075 1103 if (old_frame.timeElapsed > 0) 1076 1104 { 1077 factor = m TimeElapsed / old_frame.timeElapsed;1105 factor = mReplayTimeElapsed / old_frame.timeElapsed; 1078 1106 } 1079 1107 … … 1241 1269 } 1242 1270 } 1271 //----------------------------------------------------------------------- 1272 void TerrainFrameListener::initOverlayElement(OverlayElement **elInfo, String ext, 1273 String name, int top, String caption) 1274 { 1275 OverlayElement *el = 1276 OverlayManager::getSingleton().getOverlayElement(ext + name); 1277 1278 (*elInfo) = OverlayManager::getSingleton().getOverlayElement(ext + name + "Info"); 1279 (*elInfo)->setCaption(caption); 1280 1281 el->setTop(top); 1282 (*elInfo)->setTop(top); 1283 } 1284 //----------------------------------------------------------------------- 1285 void TerrainFrameListener::initHelpOverlayElement(String name, int top) 1286 { 1287 OverlayElement *el = OverlayManager::getSingleton().getOverlayElement( 1288 "Example/Visibility/Help/" + name); 1289 1290 el->setTop(top); 1291 } 1292 //----------------------------------------------------------------------- 1293 void TerrainFrameListener::initHelpOverlay() 1294 { 1295 const int vert_space = 15; 1296 int top = 30; 1297 1298 initHelpOverlayElement("ShowHelp", top); top += vert_space; 1299 initHelpOverlayElement("Stats", top); top += vert_space; 1300 initHelpOverlayElement("AppState", top); top += vert_space; 1301 initHelpOverlayElement("Recorded", top); top += vert_space; 1302 initHelpOverlayElement("Screenshots", top); top += vert_space; 1303 initHelpOverlayElement("WriteOut", top); top += vert_space; 1304 1305 top +=vert_space; 1306 initHelpOverlayElement("SceneDetail", top); top += vert_space; 1307 initHelpOverlayElement("DisplayCameraDetails", top); top += vert_space; 1308 initHelpOverlayElement("DisplayOctree", top); top += vert_space; 1309 initHelpOverlayElement("UseShadows", top); top += vert_space; 1310 initHelpOverlayElement("Filter", top); top += vert_space; 1311 1312 //-- visualization 1313 top += vert_space; 1314 initHelpOverlayElement("VizSection", top); top += vert_space; 1315 initHelpOverlayElement("Viz", top); top += vert_space; 1316 initHelpOverlayElement("NextVizMode", top); top += vert_space; 1317 initHelpOverlayElement("ZoomViz", top); top += vert_space; 1318 1319 1320 //-- visibility queries 1321 top += vert_space; 1322 initHelpOverlayElement("VisQuery", top); top += vert_space; 1323 initHelpOverlayElement("FromCameraQuery", top); top += vert_space; 1324 initHelpOverlayElement("FromPointQuery", top); top += vert_space; 1325 initHelpOverlayElement("QueryType", top); top += vert_space; 1326 initHelpOverlayElement("QueryTarget", top); top += vert_space; 1327 1328 //-- object generation 1329 top += vert_space; 1330 initHelpOverlayElement("SceneObjects", top); top += vert_space; 1331 initHelpOverlayElement("GenerateObjects", top); top += vert_space; 1332 initHelpOverlayElement("RemoveObjects", top); top += vert_space; 1333 initHelpOverlayElement("DropObject", top); top += vert_space; 1334 1335 OverlayElement *helpPanel = OverlayManager::getSingleton().getOverlayElement( 1336 "Example/Visibility/Help/HelpPanel"); 1337 1338 helpPanel->setHeight(top + 10); 1339 } 1340 //----------------------------------------------------------------------- 1341 void TerrainFrameListener::initVisStatsOverlay() 1342 { 1343 const int border_height = 10; 1344 const int vert_space = 15; 1345 1346 //-- visibility culling stats overlay 1347 int top = border_height; 1348 1349 String ext = "Example/Visibility/"; 1350 1351 initOverlayElement(&mAlgorithmInfo, ext, "Algorithm", top, 1352 ": " + currentAlgorithmCaptions[mCurrentAlgorithm]); top += vert_space; 1353 1354 initOverlayElement(&mThresholdInfo, ext, "Threshold", top, ": 0"); top += vert_space; 1355 initOverlayElement(&mTestGeometryForVisibleLeavesInfo, ext, 1356 "TestGeometryForVisibleLeaves", top, ": true"); top += vert_space; 1357 initOverlayElement(&mUseDepthPassInfo, ext, "UseDepthPass", top, ": false"); top += vert_space; 1358 initOverlayElement(&mAssumedVisibilityInfo, ext, "AssumedVisibility", top, ": 0"); top += vert_space; 1359 initOverlayElement(&mCurrentObjectTypeInfo, ext, "CurrentObjectType", top, ": "); top += vert_space; 1360 1361 OverlayElement *optionsPanel = OverlayManager::getSingleton(). 1362 getOverlayElement("Example/Visibility/VisibilityPanel"); 1363 1364 optionsPanel->setHeight(top + border_height); 1365 1366 top = border_height; 1367 //ext = "Example/Visibility/"; 1368 initOverlayElement(&mFrustumCulledNodesInfo, ext, "FrustumCulledNodes", top, ": 0"); top += vert_space; 1369 initOverlayElement(&mQueryCulledNodesInfo, ext, "QueryCulledNodes", top, ": 0"); top += vert_space; 1370 initOverlayElement(&mTraversedNodesInfo, ext, "TraversedNodes", top, ": 0"); top += vert_space; 1371 initOverlayElement(&mHierarchyNodesInfo, ext, "HierarchyNodes", top, ": 0"); top += vert_space; 1372 initOverlayElement(&mRenderedNodesInfo, ext, "RenderedNodes", top, ": 0"); top += vert_space; 1373 initOverlayElement(&mObjectsCountInfo, ext, "ObjectsCount", top, ": 0"); top += vert_space; 1374 initOverlayElement(&mQueriesIssuedInfo, ext, "QueriesIssued", top, ": 0"); top += vert_space; 1375 1376 OverlayElement *visPanel = OverlayManager::getSingleton(). 1377 getOverlayElement("Example/Visibility/VisibilityStatsPanel"); 1378 1379 visPanel->setHeight(top + border_height); 1380 } 1381 //----------------------------------------------------------------------- 1382 void TerrainFrameListener::initQueryOverlay() 1383 { 1384 const int border_height = 10; 1385 const int vert_space = 15; 1386 1387 //-- visibility culling stats overlay 1388 int top = border_height + 25; 1389 1390 String ext = "Example/Visibility/Query/"; 1391 1392 initOverlayElement(&mQueryTypeInfo , ext, "QueryType", top, ": 0"); top += vert_space; 1393 initOverlayElement(&mQueryVisibleGeometryInfo , ext, "VisibleGeometry", top, ": 0"); top += vert_space; 1394 initOverlayElement(&mQueryVisibleNodesInfo , ext, "VisibleNodes", top, ": 0"); top += vert_space; 1395 initOverlayElement(&mQueryVisiblePatchInfo , ext, "VisiblePatches", top, ": 0"); top += vert_space; 1396 initOverlayElement(&mQueryNodeVisibilityInfo , ext, "NodeVisibility", top, ": 0"); top += vert_space; 1397 initOverlayElement(&mQueryGeometryVisibilityInfo , ext, "GeometryVisibility", top, ": 0"); top += vert_space; 1398 initOverlayElement(&mQueryPatchVisibilityInfo , ext, "PatchVisibility", top, ": 0"); top += vert_space; 1399 1400 1401 OverlayElement *queryPanel = OverlayManager::getSingleton(). 1402 getOverlayElement("Example/Visibility/Query/QueryPanel"); 1403 1404 queryPanel->setHeight(top + border_height); 1405 } -
trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.h
r159 r160 13 13 #include "OgrePlatformQueryManager.h" 14 14 15 class TestCullingTerrainApplication; 16 17 15 18 using namespace Ogre; 16 19 … … 25 28 public: 26 29 27 TerrainFrameListener(RenderWindow* win, Camera* cam, SceneManager *sceneManager, 28 CEGUI::Renderer *renderer, TerrainContentGenerator *contentGenerator, Camera *vizCamera, 29 SceneNode *camNode, Light *sunLight); 30 TerrainFrameListener(RenderWindow* win, 31 Camera* cam, 32 SceneManager *sceneManager, 33 CEGUI::Renderer *renderer, 34 TerrainContentGenerator *contentGenerator, 35 Camera *vizCamera, 36 SceneNode *camNode, 37 Light *sunLight, 38 TestCullingTerrainApplication *app); 30 39 31 40 ~TerrainFrameListener(); … … 122 131 @param useItemBuffer if item buffer should be used or occlusion queries 123 132 */ 124 void ApplyVisibilityQuery(bool fromPoint, bool relativeVisibility, bool useItemBuffer);133 void applyVisibilityQuery(bool fromPoint, bool relativeVisibility, bool useItemBuffer); 125 134 126 135 void toggleShowQueryStats(); 127 136 137 /** Sets the type of the objects generated in the scene. 138 */ 139 void setObjectType(int objectType); 140 128 141 protected: 142 143 void initHelpOverlayElement(String name, int top); 144 void initOverlayElement(OverlayElement **elInfo, String ext, String name, int top, String caption); 145 146 //-- initialise overlays 147 void initHelpOverlay(); 148 void initVisStatsOverlay(); 149 void initQueryOverlay(); 129 150 130 151 void resetStats(); … … 162 183 OverlayElement *mUseDepthPassInfo; 163 184 OverlayElement *mRenderedNodesInfo; 164 OverlayElement *mObjects Info;185 OverlayElement *mObjectsCountInfo; 165 186 OverlayElement *mQueriesIssuedInfo; 166 187 OverlayElement *mDelayedQueriesIssuedInfo; 167 188 OverlayElement *mDelayedTraversedNodesInfo; 189 OverlayElement *mCurrentObjectTypeInfo; 168 190 169 191 OverlayElement *mQueryTypeInfo; … … 203 225 std::vector<frame_info> mFrameInfo; 204 226 205 Real m TimeElapsed;227 Real mReplayTimeElapsed; 206 228 //EventProcessor* mEventProcessor; 207 229 InputReader* mInputDevice; … … 211 233 RenderWindow* mWindow; 212 234 213 //bool mUseBufferedInputKeys, mUseBufferedInputMouse, mInputTypeSwitchingOn;214 235 unsigned int mNumScreenShots; 215 236 int mSceneDetailIndex; … … 248 269 249 270 bool mRenderPatchesForItemBuffer; 271 272 int mCurrentObjectType; 273 274 TestCullingTerrainApplication *mApplication; 250 275 }; 251 276 -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp
r159 r160 15 15 #include <windows.h> 16 16 17 /*******************************************************/ 18 /* TestCullingTerrainApplication implementation */ 19 /*******************************************************/ 17 String currentObjectCaptions[] = 18 { 19 "robot", 20 "athene", 21 "ninja" 22 //"ogrehead" 23 }; 24 25 /*********************************************************/ 26 /* TestCullingTerrainApplication implementation */ 27 /*********************************************************/ 28 29 20 30 TestCullingTerrainApplication::TestCullingTerrainApplication(): 21 31 mTerrainContentGenerator(NULL) … … 30 40 mTerrainContentGenerator = NULL; 31 41 } 32 //if(mRenderTargetListener) delete mRenderTargetListener;33 42 } 34 43 //----------------------------------------------------------------------- … … 127 136 setupGui(); 128 137 129 130 138 /* // occluder plane to test visibility 131 Plane plane; 132 plane.normal = Vector3::UNIT_Y; 133 plane.d = -60; 139 Plane plane; plane.normal = Vector3::UNIT_Y; plane.d = -60; 134 140 MeshManager::getSingleton().createPlane("Myplane", 135 141 ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane, … … 152 158 mTerrainContentGenerator = new TerrainContentGenerator(mSceneMgr); 153 159 154 // if no objects file generate yourself160 // if no objects in file, we generate new objects 155 161 if (!mTerrainContentGenerator->LoadObjects("objects.out")) 156 162 { 157 163 // to provide much occlusion, 158 // height is restricted to 50 , sono objects appear on peaks164 // height is restricted to 50 => no objects appear on peaks 159 165 mTerrainContentGenerator->SetMaxPos(Vector3(3000.0f, 50.0f, 3000.0f)); 160 166 mTerrainContentGenerator->SetOffset(0); 161 167 162 // the objects are generated on the whole terrain 163 //mTerrainContentGenerator->GenerateScene(1500, "robot"); 164 mTerrainContentGenerator->GenerateScene(1500, "athene"); 165 //mTerrainContentGenerator->GenerateScene(500, "ninja"); 168 // the objects are generated randomly distributed over the terrain 169 generateScene(1500, 0); 166 170 } 167 171 … … 169 173 // objects also on peaks of terrain 170 174 mTerrainContentGenerator->SetMaxPos(Vector3(3000.0f, 5000.0f, 3000.0f)); 175 } 176 //----------------------------------------------------------------------- 177 void TestCullingTerrainApplication::generateScene(int num, int objectType) 178 { 179 mTerrainContentGenerator->GenerateScene(num, currentObjectCaptions[objectType]); 180 181 if (objectType != 0) // from our objects, only robot has animation phases 182 return; 183 184 EntityList *entList = mTerrainContentGenerator->GetGeneratedEntities(); 185 186 //-- add animation state for new robots (located at the end of the list) 187 for (int i = entList->size() - num; i < entList->size(); ++i) 188 { 189 Entity *ent = (*entList)[i]; 190 AnimationState *st = ent->getAnimationState("Idle"); 191 st->setEnabled(true); 192 st->setLoop(true); 193 194 mAnimationStates.push_back(st); 195 mAnimationSpeed.push_back(Math::RangeRandom(0.5, 1.5)); 196 } 197 } 198 //----------------------------------------------------------------------- 199 std::vector<AnimationState *> &TestCullingTerrainApplication::getAnimationStates() 200 { 201 return mAnimationStates; 202 } 203 //----------------------------------------------------------------------- 204 std::vector<Real> &TestCullingTerrainApplication::getAnimationSpeed() 205 { 206 return mAnimationSpeed; 171 207 } 172 208 //----------------------------------------------------------------------- … … 189 225 { 190 226 mTerrainFrameListener = new TerrainFrameListener(mWindow, mCamera, mSceneMgr, 191 mGUIRenderer, mTerrainContentGenerator, mVizCamera, mCamNode, mSunLight );227 mGUIRenderer, mTerrainContentGenerator, mVizCamera, mCamNode, mSunLight, this); 192 228 193 229 mRoot->addFrameListener(mTerrainFrameListener); 194 230 } 195 231 //----------------------------------------------------------------------- 232 String TestCullingTerrainApplication::getCurrentObjectCaption(int id) 233 { 234 return currentObjectCaptions[id]; 235 } 236 //----------------------------------------------------------------------- 196 237 void TestCullingTerrainApplication::chooseSceneManager() 197 238 { 198 239 mSceneMgr = mRoot->getSceneManager(ST_EXTERIOR_CLOSE); 199 240 } 200 201 202 241 /**************************************************************/ 203 242 /* VisualizationRenderTargetListener implementation */ -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h
r145 r160 25 25 26 26 27 class TestCullingTerrainApplication 27 class TestCullingTerrainApplication: public ExampleApplication 28 28 { 29 29 public: … … 31 31 ~TestCullingTerrainApplication(); 32 32 33 void generateScene(int num, int objectType); 34 35 String getCurrentObjectCaption(int id); 36 37 std::vector<AnimationState *> &getAnimationStates(); 38 std::vector<Real> &getAnimationSpeed(); 39 33 40 protected: 41 34 42 //-- inherited from ExampleApplication 35 43 bool setup(); … … 40 48 41 49 virtual void createRenderTargetListener(); 50 51 std::vector<AnimationState *> mAnimationStates; 52 std::vector<Real> mAnimationSpeed; 42 53 43 54 /** cegui setup */ … … 61 72 TerrainFrameListener *mTerrainFrameListener; 62 73 ColourValue mAmbientLight; 63 //VisualizationRenderTargetListener *mVizRenderTargetListener;64 74 65 75 private: -
trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctree.cpp
r158 r160 262 262 mWorldAABB = mWorldAABB.intersection(box); 263 263 264 //std::stringstream d; d << "updating box: " << mWorldAABB << ", depth: " << mDepth << "null: " << mBox.isNull();265 //LogManager::getSingleton().logMessage(d.str());266 267 264 // recursively update parent bounds 268 265 if (mParent)
Note: See TracChangeset
for help on using the changeset viewer.