- Timestamp:
- 05/04/06 18:26:23 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp
r868 r897 10 10 #include <OgreEntity.h> 11 11 #include <OgreSubEntity.h> 12 #include <OgreMaterialManager.h> 12 13 #include <OgreIteratorWrappers.h> 13 14 #include "VspBspTree.h" … … 22 23 23 24 //----------------------------------------------------------------------- 24 OcclusionCullingSceneManager::OcclusionCullingSceneManager( 25 GtpVisibility::VisibilityManager *visManager): 26 TerrainSceneManager( ),25 OcclusionCullingSceneManager::OcclusionCullingSceneManager(const String& name, 26 GtpVisibility::VisibilityManager *visManager): 27 TerrainSceneManager(name), 27 28 mVisibilityManager(visManager), 28 29 mShowVisualization(false), … … 35 36 mIsDepthPassPhase(false), 36 37 mUseItemBuffer(false), 38 //mUseItemBuffer(true), 37 39 mIsItemBufferPhase(false), 38 40 mCurrentEntityId(1), … … 105 107 //mItemBufferPass->setAmbient(1, 1, 0); 106 108 } 109 //------------------------------------------------------------------------- 110 void OcclusionCullingSceneManager::setWorldGeometry( DataStreamPtr& stream, const String& typeName ) 111 { 112 // Clear out any existing world resources (if not default) 113 if (ResourceGroupManager::getSingleton().getWorldResourceGroupName() != 114 ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME) 115 { 116 ResourceGroupManager::getSingleton().clearResourceGroup( 117 ResourceGroupManager::getSingleton().getWorldResourceGroupName()); 118 } 119 destroyLevelIndexes(); 120 mTerrainPages.clear(); 121 // Load the configuration 122 loadConfig( stream ); 123 initLevelIndexes(); 124 125 // Resize the octree, allow for 1 page for now 126 float max_x = mOptions.scale.x * mOptions.pageSize; 127 float max_y = mOptions.scale.y; 128 float max_z = mOptions.scale.z * mOptions.pageSize; 129 130 float maxAxis = std::max(max_x, max_y); 131 maxAxis = std::max(maxAxis, max_z); 132 resize( AxisAlignedBox( 0, 0, 0, maxAxis, maxAxis, maxAxis ) ); 133 134 setupTerrainMaterial(); 135 136 setupTerrainPages(); 137 138 } 139 107 140 //----------------------------------------------------------------------- 108 141 void OcclusionCullingSceneManager::PrepareVisualization(Camera *cam) … … 157 190 } 158 191 //----------------------------------------------------------------------- 159 Pass *OcclusionCullingSceneManager::setPass(Pass* pass)192 const Pass *OcclusionCullingSceneManager::_setPass(Pass* pass) 160 193 { 161 194 if (NORMAL_RENDER_HACK) 162 195 { 163 return SceneManager:: setPass(pass);196 return SceneManager::_setPass(pass); 164 197 } 165 198 … … 217 250 218 251 //-- set actual pass here 219 Pass *result = SceneManager::setPass(usedPass);252 const Pass *result = SceneManager::_setPass(usedPass); 220 253 221 254 … … 232 265 } 233 266 //----------------------------------------------------------------------- 234 void OcclusionCullingSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters) 267 void OcclusionCullingSceneManager::_findVisibleObjects(Camera* cam, 268 bool onlyShadowCasters) 235 269 { 236 270 if (NORMAL_RENDER_HACK) … … 335 369 addSpecialCaseRenderQueue(RENDER_QUEUE_SKIES_LATE); 336 370 addSpecialCaseRenderQueue(RENDER_QUEUE_OVERLAY); 337 371 338 372 // exclude this queues from hierarchical rendering 339 373 setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE); … … 343 377 InitVisibilityCulling(mCameraInProgress); 344 378 345 379 346 380 /** 347 381 * the hierarchical culling algorithm … … 366 400 367 401 mLeavePassesInQueue = 0; 368 402 369 403 #if 1 370 404 // add visible nodes found by the visibility culling algorithm … … 495 529 if (useArbQueries) 496 530 { 497 mHierarchyInterface-> DeleteQueries();531 mHierarchyInterface->ResetQueries(); 498 532 mDestRenderSystem->setConfigOption("ArbQueries", "Yes"); 499 533 } 500 534 else 501 535 { 502 mHierarchyInterface-> DeleteQueries();536 mHierarchyInterface->ResetQueries(); 503 537 mDestRenderSystem->setConfigOption("ArbQueries", "No"); 504 538 } 505 539 } 506 507 540 return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 508 541 setOption(key, val) || TerrainSceneManager::setOption(key, val); … … 564 597 //----------------------------------------------------------------------- 565 598 void OcclusionCullingSceneManager::renderObjects( 566 const RenderPriorityGroup::TransparentRenderablePassList& objs, 599 const QueuedRenderableCollection& objs, 600 QueuedRenderableCollection::OrganisationMode om, 567 601 bool doLightIteration, const LightList* manualLightList) 568 602 { … … 571 605 if (NORMAL_RENDER_HACK || !mSkipTransparents) 572 606 { 573 OctreeSceneManager::renderObjects(objs, doLightIteration, manualLightList);607 OctreeSceneManager::renderObjects(objs, om, doLightIteration, manualLightList); 574 608 } 575 609 } … … 596 630 } 597 631 //----------------------------------------------------------------------- 598 void OcclusionCullingSceneManager::renderQueueGroupObjects(RenderQueueGroup* pGroup) 632 void OcclusionCullingSceneManager::_renderQueueGroupObjects(RenderQueueGroup* pGroup, 633 QueuedRenderableCollection::OrganisationMode om) 599 634 { 600 635 if (NORMAL_RENDER_HACK || !mIsItemBufferPhase) 601 636 { 602 TerrainSceneManager:: renderQueueGroupObjects(pGroup);637 TerrainSceneManager::_renderQueueGroupObjects(pGroup, om); 603 638 return; 604 639 } 605 640 #ifdef ITEM_BUFFER 641 //-- item buffer 606 642 //-- item buffer: render objects using false colors 607 643 … … 613 649 RenderItemBuffer(groupIt.getNext()); 614 650 } 615 } 651 #endif // ITEM_BUFFER 652 } 653 #ifdef ITEM_BUFFER 616 654 //----------------------------------------------------------------------- 617 655 void OcclusionCullingSceneManager::RenderItemBuffer(RenderPriorityGroup* pGroup) 618 656 { 619 657 // Do solids 620 RenderPriorityGroup::SolidRenderablePassMap solidObjs = pGroup->_getSolidPasses();658 QueuedRenderableCollection solidObjs = pGroup->getSolidsBasic();//msz 621 659 622 660 // ----- SOLIDS LOOP ----- … … 658 696 if (mRenderTransparentsForItemBuffer) 659 697 { 660 RenderPriorityGroup::TransparentRenderablePassList transpObjs = 661 pGroup->_getTransparentPasses(); 698 QueuedRenderableCollection transpObjs = pGroup->getTransparents(); //msz 662 699 RenderPriorityGroup::TransparentRenderablePassList::const_iterator 663 700 itrans, itransend; … … 713 750 } 714 751 715 Pass *usedPass =setPass(mItemBufferPass);752 const Pass *usedPass = _setPass(mItemBufferPass); 716 753 717 754 … … 719 756 renderSingleObject(rend, usedPass, false, &nullLightList); 720 757 } 758 #endif // ITEM_BUFFER 721 759 //----------------------------------------------------------------------- 722 760 GtpVisibility::VisibilityManager *OcclusionCullingSceneManager::GetVisibilityManager() … … 749 787 mLeavePassesInQueue = 0; 750 788 751 if (!mUseDepthPass && !mUseItemBuffer) 789 // if we have the depth pass or use an item buffer, no passes are left in the queue 790 if (1 && !mUseDepthPass && !mUseItemBuffer) 752 791 { 753 792 if (mShadowTechnique == SHADOWTYPE_STENCIL_ADDITIVE) … … 761 800 762 801 // just render ambient stuff 763 mIlluminationStage = IRS_AMBIENT;764 getRenderQueue()->setSplitPassesByLightingType(true);802 /*** msz: no more IRS_AMBIENT, see OgreSceneManager.h ***/ 803 // mIlluminationStage = IRS_AMBIENT; 765 804 } 766 805 … … 820 859 } 821 860 //----------------------------------------------------------------------- 822 void OcclusionCullingSceneManager::renderAdditiveStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup) 861 void OcclusionCullingSceneManager::renderAdditiveStencilShadowedQueueGroupObjects( 862 RenderQueueGroup* pGroup, QueuedRenderableCollection::OrganisationMode om) 823 863 { 824 864 // only render solid passes during hierarchical culling … … 839 879 840 880 // Render all the ambient passes first, no light iteration, no lights 841 mIlluminationStage = IRS_AMBIENT; 842 843 OctreeSceneManager::renderObjects(pPriorityGrp->_getSolidPasses(), false, &lightList); 881 /*** msz: no more IRS_AMBIENT, see OgreSceneManager.h ***/ 882 // mIlluminationStage = IRS_AMBIENT; 883 884 OctreeSceneManager::renderObjects(pPriorityGrp->getSolidsBasic(), om, false, &lightList); 844 885 // Also render any objects which have receive shadows disabled 845 OctreeSceneManager::renderObjects(pPriorityGrp-> _getSolidPassesNoShadow(), true);886 OctreeSceneManager::renderObjects(pPriorityGrp->getSolidsNoShadowReceive(), om, true); 846 887 } 847 888 } 848 889 else 849 890 { 850 OctreeSceneManager::renderAdditiveStencilShadowedQueueGroupObjects(pGroup); 851 } 852 } 853 //----------------------------------------------------------------------- 854 void OcclusionCullingSceneManager::renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup) 891 OctreeSceneManager::renderAdditiveStencilShadowedQueueGroupObjects(pGroup, om); 892 } 893 } 894 //----------------------------------------------------------------------- 895 void OcclusionCullingSceneManager::renderModulativeStencilShadowedQueueGroupObjects( 896 RenderQueueGroup* pGroup, QueuedRenderableCollection::OrganisationMode om) 855 897 { 856 898 if (mIsHierarchicalCulling) … … 867 909 868 910 // Do (shadowable) solids 869 OctreeSceneManager::renderObjects(pPriorityGrp-> _getSolidPasses(), true);911 OctreeSceneManager::renderObjects(pPriorityGrp->getSolidsBasic(), om, true); 870 912 } 871 913 } 872 914 else 873 915 { 874 SceneManager::renderModulativeStencilShadowedQueueGroupObjects(pGroup );916 SceneManager::renderModulativeStencilShadowedQueueGroupObjects(pGroup, om); 875 917 } 876 }877 //-------------------------------------------------------------------------878 void OcclusionCullingSceneManager::setWorldGeometry( const String& filename )879 {880 // Clear out any existing world resources (if not default)881 if (ResourceGroupManager::getSingleton().getWorldResourceGroupName() !=882 ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME)883 {884 ResourceGroupManager::getSingleton().clearResourceGroup(885 ResourceGroupManager::getSingleton().getWorldResourceGroupName());886 }887 mTerrainPages.clear();888 // Load the configuration889 loadConfig(filename);890 891 // Resize the octree, allow for 1 page for now892 float max_x = mOptions.scale.x * mOptions.pageSize;893 float max_y = mOptions.scale.y;894 float max_z = mOptions.scale.z * mOptions.pageSize;895 896 float maxAxis = std::max(max_x, max_y);897 maxAxis = std::max(maxAxis, max_z);898 resize( AxisAlignedBox( 0, 0, 0, maxAxis, maxAxis, maxAxis ) );899 900 setupTerrainMaterial();901 setupTerrainPages();902 918 } 903 919
Note: See TracChangeset
for help on using the changeset viewer.