Changeset 187 for trunk/VUT/Ogre
- Timestamp:
- 07/31/05 11:16:09 (19 years ago)
- Location:
- trunk/VUT/Ogre
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/Ogre/include/OgrePlatformHierarchyInterface.h
r175 r187 108 108 GtpVisibility::OcclusionQuery *IssuePatchOcclusionQuery(GtpVisibility::Patch *patch); 109 109 110 /** Deletes all occlusion queries. 111 */ 112 void DeleteQueries(); 113 110 114 protected: 111 115 /** Renders the given geometry … … 120 124 */ 121 125 void CreateNodeVizMaterials(); 122 123 /** Deletes all occlusion queries.124 */125 void DeleteQueries();126 126 127 127 /** Returns pointer to current renderable bounding box geometry. -
trunk/VUT/Ogre/include/OgreVisibilityOctreeSceneManager.h
r159 r187 83 83 OctreeHierarchyInterface *GetHierarchyInterface(); 84 84 85 void renderAdditiveStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup); 86 void renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup); 85 87 86 88 protected: … … 146 148 /// Always execute the vertex program of a pass, e.g., for the depth pass or item buffer 147 149 bool mExecuteVertexProgramForAllPasses; 150 151 bool mIsHierarchicalCulling; 148 152 }; 149 153 -
trunk/VUT/Ogre/include/OgreVisibilityOptionsManager.h
r130 r187 6 6 #include <OgreStringVector.h> 7 7 #include "VisibilityManager.h" 8 #include " HierarchyInterface.h"8 #include "OgrePlatformHierarchyInterface.h" 9 9 10 10 … … 25 25 */ 26 26 VisibilityOptionsManager(GtpVisibility::VisibilityManager *visManager, 27 GtpVisibility::HierarchyInterface *hierarchyInterface);27 PlatformHierarchyInterface *hierarchyInterface); 28 28 29 29 /** Sets the given option for the scene traverser. … … 42 42 protected: 43 43 GtpVisibility::VisibilityManager *mVisibilityManager; 44 GtpVisibility::HierarchyInterface *mHierarchyInterface;44 PlatformHierarchyInterface *mHierarchyInterface; 45 45 }; 46 46 -
trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp
r183 r187 68 68 DeleteQueries(); 69 69 70 if (mSolidBoundingBox) 71 delete mSolidBoundingBox; 70 OGRE_DELETE(mSolidBoundingBox); 72 71 } 73 72 //----------------------------------------------------------------------- 74 73 void PlatformHierarchyInterface::DeleteQueries() 75 74 { 76 for (int i=0; i < (int)mOcclusionQueries.size(); ++i) 77 delete mOcclusionQueries[i]; 78 79 mOcclusionQueries.clear(); 75 for (int i = 0; i < (int)mOcclusionQueries.size(); ++ i) 76 OGRE_DELETE(mOcclusionQueries[i]); 77 78 mCurrentTestIdx = 0; 79 mOcclusionQueries.clear(); 80 80 } 81 81 //----------------------------------------------------------------------- -
trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp
r175 r187 33 33 mSkipTransparents(false), 34 34 mSavedShadowTechnique(SHADOWTYPE_NONE), 35 mRenderTransparentsForItemBuffer(false), 36 mExecuteVertexProgramForAllPasses(false) 35 mRenderTransparentsForItemBuffer(true), 36 mExecuteVertexProgramForAllPasses(true), 37 mIsHierarchicalCulling(false) 37 38 { 38 39 mHierarchyInterface = new OctreeHierarchyInterface(this, mDestRenderSystem); … … 318 319 mRenderItemBuffer = false; 319 320 mSkipTransparents = false; 321 mIsHierarchicalCulling = false; 322 320 323 mLeavePassesInQueue = 0; 321 324 mShadowTechnique = mSavedShadowTechnique; … … 342 345 343 346 getRenderQueue()->clear(); // finally clear render queue 347 OGRE_DELETE(mRenderQueue); // HACK: should be cleared before... 344 348 //WriteLog(); // write out stats 345 349 } … … 422 426 return true; 423 427 } 424 428 if (key == "NodeVizScale") 429 { 430 OctreeNode::setVizScale(*static_cast<const float *>(val)); 431 return true; 432 } 425 433 return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 426 434 setOption(key, val) || OctreeSceneManager::setOption(key, val); … … 639 647 640 648 // render standard solids without shadows during hierarchical culling pass 641 if ((mShadowTechnique == SHADOWTYPE_STENCIL_ADDITIVE) ||649 /*if ((mShadowTechnique == SHADOWTYPE_STENCIL_ADDITIVE) || 642 650 (mShadowTechnique == SHADOWTYPE_STENCIL_MODULATIVE)) 643 651 { 644 652 mShadowTechnique = SHADOWTYPE_NONE; 645 } 653 }*/ 646 654 647 655 // set depth pass flag before rendering 648 656 mRenderDepthPass = mUseDepthPass; 657 658 mIsHierarchicalCulling = true; // during hierarchical culling 649 659 650 660 // item buffer needs full ambient lighting to use item colors as unique id … … 662 672 mLeavePassesInQueue = 0; 663 673 664 if (!mUseDepthPass ||!mUseItemBuffer)665 { 666 if (mS hadowTechnique == SHADOWTYPE_STENCIL_ADDITIVE)674 if (!mUseDepthPass && !mUseItemBuffer) 675 { 676 if (mSavedShadowTechnique == SHADOWTYPE_STENCIL_ADDITIVE) 667 677 { 668 678 // TODO: remove this pass because it should be processed during hierarchical culling 669 mLeavePassesInQueue |= RenderPriorityGroup::SOLID_PASSES_NOSHADOW;679 //mLeavePassesInQueue |= RenderPriorityGroup::SOLID_PASSES_NOSHADOW; 670 680 671 681 mLeavePassesInQueue |= RenderPriorityGroup::SOLID_PASSES_DECAL; … … 675 685 // just render ambient passes 676 686 mIlluminationStage = IRS_AMBIENT; 677 } 678 679 if (mShadowTechnique == SHADOWTYPE_STENCIL_MODULATIVE) 687 getRenderQueue()->setSplitPassesByLightingType(true); 688 } 689 690 if (mSavedShadowTechnique == SHADOWTYPE_STENCIL_MODULATIVE) 680 691 { 681 692 mLeavePassesInQueue |= RenderPriorityGroup::SOLID_PASSES_NOSHADOW; … … 712 723 } 713 724 //----------------------------------------------------------------------- 714 /*void VisibilityOctreeSceneManager::renderBasicQueueGroupObjects(RenderQueueGroup* pGroup) 715 { 716 // Basic render loop: Iterate through priorities 717 RenderQueueGroup::PriorityMapIterator groupIt = pGroup->getIterator(); 718 719 while (groupIt.hasMoreElements()) 720 { 721 RenderPriorityGroup* pPriorityGrp = groupIt.getNext(); 722 723 // Sort the queue first 724 pPriorityGrp->sort(mCameraInProgress); 725 726 // Do solids 727 // TODO: render other solid passes for shadows 728 renderObjects(pPriorityGrp->_getSolidPassesNoShadows(), true); 729 730 // do solid passes no shadows if addititive stencil shadows 731 if (mSavedShadowTechnique == SHADOWTYPE_STENCIL_ADDITIVE) 732 renderObjects(pPriorityGrp->_getSolidPassesNoShadows(), true); 725 void VisibilityOctreeSceneManager::renderAdditiveStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup) 726 { 727 // only render solid passes during hierarchical culling 728 if (mIsHierarchicalCulling) 729 { 730 RenderQueueGroup::PriorityMapIterator groupIt = pGroup->getIterator(); 731 LightList lightList; 732 733 while (groupIt.hasMoreElements()) 734 { 735 RenderPriorityGroup* pPriorityGrp = groupIt.getNext(); 736 737 // Sort the queue first 738 pPriorityGrp->sort(mCameraInProgress); 739 740 // Clear light list 741 lightList.clear(); 742 743 // Render all the ambient passes first, no light iteration, no lights 744 mIlluminationStage = IRS_AMBIENT; 745 746 OctreeSceneManager::renderObjects(pPriorityGrp->_getSolidPasses(), false, &lightList); 747 // Also render any objects which have receive shadows disabled 748 OctreeSceneManager::renderObjects(pPriorityGrp->_getSolidPassesNoShadow(), true); 733 749 734 // Do transparents 735 renderObjects(pPriorityGrp->_getTransparentPasses(), true); 736 737 738 }// for each priority 739 }*/ 750 /*std::stringstream d; 751 d << " solid size: " << (int)pPriorityGrp->_getSolidPasses().size() 752 << " solid no shadow size: " << (int)pPriorityGrp->_getSolidPassesNoShadow().size() 753 << "difspec size: " << (int)pPriorityGrp->_getSolidPassesDiffuseSpecular().size() 754 << " decal size: " << (int)pPriorityGrp->_getSolidPassesDecal().size(); 755 LogManager::getSingleton().logMessage(d.str());*/ 756 } 757 } 758 else 759 { 760 OctreeSceneManager::renderAdditiveStencilShadowedQueueGroupObjects(pGroup); 761 762 /*RenderQueueGroup::PriorityMapIterator groupIt = pGroup->getIterator(); 763 LightList lightList; 764 765 while (groupIt.hasMoreElements()) 766 { 767 768 RenderPriorityGroup* pPriorityGrp = groupIt.getNext(); 769 770 // Sort the queue first 771 pPriorityGrp->sort(mCameraInProgress); 772 773 // Clear light list 774 lightList.clear(); 775 776 // Now iterate per light 777 mIlluminationStage = IRS_PER_LIGHT; 778 779 // Iterate over lights, render all volumes to stencil 780 LightList::const_iterator li, liend; 781 liend = mLightsAffectingFrustum.end(); 782 783 for (li = mLightsAffectingFrustum.begin(); li != liend; ++li) 784 { 785 LogManager::getSingleton().logMessage("iterating over lights"); 786 Light* l = *li; 787 // Set light state 788 789 if (l->getCastShadows()) 790 { 791 // Clear stencil 792 mDestRenderSystem->clearFrameBuffer(FBT_STENCIL); 793 renderShadowVolumesToStencil(l, mCameraInProgress); 794 // turn stencil check on 795 mDestRenderSystem->setStencilCheckEnabled(true); 796 // NB we render where the stencil is equal to zero to render lit areas 797 mDestRenderSystem->setStencilBufferParams(CMPF_EQUAL, 0); 798 } 799 800 // render lighting passes for this light 801 if (lightList.empty()) 802 lightList.push_back(l); 803 else 804 lightList[0] = l; 805 OctreeSceneManager::renderObjects(pPriorityGrp->_getSolidPassesDiffuseSpecular(), false, &lightList); 806 807 // Reset stencil params 808 mDestRenderSystem->setStencilBufferParams(); 809 mDestRenderSystem->setStencilCheckEnabled(false); 810 mDestRenderSystem->_setDepthBufferParams(); 811 812 }// for each light 813 814 // Now render decal passes, no need to set lights as lighting will be disabled 815 mIlluminationStage = IRS_DECAL; 816 OctreeSceneManager::renderObjects(pPriorityGrp->_getSolidPassesDecal(), false); 817 }// for each priority 818 819 // reset lighting stage 820 mIlluminationStage = IRS_NONE;*/ 821 } 822 } 823 //----------------------------------------------------------------------- 824 void VisibilityOctreeSceneManager::renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup) 825 { 826 if (mIsHierarchicalCulling) 827 { 828 // Iterate through priorities 829 RenderQueueGroup::PriorityMapIterator groupIt = pGroup->getIterator(); 830 831 while (groupIt.hasMoreElements()) 832 { 833 RenderPriorityGroup* pPriorityGrp = groupIt.getNext(); 834 835 // Sort the queue first 836 pPriorityGrp->sort(mCameraInProgress); 837 838 // Do (shadowable) solids 839 OctreeSceneManager::renderObjects(pPriorityGrp->_getSolidPasses(), true); 840 } 841 } 842 else 843 { 844 SceneManager::renderModulativeStencilShadowedQueueGroupObjects(pGroup); 845 } 846 } 740 847 } // namespace Ogre -
trunk/VUT/Ogre/src/OgreVisibilityOptionsManager.cpp
r155 r187 4 4 //----------------------------------------------------------------------- 5 5 VisibilityOptionsManager::VisibilityOptionsManager( 6 GtpVisibility::VisibilityManager *visManager,7 GtpVisibility::HierarchyInterface *hierarchyInterface):6 GtpVisibility::VisibilityManager *visManager, 7 PlatformHierarchyInterface *hierarchyInterface): 8 8 mVisibilityManager(visManager), 9 9 mHierarchyInterface(hierarchyInterface) … … 11 11 } 12 12 //----------------------------------------------------------------------- 13 bool VisibilityOptionsManager::setOption( const String & key, const void * val)13 bool VisibilityOptionsManager::setOption(const String & key, const void * val) 14 14 { 15 15 if (key == "Algorithm") 16 16 { 17 mHierarchyInterface->DeleteQueries(); 17 18 mVisibilityManager->SetCullingManager(*static_cast<const 18 19 GtpVisibility::VisibilityEnvironment::CullingManagerType *>(val)); -
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r175 r187 32 32 mSkipTransparents(false), 33 33 mSavedShadowTechnique(SHADOWTYPE_NONE), 34 mRenderTransparentsForItemBuffer( false),35 mExecuteVertexProgramForAllPasses( false)34 mRenderTransparentsForItemBuffer(true), 35 mExecuteVertexProgramForAllPasses(true) 36 36 { 37 37 mHierarchyInterface = new OctreeHierarchyInterface(this, mDestRenderSystem); 38 38 39 //mDisplayNodes = true;//mShowBoundingBoxes = true;//mShowBoxes = true; 39 //mDisplayNodes = true; 40 //mShowBoundingBoxes = true; 41 //mShowBoxes = true; 40 42 41 43 // TODO: set maxdepth to reasonable value … … 209 211 } 210 212 //----------------------------------------------------------------------- 211 void VisibilityTerrainSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters) 213 void VisibilityTerrainSceneManager::_findVisibleObjects(Camera* cam, 214 bool onlyShadowCasters) 212 215 { 213 216 //-- show visible scene nodes and octree bounding boxes from last frame … … 345 348 346 349 getRenderQueue()->clear(); // finally clear render queue 350 OGRE_DELETE(mRenderQueue); // HACK: should be cleared before... 347 351 //WriteLog(); // write out stats 348 352 } … … 423 427 { 424 428 mRenderTransparentsForItemBuffer = (*static_cast<const bool *>(val)); 429 return true; 430 } 431 if (key == "NodeVizScale") 432 { 433 OctreeNode::setVizScale(*static_cast<const float *>(val)); 425 434 return true; 426 435 } … … 663 672 if (!mUseDepthPass || !mUseItemBuffer) 664 673 { 665 if (mS hadowTechnique == SHADOWTYPE_STENCIL_ADDITIVE)674 if (mSavedShadowTechnique == SHADOWTYPE_STENCIL_ADDITIVE) 666 675 { 667 676 // TODO: remove this pass because it should be processed during hierarchical culling 677 //mLeavePassesInQueue |= RenderPriorityGroup::SOLID_PASSES; 668 678 mLeavePassesInQueue |= RenderPriorityGroup::SOLID_PASSES_NOSHADOW; 669 679 … … 676 686 } 677 687 678 if (mS hadowTechnique == SHADOWTYPE_STENCIL_MODULATIVE)688 if (mSavedShadowTechnique == SHADOWTYPE_STENCIL_MODULATIVE) 679 689 { 680 690 mLeavePassesInQueue |= RenderPriorityGroup::SOLID_PASSES_NOSHADOW;
Note: See TracChangeset
for help on using the changeset viewer.