Changeset 135 for trunk/VUT/Ogre
- Timestamp:
- 06/16/05 18:13:33 (20 years ago)
- Location:
- trunk/VUT/Ogre
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.