- Timestamp:
- 05/04/06 18:26:23 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreVisibilityOctreeSceneManager.cpp
r880 r897 9 9 #include <OgreEntity.h> 10 10 #include <OgreSubEntity.h> 11 #include <OgreMaterialManager.h> 11 12 #include <OgreIteratorWrappers.h> 12 13 #include "VspBspTree.h" … … 24 25 25 26 //----------------------------------------------------------------------- 26 VisibilityOctreeSceneManager::VisibilityOctreeSceneManager( 27 GtpVisibility::VisibilityManager *visManager): 28 OctreeSceneManager(), 27 VisibilityOctreeSceneManager::VisibilityOctreeSceneManager(const String& name, 28 GtpVisibility::VisibilityManager *visManager) 29 : 30 OctreeSceneManager(name), 29 31 mVisibilityManager(visManager), 30 32 mShowVisualization(false), … … 135 137 } 136 138 // add bounding boxes of rendered objects 137 if ( 0)139 if (1) 138 140 for (BoxList::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it) 139 141 { … … 159 161 (*it)->getAttachedObject(0)->isVisible()) 160 162 { 161 162 163 getRenderQueue()->addRenderable((*it)); 164 } 163 165 } 164 166 // add renderables itself … … 171 173 } 172 174 //----------------------------------------------------------------------- 173 Pass *VisibilityOctreeSceneManager::setPass(Pass* pass)175 const Pass *VisibilityOctreeSceneManager::_setPass(Pass* pass) 174 176 { 175 177 if (NORMAL_RENDER_HACK) 176 178 { 177 return SceneManager:: setPass(pass);179 return SceneManager::_setPass(pass); 178 180 } 179 181 … … 230 232 231 233 //-- set actual pass here 232 Pass *result = SceneManager::setPass(usedPass);234 const Pass *result = SceneManager::_setPass(usedPass); 233 235 234 236 … … 291 293 { 292 294 OctreeSceneManager::_renderVisibleObjects(); 293 295 294 296 return; 295 297 } … … 357 359 // exclude this queues from hierarchical rendering 358 360 setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE); 361 359 362 360 363 // set all necessary parameters for … … 402 405 //-- used for depth pass, transparents, overlay 403 406 clearSpecialCaseRenderQueues(); 404 407 408 //-- we render all remaining queue objects 409 // used for depth pass, transparents, overlay 410 clearSpecialCaseRenderQueues(); 405 411 OctreeSceneManager::_renderVisibleObjects(); 406 412 407 } // hierarchical culling413 } // hierarchical culling 408 414 409 415 // reset ambient light … … 535 541 return true; 536 542 } 537 543 538 544 return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 539 545 setOption(key, val) || OctreeSceneManager::setOption(key, val); … … 593 599 //----------------------------------------------------------------------- 594 600 void VisibilityOctreeSceneManager::renderObjects( 595 const RenderPriorityGroup::TransparentRenderablePassList& objs, 601 const QueuedRenderableCollection& objs, 602 QueuedRenderableCollection::OrganisationMode om, 596 603 bool doLightIteration, const LightList* manualLightList) 597 604 { … … 600 607 if (NORMAL_RENDER_HACK || !mSkipTransparents) 601 608 { 602 OctreeSceneManager::renderObjects(objs, doLightIteration, manualLightList);609 OctreeSceneManager::renderObjects(objs, om, doLightIteration, manualLightList); 603 610 } 604 611 } … … 625 632 } 626 633 //----------------------------------------------------------------------- 627 void VisibilityOctreeSceneManager::renderQueueGroupObjects(RenderQueueGroup* pGroup) 634 void VisibilityOctreeSceneManager::_renderQueueGroupObjects( 635 RenderQueueGroup* pGroup, QueuedRenderableCollection::OrganisationMode om) 628 636 { 629 637 if (NORMAL_RENDER_HACK || !mIsItemBufferPhase) 630 638 { 631 OctreeSceneManager:: renderQueueGroupObjects(pGroup);639 OctreeSceneManager::_renderQueueGroupObjects(pGroup, om); 632 640 return; 633 641 } 634 635 //-- item buffer: render objects using false colors642 #ifdef ITEM_BUFFER 643 //-- renders item buffer 636 644 637 645 // Iterate through priorities … … 642 650 RenderItemBuffer(groupIt.getNext()); 643 651 } 644 } 652 #endif // ITEM_BUFFER 653 } 654 #ifdef ITEM_BUFFER 645 655 //----------------------------------------------------------------------- 646 656 void VisibilityOctreeSceneManager::RenderItemBuffer(RenderPriorityGroup* pGroup) … … 748 758 renderSingleObject(rend, usedPass, false, &nullLightList); 749 759 } 760 #endif // ITEM_BUFFER 750 761 //----------------------------------------------------------------------- 751 762 GtpVisibility::VisibilityManager *VisibilityOctreeSceneManager::GetVisibilityManager() … … 789 800 mLeavePassesInQueue |= RenderPriorityGroup::TRANSPARENT_PASSES; 790 801 791 // just render ambient stuff 792 mIlluminationStage = IRS_AMBIENT; 802 // just render ambient passes 803 /*** msz: no more IRS_AMBIENT, see OgreSceneManager.h ***/ 804 // mIlluminationStage = IRS_AMBIENT; 793 805 getRenderQueue()->setSplitPassesByLightingType(true); 794 806 } … … 821 833 mLeavePassesInQueue); 822 834 835 //std::stringstream d; d << "leave passes in queue: " << mLeavePassesInQueue; 836 //LogManager::getSingleton().logMessage(d.str()); 823 837 } 824 838 //----------------------------------------------------------------------- … … 845 859 //----------------------------------------------------------------------- 846 860 void VisibilityOctreeSceneManager::renderAdditiveStencilShadowedQueueGroupObjects( 847 RenderQueueGroup* pGroup )861 RenderQueueGroup* pGroup, QueuedRenderableCollection::OrganisationMode om) 848 862 { 849 863 // only render solid passes during hierarchical culling … … 864 878 865 879 // Render all the ambient passes first, no light iteration, no lights 866 mIlluminationStage = IRS_AMBIENT; 867 868 OctreeSceneManager::renderObjects(pPriorityGrp->_getSolidPasses(), false, &lightList); 880 /*** msz: no more IRS_AMBIENT, see OgreSceneManager.h ***/ 881 // mIlluminationStage = IRS_AMBIENT; 882 883 OctreeSceneManager::renderObjects(pPriorityGrp->getSolidsBasic(), om, false, &lightList); 869 884 // Also render any objects which have receive shadows disabled 870 OctreeSceneManager::renderObjects(pPriorityGrp-> _getSolidPassesNoShadow(), true);885 OctreeSceneManager::renderObjects(pPriorityGrp->getSolidsNoShadowReceive(), om, true); 871 886 #if 0 872 887 std::stringstream d; … … 881 896 else // render the rest of the passes 882 897 { 883 OctreeSceneManager::renderAdditiveStencilShadowedQueueGroupObjects(pGroup); 884 } 885 } 886 //----------------------------------------------------------------------- 887 void VisibilityOctreeSceneManager::renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup) 898 OctreeSceneManager::renderAdditiveStencilShadowedQueueGroupObjects(pGroup, om); 899 } 900 } 901 //----------------------------------------------------------------------- 902 void VisibilityOctreeSceneManager::renderModulativeStencilShadowedQueueGroupObjects( 903 RenderQueueGroup* pGroup, QueuedRenderableCollection::OrganisationMode om) 888 904 { 889 905 if (mIsHierarchicalCulling) … … 900 916 901 917 // Do (shadowable) solids 902 OctreeSceneManager::renderObjects(pPriorityGrp-> _getSolidPasses(), true);918 OctreeSceneManager::renderObjects(pPriorityGrp->getSolidsBasic(), om, true); 903 919 } 904 920 } 905 921 else 906 922 { 907 SceneManager::renderModulativeStencilShadowedQueueGroupObjects(pGroup );923 SceneManager::renderModulativeStencilShadowedQueueGroupObjects(pGroup, om); 908 924 } 909 925 } 910 926 //------------------------------------------------------------------------- 927 void VisibilityOctreeSceneManager::SetObjectsVisible(const bool visible) 928 { 929 GtpVisibilityPreprocessor::ObjectContainer::iterator it, it_end = mObjects.end(); 930 931 for (it = mObjects.begin(); it != it_end; ++ it) 932 { 933 OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(*it); 934 Entity *ent = omi->GetMesh(); 935 ent->setVisible(visible); 936 } 937 } 938 //------------------------------------------------------------------------- 939 void VisibilityOctreeSceneManager::loadVisibilityConfig(const String& filename) 940 { 941 // TODO matt 942 // Set up the options 943 ConfigFile config; 944 String val; 945 946 config.load(filename); 947 948 val = config.getSetting("Algorithm"); 949 950 if (!val.empty()) 951 { 952 VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface).setOption("Algorithm", val.c_str()); 953 } 954 955 val = config.getSetting("UseDepthPass"); 956 957 if (!val.empty()) 958 { 959 setOption("UseDepthPass", val.c_str()); 960 } 961 } 962 //------------------------------------------------------------------------- 911 963 inline static AxisAlignedBox EnlargeBox(const AxisAlignedBox &box) 912 964 { … … 1056 1108 } 1057 1109 //------------------------------------------------------------------------- 1058 void VisibilityOctreeSceneManager::SetObjectsVisible(const bool visible)1059 {1060 // for OGRE 1.21061 //#ifdef OGRE121062 //MovableObjectIterator mit = getMovableObjectIterator("Entity");1063 #if 01064 EntityIterator eit = getEntityIterator();1065 1066 // set all objects to invisible (initially);1067 while (eit.hasMoreElements())1068 {1069 Entity *ent = eit.getNext();1070 ent->setVisible(visible);1071 }1072 1073 #else1074 GtpVisibilityPreprocessor::ObjectContainer::iterator it, it_end = mObjects.end();1075 1076 for (it = mObjects.begin(); it != it_end; ++ it)1077 {1078 OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(*it);1079 Entity *ent = omi->GetMesh();1080 ent->setVisible(visible);1081 }1082 #endif1083 }1084 //-------------------------------------------------------------------------1085 void VisibilityOctreeSceneManager::loadVisibilityConfig(const String &filename)1086 {1087 // TODO matt1088 // Set up the options1089 ConfigFile config;1090 String val;1091 1092 config.load(filename);1093 1094 val = config.getSetting("Algorithm");1095 1096 if (!val.empty())1097 {1098 VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface).setOption("Algorithm", val.c_str());1099 }1100 1101 val = config.getSetting("UseDepthPass");1102 1103 if (!val.empty())1104 {1105 setOption("UseDepthPass", val.c_str());1106 }1107 }1108 //-------------------------------------------------------------------------1109 1110 void VisibilityOctreeSceneManager::updatePvs(Camera *cam) 1110 1111 { … … 1156 1157 } 1157 1158 1159 1160 1161 //----------------------------------------------------------------------- 1162 const String VisibilityOctreeSceneManagerFactory::FACTORY_TYPE_NAME = "VisibilityOctreeSceneManager"; 1163 //----------------------------------------------------------------------- 1164 void VisibilityOctreeSceneManagerFactory::initMetaData(void) const 1165 { 1166 mMetaData.typeName = FACTORY_TYPE_NAME; 1167 mMetaData.description = "Scene manager organising the scene on the basis of an octree with advanced occlusion culling (TM)."; 1168 mMetaData.sceneTypeMask = 0xFFFF; // support all types 1169 mMetaData.worldGeometrySupported = false; 1170 } 1171 //----------------------------------------------------------------------- 1172 SceneManager* VisibilityOctreeSceneManagerFactory::createInstance( 1173 const String& instanceName) 1174 { 1175 return new VisibilityOctreeSceneManager(instanceName, visManager); 1176 } 1177 //----------------------------------------------------------------------- 1178 void VisibilityOctreeSceneManagerFactory::destroyInstance(SceneManager* instance) 1179 { 1180 delete instance; 1181 } 1182 1158 1183 } // namespace Ogre
Note: See TracChangeset
for help on using the changeset viewer.