Changeset 150 for trunk/VUT/Ogre/src
- Timestamp:
- 06/27/05 17:22:08 (19 years ago)
- Location:
- trunk/VUT/Ogre/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/Ogre/src/OgrePlatformQueryManager.cpp
r145 r150 31 31 //-- Render scene to get conservative visibility and fill depth buffer 32 32 33 // c an do const_cast because Camera nochanged in renderScene33 // const_cast allowed because camera is not changed in renderScene 34 34 Camera *pCam = const_cast<Camera *>(&camera); 35 35 36 // disable overlays, reset them later 36 37 bool overlayEnabled = mViewport->getOverlaysEnabled(); 37 38 mViewport->setOverlaysEnabled(false); … … 39 40 40 41 /* 41 Two query lists: 42 We test two to get exact visibility with regard to the current camera and 43 issue all queries at once to avoid starvation & stalls. 42 Two query lists for projected pixels and for visibile pixels: 43 We test queries after a rendering pass 44 to get exact visibility with regard to the current camera. 45 We issue all queries at once to avoid starvation & stalls. 44 46 */ 45 47 GtpVisibility::QueryList queryList[2]; … … 100 102 // this option must be provided by the scene manager 101 103 pfHierarchyInterface->GetSceneManager()->setOption("DepthWrite", &enableDepthWrite); 102 104 // reset old overlay status 103 105 mViewport->setOverlaysEnabled(overlayEnabled); 104 106 105 107 //---- collect results 106 107 std::pair<InfoContainer<GtpVisibility::NodeInfo>::iterator, bool> insertNode;108 std::pair<InfoContainer<GtpVisibility::MeshInfo>::iterator, bool> insertGeom;109 110 108 GtpVisibility::QueryList::iterator visQueryIt, projQueryIt; 111 109 … … 236 234 mViewport->setCamera(savedCam); 237 235 238 // --- single out duplicates239 240 // before duplicates can be deleted we have to add up visibility236 // --- remove duplicates (happens if an object is on the edge of the viewport) 237 238 // before duplicates can be deleted we have to add up their visibility 241 239 242 240 // --- visible nodes … … 261 259 } 262 260 263 // nowdelete duplicates261 // really delete duplicates 264 262 visibleNodes->erase( std::unique(visibleNodes->begin(), 265 263 visibleNodes->end(), nodeinfo_eq), visibleNodes->end()); … … 286 284 } 287 285 288 // nowdelete duplicates286 // really delete duplicates 289 287 visibleGeometry->erase(std::unique(visibleGeometry->begin(), visibleGeometry->end(), 290 288 meshinfo_eq), visibleGeometry->end()); -
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r149 r150 78 78 mItemBufferPass->setDepthWriteEnabled(true); 79 79 mItemBufferPass->setLightingEnabled(true); 80 //mItemBufferPass->setLightingEnabled(false); 80 81 } 81 82 else … … 83 84 mItemBufferPass = itemBufferMat->getTechnique(0)->getPass(0); 84 85 } 85 mItemBufferPass->setAmbient(1, 1, 0);86 //mItemBufferPass->setAmbient(1, 1, 0); 86 87 } 87 88 //----------------------------------------------------------------------- … … 213 214 void VisibilityTerrainSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters) 214 215 { 215 // needs full ambient lighting for item colors to be exact216 //if (mRenderItemBuffer) {setAmbientLight(ColourValue(1,1,1,1));}217 218 216 //-- show visible scene nodes and octree bounding boxes from last frame 219 217 if (mShowVisualization) … … 244 242 void VisibilityTerrainSceneManager::_renderVisibleObjects() 245 243 { 244 ColourValue savedAmbient = mAmbientLight; 245 246 246 // visualization or shadow pass: apply standard rendering 247 247 if (mShowVisualization || (mShadowTechnique == SHADOWTYPE_TEXTURE_MODULATIVE && … … 305 305 mLeavePassesInQueue = 0; 306 306 mShadowTechnique = mSavedShadowTechnique; 307 307 mRenderItemBuffer = false; 308 308 309 309 // add visible nodes found by the visibility culling algorithm … … 327 327 328 328 getRenderQueue()->clear(); 329 330 // reset ambient light 331 setAmbientLight(savedAmbient); 329 332 //WriteLog(); // write out stats 330 333 } … … 399 402 { 400 403 mEnableDepthWrite = (*static_cast<const bool *>(val)); 404 return true; 405 } 406 if (key == "ItemBuffer") 407 { 408 mRenderItemBuffer = (*static_cast<const bool *>(val)); 401 409 return true; 402 410 } … … 531 539 532 540 // ----- TRANSPARENT LOOP: must be handled differently 533 // although we don't really care about transparents for the item buffer534 541 // TODO: HOW TO HANDLE OCCLUDED OBJECTS ???? 535 542 RenderPriorityGroup::TransparentRenderablePassList … … 551 558 { 552 559 static LightList nullLightList; 553 554 Real col = (Real)rend->getId() / (Real)mCurrentEntityId; 555 556 mItemBufferPass->setAmbient(ColourValue(0, col, 0)); 557 //mItemBufferPass->setDiffuse(ColourValue(0, col, 0)); 558 //mItemBufferPass->setSpecular(ColourValue(0, col, 0)); 560 561 int col[4]; 562 563 col[0] = (rend->getId() >> 16) & 255; 564 col[1] = (rend->getId() >> 8) & 255; 565 col[2] = rend->getId() & 255; 566 col[3] = 255; 567 568 //mDestRenderSystem->setColour(col[0], col[1], col[2], col[3]); 559 569 570 mItemBufferPass->setAmbient(ColourValue(col[0] / 255.0f, 571 col[1] / 255.0f, 572 col[2] / 255.0f, 1)); 573 560 574 // set vertex program of current pass 561 575 if (pass->hasVertexProgram()) … … 581 595 //Pass *usedPass = setPass(pass); 582 596 583 std::stringstream d; d << "item buffer id: " << rend->getId() << ", col: " << col; 584 LogManager::getSingleton().logMessage(d.str()); 597 if (rend->getId() > 0) 598 { 599 std::stringstream d; d << "item buffer id: " << rend->getId() << ", col: " << col[0] << 600 " " << col[1] << " " << col[2] << " " << col[3]; 601 LogManager::getSingleton().logMessage(d.str()); 602 } 585 603 586 604 // Render a single object, this will set up auto params if required 587 605 renderSingleObject(rend, usedPass, false, &nullLightList); 606 607 // reset colour 608 //mDestRenderSystem->setColour(255, 255, 255, 255); 588 609 } 589 610 //----------------------------------------------------------------------- … … 600 621 for (int i = 0; i < (int)ent->getNumSubEntities(); ++i) 601 622 { 602 ent->getSubEntity(i)->setId(mCurrentEntityId ++); 603 } 623 ent->getSubEntity(i)->setId(mCurrentEntityId); 624 } 625 626 ++ mCurrentEntityId; 604 627 605 628 return ent; … … 615 638 616 639 640 mLeavePassesInQueue = 0; 641 642 // item buffer needs full ambient lighting to use item colors as unique id 643 if (mUseItemBuffer) 644 { 645 mRenderItemBuffer = true; 646 setAmbientLight(ColourValue(1,1,1,1)); 647 } 648 649 617 650 // set passes which should be stored in render queue 618 651 // for rendering after hierarchical culling 619 mLeavePassesInQueue = 0; 620 652 621 653 if (mShadowTechnique == SHADOWTYPE_STENCIL_ADDITIVE) 622 654 { … … 662 694 663 695 // set depth pass flag before rendering 664 mRenderDepthPass = mUseDepthPass; 665 696 mRenderDepthPass = mUseDepthPass; 666 697 // set flag for skipping transparents in the hierarchical culling pass 667 698 mSkipTransparents = mUseDepthPass ||
Note: See TracChangeset
for help on using the changeset viewer.