Changeset 153 for trunk/VUT/Ogre/src
- Timestamp:
- 07/04/05 03:15:53 (19 years ago)
- Location:
- trunk/VUT/Ogre/src
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/Ogre/src/OgrePlatformQueryManager.cpp
r150 r153 37 37 bool overlayEnabled = mViewport->getOverlaysEnabled(); 38 38 mViewport->setOverlaysEnabled(false); 39 40 //-- render the scene once to update depth buffer 39 41 pfHierarchyInterface->GetSceneManager()->_renderScene(pCam, mViewport, false); 40 42 … … 234 236 mViewport->setCamera(savedCam); 235 237 236 // --- remove duplicates ( happensif an object is on the edge of the viewport)238 // --- remove duplicates (duplicates occur if an object is on the edge of the viewport) 237 239 238 240 // before duplicates can be deleted we have to add up their visibility … … 259 261 } 260 262 261 // really delete duplicates263 // physically delete duplicates 262 264 visibleNodes->erase( std::unique(visibleNodes->begin(), 263 265 visibleNodes->end(), nodeinfo_eq), visibleNodes->end()); … … 284 286 } 285 287 286 // really delete duplicates288 // physically delete duplicates 287 289 visibleGeometry->erase(std::unique(visibleGeometry->begin(), visibleGeometry->end(), 288 290 meshinfo_eq), visibleGeometry->end()); -
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r150 r153 13 13 14 14 //----------------------------------------------------------------------- 15 VisibilityTerrainSceneManager::VisibilityTerrainSceneManager( 16 GtpVisibility::VisibilityManager *visManager):15 VisibilityTerrainSceneManager::VisibilityTerrainSceneManager(GtpVisibility:: 16 VisibilityManager *visManager): 17 17 mVisibilityManager(visManager), 18 mRenderDepthPass(false),19 18 mShowVisualization(false), 20 19 mRenderNodesForViz(false), … … 24 23 mDelayRenderTransparents(true), 25 24 mUseDepthPass(false), 26 mRenderItemBuffer(true), 25 mRenderDepthPass(false), 26 //mUseItemBuffer(false), 27 mUseItemBuffer(true), 28 mRenderItemBuffer(false), 27 29 mCurrentEntityId(0), 28 30 mEnableDepthWrite(true), … … 31 33 { 32 34 mHierarchyInterface = new OctreeHierarchyInterface(this, mDestRenderSystem); 33 mQueryManager = new PlatformQueryManager(mHierarchyInterface, mCurrentViewport);34 35 mVisibilityManager->SetQueryManager(mQueryManager);36 35 37 36 //mDisplayNodes = true; … … 94 93 mHierarchyInterface = NULL; 95 94 } 96 if (mQueryManager)97 {98 delete mQueryManager;99 mQueryManager = NULL;100 }101 95 } 102 96 //----------------------------------------------------------------------- … … 259 253 mIlluminationStage = savedStage; 260 254 } 261 else // the hierarchical culling algorithm 262 { 263 //-- hierarchical culling 255 else // -- the hierarchical culling algorithm 256 { 257 // don't render backgrounds for item buffer 258 if (mUseItemBuffer) 259 { 260 clearSpecialCaseRenderQueues(); 261 getRenderQueue()->clear(); 262 } 263 264 264 // the objects of different layers (e.g., background, scene, 265 265 // overlay) must be identified and rendered one after another … … 272 272 273 273 TerrainSceneManager::_renderVisibleObjects(); 274 274 275 275 276 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 277 // delete previously rendered contenbt 276 278 _deleteRenderedQueueGroups(); 277 279 #endif … … 284 286 285 287 286 //-- set all necessary parameters for hierarchical visibility culling and rendering 288 // set all necessary parameters for 289 // hierarchical visibility culling and rendering 287 290 InitVisibilityCulling(mCameraInProgress); 288 291 289 292 /** 290 293 * the hierarchical culling algorithm 291 * if usingdepth pass: will just find objects and update depth buffer292 * for "delayed" rendering: will render some passes afterwards, e.g. transparents294 * if we use a depth pass: will just find objects and update depth buffer 295 * for "delayed" rendering: will render some passes afterwards, e.g., transparents 293 296 **/ 294 297 … … 302 305 //-- reset parameters 303 306 mRenderDepthPass = false; 307 mRenderItemBuffer = false; 304 308 mSkipTransparents = false; 305 309 mLeavePassesInQueue = 0; 306 310 mShadowTechnique = mSavedShadowTechnique; 307 mRenderItemBuffer = false;311 308 312 309 313 // add visible nodes found by the visibility culling algorithm … … 326 330 TerrainRenderable::setCurrentRenderLevelIndex(levelIdx); 327 331 328 getRenderQueue()->clear();329 330 332 // reset ambient light 331 333 setAmbientLight(savedAmbient); 334 335 getRenderQueue()->clear(); 332 336 //WriteLog(); // write out stats 333 337 } … … 404 408 return true; 405 409 } 406 if (key == " ItemBuffer")407 { 408 m RenderItemBuffer = (*static_cast<const bool *>(val));410 if (key == "UseItemBuffer") 411 { 412 mUseItemBuffer = (*static_cast<const bool *>(val)); 409 413 return true; 410 414 } … … 425 429 } 426 430 //----------------------------------------------------------------------- 427 bool VisibilityTerrainSceneManager::getOptionValues(const String & key, StringVector &refValueList) 431 bool VisibilityTerrainSceneManager::getOptionValues(const String & key, 432 StringVector &refValueList) 428 433 { 429 434 return TerrainSceneManager::getOptionValues( key, refValueList); … … 436 441 } 437 442 //----------------------------------------------------------------------- 438 void VisibilityTerrainSceneManager::setVisibilityManager(GtpVisibility::VisibilityManager *visManager) 443 void VisibilityTerrainSceneManager::setVisibilityManager(GtpVisibility:: 444 VisibilityManager *visManager) 439 445 { 440 446 mVisibilityManager = visManager; … … 634 640 InitItemBufferPass(); // create material for item buffer pass 635 641 642 // reset culling manager stats 643 mVisibilityManager->GetCullingManager()->InitFrame(mVisualizeCulledNodes); 644 636 645 // save shadow technique. It will be reset after hierarchical culling 637 646 mSavedShadowTechnique = mShadowTechnique; 638 647 639 640 mLeavePassesInQueue = 0; 641 648 // render standard solids without shadows during hierarchical culling pass 649 if ((mShadowTechnique == SHADOWTYPE_STENCIL_ADDITIVE) || 650 (mShadowTechnique == SHADOWTYPE_STENCIL_MODULATIVE)) 651 { 652 653 mShadowTechnique = SHADOWTYPE_NONE; 654 } 655 656 // set depth pass flag before rendering 657 mRenderDepthPass = mUseDepthPass; 658 642 659 // item buffer needs full ambient lighting to use item colors as unique id 643 660 if (mUseItemBuffer) … … 649 666 650 667 // set passes which should be stored in render queue 651 // for rendering after hierarchical culling 652 653 if (mShadowTechnique == SHADOWTYPE_STENCIL_ADDITIVE) 654 { 655 // render standard solids without shadows during hierarchical culling pass 656 mShadowTechnique = SHADOWTYPE_NONE; 657 658 if (!mUseDepthPass) 659 { 660 // TODO: remove this because should be processed in first pass 668 // for rendering AFTER hierarchical culling, i.e., passes which need 669 // a special rendering order 670 mLeavePassesInQueue = 0; 671 672 if (!mUseDepthPass || !mUseItemBuffer) 673 { 674 if (mShadowTechnique == SHADOWTYPE_STENCIL_ADDITIVE) 675 { 676 // TODO: remove this pass because it should be processed during hierarchical culling 661 677 mLeavePassesInQueue |= RenderPriorityGroup::SOLID_PASSES_NOSHADOW; 662 678 … … 664 680 mLeavePassesInQueue |= RenderPriorityGroup::SOLID_PASSES_DIFFUSE_SPECULAR; 665 681 mLeavePassesInQueue |= RenderPriorityGroup::TRANSPARENT_PASSES; 666 } 667 } 668 if (mShadowTechnique == SHADOWTYPE_STENCIL_MODULATIVE) 669 { 670 // render standard solids without shadows during hierarchical culling pass 671 mShadowTechnique = SHADOWTYPE_NONE; 672 673 if (!mUseDepthPass) 682 683 // just render ambient stuff 684 mIlluminationStage = IRS_AMBIENT; 685 } 686 687 if (mShadowTechnique == SHADOWTYPE_STENCIL_MODULATIVE) 674 688 { 675 689 mLeavePassesInQueue |= RenderPriorityGroup::SOLID_PASSES_NOSHADOW; 676 690 mLeavePassesInQueue |= RenderPriorityGroup::TRANSPARENT_PASSES; 677 691 } 678 } 679 680 if (mDelayRenderTransparents && (!mUseDepthPass)) 681 { 682 mLeavePassesInQueue |= RenderPriorityGroup::TRANSPARENT_PASSES; 683 } 684 //std::stringstream d; d << "leave passes in queue: " << mLeavePassesInQueue;LogManager::getSingleton().logMessage(d.str()); 692 693 // transparents should be rendered after hierarchical culling to 694 // provide front-to-back ordering 695 if (mDelayRenderTransparents) 696 { 697 mLeavePassesInQueue |= RenderPriorityGroup::TRANSPARENT_PASSES; 698 } 699 } 700 701 // skip rendering transparents in the hierarchical culling 702 // (because they will be rendered afterwards) 703 mSkipTransparents = mUseDepthPass || 704 (mLeavePassesInQueue & RenderPriorityGroup::TRANSPARENT_PASSES); 685 705 686 706 // possible two cameras (one for culling, one for rendering) … … 689 709 mLeavePassesInQueue); 690 710 691 692 // reset culling manager stats 693 mVisibilityManager->GetCullingManager()->InitFrame(mVisualizeCulledNodes); 694 695 // set depth pass flag before rendering 696 mRenderDepthPass = mUseDepthPass; 697 // set flag for skipping transparents in the hierarchical culling pass 698 mSkipTransparents = mUseDepthPass || 699 (mLeavePassesInQueue & RenderPriorityGroup::TRANSPARENT_PASSES); 700 } 701 711 //std::stringstream d; d << "leave passes in queue: " << mLeavePassesInQueue;LogManager::getSingleton().logMessage(d.str()); 712 } 713 //----------------------------------------------------------------------- 714 OctreeHierarchyInterface *VisibilityTerrainSceneManager::GetHierarchyInterface() 715 { 716 return mHierarchyInterface; 717 } 702 718 //----------------------------------------------------------------------- 703 719 /*void VisibilityTerrainSceneManager::renderBasicQueueGroupObjects(RenderQueueGroup* pGroup) 704 720 { 705 // Basic render loop 706 // Iterate through priorities 721 // Basic render loop: Iterate through priorities 707 722 RenderQueueGroup::PriorityMapIterator groupIt = pGroup->getIterator(); 708 723 … … 714 729 pPriorityGrp->sort(mCameraInProgress); 715 730 716 // TODO: render other splid passes for shadows717 // Do solids731 // Do solids 732 // TODO: render other solid passes for shadows 718 733 renderObjects(pPriorityGrp->_getSolidPassesNoShadows(), true); 719 734
Note: See TracChangeset
for help on using the changeset viewer.