Changeset 2115 for GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE
- Timestamp:
- 02/12/07 19:00:37 (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
r2113 r2115 39 39 }; 40 40 41 41 42 /** Class which converts preprocessor types to OGRE types 42 43 */ … … 121 122 122 123 list<SceneNode *>::const_iterator sit, sit_end = sceneNodeList.end(); 124 123 125 // find the bbox which is closest to the current bbox 124 126 for (sit = sceneNodeList.begin(); sit != sit_end; ++ sit) … … 247 249 for (iit = iboxes.begin(); iit != iit_end; ++ iit) 248 250 { 251 const GtpVisibilityPreprocessor::AxisAlignedBox3 pbox = (*iit).second; 252 const int id = (*iit).first; 253 249 254 const AxisAlignedBox box = 250 OgreTypeConverter::ConvertToOgre( (*iit).second);251 252 EntityContainer *entryObjects = new EntityContainer();255 OgreTypeConverter::ConvertToOgre(pbox); 256 257 EntityContainer entryObjects; 253 258 254 259 // find all objects that intersect the bounding box 255 FindIntersectingObjects(box, *entryObjects); 256 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 257 277 EngineIntersectable *entry = 258 278 new EngineIntersectable(entryObjects); 259 279 260 entry->SetId((*iit).first); 261 280 entry->SetId(id); 262 281 objects.push_back(entry); 282 #endif 263 283 } 264 284 265 285 return true; 266 286 } 287 267 288 #else 289 268 290 //------------------------------------------------------------------------- 269 291 template<typename T> -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreMeshInstance.h
r2069 r2115 49 49 const int maxTries); 50 50 51 int GetRandomEdgePoint(GtpVisibilityPreprocessor::Vector3 &point, 52 GtpVisibilityPreprocessor::Vector3 &normal); 53 51 54 ostream &Describe(ostream &s); 52 55 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreBvHierarchySceneManager.cpp
r2114 r2115 1325 1325 GtpVisibilityPreprocessor::IndexedBoundingBoxContainer iboxes; 1326 1326 BvhBoundingBoxConverter bconverter(this); 1327 GtpVisibilityPreprocessor::ObjectContainer dummys; 1327 1328 1328 // load the view cells and assigns the objects in the pvs to 1329 1329 // the scene objects using the bounding boxes 1330 1330 mViewCellsManager = 1331 1331 GtpVisibilityPreprocessor::ViewCellsManager:: 1332 LoadViewCells(filename, mObjects, dummys,false, &bconverter);1332 LoadViewCells(filename, mObjects, false, &bconverter); 1333 1333 1334 1334 return (mViewCellsManager != NULL); -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneManager.cpp
r2114 r2115 1325 1325 GtpVisibilityPreprocessor::IndexedBoundingBoxContainer iboxes; 1326 1326 KdTreeBoundingBoxConverter bconverter(this); 1327 GtpVisibilityPreprocessor::ObjectContainer dummys; 1327 1328 1328 // load the view cells assigning the found objects to the pvss 1329 1329 mViewCellsManager = 1330 1330 GtpVisibilityPreprocessor::ViewCellsManager:: 1331 LoadViewCells(filename, mObjects, dummys,false, &bconverter);1331 LoadViewCells(filename, mObjects, false, &bconverter); 1332 1332 1333 1333 return (mViewCellsManager != NULL); … … 1344 1344 // representing unbounded space then 1345 1345 SetObjectsVisible(true); 1346 1346 1347 return; 1347 1348 } -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreMeshInstance.cpp
r2066 r2115 55 55 56 56 int OgreMeshInstance::GetRandomSurfacePoint(GtpVisibilityPreprocessor::Vector3 &point, 57 GtpVisibilityPreprocessor::Vector3 &normal)57 GtpVisibilityPreprocessor::Vector3 &normal) 58 58 { 59 59 return 0; 60 60 } 61 61 62 int OgreMeshInstance::GetRandomEdgePoint(GtpVisibilityPreprocessor::Vector3 &point, 63 GtpVisibilityPreprocessor::Vector3 &normal) 64 { 65 return 0; 66 } 67 62 68 int OgreMeshInstance::GetRandomVisibleSurfacePoint(GtpVisibilityPreprocessor::Vector3 &point, 63 69 GtpVisibilityPreprocessor::Vector3 &normal, … … 67 73 return 0; 68 74 } 69 75 70 76 ostream &OgreMeshInstance::Describe(ostream &s) 71 77 { -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp
r2114 r2115 403 403 // show current view cell geometry 404 404 if (mCurrentViewCell && mCurrentViewCell->GetMesh()) 405 { 405 {/* 406 406 //const bool showSingleViewCell = true; 407 407 if (mViewCellsGeometryLoaded) … … 427 427 } 428 428 } 429 430 429 */ 431 430 ////////// 432 431 //-- set PVS of view cell visible 433 432 434 GtpVisibilityPreprocessor::ObjectPvsIterator pit = 435 mCurrentViewCell->GetPvs().GetIterator(); 433 GtpVisibilityPreprocessor::ObjectPvsIterator pit = mCurrentViewCell->GetPvs().GetIterator(); 436 434 437 435 while (pit.HasMoreEntries()) … … 440 438 GtpVisibilityPreprocessor::Intersectable *obj = entry.mObject; 441 439 442 if (obj->Type() != 443 GtpVisibilityPreprocessor::Intersectable::ENGINE_INTERSECTABLE) 444 continue; 445 446 EngineIntersectable *oi = static_cast<EngineIntersectable *>(obj); 447 448 EntityContainer *entries = oi->GetItem(); 449 EntityContainer::const_iterator eit, eit_end = entries->end(); 450 451 for (eit = entries->begin(); eit != eit_end; ++ eit) 452 { 453 (*eit)->setUserAny(Any((int)0)); 454 } 455 } 456 457 pit = mCurrentViewCell->GetPvs().GetIterator(); 458 459 while (pit.HasMoreEntries()) 460 { 461 GtpVisibilityPreprocessor::ObjectPvsEntry entry = pit.Next(); 462 GtpVisibilityPreprocessor::Intersectable *obj = entry.mObject; 463 464 switch (obj->Type()) 465 { 466 case GtpVisibilityPreprocessor::Intersectable::OGRE_MESH_INSTANCE: 467 { 468 OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(obj); 469 omi->GetEntity()->_updateRenderQueue(getRenderQueue()); 470 } 471 break; 472 473 case GtpVisibilityPreprocessor::Intersectable::ENGINE_INTERSECTABLE: 474 { 475 EngineIntersectable *oi = static_cast<EngineIntersectable *>(obj); 476 477 EntityContainer *entries = oi->GetItem(); 478 EntityContainer::const_iterator eit, eit_end = entries->end(); 479 480 for (eit = entries->begin(); eit != eit_end; ++ eit) 481 { 482 483 Entity *ent = *eit; 484 Any newAny = ent->getUserAny(); 485 486 int flt = any_cast<int>(newAny); 487 488 if (any_cast<int>(newAny) == 0) 489 { 490 ent->setUserAny(Any((int)1)); 491 ent->_updateRenderQueue(getRenderQueue()); 492 } 493 494 } 495 } 496 break; 497 default: 498 break; 499 } 500 } 440 OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(obj); 441 omi->GetEntity()->_updateRenderQueue(getRenderQueue()); 442 } 443 501 444 } 502 445 /* … … 1414 1357 GtpVisibilityPreprocessor::Intersectable *entry = *it; 1415 1358 1416 switch (entry->Type()) 1417 { 1418 case GtpVisibilityPreprocessor::Intersectable::OGRE_MESH_INSTANCE: 1419 { 1420 OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(entry); 1421 omi->GetEntity()->setVisible(visible); 1422 //GtpVisibilityPreprocessor::Debug << "assigned id " << omi->GetId() << endl; 1423 } 1424 break; 1425 case GtpVisibilityPreprocessor::Intersectable::ENGINE_INTERSECTABLE: 1426 { 1427 EngineIntersectable *oi = static_cast<EngineIntersectable *>(entry); 1428 1429 EntityContainer *entries = oi->GetItem(); 1430 EntityContainer::const_iterator eit, 1431 eit_end = entries->end(); 1432 for (eit = entries->begin(); eit != eit_end; ++ eit) 1433 { 1434 Entity *ent = *eit; 1435 ent->setVisible(visible); 1436 } 1437 } 1438 break; 1439 default: 1440 break; 1441 } 1359 OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(entry); 1360 omi->GetEntity()->setVisible(visible); 1361 //GtpVisibilityPreprocessor::Debug << "assigned id " << omi->GetId() << endl; 1442 1362 } 1443 1363 } … … 1459 1379 const bool finalizeViewCells = false; 1460 1380 1461 GtpVisibilityPreprocessor::ObjectContainer dummys;1462 1381 // load the view cells assigning the found objects to the pvss 1463 1382 mViewCellsManager = 1464 1383 GtpVisibilityPreprocessor::ViewCellsManager:: 1465 LoadViewCells(filename, mObjects, dummys,false, &bconverter);1384 LoadViewCells(filename, mObjects, false, &bconverter); 1466 1385 1467 1386 Ogre::LogManager::getSingleton().logMessage("******** view cells loaded *********"); … … 1508 1427 if (!obj) continue; 1509 1428 1510 switch (obj->Type()) 1511 { 1512 case GtpVisibilityPreprocessor::Intersectable::OGRE_MESH_INSTANCE: 1513 { 1514 OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(obj); 1515 omi->GetEntity()->setVisible(load); 1516 } 1517 break; 1518 case GtpVisibilityPreprocessor::Intersectable::ENGINE_INTERSECTABLE: 1519 { 1520 EngineIntersectable *oi = static_cast<EngineIntersectable *>(obj); 1521 1522 EntityContainer *entries = oi->GetItem(); 1523 1524 EntityContainer::const_iterator eit, eit_end = entries->end(); 1525 1526 for (eit = entries->begin(); eit != eit_end; ++ eit) 1527 { 1528 Entity *ent = *eit; 1529 ent->setVisible(load); 1530 } 1531 } 1532 break; 1533 default: 1534 LogManager::getSingleton().logMessage("error: should not come here"); 1535 break; 1536 } 1429 OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(obj); 1430 omi->GetEntity()->setVisible(load); 1537 1431 } 1538 1432 }
Note: See TracChangeset
for help on using the changeset viewer.