Changeset 135
- Timestamp:
- 06/16/05 18:13:33 (20 years ago)
- Location:
- trunk/VUT
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibility/include/VisibilityInfo.h
r130 r135 16 16 NodeInfo(HierarchyNode *node,const float v): mNode(node), mVisibility(v) {} 17 17 18 float GetVisibili y() const {return mVisibility;}18 float GetVisibility() const {return mVisibility;} 19 19 20 20 protected: … … 34 34 MeshInfo(Mesh *mesh, const float v): mMesh(mesh), mVisibility(v) {} 35 35 36 float GetVisibili y() const {return mVisibility;}36 float GetVisibility() const {return mVisibility;} 37 37 38 38 protected: -
trunk/VUT/Ogre/include/OgreTerrainContentGenerator.h
r130 r135 32 32 33 33 /** 34 Generates objects and places it on the terrain 34 Generates objects and places it on the terrain. 35 35 */ 36 36 SceneNode *GenerateSceneObject(const Vector3 &position, 37 const Vector3 &rotation, const String &objName, const bool clampToTerrain = true); 37 const Vector3 &rotation, const String &objName); 38 /** 39 Generates objects and optionally places it on the terrain. 40 @param clampToTerrain if true, scene object is clamped to the terrain 41 */ 42 SceneNode *GenerateSceneObject(const Vector3 &position, 43 const Vector3 &rotation, const String &objName, const bool clampToTerrain); 38 44 39 45 /** offset which is added to objects when put into the terrain */ -
trunk/VUT/Ogre/resources/VisibilityDemo.overlay
r121 r135 240 240 } 241 241 242 242 243 Example/Visibility/HelpOverlay 243 244 { 244 245 zorder 600 245 246 // Stats block 246 container BorderPanel(Example/Visibility/Help Panel)247 container BorderPanel(Example/Visibility/Help/HelpPanel) 247 248 { 248 249 metrics_mode pixels … … 250 251 vert_align top 251 252 width 600 252 height 3 15253 height 300 253 254 left 200 254 255 top 200 … … 276 277 } 277 278 278 element TextArea(Example/Visibility/Help/Help )279 element TextArea(Example/Visibility/Help/HelpOptions) 279 280 { 280 281 metrics_mode pixels … … 293 294 { 294 295 left 5 295 top 40296 top 30 296 297 width 180 297 298 height 30 … … 301 302 { 302 303 left 5 303 top 55304 top 45 304 305 width 180 305 306 height 30 … … 309 310 { 310 311 left 5 311 top 85312 top 75 312 313 width 180 313 314 height 30 … … 317 318 { 318 319 left 5 319 top 70320 top 60 320 321 width 180 321 322 height 30 … … 325 326 { 326 327 left 5 327 top 1 15328 top 105 328 329 width 180 329 330 height 30 … … 333 334 { 334 335 left 5 335 top 1 30336 top 120 336 337 width 180 337 338 height 30 … … 342 343 { 343 344 left 5 344 top 1 60345 top 150 345 346 width 180 346 347 height 30 … … 350 351 { 351 352 left 5 352 top 1 75353 top 165 353 354 width 175 354 355 height 30 … … 358 359 { 359 360 left 5 360 top 1 90361 top 180 361 362 width 190 362 363 height 30 … … 366 367 { 367 368 left 5 368 top 2 20369 top 210 369 370 width 180 370 371 height 30 … … 374 375 { 375 376 left 5 376 top 2 35377 top 225 377 378 width 180 378 379 height 30 … … 382 383 { 383 384 left 5 384 top 2 50385 top 240 385 386 width 180 386 387 height 30 … … 390 391 { 391 392 left 5 392 top 2 65393 top 255 393 394 width 180 394 395 height 30 … … 398 399 { 399 400 left 5 400 top 2 80401 top 270 401 402 width 180 402 403 height 30 … … 405 406 } 406 407 } 408 409 Example/Visibility/QueryOverlay 410 { 411 zorder 650 412 // Stats block 413 container BorderPanel(Example/Visibility/Query/QueryPanel) 414 { 415 metrics_mode pixels 416 horz_align left 417 vert_align top 418 width 600 419 height 120 420 left 200 421 top 300 422 material Core/StatsBlockCenter 423 424 border_size 1 1 1 1 425 border_material Core/StatsBlockBorder 426 border_topleft_uv 0.0000 1.0000 0.0039 0.9961 427 border_top_uv 0.0039 1.0000 0.9961 0.9961 428 border_topright_uv 0.9961 1.0000 1.0000 0.9961 429 border_left_uv 0.0000 0.9961 0.0039 0.0039 430 border_right_uv 0.9961 0.9961 1.0000 0.0039 431 border_bottomleft_uv 0.0000 0.0039 0.0039 0.0000 432 border_bottom_uv 0.0039 0.0039 0.9961 0.0000 433 border_bottomright_uv 0.9961 0.0039 1.0000 0.0000 434 435 container Panel(Example/Visibility/Query/BreakPanel) 436 { 437 metrics_mode pixels 438 left 5 439 top 22 440 width 590 441 height 1 442 material Core/StatsBreak 443 } 444 445 element TextArea(Example/Visibility/Query/Headline) 446 { 447 metrics_mode pixels 448 left 5 449 top 5 450 width 90 451 height 30 452 font_name TrebuchetMSBold 453 char_height 19 454 caption Exact Visibility Query 455 colour_top 1 1 0.7 456 colour_bottom 1 1 0.7 457 } 458 459 element TextArea(Example/Visibility/Query/QueryType): Example/Visibility/Templates/BasicText 460 { 461 left 5 462 top 30 463 width 90 464 height 30 465 caption Type 466 } 467 468 469 element TextArea(Example/Visibility/Query/QueryTypeInfo): Example/Visibility/Templates/BasicText 470 { 471 left 180 472 top 30 473 width 90 474 height 30 475 caption : 476 } 477 478 element TextArea(Example/Visibility/Query/VisibleNodes): Example/Visibility/Templates/BasicText 479 { 480 left 5 481 top 45 482 width 90 483 height 30 484 caption Visible nodes 485 } 486 element TextArea(Example/Visibility/Query/VisibleNodesInfo): Example/Visibility/Templates/BasicText 487 { 488 left 180 489 top 45 490 width 90 491 height 30 492 caption : 493 } 494 495 element TextArea(Example/Visibility/Query/VisibleGeometry): Example/Visibility/Templates/BasicText 496 { 497 left 5 498 top 60 499 width 90 500 height 30 501 caption Visible geometry 502 } 503 element TextArea(Example/Visibility/Query/VisibleGeometryInfo): Example/Visibility/Templates/BasicText 504 { 505 left 180 506 top 60 507 width 90 508 height 30 509 caption : 510 } 511 512 element TextArea(Example/Visibility/Query/NodeVisibility): Example/Visibility/Templates/BasicText 513 { 514 left 5 515 top 75 516 width 90 517 height 30 518 caption Avg. node visibility 519 } 520 521 element TextArea(Example/Visibility/Query/NodeVisibilityInfo): Example/Visibility/Templates/BasicText 522 { 523 left 180 524 top 75 525 width 90 526 height 30 527 caption: 528 } 529 530 element TextArea(Example/Visibility/Query/GeometryVisibility): Example/Visibility/Templates/BasicText 531 { 532 left 5 533 top 90 534 width 90 535 height 30 536 caption Avg. geometry visibility 537 } 538 539 element TextArea(Example/Visibility/Query/GeometryVisibilityInfo): Example/Visibility/Templates/BasicText 540 { 541 left 180 542 top 90 543 width 90 544 height 30 545 caption: 546 } 547 548 } 549 } -
trunk/VUT/Ogre/src/OgreOctreeHierarchyInterface.cpp
r130 r135 137 137 { 138 138 mPreviousNode = node; 139 static_cast<Octree *>(node)->_getCullBounds(&mBox); 139 // static_cast<Octree *>(node)->_getCullBounds(&mBox); 140 mBox = static_cast<Octree *>(node)->_getWorldAABB(); 140 141 } 141 142 -
trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp
r133 r135 188 188 else 189 189 { 190 // used by the scene manager, because bounding box rendering must be handled191 // differently190 // this information is used e.g., by the scene graph, because the bounding box 191 // must be treated differently to the scene geometry during rendering 192 192 mIsBoundingBoxQuery = true; 193 193 -
trunk/VUT/Ogre/src/OgrePlatformQueryManager.cpp
r134 r135 25 25 bool relativeVisibility) 26 26 { 27 if (relativeVisibility)28 LogManager::getSingleton().logMessage("relative");29 else30 LogManager::getSingleton().logMessage("absolute");31 32 27 // we need access to the scene manager and the rendersystem 33 28 PlatformHierarchyInterface *pfHierarchyInterface = … … 39 34 Camera *pCam = const_cast<Camera *>(&camera); 40 35 36 bool overlayEnabled = mViewport->getOverlaysEnabled(); 37 mViewport->setOverlaysEnabled(false); 41 38 pfHierarchyInterface->GetSceneManager()->_renderScene(pCam, mViewport, false); 42 39 … … 53 50 GtpVisibility::GeometryList geometryList; 54 51 55 GtpVisibility::HierarchyNodeList:: const_iterator nodeIt, nodeIt_end = nodeList->end();52 GtpVisibility::HierarchyNodeList::iterator nodeIt, nodeIt_end = nodeList->end(); 56 53 // geometry list has still do be built 57 54 GtpVisibility::GeometryList::iterator geometryIt, geometryIt_end; 58 55 56 // to obtain the correct number of projected pixels, depth write must be disabled 57 58 bool enableDepthWrite = false; 59 // this option must be provided by the scene manager 60 pfHierarchyInterface->GetSceneManager()->setOption("DepthWrite", &enableDepthWrite); 61 62 /* relative visiblity: 63 1) get visible pixels count of objects 64 2) clear frame buffer 65 3) get projected visible pixels count: 66 test all objects again without depth write (set as option in scene manager) 67 4) calculate ratio between visible vs. projected pixels 68 */ 59 69 // for relative visibility we need 2 rendering passes 60 70 int n = relativeVisibility ? 2 : 1; … … 63 73 { 64 74 //-- queries for hierarchy nodes 65 for (nodeIt = nodeList->begin(); nodeIt != nodeIt_end; ++nodeIt) 75 for (nodeIt = nodeList->begin(); nodeIt != nodeIt_end; ++nodeIt) 66 76 { 67 77 // TODO: DELETE QUERIES FROM PREVIOUS RENDER … … 69 79 70 80 // store geometry of the hierarchy node in a geometry list (only once!) 71 if (i == n - 2)81 if (i == 0) 72 82 { 73 83 mHierarchyInterface->GetGeometry(*nodeIt, &geometryList, false); … … 83 93 } 84 94 85 // --- relative visiblity 86 /* 87 1) get visible pixels count of objects 88 2) clear frame buffer 89 3) get projected visible pixels count: 90 test all objects again without depth write (set as option in scene manager) 91 4) calculate ratio between visible vs. projected pixels 92 */ 93 if (i == n - 2) // if relativeVisibility, between first and second loop 94 { 95 pfHierarchyInterface->GetRenderSystem()->clearFrameBuffer(FBT_COLOUR | FBT_DEPTH); 96 } 97 98 // to obtain the correct number of projected pixels, depth write must be disabled 99 bool enableDepthWrite = (i != n - 2); 100 101 // this option must be provided by the scene manager 102 pfHierarchyInterface->GetSceneManager()->setOption("DepthWrite", &enableDepthWrite); 95 96 pfHierarchyInterface->GetRenderSystem()->clearFrameBuffer(FBT_DEPTH); 103 97 } 104 98 99 enableDepthWrite = true; 100 // this option must be provided by the scene manager 101 pfHierarchyInterface->GetSceneManager()->setOption("DepthWrite", &enableDepthWrite); 102 103 mViewport->setOverlaysEnabled(overlayEnabled); 105 104 106 105 //---- collect results 107 unsigned int visiblePixels ;106 unsigned int visiblePixels = 0; 108 107 109 108 GtpVisibility::QueryList::iterator visQueryIt, projQueryIt; … … 111 110 visQueryIt = queryList[0].begin(); 112 111 projQueryIt = queryList[1].begin(); 112 113 113 114 114 for (nodeIt = nodeList->begin(); nodeIt != nodeIt_end; ++nodeIt) 115 115 { 116 116 (*visQueryIt)->GetQueryResult(visiblePixels, true); 117 117 118 118 119 float vis = (float)visiblePixels; 119 120 … … 121 122 { 122 123 (*projQueryIt)->GetQueryResult(visiblePixels, true); 123 std::stringstream d; d << "relativ " << visiblePixels; 124 LogManager::getSingleton().logMessage(d.str()); 125 124 126 125 if (visiblePixels > 0) 127 126 { … … 132 131 133 132 ++visQueryIt; 134 133 135 134 // leave nodes with visibilty 0 in queue: 136 135 // happens if node is intersected by near plane … … 141 140 geometryIt_end = geometryList.end(); 142 141 143 /*for (geometryIt = geometryList.begin(); geometryIt != geometryIt_end; ++geometryIt)142 for (geometryIt = geometryList.begin(); geometryIt != geometryIt_end; ++geometryIt) 144 143 { 145 (*absQueryIt)->GetQueryResult(visiblePixels, true); 144 (*visQueryIt)->GetQueryResult(visiblePixels, true); 145 146 146 147 147 float vis = (float)visiblePixels; … … 150 150 if (relativeVisibility) 151 151 { 152 (* relQueryIt)->GetQueryResult(visiblePixels, true);152 (*projQueryIt)->GetQueryResult(visiblePixels, true); 153 153 154 154 if (visiblePixels) … … 156 156 vis /= (float) visiblePixels; 157 157 } 158 ++ relQueryIt;158 ++projQueryIt; 159 159 } 160 160 161 ++ absQueryIt;161 ++visQueryIt; 162 162 163 163 // approximate depth ordering during rendering => … … 167 167 visibleGeometry->push_back(GtpVisibility::MeshInfo(*geometryIt, vis)); 168 168 } 169 } */169 } 170 170 171 171 } … … 176 176 bool relativeVisibility) 177 177 { 178 visibleNodes->push_back(GtpVisibility::NodeInfo(mHierarchyInterface->GetSceneRoot(), 1.0f));178 179 179 } 180 180 //----------------------------------------------------------------------- -
trunk/VUT/Ogre/src/OgreTerrainContentGenerator.cpp
r130 r135 70 70 const Vector3 &rotation, const String& objName, const bool clampToTerrain) 71 71 { 72 73 if (clampToTerrain) 74 { 75 return GenerateSceneObject(position, rotation, objName); 76 } 77 else 78 { 79 return SceneContentGenerator::GenerateSceneObject(position, rotation, objName); 80 } 81 } 82 //----------------------------------------------------------------------- 83 SceneNode *TerrainContentGenerator::GenerateSceneObject(const Vector3 &position, 84 const Vector3 &rotation, const String& objName) 85 { 72 86 Vector3 queryResult; 73 87 // set y to max height so we are sure to be over terrain 74 88 Vector3 pos(position.x, MAX_HEIGHT, position.z); 75 76 if (!clampToTerrain)77 {78 return SceneContentGenerator::GenerateSceneObject(queryResult, rotation, objName);79 }80 89 81 90 if (mRayQueryExecutor->executeRayQuery(&queryResult, position, Vector3::NEGATIVE_UNIT_Y)) -
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r134 r135 274 274 TerrainSceneManager::_renderVisibleObjects(); 275 275 276 277 276 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 278 277 _deleteRenderedQueueGroups(false); … … 300 299 mVisibilityManager->ApplyVisibilityCulling(); 301 300 301 // delete remaining renderables from queue (or all but transparents) 302 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 303 _deleteRenderedQueueGroups(mSkipTransparents); 304 #endif 302 305 303 306 // for depth pass: add visible nodes found with the visibility culling … … 320 323 321 324 TerrainRenderable::setCurrentRenderLevelIndex(renderLevel); 325 getRenderQueue()->clear(); 322 326 //WriteLog(); // write out stats 323 327 } -
trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp
r133 r135 16 16 17 17 18 String mCurrentAlgorithmCaptions[GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS] =19 { 20 18 String currentAlgorithmCaptions[GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS] = 19 { 20 "View Frustum Culling", 21 21 "Stop and Wait Culling", 22 22 "Coherent Hierarchical Culling" 23 23 }; 24 24 25 String queryTypeCaptions[4] = 26 { 27 "from camera, visible pixels", 28 "from viewpoint, visible pixels", 29 "from camera, relative visibility", 30 "from viewpoint, relative visibility" 31 }; 25 32 26 33 //----------------------------------------------------------------------- … … 73 80 mVisualizeCulledNodes(false), 74 81 mSunLight(sunLight), 75 mShiftPressed(false) 82 mShiftPressed(false), 83 mShowQueryStats(false) 76 84 { 77 85 //mInputDevice = PlatformManager::getSingleton().createInputReader(); 78 79 86 //mInputDevice->initialise(win, true, true); 87 80 88 mEventProcessor = new EventProcessor(); 81 89 … … 94 102 mHelpOverlay = OverlayManager::getSingleton().getByName("Example/Visibility/HelpOverlay"); 95 103 mDebugOverlay = OverlayManager::getSingleton().getByName("Core/DebugOverlay"); 96 104 mQueryOverlay = OverlayManager::getSingleton().getByName("Example/Visibility/QueryOverlay"); 97 105 98 106 //-- visibility culling stats overlay … … 112 120 mQueriesIssuedInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/QueriesIssuedInfo"); 113 121 114 mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]);122 mAlgorithmInfo->setCaption(": " + currentAlgorithmCaptions[mCurrentAlgorithm]); 115 123 mThresholdInfo->setCaption(": 0"); 116 124 mFrustumCulledNodesInfo->setCaption(": 0"); … … 124 132 mQueriesIssuedInfo->setCaption(": 0"); 125 133 134 135 //-- visibility query stats overlay 136 mQueryTypeInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/Query/QueryTypeInfo"); 137 mQueryVisibleNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/Query/VisibleNodesInfo"); 138 mQueryVisibleGeometryInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/Query/VisibleGeometryInfo"); 139 mQueryNodeVisibilityInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/Query/NodeVisibilityInfo"); 140 mQueryGeometryVisibilityInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/Query/GeometryVisibilityInfo"); 141 126 142 // show stats overlays 127 143 showStats(true); … … 145 161 mSceneMgr->setOption("ShowVisualization", &mShowVisualization); 146 162 147 // TODO: change this 163 // TODO: change this (does not work with other scene manager plugins) 148 164 mVisibilityManager = dynamic_cast<VisibilityTerrainSceneManager *>(mSceneMgr)-> 149 165 GetVisibilityManager(); … … 155 171 TerrainFrameListener::~TerrainFrameListener() 156 172 { 157 //PlatformManager::getSingleton().destroyInputReader(mInputDevice);158 159 173 delete mRayQueryExecutor; 160 174 delete mEventProcessor; … … 182 196 // Get results, create a node/entity on the position 183 197 mCurrentObject = mTerrainContentGenerator->GenerateSceneObject( 184 mouseRay.getOrigin(), Vector3::ZERO, "robot" , false);198 mouseRay.getOrigin(), Vector3::ZERO, "robot"); 185 199 186 200 mLMouseDown = true; … … 341 355 if (fromPoint) 342 356 { 357 Vector3 point; 358 mVisibilityManager->GetQueryManager()-> 359 ComputeFromPointVisibility(point, &visibleNodes, &visibleGeometry, relativeVisibility); 343 360 } 344 361 else … … 348 365 } 349 366 367 float averageNodeVis = 0; 368 float averageGeometryVis = 0; 369 350 370 for (int i=0; i < visibleGeometry.size(); ++i) 351 371 { 352 std::stringstream d; d << "Geometry visibility: " << visibleGeometry[i].GetVisibiliy(); 372 averageGeometryVis += visibleGeometry[i].GetVisibility(); 373 374 std::stringstream d; d << "Geometry visibility: " << visibleGeometry[i].GetVisibility(); 353 375 LogManager::getSingleton().logMessage(d.str()); 354 376 } 355 377 for (int i=0; i < visibleNodes.size(); ++i) 356 378 { 357 std::stringstream d; d << "Node visibility: " << visibleNodes[i].GetVisibiliy(); 379 averageNodeVis += visibleNodes[i].GetVisibility(); 380 381 std::stringstream d; d << "Node visibility: " << visibleNodes[i].GetVisibility(); 358 382 LogManager::getSingleton().logMessage(d.str()); 359 383 } 360 384 385 averageNodeVis /= (float)visibleNodes.size(); 386 averageGeometryVis /= (float)visibleGeometry.size(); 387 388 char str[100]; 389 390 //-- update visibility queries stats 391 try 392 { 393 //-- visibility queries stats 394 int idx = fromPoint ? 1 : 0; 395 idx += relativeVisibility ? 2 : 0; 396 397 sprintf(str, ": %s", queryTypeCaptions[idx].c_str()); 398 mQueryTypeInfo->setCaption(str); 399 400 sprintf(str, ": %d", (int)visibleNodes.size()); 401 mQueryVisibleNodesInfo->setCaption(str); 402 403 sprintf(str,": %d", (int)visibleGeometry.size()); 404 mQueryVisibleGeometryInfo->setCaption(str); 405 406 sprintf(str,": %3.3f", averageNodeVis); 407 mQueryNodeVisibilityInfo->setCaption(str); 408 409 sprintf(str,": %3.3f", averageGeometryVis); 410 mQueryGeometryVisibilityInfo->setCaption(str); 411 } 412 catch (...) 413 { 414 // ignore 415 } 416 417 // show the results 418 if (!mShowQueryStats) 419 { 420 mQueryOverlay->show(); 421 mShowQueryStats = true; 422 } 361 423 } 362 424 //----------------------------------------------------------------------- … … 399 461 400 462 it_end = mFrameInfo.end(); 401 for (it = mFrameInfo.begin(); it < it_end; ++it)463 for (it = mFrameInfo.begin(); it < it_end; ++it) 402 464 { 403 465 ofstr << StringConverter::toString((*it).position) << " " … … 422 484 ifstr.getline(line, 256); 423 485 sscanf(line, "%f %f %f %f %f %f %f %f", &info.position.x, &info.position.y, &info.position.z, 424 425 486 &info.orientation.w, &info.orientation.x, &info.orientation.y, &info.orientation.z, 487 &info.timeElapsed); 426 488 427 489 mFrameInfo.push_back(info); … … 447 509 //-- write out stats for recorded walkthrough 448 510 std::stringstream d; 449 d << "Algorithm: " << mCurrentAlgorithmCaptions[mCurrentAlgorithm] << "\n"511 d << "Algorithm: " << currentAlgorithmCaptions[mCurrentAlgorithm] << "\n" 450 512 << "avg. FPS: " << mWindow->getAverageFPS() << "\n" 451 513 << "best FPS: " << mWindow->getBestFPS() << "\n" … … 532 594 void TerrainFrameListener::setAlgorithm(int algorithm) 533 595 { 534 mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]);596 mAlgorithmInfo->setCaption(": " + currentAlgorithmCaptions[mCurrentAlgorithm]); 535 597 mSceneMgr->setOption("Algorithm", &mCurrentAlgorithm); 536 598 } … … 548 610 549 611 // update stats when necessary 550 try { 612 try 613 { 551 614 OverlayElement* guiAvg = OverlayManager::getSingleton().getOverlayElement("Core/AverageFps"); 552 615 OverlayElement* guiCurr = OverlayManager::getSingleton().getOverlayElement("Core/CurrFps"); … … 591 654 mObjectsInfo->setCaption(str); 592 655 } 593 catch (...)594 { 595 656 catch (...) 657 { 658 // ignore 596 659 } 597 660 } … … 787 850 788 851 case KC_LSHIFT: 789 mShiftPressed = !mShiftPressed;852 mShiftPressed = true; 790 853 break; 791 854 //KEY_PRESSED(KC_F3, 0.3, writeFrames()); … … 798 861 { 799 862 // Print camera details 800 mWindow->setDebugText("P: " + StringConverter::toString(mCamera->getDerivedPosition()) + " " +801 863 mWindow->setDebugText("P: " + StringConverter::toString(mCamera->getDerivedPosition()) + 864 " " + "O: " + StringConverter::toString(mCamera->getDerivedOrientation())); 802 865 } 803 866 … … 809 872 void TerrainFrameListener::keyReleased(KeyEvent* e) 810 873 { 874 if (e->getKey() == KC_LSHIFT) 875 { 876 mShiftPressed = false; 877 } 878 811 879 CEGUI::System::getSingleton().injectKeyUp(e->getKey()); 812 880 e->consume(); … … 867 935 bool TerrainFrameListener::processUnbufferedKeyInput(const FrameEvent& evt) 868 936 { 869 /*if (mInputDevice->isKeyDown(KC_ESCAPE)) 870 { 871 return false; 872 }*/ 873 937 bool cursorPressed = false; 938 874 939 /* Move camera forward by keypress. */ 875 940 if (mInputDevice->isKeyDown(KC_UP)) 876 941 { 877 942 mTranslateVector.z = -mMoveScale; 878 }879 943 cursorPressed = true; 944 } 880 945 /* Move camera backward by keypress. */ 881 946 if (mInputDevice->isKeyDown(KC_DOWN)) 882 947 { 883 948 mTranslateVector.z = mMoveScale; 949 cursorPressed = true; 884 950 } 885 951 … … 887 953 { 888 954 mCamNode->yaw(-mRotScale); 955 cursorPressed = true; 889 956 } 890 957 … … 892 959 { 893 960 mCamNode->yaw(mRotScale); 961 cursorPressed = true; 894 962 } 895 963 // visualization camera … … 903 971 } 904 972 973 // show the results 974 if (cursorPressed && mShowQueryStats) 975 { 976 mQueryOverlay->hide(); 977 mShowQueryStats = false; 978 } 905 979 906 980 // Return true to continue rendering -
trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.h
r133 r135 121 121 */ 122 122 void ApplyVisibilityQuery(bool fromPoint, bool relativeVisibility); 123 124 void toggleShowQueryStats(); 123 125 124 126 protected: … … 156 158 OverlayElement *mObjectsInfo; 157 159 OverlayElement *mQueriesIssuedInfo; 160 161 OverlayElement *mQueryTypeInfo; 162 OverlayElement *mQueryVisibleNodesInfo; 163 OverlayElement *mQueryVisibleGeometryInfo; 164 OverlayElement *mQueryVisiblityInfo; 165 OverlayElement *mQueryNodeVisibilityInfo; 166 OverlayElement *mQueryGeometryVisibilityInfo; 158 167 159 168 RayQueryExecutor *mRayQueryExecutor; … … 173 182 bool mShutdownRequested; 174 183 bool mDisplayCameraDetails; 175 184 176 185 Real mVizCameraHeight; 177 186 … … 208 217 Overlay* mHelpOverlay; 209 218 Overlay* mCullStatsOverlay; 219 Overlay* mQueryOverlay; 210 220 211 221 Light *mSunLight; … … 214 224 215 225 bool mShiftPressed; 226 bool mShowQueryStats; 227 216 228 //bool mUseBufferedInputKeys, mUseBufferedInputMouse, mInputTypeSwitchingOn; 217 229 }; -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp
r133 r135 162 162 if (!mTerrainContentGenerator->LoadObjects("objects.out")) 163 163 { 164 // height is restricted to 50, so no objects appear on peaks165 // => there is much occlusion164 // to provide much occlusion, 165 // height is restricted to 50, so no objects appear on peaks 166 166 mTerrainContentGenerator->SetMaxPos(Vector3(3000.0f, 50.0f, 3000.0f)); 167 167 mTerrainContentGenerator->SetOffset(0); -
trunk/VUT/work/ogre_changes/OgreMain/src/OgreSceneManager.cpp
r131 r135 779 779 void SceneManager::_renderScene(Camera* camera, Viewport* vp, bool includeOverlays) 780 780 { 781 LogManager::getSingleton().logMessage("***********RENDER SCENE************"); 782 Root::getSingleton()._setCurrentSceneManager(this); 781 Root::getSingleton()._setCurrentSceneManager(this); 783 782 // Prep Pass for use in debug shadows 784 783 initShadowVolumeMaterials(); … … 4200 4199 void SceneManager::_renderSceneNode(Camera *cam, SceneNode *node, bool leaveTransparentsInQueue) 4201 4200 { 4201 // delete previously rendered objects from renderqueue 4202 _deleteRenderedQueueGroups(leaveTransparentsInQueue); 4203 4202 4204 node->_findVisibleObjects(cam, getRenderQueue(), false, mDisplayNodes, false); 4203 4205 SceneManager::_renderVisibleObjects(); 4204 4205 // delete all rendered objects from renderqueue4206 _deleteRenderedQueueGroups(leaveTransparentsInQueue);4207 4206 } 4208 4207 //----------------------------------------------------------------------- … … 4248 4247 void SceneManager::_renderMovableObject(MovableObject *mov, const bool leaveTransparentsInQueue) 4249 4248 { 4249 // delete previously rendered objects from renderqueue 4250 _deleteRenderedQueueGroups(leaveTransparentsInQueue); 4251 4250 4252 mov->_updateRenderQueue(getRenderQueue()); 4251 4253 SceneManager::_renderVisibleObjects(); 4252 4253 // delete rendered objects from renderqueue4254 //TODO: should be first4255 _deleteRenderedQueueGroups(leaveTransparentsInQueue);4256 4254 } 4257 4255 #endif //GTP_VISIBILITY_MODIFIED_OGRE -
trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreOctree.h
r104 r135 157 157 158 158 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 159 public: 160 /** Returns last visited frame id. */ 161 int lastVisited(void); 162 /** Set to current frame id. 163 @param current frame id. 164 */ 165 void setLastVisited(int frameid); 166 /** Makes this octree become visible / invisble. 167 @param visible Whether this node is to be made visible or invisible 168 */ 169 void setOctreeVisible(bool visible); 170 /** Returns true if this node is marked visible, false otherwise. 171 */ 172 bool isOctreeVisible(void); 173 /** Gets this node's parent (NULL if this is the root). 174 */ 175 Octree *getParent(); 176 /** Frame id when this octree was last rendered. 177 @return last rendered frame id 178 */ 179 int lastRendered(void); 180 /** Sets frame id when this octree was last rendered. 181 @param last rendered frame id 182 */ 183 void setLastRendered(int frameid); 184 /** Returns current depth of octree 185 @return current depth 186 */ 187 int getDepth(); 188 189 protected: 190 191 int mLastRendered; 192 int mLastVisited; 193 bool mVisible; 194 int mDepth; 159 public: 160 /** Returns last visited frame id. */ 161 int lastVisited(void); 162 /** Set to current frame id. 163 @param current frame id. 164 */ 165 void setLastVisited(int frameid); 166 /** Makes this octree become visible / invisble. 167 @param visible Whether this node is to be made visible or invisible 168 */ 169 void setOctreeVisible(bool visible); 170 /** Returns true if this node is marked visible, false otherwise. 171 */ 172 bool isOctreeVisible(void); 173 /** Gets this node's parent (NULL if this is the root). 174 */ 175 Octree *getParent(); 176 /** Frame id when this octree was last rendered. 177 @return last rendered frame id 178 */ 179 int lastRendered(void); 180 /** Sets frame id when this octree was last rendered. 181 @param last rendered frame id 182 */ 183 void setLastRendered(int frameid); 184 /** Returns current depth of octree 185 @return current depth 186 */ 187 int getDepth(); 188 /** Returns real extent of the octree, i.e., the merged extent of the bounding boxes. */ 189 AxisAlignedBox _getWorldAABB(void) const; 190 191 /** Updates bounds of real aabb of octree. */ 192 void _updateBounds(); 193 194 protected: 195 196 /** the real extent of the octree. */ 197 AxisAlignedBox mWorldAABB; 198 199 int mLastRendered; 200 int mLastVisited; 201 bool mVisible; 202 int mDepth; 195 203 196 204 #endif // GTP_VISIBILITY_MODIFIED_OGRE -
trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctree.cpp
r115 r135 142 142 _ref(); 143 143 144 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 145 _updateBounds(); 146 #endif 147 144 148 } 145 149 … … 151 155 //update total counts. 152 156 _unref(); 157 158 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 159 _updateBounds(); 160 #endif 153 161 } 154 162 … … 165 173 mWireBoundingBox = new WireBoundingBox(); 166 174 167 mWireBoundingBox->setupBoundingBox(mBox); 175 //mWireBoundingBox->setupBoundingBox(mBox); 176 mWireBoundingBox->setupBoundingBox(mWorldAABB); 168 177 return mWireBoundingBox; 169 178 } … … 171 180 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 172 181 //----------------------------------------------------------------------- 173 int Octree::lastVisited( void)182 int Octree::lastVisited() 174 183 { 175 184 return mLastVisited; … … 181 190 } 182 191 //----------------------------------------------------------------------- 183 int Octree::lastRendered( void)192 int Octree::lastRendered() 184 193 { 185 194 return mLastRendered; … … 196 205 } 197 206 //----------------------------------------------------------------------- 198 bool Octree::isOctreeVisible( void)207 bool Octree::isOctreeVisible() 199 208 { 200 209 return mVisible; … … 210 219 return mDepth; 211 220 } 221 //----------------------------------------------------------------------- 222 AxisAlignedBox Octree::_getWorldAABB(void) const 223 { 224 return mWorldAABB; 225 } 226 //----------------------------------------------------------------------- 227 void Octree::_updateBounds() 228 { 229 // Reset bounds first 230 mWorldAABB.setNull(); 231 232 // Update bounds from own attached objects 233 NodeList::iterator it, it_end; 234 it_end = mNodes.end(); 235 236 for (it = mNodes.begin(); it != it_end; ++it) 237 { 238 // Merge world bounds of each object 239 mWorldAABB.merge((*it)->_getWorldAABB()); 240 } 241 242 // Merge with children 243 for (int i = 0; i < 2; ++i) 244 { 245 for (int j = 0; j < 2; ++j) 246 { 247 for (int k = 0; k < 2; ++k) 248 { 249 if (mChildren[i][j][k] != 0) 250 { 251 mWorldAABB.merge(mChildren[i][j][k]->_getWorldAABB()); 252 } 253 } 254 } 255 } 256 // recursively update parent bounds 257 if (mParent) 258 { 259 mParent->_updateBounds(); 260 } 261 } 212 262 #endif //GTP_VISIBILITY_MODIFIED_OGRE 213 263 } -
trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctreeSceneManager.cpp
r115 r135 428 428 _addOctreeNode( onode, mOctree ); 429 429 } 430 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 431 else // still update because bounding box may be different 432 { 433 onode -> getOctant() -> _updateBounds(); 434 } 435 #endif // GTP_VISIBILITY_MODIFIED_OGRE 430 436 } 431 437 … … 1172 1178 bool leaveTransparentsInQueue)//, bool useZPassQueue) 1173 1179 { 1180 // delete previously rendered objects from the render queue 1181 _deleteRenderedQueueGroups(leaveTransparentsInQueue); 1182 1174 1183 //Add stuff to be rendered; 1175 1184 NodeList::iterator it = octant->mNodes.begin(); … … 1211 1220 //-- the actual rendering 1212 1221 SceneManager::_renderVisibleObjects(); 1213 // delete all rendered objects from the render queue1214 _deleteRenderedQueueGroups(leaveTransparentsInQueue);1215 1222 } 1216 1223 #endif // GTP_VISIBILITY_MODIFIED_OGRE
Note: See TracChangeset
for help on using the changeset viewer.