Changeset 254 for trunk/VUT/Ogre/src
- Timestamp:
- 08/26/05 23:24:31 (19 years ago)
- Location:
- trunk/VUT/Ogre/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp
r202 r254 9 9 #include <OgreEntity.h> 10 10 #include <OgreSubEntity.h> 11 11 #include <OgreConfigFile.h> 12 12 13 13 namespace Ogre { … … 24 24 mLeavePassesInQueue(0), 25 25 mDelayRenderTransparents(true), 26 //mDelayRenderTransparents(false), 27 //mUseDepthPass(true), 26 28 mUseDepthPass(false), 27 m RenderDepthPass(false),29 mIsDepthPassPhase(false), 28 30 mUseItemBuffer(false), 29 31 //mUseItemBuffer(true), 30 m RenderItemBuffer(false),32 mIsItemBufferPhase(false), 31 33 mCurrentEntityId(1), 32 34 mEnableDepthWrite(true), … … 44 46 // TODO: set maxdepth to reasonable value 45 47 mMaxDepth = 50; 48 49 //loadVisibilityConfig("GtpVisibility.cfg"); 46 50 } 47 51 //----------------------------------------------------------------------- … … 145 149 { 146 150 // set depth fill pass if we currently do not make an aabb occlusion query 147 Pass *usedPass = (m RenderDepthPass&& !mHierarchyInterface->IsBoundingBoxQuery() ?151 Pass *usedPass = (mIsDepthPassPhase && !mHierarchyInterface->IsBoundingBoxQuery() ? 148 152 mDepthPass : pass); 149 153 … … 152 156 // set illumination stage to NONE so no shadow material is used 153 157 // for depth pass or for occlusion query 154 if (m RenderDepthPass|| mHierarchyInterface->IsBoundingBoxQuery())158 if (mIsDepthPassPhase || mHierarchyInterface->IsBoundingBoxQuery()) 155 159 { 156 160 mIlluminationStage = IRS_NONE; … … 158 162 159 163 //-- set vertex program of current pass in order to set correct depth 160 if (m RenderDepthPass&& mExecuteVertexProgramForAllPasses && pass->hasVertexProgram())164 if (mIsDepthPassPhase && mExecuteVertexProgramForAllPasses && pass->hasVertexProgram()) 161 165 { 162 166 // add vertex program of current pass to depth pass … … 311 315 312 316 //-- reset parameters 313 m RenderDepthPass= false;314 m RenderItemBuffer= false;317 mIsDepthPassPhase = false; 318 mIsItemBufferPhase = false; 315 319 mSkipTransparents = false; 316 320 mIsHierarchicalCulling = false; … … 498 502 { 499 503 // skip all but first pass if we are doing the depth pass 500 if ((m RenderDepthPass || mRenderItemBuffer) && pass->getIndex() > 0)504 if ((mIsDepthPassPhase || mIsItemBufferPhase) && pass->getIndex() > 0) 501 505 { 502 506 return false; … … 507 511 void VisibilityOctreeSceneManager::renderQueueGroupObjects(RenderQueueGroup* pGroup) 508 512 { 509 if (!m RenderItemBuffer)513 if (!mIsItemBufferPhase) 510 514 { 511 515 OctreeSceneManager::renderQueueGroupObjects(pGroup); … … 513 517 } 514 518 515 // ---item buffer519 //-- renders item buffer 516 520 517 521 // Iterate through priorities … … 559 563 } 560 564 561 // 565 //-- TRANSPARENT LOOP: must be handled differently 562 566 563 567 // transparents are treated either as solids or completely discarded … … 637 641 638 642 // set depth pass flag before rendering 639 m RenderDepthPass= mUseDepthPass;643 mIsDepthPassPhase = mUseDepthPass; 640 644 641 645 mIsHierarchicalCulling = true; // during hierarchical culling … … 644 648 if (mUseItemBuffer) 645 649 { 646 m RenderItemBuffer= true;650 mIsItemBufferPhase = true; 647 651 setAmbientLight(ColourValue(1,1,1,1)); 648 652 } … … 739 743 } 740 744 } 741 else 745 else // render the rest of the passes 742 746 { 743 747 OctreeSceneManager::renderAdditiveStencilShadowedQueueGroupObjects(pGroup); 744 745 /*RenderQueueGroup::PriorityMapIterator groupIt = pGroup->getIterator();746 LightList lightList;747 748 while (groupIt.hasMoreElements())749 {750 751 RenderPriorityGroup* pPriorityGrp = groupIt.getNext();752 753 // Sort the queue first754 pPriorityGrp->sort(mCameraInProgress);755 756 // Clear light list757 lightList.clear();758 759 // Now iterate per light760 mIlluminationStage = IRS_PER_LIGHT;761 762 // Iterate over lights, render all volumes to stencil763 LightList::const_iterator li, liend;764 liend = mLightsAffectingFrustum.end();765 766 for (li = mLightsAffectingFrustum.begin(); li != liend; ++li)767 {768 LogManager::getSingleton().logMessage("iterating over lights");769 Light* l = *li;770 // Set light state771 772 if (l->getCastShadows())773 {774 // Clear stencil775 mDestRenderSystem->clearFrameBuffer(FBT_STENCIL);776 renderShadowVolumesToStencil(l, mCameraInProgress);777 // turn stencil check on778 mDestRenderSystem->setStencilCheckEnabled(true);779 // NB we render where the stencil is equal to zero to render lit areas780 mDestRenderSystem->setStencilBufferParams(CMPF_EQUAL, 0);781 }782 783 // render lighting passes for this light784 if (lightList.empty())785 lightList.push_back(l);786 else787 lightList[0] = l;788 OctreeSceneManager::renderObjects(pPriorityGrp->_getSolidPassesDiffuseSpecular(), false, &lightList);789 790 // Reset stencil params791 mDestRenderSystem->setStencilBufferParams();792 mDestRenderSystem->setStencilCheckEnabled(false);793 mDestRenderSystem->_setDepthBufferParams();794 795 }// for each light796 797 // Now render decal passes, no need to set lights as lighting will be disabled798 mIlluminationStage = IRS_DECAL;799 OctreeSceneManager::renderObjects(pPriorityGrp->_getSolidPassesDecal(), false);800 }// for each priority801 802 // reset lighting stage803 mIlluminationStage = IRS_NONE;*/804 748 } 805 749 } … … 828 772 } 829 773 } 830 } // namespace Ogre 774 //------------------------------------------------------------------------- 775 void VisibilityOctreeSceneManager::loadVisibilityConfig(const String& filename) 776 { 777 /// Set up the options 778 ConfigFile config; 779 String val; 780 781 config.load(filename); 782 783 val = config.getSetting("Algorithm"); 784 785 if (!val.empty()) 786 { 787 VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface).setOption("Algorithm", val.c_str()); 788 } 789 790 val = config.getSetting("UseDepthPass"); 791 792 if (!val.empty()) 793 { 794 setOption("UseDepthPass", val.c_str()); 795 } 796 } 797 } // namespace Ogre -
trunk/VUT/Ogre/src/OgreVisibilityOptionsManager.cpp
r187 r254 15 15 if (key == "Algorithm") 16 16 { 17 // delete old queries (not needed for e.g., view frustum culling) 17 18 mHierarchyInterface->DeleteQueries(); 18 19 mVisibilityManager->SetCullingManager(*static_cast<const -
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r202 r254 24 24 mDelayRenderTransparents(true), 25 25 mUseDepthPass(false), 26 m RenderDepthPass(false),26 mIsDepthPassPhase(false), 27 27 mUseItemBuffer(false), 28 28 //mUseItemBuffer(true), 29 m RenderItemBuffer(false),29 mIsItemBufferPhase(false), 30 30 mCurrentEntityId(1), 31 31 mEnableDepthWrite(true), … … 147 147 { 148 148 // TODO: setting vertex program is not efficient 149 //Pass *usedPass = ((m RenderDepthPass&& !pass->hasVertexProgram()) ? mDepthPass : pass);149 //Pass *usedPass = ((mIsDepthPassPhase && !pass->hasVertexProgram()) ? mDepthPass : pass); 150 150 151 151 // set depth fill pass if we currently do not make an aabb occlusion query 152 Pass *usedPass = (m RenderDepthPass&& !mHierarchyInterface->IsBoundingBoxQuery() ?152 Pass *usedPass = (mIsDepthPassPhase && !mHierarchyInterface->IsBoundingBoxQuery() ? 153 153 mDepthPass : pass); 154 154 … … 157 157 // set illumination stage to NONE so no shadow material is used 158 158 // for depth pass or for occlusion query 159 if (m RenderDepthPass|| mHierarchyInterface->IsBoundingBoxQuery())159 if (mIsDepthPassPhase || mHierarchyInterface->IsBoundingBoxQuery()) 160 160 { 161 161 mIlluminationStage = IRS_NONE; … … 163 163 164 164 // --- set vertex program of current pass in order to set correct depth 165 if (mExecuteVertexProgramForAllPasses && m RenderDepthPass&& pass->hasVertexProgram())165 if (mExecuteVertexProgramForAllPasses && mIsDepthPassPhase && pass->hasVertexProgram()) 166 166 { 167 167 // add vertex program of current pass to depth pass … … 315 315 316 316 //-- reset parameters 317 m RenderDepthPass= false;318 m RenderItemBuffer= false;317 mIsDepthPassPhase = false; 318 mIsItemBufferPhase = false; 319 319 mSkipTransparents = false; 320 320 mLeavePassesInQueue = 0; … … 501 501 { 502 502 // skip all but first pass if we are doing the depth pass 503 if ((m RenderDepthPass || mRenderItemBuffer) && pass->getIndex() > 0)503 if ((mIsDepthPassPhase || mIsItemBufferPhase) && pass->getIndex() > 0) 504 504 { 505 505 return false; … … 510 510 void VisibilityTerrainSceneManager::renderQueueGroupObjects(RenderQueueGroup* pGroup) 511 511 { 512 if (!m RenderItemBuffer)512 if (!mIsItemBufferPhase) 513 513 { 514 514 TerrainSceneManager::renderQueueGroupObjects(pGroup); … … 640 640 641 641 // set depth pass flag before rendering 642 m RenderDepthPass= mUseDepthPass;642 mIsDepthPassPhase = mUseDepthPass; 643 643 644 644 // item buffer needs full ambient lighting to use item colors as unique id 645 645 if (mUseItemBuffer) 646 646 { 647 m RenderItemBuffer= true;647 mIsItemBufferPhase = true; 648 648 setAmbientLight(ColourValue(1,1,1,1)); 649 649 }
Note: See TracChangeset
for help on using the changeset viewer.