Changeset 2123 for GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE
- Timestamp:
- 02/17/07 22:48:12 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBoundingBoxConverter.h
r2115 r2123 217 217 218 218 // we are only interested in scene entities 219 if (mo->getMovableType() != "Entity") 219 if ((mo->getMovableType() != "Entity") && 220 (mo->getMovableType() != "ManualObject")) 220 221 continue; 221 222 … … 237 238 } 238 239 240 static void AddToObjects(EntityContainer *entites, 241 GtpVisibilityPreprocessor::ObjectContainer &objects, 242 const int id) 243 { 244 // TODO: can actually just put single objects into pvs with same id, 245 // this can be sorted out later!! 246 #if 0 247 EntityContainer::const_iterator eit, eit_end = entryObjects.end(); 248 249 for (eit = entryObjects.begin(); eit != eit_end; ++ eit) 250 { 251 Entity *ent = *eit; 252 253 // warning: multiple ids possible 254 OgreMeshInstance *omi = new OgreMeshInstance(ent); 255 omi->SetId(id); 256 objects.push_back(omi); 257 } 258 259 delete entryObjects; 260 261 #else 262 263 EngineIntersectable *entry = new EngineIntersectable(entites); 264 265 entry->SetId(id); 266 objects.push_back(entry); 267 #endif 268 } 269 239 270 #if USE_KD_PVS 240 271 //------------------------------------------------------------------------- … … 255 286 OgreTypeConverter::ConvertToOgre(pbox); 256 287 257 EntityContainer entryObjects;288 EntityContainer *entryObjects = new EntityContainer(); 258 289 259 290 // find all objects that intersect the bounding box 260 FindIntersectingObjects(box, entryObjects); 261 262 // TODO: can actually just put single objects into pvs with same id, 263 // this can be sorted out later!! 264 #if 1 265 EntityContainer::const_iterator eit, eit_end = entryObjects.end(); 266 267 for (eit = entryObjects.begin(); eit != eit_end; ++ eit) 268 { 269 Entity *ent = *eit; 270 271 // warning: multiple ids possible 272 OgreMeshInstance *omi = new OgreMeshInstance(ent); 273 omi->SetId(id); 274 objects.push_back(omi); 275 } 276 #else 277 EngineIntersectable *entry = 278 new EngineIntersectable(entryObjects); 279 280 entry->SetId(id); 281 objects.push_back(entry); 282 #endif 291 FindIntersectingObjects(box, *entryObjects); 292 293 AddToObjects(entryObjects, objects, id); 283 294 } 284 295 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreOcclusionCullingSceneManager.h
r2119 r2123 14 14 #include "ViewCellsManager.h" 15 15 16 17 namespace GtpVisibilityPreprocessor { 18 class Intersectable; 19 } 20 21 class ObjReader; 22 16 23 namespace Ogre { 17 24 … … 24 31 { 25 32 public: 26 OcclusionCullingSceneManager(const String& name, GtpVisibility::VisibilityManager *visManager); 33 OcclusionCullingSceneManager(const String& name, 34 GtpVisibility::VisibilityManager *visManager); 27 35 ~OcclusionCullingSceneManager(); 28 36 … … 70 78 */ 71 79 bool validatePassForRendering(Pass* pass); 80 72 81 #ifdef ITEM_BUFFER 73 82 void RenderItemBuffer(RenderPriorityGroup* pGroup); 74 83 void RenderSingleObjectForItemBuffer(Renderable *rend, Pass *pass); 75 84 #endif // ITEM_BUFFER 85 76 86 void _renderQueueGroupObjects(RenderQueueGroup* pGroup, 77 QueuedRenderableCollection::OrganisationMode om); 78 79 /** Override from SceneManager so that sub entities can be assigned an id for item buffer. 87 QueuedRenderableCollection::OrganisationMode om); 88 89 /** Override from SceneManager so that sub entities can be assigned 90 an id for item buffer. 80 91 */ 81 92 Entity* createEntity(const String& entityName, const String& meshName); … … 93 104 void endFrame(); 94 105 95 void renderAdditiveStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup, 96 QueuedRenderableCollection::OrganisationMode om); 97 void renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup, 98 QueuedRenderableCollection::OrganisationMode om); 106 void renderAdditiveStencilShadowedQueueGroupObjects( 107 RenderQueueGroup* pGroup, 108 QueuedRenderableCollection::OrganisationMode om); 109 void renderModulativeStencilShadowedQueueGroupObjects( 110 RenderQueueGroup* pGroup, 111 QueuedRenderableCollection::OrganisationMode om); 99 112 100 113 /** Override standard function so octree boxes are always of equal side length. … … 113 126 protected: 114 127 128 void MailPvsObjects(); 129 void RenderPvsEntry(GtpVisibilityPreprocessor::Intersectable *obj); 130 void SetObjectVisible(GtpVisibilityPreprocessor::Intersectable *entry, 131 const bool visible); 132 void ShowViewCellsGeometry(); 133 115 134 /** Creates material for depth pass, e.g., a pass that only fills the depth buffer. 116 135 */ … … 254 273 255 274 bool mShowTerrain; 275 276 ObjReader *mObjReader; 256 277 }; 257 278 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreBvHierarchySceneManager.cpp
r2115 r2123 1354 1354 while (pit.HasMoreEntries()) 1355 1355 { 1356 GtpVisibilityPreprocessor:: ObjectPvsEntryentry = pit.Next();1357 1358 if (entry .mObject)1359 { 1360 OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(entry .mObject);1356 GtpVisibilityPreprocessor::Intersectable *entry = pit.Next(); 1357 1358 if (entry) 1359 { 1360 OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(entry); 1361 1361 omi->GetEntity()->setVisible(load); 1362 1362 } -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneManager.cpp
r2115 r2123 1355 1355 while (pit.HasMoreEntries()) 1356 1356 { 1357 GtpVisibilityPreprocessor:: ObjectPvsEntryentry = pit.Next();1358 1359 if (entry .mObject)1360 { 1361 OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(entry .mObject);1357 GtpVisibilityPreprocessor::Intersectable *entry = pit.Next(); 1358 1359 if (entry) 1360 { 1361 OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(entry); 1362 1362 omi->GetEntity()->setVisible(load); 1363 1363 } -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp
r2122 r2123 78 78 // TODO: set maxdepth to reasonable value 79 79 mMaxDepth = 50; 80 81 mObjReader = new ObjReader(this); 80 82 } 81 83 //----------------------------------------------------------------------- … … 107 109 CLEAR_CONTAINER(mObjects); 108 110 OGRE_DELETE(mCurrentViewCell); 111 112 OGRE_DELETE(mObjReader); 109 113 } 110 114 //----------------------------------------------------------------------- … … 379 383 selectPageSource(pageSourceName, optlist); 380 384 } 385 386 387 void OcclusionCullingSceneManager::MailPvsObjects() 388 { 389 GtpVisibilityPreprocessor::ObjectPvsIterator pit = 390 mCurrentViewCell->GetPvs().GetIterator(); 391 392 while (pit.HasMoreEntries()) 393 { 394 GtpVisibilityPreprocessor::Intersectable *obj = pit.Next(); 395 396 if (obj->Type() != 397 GtpVisibilityPreprocessor::Intersectable::ENGINE_INTERSECTABLE) 398 continue; 399 400 EngineIntersectable *oi = static_cast<EngineIntersectable *>(obj); 401 402 EntityContainer *entries = oi->GetItem(); 403 EntityContainer::const_iterator eit, eit_end = entries->end(); 404 405 for (eit = entries->begin(); eit != eit_end; ++ eit) 406 { 407 (*eit)->setUserAny(Any((int)0)); 408 } 409 } 410 } 411 //----------------------------------------------------------------------- 412 void OcclusionCullingSceneManager::ShowViewCellsGeometry() 413 {/* 414 // show only current view cell 415 if (!mShowViewCells) 416 { 417 const int id = mCurrentViewCell->GetId(); 418 419 MovableMap::iterator fit = mViewCellsGeometry.find(id); 420 421 if ((fit != mViewCellsGeometry.end()) && (*fit).second) 422 (*fit).second->_updateRenderQueue(getRenderQueue()); 423 } 424 else 425 { 426 MovableMap::const_iterator mit, mit_end = mViewCellsGeometry.end(); 427 428 for (mit = mViewCellsGeometry.begin(); mit != mit_end; ++ mit) 429 { 430 if ((*mit).second) 431 (*mit).second->_updateRenderQueue(getRenderQueue()); 432 } 433 }*/ 434 } 435 436 437 void OcclusionCullingSceneManager::RenderPvsEntry(GtpVisibilityPreprocessor::Intersectable *obj) 438 { 439 switch (obj->Type()) 440 { 441 case GtpVisibilityPreprocessor::Intersectable::OGRE_MESH_INSTANCE: 442 { 443 OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(obj); 444 omi->GetEntity()->_updateRenderQueue(getRenderQueue()); 445 } 446 break; 447 448 case GtpVisibilityPreprocessor::Intersectable::ENGINE_INTERSECTABLE: 449 { 450 EngineIntersectable *oi = static_cast<EngineIntersectable *>(obj); 451 452 EntityContainer *entries = oi->GetItem(); 453 EntityContainer::const_iterator eit, eit_end = entries->end(); 454 455 for (eit = entries->begin(); eit != eit_end; ++ eit) 456 { 457 Entity *ent = *eit; 458 // mailing hack 459 Any newAny = ent->getUserAny(); 460 int flt = any_cast<int>(newAny); 461 462 if (any_cast<int>(newAny) == 0) 463 { 464 ent->setUserAny(Any((int)1)); 465 ent->_updateRenderQueue(getRenderQueue()); 466 } 467 } 468 } 469 break; 470 default: 471 break; 472 } 473 } 474 //----------------------------------------------------------------------- 475 void OcclusionCullingSceneManager::SetObjectVisible(GtpVisibilityPreprocessor::Intersectable *entry, 476 const bool visible) 477 { 478 switch (entry->Type()) 479 { 480 case GtpVisibilityPreprocessor::Intersectable::OGRE_MESH_INSTANCE: 481 { 482 OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(entry); 483 omi->GetEntity()->setVisible(visible); 484 //GtpVisibilityPreprocessor::Debug << "assigned id " << omi->GetId() << endl; 485 } 486 break; 487 case GtpVisibilityPreprocessor::Intersectable::ENGINE_INTERSECTABLE: 488 { 489 EngineIntersectable *oi = static_cast<EngineIntersectable *>(entry); 490 491 EntityContainer *entries = oi->GetItem(); 492 EntityContainer::const_iterator eit, eit_end = entries->end(); 493 for (eit = entries->begin(); eit != eit_end; ++ eit) 494 { 495 Entity *ent = *eit; 496 ent->setVisible(visible); 497 } 498 } 499 break; 500 default: 501 break; 502 } 503 } 381 504 //----------------------------------------------------------------------- 382 505 void OcclusionCullingSceneManager::PrepareVisualization(Camera *cam) … … 404 527 405 528 // show current view cell geometry 406 if (mCurrentViewCell && mCurrentViewCell->GetMesh())407 { /*529 if (mCurrentViewCell)// && mCurrentViewCell->GetMesh()) 530 { 408 531 //const bool showSingleViewCell = true; 409 532 if (mViewCellsGeometryLoaded) 410 533 { 411 if (!mShowViewCells) 412 { 413 const int id = mCurrentViewCell->GetId(); 414 415 MovableMap::iterator fit = mViewCellsGeometry.find(id); 416 417 if ((fit != mViewCellsGeometry.end()) && (*fit).second) 418 (*fit).second->_updateRenderQueue(getRenderQueue()); 419 } 420 else 421 { 422 MovableMap::const_iterator mit, mit_end = mViewCellsGeometry.end(); 423 424 for (mit = mViewCellsGeometry.begin(); mit != mit_end; ++ mit) 425 { 426 if ((*mit).second) 427 (*mit).second->_updateRenderQueue(getRenderQueue()); 428 } 429 } 430 } 431 */ 534 ShowViewCellsGeometry(); 535 } 536 432 537 ////////// 433 538 //-- set PVS of view cell visible 434 539 435 GtpVisibilityPreprocessor::ObjectPvsIterator pit = mCurrentViewCell->GetPvs().GetIterator(); 540 GtpVisibilityPreprocessor::ObjectPvsIterator pit = 541 mCurrentViewCell->GetPvs().GetIterator(); 542 543 MailPvsObjects(); 436 544 437 545 while (pit.HasMoreEntries()) 438 { 439 GtpVisibilityPreprocessor::ObjectPvsEntry entry = pit.Next(); 440 GtpVisibilityPreprocessor::Intersectable *obj = entry.mObject; 441 442 OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(obj); 443 omi->GetEntity()->_updateRenderQueue(getRenderQueue()); 444 } 445 446 } 447 /* 546 { 547 RenderPvsEntry(pit.Next()); 548 } 549 } 550 #if 0 448 551 if (mRenderNodesForViz || mRenderNodesContentForViz) 449 552 { … … 479 582 } 480 583 } 481 }*/ 584 } 585 #endif 482 586 } 483 587 //----------------------------------------------------------------------- … … 601 705 { 602 706 // $$matt temp: Remove this!! 603 if ( 1)707 if (0) 604 708 { 605 709 getDestinationRenderSystem()->_setCullingMode(CULL_NONE); 606 LogManager::getSingleton().logMessage("warning: culling mode");710 //LogManager::getSingleton().logMessage("warning: culling mode"); 607 711 } 608 712 … … 1367 1471 GtpVisibilityPreprocessor::Intersectable *entry = *it; 1368 1472 1369 OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(entry); 1370 omi->GetEntity()->setVisible(visible); 1371 //GtpVisibilityPreprocessor::Debug << "assigned id " << omi->GetId() << endl; 1473 SetObjectVisible(entry, visible); 1372 1474 } 1373 1475 } … … 1421 1523 } 1422 1524 1423 GtpVisibilityPreprocessor::ObjectPvsIterator pit = vc->GetPvs().GetIterator();1424 1425 1525 //////////// 1426 1526 //-- set PVS of view cell to visible … … 1429 1529 //LogManager::getSingleton().logMessage(d.str()); 1430 1530 1531 GtpVisibilityPreprocessor::ObjectPvsIterator pit = vc->GetPvs().GetIterator(); 1532 1431 1533 while (pit.HasMoreEntries()) 1432 1534 { 1433 GtpVisibilityPreprocessor::ObjectPvsEntry entry = pit.Next(); 1434 GtpVisibilityPreprocessor::Intersectable *obj = entry.mObject; 1535 GtpVisibilityPreprocessor::Intersectable *obj = pit.Next(); 1435 1536 1436 1537 // no associated geometry found 1437 1538 if (!obj) continue; 1438 1539 1439 OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(obj); 1440 omi->GetEntity()->setVisible(load); 1540 SetObjectVisible(obj, load); 1441 1541 } 1442 1542 } … … 1706 1806 SceneNode *root) 1707 1807 { 1708 ObjReader objReader(this);1709 1710 1808 Timer *timer = PlatformManager::getSingleton().createTimer(); 1711 1809 timer->reset(); 1712 1810 1713 if (! objReader.LoadFile(filename.c_str(), viewCellsFile, root))1811 if (!mObjReader->LoadFile(filename.c_str(), viewCellsFile, root)) 1714 1812 { 1715 1813 PlatformManager::getSingleton().destroyTimer(timer); -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/Plugin_VisibilitySceneManager.vcproj
r2122 r2123 20 20 Name="VCCLCompilerTool" 21 21 Optimization="0" 22 AdditionalIncludeDirectories=""$(OGRE_PATH)\PlugIns\OctreeSceneManager\include";"$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Dependencies\include";..\include;..\..\..\OnlineCullingCHC\include;..\..\..\Preprocessing\src "22 AdditionalIncludeDirectories=""$(OGRE_PATH)\PlugIns\OctreeSceneManager\include";"$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Dependencies\include";..\include;..\..\..\OnlineCullingCHC\include;..\..\..\Preprocessing\src;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\include;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\ObjReader\include" 23 23 PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PLUGIN_KD_TERRAIN_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE" 24 24 MinimalRebuild="TRUE" … … 36 36 Name="VCLinkerTool" 37 37 IgnoreImportLibrary="TRUE" 38 AdditionalDependencies="OgreMain_d.lib CEGUIBase_d.lib OgreGUIRenderer_d.lib Plugin_OctreeSceneManager.lib GtpVisibility.lib zdll.lib zziplibd.lib Preprocessor.lib devil.lib glut32.lib xerces-c_2D.lib OpenGL32.Lib glu32.lib cg.lib cgGL.lib glew32.lib "38 AdditionalDependencies="OgreMain_d.lib CEGUIBase_d.lib OgreGUIRenderer_d.lib Plugin_OctreeSceneManager.lib GtpVisibility.lib zdll.lib zziplibd.lib Preprocessor.lib devil.lib glut32.lib xerces-c_2D.lib OpenGL32.Lib glu32.lib cg.lib cgGL.lib glew32.lib IVReader.lib ObjReader.lib" 39 39 OutputFile="$(OutDir)/Plugin_VisibilitySceneManager.dll" 40 40 Version="0.99" 41 41 LinkIncremental="1" 42 42 SuppressStartupBanner="TRUE" 43 AdditionalLibraryDirectories=""$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)";"$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)";"$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib";"..\lib\$(ConfigurationName)";"..\..\lib\$(ConfigurationName)";"..\..\..\Preprocessing\lib\$(ConfigurationName)";..\..\..\Preprocessing\src\GL;..\..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;"$(CG_LIB_PATH)" "43 AdditionalLibraryDirectories=""$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)";"$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)";"$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib";"..\lib\$(ConfigurationName)";"..\..\lib\$(ConfigurationName)";"..\..\..\Preprocessing\lib\$(ConfigurationName)";..\..\..\Preprocessing\src\GL;..\..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;"$(CG_LIB_PATH)";"..\..\..\..\..\Lib\Vis\OnlineCullingCHC\ObjReader\lib\$(ConfigurationName)";"..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\lib\$(ConfigurationName)"" 44 44 ModuleDefinitionFile="..\misc\OgreVisibilitySceneManager.def" 45 45 GenerateDebugInformation="TRUE" … … 87 87 OmitFramePointers="TRUE" 88 88 EnableFiberSafeOptimizations="TRUE" 89 OptimizeForProcessor=" 3"89 OptimizeForProcessor="0" 90 90 OptimizeForWindowsApplication="TRUE" 91 AdditionalIncludeDirectories=""$(OGRE_PATH)\PlugIns\OctreeSceneManager\include";"$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Dependencies\include";..\include;..\..\..\OnlineCullingCHC\include;..\..\..\Preprocessing\src;..\..\..\ ..\..\Lib\Vis\OnlineCullingCHC\IVReader\include;..\..\..\Preprocessing\src\Timer;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\ObjReader\include"92 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_KD_TERRAIN_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE 1;USE_VERBOSE_PVS"91 AdditionalIncludeDirectories=""$(OGRE_PATH)\PlugIns\OctreeSceneManager\include";"$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Dependencies\include";..\include;..\..\..\OnlineCullingCHC\include;..\..\..\Preprocessing\src;..\..\..\Preprocessing\src\Timer;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\include;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\ObjReader\include" 92 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_KD_TERRAIN_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE" 93 93 StringPooling="TRUE" 94 94 RuntimeLibrary="2"
Note: See TracChangeset
for help on using the changeset viewer.