Changeset 2066
- Timestamp:
- 01/31/07 01:51:57 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis
- Files:
-
- 69 added
- 37 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBoundingBoxConverter.h
r1676 r2066 21 21 typedef vector<Entity *> EntityContainer; 22 22 23 class ObjectsIntersectable: public GtpVisibilityPreprocessor::IntersectableWrapper<EntityContainer *>23 class EngineIntersectable: public GtpVisibilityPreprocessor::IntersectableWrapper<EntityContainer *> 24 24 { 25 25 public: 26 ObjectsIntersectable(EntityContainer *item):26 EngineIntersectable(EntityContainer *item): 27 27 GtpVisibilityPreprocessor::IntersectableWrapper<EntityContainer *>(item) {} 28 28 29 29 // hack 30 ObjectsIntersectable::~ObjectsIntersectable() 31 { 32 //CLEAR_CONTAINER(*mItem); 30 EngineIntersectable::~EngineIntersectable() 31 { 33 32 delete mItem; 34 33 } … … 36 35 int Type() const 37 36 { 38 return Intersectable:: OBJECTS_INTERSECTABLE;37 return Intersectable::ENGINE_INTERSECTABLE; 39 38 } 40 39 }; … … 90 89 vector<Entity *> &objects) const; 91 90 91 /// this can be any scene manager 92 92 T *mSceneMgr; 93 93 }; … … 108 108 109 109 // get intersecting scene nodes 110 // note: this function must be provided by scene manager 110 111 mSceneMgr->findNodesIn(mybox, sceneNodeList, NULL); 111 112 … … 169 170 return bestFittingObj; 170 171 } 171 //----------------------------------------------------------------------- 172 /*template<typename T> 172 173 174 #define ENLARGE_OBJECT_BBOX 0 175 #define ENLRAGE_NODE_BBOX 0 176 template<typename T> 173 177 void PlatFormBoundingBoxConverter<T>::FindIntersectingObjects(const AxisAlignedBox &box, 174 178 EntityContainer &objects) const 175 { //return;179 { 176 180 list<SceneNode *> sceneNodeList; 177 181 178 // get intersecting scene nodes (= candidates) 182 // find intersecting scene nodes to get candidates for intersection 183 // note: this function has to be provided by scene manager 184 #if ENLARGE_NODE_BBOX 185 // make search radius larger 179 186 AxisAlignedBox mybox = EnlargeBox(box); 180 187 mSceneMgr->findNodesIn(mybox, sceneNodeList, NULL); 181 //mSceneMgr->findNodesIn(box, sceneNodeList, NULL);182 188 183 189 list<SceneNode *>::const_iterator sit, sit_end = sceneNodeList.end(); 184 190 185 GtpVisibilityPreprocessor::AxisAlignedBox3 nodeBox = OgreTypeConverter::ConvertFromOgre(mybox); 186 //GtpVisibilityPreprocessor::AxisAlignedBox3 nodeBox = OgreTypeConverter::ConvertFromOgre(box); 187 188 // find really intersecting objects 191 GtpVisibilityPreprocessor::AxisAlignedBox3 nodeBox = 192 OgreTypeConverter::ConvertFromOgre(mybox); 193 #else 194 195 mSceneMgr->findNodesIn(box, sceneNodeList, NULL); 196 197 GtpVisibilityPreprocessor::AxisAlignedBox3 nodeBox = 198 OgreTypeConverter::ConvertFromOgre(box); 199 #endif 200 201 // loop through the intersected scene nodes 189 202 for (sit = sceneNodeList.begin(); sit != sceneNodeList.end(); ++ sit) 190 203 { … … 192 205 SceneNode::ObjectIterator oit = sn->getAttachedObjectIterator(); 193 206 207 // find the objects that intersect the box 194 208 while (oit.hasMoreElements()) 195 209 { … … 198 212 // we are only interested in scene entities 199 213 if (mo->getMovableType() != "Entity") 214 continue; 215 216 // get the bounding box of the objects 217 #if ENLARGE_OBJECT_BBOX) 218 // compare with enlarged entitiy box 219 const AxisAlignedBox bbox = EnlargeBox(mo->getWorldBoundingBox()); 220 #else 221 const AxisAlignedBox bbox = mo->getWorldBoundingBox(); 222 #endif 223 224 // test for intersection (note: function provided of preprocessor) 225 if (Overlap(nodeBox, OgreTypeConverter::ConvertFromOgre(bbox))) 200 226 { 201 continue;227 objects.push_back(static_cast<Entity *>(mo)); 202 228 } 203 204 //const AxisAlignedBox bbox = EnlargeBox(mo->getWorldBoundingBox());205 const AxisAlignedBox bbox = mo->getWorldBoundingBox();206 207 const bool overlaps = Overlap(nodeBox,208 OgreTypeConverter::ConvertFromOgre(bbox)209 );210 //,0.00001);211 212 if (overlaps)213 {214 objects.push_back(static_cast<Entity *>(mo));215 }216 229 } 217 230 } 218 231 } 219 */220 template<typename T>221 void PlatFormBoundingBoxConverter<T>::FindIntersectingObjects(const AxisAlignedBox &box,222 EntityContainer &objects) const223 {//return;224 list<SceneNode *> sceneNodeList;225 226 // get intersecting scene nodes (= candidates)227 //AxisAlignedBox mybox = EnlargeBox(box);228 //mSceneMgr->findNodesIn(mybox, sceneNodeList, NULL);229 mSceneMgr->findNodesIn(box, sceneNodeList, NULL);230 231 list<SceneNode *>::const_iterator sit, sit_end = sceneNodeList.end();232 233 //GtpVisibilityPreprocessor::AxisAlignedBox3 nodeBox = OgreTypeConverter::ConvertFromOgre(mybox);234 GtpVisibilityPreprocessor::AxisAlignedBox3 nodeBox = OgreTypeConverter::ConvertFromOgre(box);235 236 // find really intersecting objects237 for (sit = sceneNodeList.begin(); sit != sceneNodeList.end(); ++ sit)238 {239 SceneNode *sn = *sit;240 SceneNode::ObjectIterator oit = sn->getAttachedObjectIterator();241 242 while (oit.hasMoreElements())243 {244 MovableObject *mo = oit.getNext();245 246 // we are only interested in scene entities247 if (mo->getMovableType() != "Entity")248 {249 continue;250 }251 252 //const AxisAlignedBox bbox = EnlargeBox(mo->getWorldBoundingBox());253 const AxisAlignedBox bbox = mo->getWorldBoundingBox();254 255 const bool overlaps =256 Overlap(nodeBox, OgreTypeConverter::ConvertFromOgre(bbox));257 258 259 if (overlaps)260 {261 objects.push_back(static_cast<Entity *>(mo));262 }263 }264 }265 }266 232 #if USE_KD_PVS 267 //-------------------------------------------------------------------------268 template<typename T>269 bool PlatFormBoundingBoxConverter<T>::IdentifyObjects(270 const GtpVisibilityPreprocessor::IndexedBoundingBoxContainer &iboxes,271 GtpVisibilityPreprocessor::ObjectContainer &objects) const272 {273 //Ogre::LogManager().logMessage("pvs: intersecting objects");274 const long startTime = GtpVisibilityPreprocessor::GetTime();275 276 GtpVisibilityPreprocessor::IndexedBoundingBoxContainer::277 const_iterator iit, iit_end = iboxes.end();278 279 int i = 0;280 281 for (iit = iboxes.begin(); iit != iit_end; ++ iit, ++ i)282 {283 if (0 && ((i % 1000) == 0))284 {285 std::stringstream d; d << "found " << i << " objects";286 Ogre::LogManager().getSingleton().logMessage(d.str());287 }288 289 const AxisAlignedBox box = OgreTypeConverter::ConvertToOgre((*iit).second);290 291 //GtpVisibilityPreprocessor::ObjectContainer *entryObjects = new EntityContainer();292 EntityContainer *entryObjects = new EntityContainer();293 294 // find all objects that intersect the bounding box295 FindIntersectingObjects(box, *entryObjects);296 297 /*vector<Entity *>::const_iterator mit, mit_end = sceneObjects.end();298 299 for (mit = sceneObjects.begin(); mit != mit_end; ++ mit)300 {301 Entity *ent = *mit;302 // create new mesh instance303 OgreMeshInstance *omi = new OgreGetOrCreateOgreMeshInstance(ent);304 //omi->SetId((*iit).first);305 entryObjects->push_back(omi);306 }*/307 308 ObjectsIntersectable *entry =309 new ObjectsIntersectable(entryObjects);310 entry->SetId((*iit).first);311 //kdObj->mBbox = (*iit).second;312 objects.push_back(entry);313 }314 315 //std::stringstream d; d << "finished object intersection in " << GtpVisibilityPreprocessor::TimeDiff(startTime, GtpVisibilityPreprocessor::GetTime()) * 1e-3 << "secs";316 //Ogre::LogManager().logMessage(d.str());317 318 return true;319 }320 #else321 233 //------------------------------------------------------------------------- 322 234 template<typename T> … … 330 242 for (iit = iboxes.begin(); iit != iit_end; ++ iit) 331 243 { 244 const AxisAlignedBox box = 245 OgreTypeConverter::ConvertToOgre((*iit).second); 246 247 EntityContainer *entryObjects = new EntityContainer(); 248 249 // find all objects that intersect the bounding box 250 FindIntersectingObjects(box, *entryObjects); 251 252 EngineIntersectable *entry = 253 new EngineIntersectable(entryObjects); 254 entry->SetId((*iit).first); 255 256 objects.push_back(entry); 257 } 258 259 return true; 260 } 261 #else 262 //------------------------------------------------------------------------- 263 template<typename T> 264 bool PlatFormBoundingBoxConverter<T>::IdentifyObjects( 265 const GtpVisibilityPreprocessor::IndexedBoundingBoxContainer &iboxes, 266 GtpVisibilityPreprocessor::ObjectContainer &objects) const 267 { 268 GtpVisibilityPreprocessor::IndexedBoundingBoxContainer:: 269 const_iterator iit, iit_end = iboxes.end(); 270 271 for (iit = iboxes.begin(); iit != iit_end; ++ iit) 272 { 332 273 const GtpVisibilityPreprocessor::AxisAlignedBox3 box = (*iit).second; 333 274 const AxisAlignedBox currentBox = OgreTypeConverter::ConvertToOgre(box); 334 275 335 276 Entity *ent = FindBestFittingObject(currentBox); 336 337 if (ent) 338 { 339 // create new mesh instance 340 OgreMeshInstance *omi = new OgreMeshInstance(ent); 341 omi->SetId((*iit).first); 342 objects.push_back(omi); 343 } 277 if (!ent) continue; 278 279 // create new mesh instance 280 OgreMeshInstance *omi = new OgreMeshInstance(ent); 281 omi->SetId((*iit).first); 282 objects.push_back(omi); 344 283 } 345 284 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreMeshInstance.h
r1593 r2066 10 10 Wrapper for Ogre object intances for use with the preprocessed view cells. 11 11 */ 12 #if 0 12 13 class __declspec(dllexport) OgreMeshInstance: public GtpVisibilityPreprocessor::Intersectable 13 14 { … … 56 57 }; 57 58 59 58 60 } // namespace Ogre 59 61 #endif 60 62 #endif // OgreMeshIntance -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreBvHierarchy.cpp
r1344 r2066 1536 1536 it != leaf->mBvhRenderables.end(); it ++) 1537 1537 { 1538 SceneNode *sn = dynamic_cast<SceneNode *>(*it);1538 SceneNode *sn = static_cast<SceneNode *>(*it); 1539 1539 1540 1540 if (sn != exclude) … … 1618 1618 while (it != end) 1619 1619 { 1620 scenenode = dynamic_cast<BvHierarchySceneNode *>(*it);1620 scenenode = static_cast<BvHierarchySceneNode *>(*it); 1621 1621 mBuildLog->logMessage(pad + "# Leaf level " + 1622 1622 StringConverter::toString(node->getLevel()) + -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreBvHierarchyInterface.cpp
r1320 r2066 132 132 } 133 133 134 dynamic_cast<BvHierarchySceneManager *>(mSceneManager)->getRenderQueue()->addRenderable(box);134 static_cast<BvHierarchySceneManager *>(mSceneManager)->getRenderQueue()->addRenderable(box); 135 135 } 136 136 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreBvHierarchySceneManager.cpp
r1816 r2066 1357 1357 if (entry.mObject) 1358 1358 { 1359 OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance *>(entry.mObject);1359 OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(entry.mObject); 1360 1360 omi->GetEntity()->setVisible(load); 1361 1361 } -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTree.cpp
r1593 r2066 1528 1528 it != leaf->mKdRenderables.end(); it ++) 1529 1529 { 1530 SceneNode *sn = dynamic_cast<SceneNode *>(*it);1530 SceneNode *sn = static_cast<SceneNode *>(*it); 1531 1531 1532 1532 if (sn != exclude) … … 1606 1606 while (it != end) 1607 1607 { 1608 scenenode = dynamic_cast<KdTreeSceneNode *>(*it);1608 scenenode = static_cast<KdTreeSceneNode *>(*it); 1609 1609 mBuildLog->logMessage(pad + "# Leaf level " + 1610 1610 StringConverter::toString(node->getLevel()) + -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeHierarchyInterface.cpp
r1304 r2066 132 132 } 133 133 134 dynamic_cast<KdTreeSceneManager *>(mSceneManager)->getRenderQueue()->addRenderable(box);134 static_cast<KdTreeSceneManager *>(mSceneManager)->getRenderQueue()->addRenderable(box); 135 135 } 136 136 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneManager.cpp
r1816 r2066 1346 1346 ////////// 1347 1347 //-- set PVS of view cell visible 1348 1348 1349 GtpVisibilityPreprocessor::ObjectPvsIterator pit = vc->GetPvs().GetIterator(); 1349 1350 … … 1354 1355 if (entry.mObject) 1355 1356 { 1356 OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance *>(entry.mObject);1357 OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(entry.mObject); 1357 1358 omi->GetEntity()->setVisible(load); 1358 1359 } -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreMeshInstance.cpp
r1593 r2066 4 4 namespace Ogre 5 5 { 6 7 6 OgreMeshInstance::OgreMeshInstance(Entity *ent): 8 7 GtpVisibilityPreprocessor::Intersectable(), mEntity(ent) … … 74 73 return s; 75 74 } 76 77 75 } -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp
r1823 r2066 28 28 29 29 //----------------------------------------------------------------------- 30 OcclusionCullingSceneManager::OcclusionCullingSceneManager(const String& name, 31 GtpVisibility::VisibilityManager *visManager): 30 OcclusionCullingSceneManager::OcclusionCullingSceneManager( 31 const String& name, 32 GtpVisibility::VisibilityManager *visManager): 32 33 TerrainSceneManager(name), 33 34 mVisibilityManager(visManager), … … 432 433 433 434 if (obj->Type() == 434 GtpVisibilityPreprocessor::Intersectable:: OBJECTS_INTERSECTABLE)435 GtpVisibilityPreprocessor::Intersectable::ENGINE_INTERSECTABLE) 435 436 { 436 ObjectsIntersectable *oi = dynamic_cast<ObjectsIntersectable *>(obj);437 EngineIntersectable *oi = static_cast<EngineIntersectable *>(obj); 437 438 438 439 EntityContainer *entries = oi->GetItem(); … … 457 458 case GtpVisibilityPreprocessor::Intersectable::OGRE_MESH_INSTANCE: 458 459 { 459 OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance *>(obj);460 OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(obj); 460 461 omi->GetEntity()->_updateRenderQueue(getRenderQueue()); 461 462 } 462 463 break; 463 464 464 case GtpVisibilityPreprocessor::Intersectable:: OBJECTS_INTERSECTABLE:465 case GtpVisibilityPreprocessor::Intersectable::ENGINE_INTERSECTABLE: 465 466 { 466 ObjectsIntersectable *oi = dynamic_cast<ObjectsIntersectable *>(obj);467 EngineIntersectable *oi = static_cast<EngineIntersectable *>(obj); 467 468 468 469 EntityContainer *entries = oi->GetItem(); … … 471 472 for (eit = entries->begin(); eit != eit_end; ++ eit) 472 473 { 473 //OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance *>(*eit);474 //OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(*eit); 474 475 Entity *ent = *eit; 475 476 Any newAny = ent->getUserAny(); … … 1394 1395 case GtpVisibilityPreprocessor::Intersectable::OGRE_MESH_INSTANCE: 1395 1396 { 1396 OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance *>(entry);1397 OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(entry); 1397 1398 omi->GetEntity()->setVisible(visible); 1398 1399 //GtpVisibilityPreprocessor::Debug << "assigned id " << omi->GetId() << endl; 1399 1400 } 1400 1401 break; 1401 case GtpVisibilityPreprocessor::Intersectable:: OBJECTS_INTERSECTABLE:1402 case GtpVisibilityPreprocessor::Intersectable::ENGINE_INTERSECTABLE: 1402 1403 { 1403 //GtpVisibilityPreprocessor::ObjectsIntersectable *oi = 1404 // dynamic_cast<GtpVisibilityPreprocessor::ObjectsIntersectable *>(entry); 1405 ObjectsIntersectable *oi = dynamic_cast<ObjectsIntersectable *>(entry); 1406 1407 //GtpVisibilityPreprocessor::ObjectContainer *entries = oi->GetItem(); 1404 EngineIntersectable *oi = static_cast<EngineIntersectable *>(entry); 1405 1408 1406 EntityContainer *entries = oi->GetItem(); 1409 1407 EntityContainer::const_iterator eit, … … 1411 1409 for (eit = entries->begin(); eit != eit_end; ++ eit) 1412 1410 { 1413 //OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance *>(*eit);1414 1411 Entity *ent = *eit; 1415 1412 ent->setVisible(visible); 1416 //GtpVisibilityPreprocessor::Debug << "assigned id " << omi->GetId() << endl;1417 1413 } 1418 1414 } … … 1484 1480 case GtpVisibilityPreprocessor::Intersectable::OGRE_MESH_INSTANCE: 1485 1481 { 1486 OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance *>(obj);1482 OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(obj); 1487 1483 omi->GetEntity()->setVisible(load); 1488 1484 //GtpVisibilityPreprocessor::Debug << "assigned id " << omi->GetId() << endl; 1489 1485 } 1490 1486 break; 1491 case GtpVisibilityPreprocessor::Intersectable:: OBJECTS_INTERSECTABLE:1487 case GtpVisibilityPreprocessor::Intersectable::ENGINE_INTERSECTABLE: 1492 1488 { 1493 //GtpVisibilityPreprocessor:: ObjectsIntersectable *oi =1494 // dynamic_cast<GtpVisibilityPreprocessor::ObjectsIntersectable *>(entry);1495 ObjectsIntersectable *oi = dynamic_cast<ObjectsIntersectable *>(obj);1489 //GtpVisibilityPreprocessor::EngineIntersectable *oi = 1490 // static_cast<GtpVisibilityPreprocessor::EngineIntersectable *>(entry); 1491 EngineIntersectable *oi = static_cast<EngineIntersectable *>(obj); 1496 1492 1497 1493 //GtpVisibilityPreprocessor::ObjectContainer *entries = oi->GetItem(); … … 1502 1498 for (eit = entries->begin(); eit != eit_end; ++ eit) 1503 1499 { 1504 //OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance *>(*eit);1500 //OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(*eit); 1505 1501 //omi->GetEntity()->setVisible(load); 1506 1502 Entity *ent = *eit; -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionQueriesQueryManager.cpp
r1602 r2066 27 27 // we need access to the scene manager and the rendersystem 28 28 PlatformHierarchyInterface *pfHierarchyInterface = 29 // dynamic_cast<PlatformHierarchyInterface *>(mHierarchyInterface);29 //static_cast<PlatformHierarchyInterface *>(mHierarchyInterface); 30 30 static_cast<PlatformHierarchyInterface *>(mHierarchyInterface); 31 31 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOctreeHierarchyInterface.cpp
r944 r2066 116 116 octant->setLastRendered(mFrameId); 117 117 OctreeSceneManager *ocm = 118 dynamic_cast<OctreeSceneManager *>(mSceneManager);118 static_cast<OctreeSceneManager *>(mSceneManager); 119 119 120 120 ocm->_renderOctant(mCamera, octant, mOnlyShadowCasters, mLeavePassesInQueue); … … 172 172 } 173 173 174 // dynamic_cast<OctreeSceneManager *>(mSceneManager)->getBoxes()->push_back(box);175 dynamic_cast<OctreeSceneManager *>(mSceneManager)->getBoxes()->push_back(box);174 //static_cast<OctreeSceneManager *>(mSceneManager)->getBoxes()->push_back(box); 175 static_cast<OctreeSceneManager *>(mSceneManager)->getBoxes()->push_back(box); 176 176 } 177 177 //----------------------------------------------------------------------- -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgrePlatformQueryManager.cpp
r925 r2066 33 33 bool relativeVisibility) 34 34 { 35 SceneManager *sm = // dynamic_cast<PlatformHierarchyInterface *>35 SceneManager *sm = //static_cast<PlatformHierarchyInterface *> 36 36 static_cast<PlatformHierarchyInterface *> 37 37 (mHierarchyInterface)->GetSceneManager(); … … 96 96 // we need access to the scene manager and the rendersystem 97 97 PlatformHierarchyInterface *pfHierarchyInterface = 98 // dynamic_cast<PlatformHierarchyInterface *>(mHierarchyInterface);98 //static_cast<PlatformHierarchyInterface *>(mHierarchyInterface); 99 99 static_cast<PlatformHierarchyInterface *>(mHierarchyInterface); 100 100 … … 195 195 196 196 SceneManager *sm = 197 // dynamic_cast<PlatformHierarchyInterface *>(mHierarchyInterface)->GetSceneManager();197 //static_cast<PlatformHierarchyInterface *>(mHierarchyInterface)->GetSceneManager(); 198 198 static_cast<PlatformHierarchyInterface *>(mHierarchyInterface)->GetSceneManager(); 199 199 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/src/VisibilityManager.cpp
r925 r2066 115 115 VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING) 116 116 { 117 dynamic_cast<CoherentHierarchicalCullingManager *>(mCullingManager)->117 static_cast<CoherentHierarchicalCullingManager *>(mCullingManager)-> 118 118 SetAssumedVisibility(assumedVisibility); 119 119 } -
GTP/trunk/Lib/Vis/Preprocessing/scripts/generate_viewcells.env
r2065 r2066 5 5 6 6 Scene { 7 # filename ../data/vienna/vienna_cropped.obj 8 filename ../data/soda/soda5.obj 7 filename ../data/vienna/vienna_cropped.obj 8 # filename ../data/soda/soda5.obj 9 # filename ../data/soda/soda5.dat 9 10 } 10 11 … … 86 87 maxDepth 20 87 88 88 maxCostRatio 2.5 89 maxCostRatio 1.5 90 #maxCostRatio 999999 89 91 ct_div_ci 0.5 90 92 } … … 127 129 128 130 exportPvs false 131 filename vienna_cropped-visibility.xml.gz 129 132 130 133 # type of view cells … … 164 167 } 165 168 166 showVisualization true167 #showVisualization false169 #showVisualization true 170 showVisualization false 168 171 evaluateViewCells false 169 172 … … 187 190 VspBspTree { 188 191 Construction { 189 samples 300000192 samples 2000000 190 193 epsilon 0.0000001 191 194 randomize false … … 208 211 209 212 # maximal tested rays for split cost heuristics 210 maxTests 10000 213 maxTests 100000 211 214 212 215 maxTotalMemory 50 … … 235 238 minGlobalCostRatio 0.0001 236 239 237 maxViewCells 200 238 239 240 maxViewCells 5000 241 240 242 # used for pvs criterium 241 243 ct_div_ci 0.0 -
GTP/trunk/Lib/Vis/Preprocessing/scripts/generate_viewcells.sh
r2064 r2066 9 9 PROGRAM=../bin/$TARGET/Preprocessor.exe 10 10 11 #SCENE=vienna_cropped12 SCENE=soda511 SCENE=vienna_cropped 12 #SCENE=soda5 13 13 14 14 LOG_PREFIX=../scripts/$SCENE … … 33 33 34 34 $PROGRAM $ENVIRONMENT \ 35 -view_cells_type=vspBspTree \36 35 -view_cells_filename=$LOG_PREFIX-visibility.xml.zip 37 36 -
GTP/trunk/Lib/Vis/Preprocessing/src/BoundingBoxConverter.h
r1676 r2066 16 16 }; 17 17 18 /** Class used to assign unique indices to objects using a comparison of bounding boxes. 18 /** Class used to assign unique indices to objects using a 19 comparison of bounding boxes. 19 20 */ 20 21 class BoundingBoxConverter 21 22 { 22 23 public: 23 /** Takes a vector of indexed bounding boxes and uses it to identify objects with a similar bounding box 24 and assigns them their index (id). 24 /** Takes a vector of indexed bounding boxes and uses it to 25 identify objects with a similar bounding box 26 and assigns them the proper index (id). 25 27 The objects are returned in the object container. 26 28 … … 30 32 ObjectContainer &objects) const 31 33 { 32 // default: do nothing as we assume that a unique id is already assigned to the objects. 34 // default: do nothing as we assume that a unique id is 35 // already assigned to the objects. 33 36 return true; 34 37 } -
GTP/trunk/Lib/Vis/Preprocessing/src/CombinedPreprocessor.cpp
r2051 r2066 119 119 120 120 if (i - lastEvaluation >= mSamplesPerEvaluation) { 121 longtime = TimeDiff(startTime, GetTime());121 Real time = TimeDiff(startTime, GetTime()); 122 122 mViewCellsManager->PrintPvsStatistics(mStats); 123 123 mStats << … … 147 147 148 148 149 longtime = TimeDiff(startTime, GetTime());149 Real time = TimeDiff(startTime, GetTime()); 150 150 if (mTotalTime!= -1 && time/1000 > mTotalTime) 151 151 break; -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r2017 r2066 1951 1951 if (!vc->GetPvs().Empty()) 1952 1952 { 1953 //if (vc->IsLeaf()) cout << " l " << pvs.GetSize();1954 //else cout << " i " << pvs.GetSize();1955 1953 pvs.MergeInPlace(vc->GetPvs()); 1956 1954 } 1957 1955 else if (!vc->IsLeaf()) // interior cells: go down to leaf level 1958 1956 { 1959 //cout <<" t";1960 1957 ViewCellInterior *interior = static_cast<ViewCellInterior *>(vc); 1961 1958 ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); … … 1966 1963 } 1967 1964 } 1968 else cout <<"k";1969 1965 } 1970 1966 } … … 2104 2100 //GetPvsRecursive(vc, pvs); 2105 2101 vc->SetPvs(pvs); 2106 //cout << "q"; 2107 } 2108 //else cout << "t"; 2102 } 2109 2103 #endif 2110 2104 -
GTP/trunk/Lib/Vis/Preprocessing/src/Intersectable.h
r2048 r2066 18 18 19 19 20 struct FaceParentInfo { 20 struct FaceParentInfo 21 { 21 22 /// intersectable 22 23 Intersectable *mObject; … … 30 31 31 32 32 class Intersectable { 33 class Intersectable 34 { 33 35 public: 34 36 … … 42 44 BvhLeaf *mBvhLeaf; 43 45 44 /// # of references to this instance45 //int mReferences;46 47 //////////////////48 // note matt: delete these, they are only taking memory49 50 /// object based pvs51 //KdPvs mKdPvs;52 53 /// view cell based pvs per object54 //ViewCellPvs mViewCellPvs;55 56 46 /////////////////////// 57 47 … … 64 54 BVH_INTERSECTABLE, 65 55 TRIANGLE_INTERSECTABLE, 66 OBJECTS_INTERSECTABLE,67 DUMMY_INTERSECTABLE56 DUMMY_INTERSECTABLE, 57 ENGINE_INTERSECTABLE, 68 58 }; 69 59 70 Intersectable(): 71 mMailbox(0), 72 //mReferences(0), 73 mBvhLeaf(0), 74 mVssRays(NULL) {} 60 Intersectable(); 75 61 76 virtual Intersectable::~Intersectable() {DEL_PTR(mVssRays);}62 virtual ~Intersectable(); 77 63 78 64 void SetId(const int id) { mId = id; } 79 65 int GetId() { return mId; } 80 66 81 ///////////// ///////////////////////////////////82 // 67 ///////////// 68 // Mailing stuff 83 69 84 static void NewMail(const int reserve = 1) { 85 sMailId += sReservedMailboxes; 86 sReservedMailboxes = reserve; 70 static void NewMail(const int reserve = 1) 71 { 72 sMailId += sReservedMailboxes; 73 sReservedMailboxes = reserve; 87 74 } 88 75 … … 104 91 105 92 106 //////////////////////////////////////////////////// 93 //////////////// 94 // virtual interface 95 107 96 virtual AxisAlignedBox3 GetBox() const = 0; 108 97 virtual int CastRay(Ray &ray) = 0; … … 114 103 virtual int NumberOfFaces() const = 0; 115 104 virtual int Type() const = 0; 116 virtual float GetArea() const {return 0; }105 117 106 virtual int GetRandomSurfacePoint(Vector3 &point, Vector3 &normal) = 0; 118 virtual int GetRandomSurfacePoint(const float u, 119 const float v, 120 Vector3 &point, 121 Vector3 &normal) { 122 cerr<<"GetRandomSurfacePoint(u,v...) not yet implemented"<<endl; 123 return 1; 124 } 125 107 126 108 virtual int GetRandomEdgePoint(Vector3 &point, 127 109 Vector3 &normal) = 0; … … 132 114 const int maxTries) = 0; 133 115 134 // virtual int GetRandomPoint(Vector3 &point,135 // Vector3 &normal) = 0;116 // virtual int GetRandomPoint(Vector3 &point, 117 // vector3 &normal) = 0; 136 118 137 119 virtual ostream &Describe(ostream &s) = 0; 138 120 121 ////////////////////////////////////// 122 123 139 124 virtual int GenerateSilhouetteRays(const int nrays, 140 const AxisAlignedBox3 &originBox, 141 const AxisAlignedBox3 &directionBox, VssRayContainer &rays) 142 { 143 return 0; 144 } 125 const AxisAlignedBox3 &originBox, 126 const AxisAlignedBox3 &directionBox, 127 VssRayContainer &rays); 128 129 virtual int GetRandomSurfacePoint(const float u, 130 const float v, 131 Vector3 &point, 132 Vector3 &normal); 145 133 146 static bool GreaterCounter(const Intersectable *a, 147 const Intersectable *b) 148 { 149 return a->mCounter > b->mCounter; 150 } 134 virtual float GetArea() const; 151 135 152 static string GetTypeName(Intersectable *obj) 153 { 154 switch(obj->Type()) 155 { 156 case MESH_INSTANCE: 157 return "mesh_instance\n"; 136 static bool GreaterCounter(const Intersectable *a, 137 const Intersectable *b); 158 138 159 case TRANSFORMED_MESH_INSTANCE: 160 return "transformed_mesh_instance\n"; 139 /** Returns the name of the type of this intersectable 140 */ 141 static string GetTypeName(Intersectable *obj); 161 142 162 case SPHERE: 163 return "sphere\n"; 143 /** Returns normal from the face with the specified index. 144 PROBLEM: Does not fit to all intersectable types (e.g., spheres) 145 */ 146 virtual Vector3 GetNormal(const int idx) const; 164 147 165 case VIEW_CELL: 166 return "view cell\n"; 148 /** Returns rays stored with this intersectable. 149 */ 150 VssRayContainer *GetOrCreateRays(); 167 151 168 case OGRE_MESH_INSTANCE: 169 return "ogre_mesh_instance\n"; 170 171 case KD_INTERSECTABLE: 172 return "kd_intersectable\n"; 173 174 default: 175 return "unknown\n"; 176 } 177 } 178 179 /** Returns normal from the face with the specified index. 180 PROBLEM: Does not fit to all intersectable types (e.g., spheres) 181 */ 182 virtual Vector3 GetNormal(const int idx) const { return Vector3(0, 0, 0); } 183 184 VssRayContainer *GetOrCreateRays() 185 { 186 if (!mVssRays) 187 mVssRays = new VssRayContainer(); 188 return mVssRays; 189 } 190 191 void DelRayRefs() 192 { 193 DEL_PTR(mVssRays); 194 } 152 /** Deletes the rays associated with this intersectable. 153 */ 154 void DelRayRefs(); 195 155 196 156 protected: 197 157 198 199 158 /// some rays piercing this intersectable 159 VssRayContainer *mVssRays; 200 160 }; 201 161 -
GTP/trunk/Lib/Vis/Preprocessing/src/IntersectableWrapper.h
r2048 r2066 165 165 { 166 166 public: 167 AxisAlignedBox3 mBox; 168 169 KdIntersectable(KdNode *item, const AxisAlignedBox3 &box); 170 171 172 int Type() const 173 { 174 return Intersectable::KD_INTERSECTABLE; 175 } 176 177 178 AxisAlignedBox3 GetBox() const { 179 return mBox; 180 } 167 AxisAlignedBox3 mBox; 168 169 KdIntersectable(KdNode *item, const AxisAlignedBox3 &box); 170 171 int Type() const 172 { 173 return Intersectable::KD_INTERSECTABLE; 174 } 175 176 AxisAlignedBox3 GetBox() const 177 { 178 return mBox; 179 } 181 180 }; 182 181 -
GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp
r2017 r2066 16 16 int KdNode::sMailId = 1; 17 17 int KdNode::sReservedMailboxes = 1; 18 18 19 19 20 inline static bool ilt(Intersectable *obj1, Intersectable *obj2) … … 178 179 179 180 180 181 181 bool 182 182 KdTree::TerminationCriteriaMet(const KdLeaf *leaf) 183 183 { 184 // cerr<<"\n OBJECTS="<<leaf->mObjects.size()<<endl; 185 return 186 ((int)leaf->mObjects.size() <= mTermMinCost) || 187 (leaf->mDepth >= mTermMaxDepth); 188 184 const bool criteriaMet = 185 ((int)leaf->mObjects.size() <= mTermMinCost) || 186 (leaf->mDepth >= mTermMaxDepth); 187 188 if (criteriaMet) 189 cerr<<"\n OBJECTS="<<leaf->mObjects.size()<<endl; 190 191 return criteriaMet; 189 192 } 190 193 … … 462 465 { 463 466 CLEAR_CONTAINER(*splitCandidates); 464 //splitCandidates->clear(); 465 466 int requestedSize = 2*(int)node->mObjects.size(); 467 // creates a sorted split candidates array 468 if (splitCandidates->capacity() > 500000 && 469 requestedSize < (int)(splitCandidates->capacity()/10) ) { 470 delete splitCandidates; 471 splitCandidates = new vector<SortableEntry *>; 467 //splitCandidates->clear(); 468 469 int requestedSize = 2*(int)node->mObjects.size(); 470 471 // creates a sorted split candidates array 472 if (splitCandidates->capacity() > 500000 && 473 requestedSize < (int)(splitCandidates->capacity()/10) ) { 474 delete splitCandidates; 475 splitCandidates = new vector<SortableEntry *>; 472 476 } 473 477 … … 477 481 for(ObjectContainer::const_iterator mi = node->mObjects.begin(); 478 482 mi != node->mObjects.end(); 479 mi++) { 480 AxisAlignedBox3 box = (*mi)->GetBox(); 481 482 splitCandidates->push_back(new SortableEntry(SortableEntry::BOX_MIN, 483 box.Min(axis), 484 *mi) 485 ); 483 mi++) 484 { 485 AxisAlignedBox3 box = (*mi)->GetBox(); 486 487 splitCandidates->push_back(new SortableEntry(SortableEntry::BOX_MIN, 488 box.Min(axis), 489 *mi) 490 ); 486 491 487 488 splitCandidates->push_back(new SortableEntry(SortableEntry::BOX_MAX, 489 box.Max(axis), 490 *mi) 491 ); 492 } 493 494 stable_sort(splitCandidates->begin(), splitCandidates->end()); 492 splitCandidates->push_back(new SortableEntry(SortableEntry::BOX_MAX, 493 box.Max(axis), 494 *mi) 495 ); 496 } 497 498 stable_sort(splitCandidates->begin(), splitCandidates->end(), iltS); 495 499 } 496 500 -
GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.h
r2003 r2066 546 546 547 547 }; 548 548 549 inline static bool iltS(SortableEntry *a, SortableEntry *b) 550 { 551 return a->value < b->value; 552 } 553 549 554 // reusable array of split candidates 550 555 vector<SortableEntry *> *splitCandidates; -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r2065 r2066 1313 1313 } 1314 1314 1315 cout << "here5" << endl;1316 1317 1315 DeterminePvsObjects(vssRays); 1318 1316 } -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj
r2063 r2066 71 71 OptimizeForProcessor="0" 72 72 OptimizeForWindowsApplication="TRUE" 73 AdditionalIncludeDirectories="..\include;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\NonGTP\Boost "73 AdditionalIncludeDirectories="..\include;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\NonGTP\Boost;Timer" 74 74 PreprocessorDefinitions="WIN32;NDEBUG;_LIB" 75 75 ExceptionHandling="TRUE" … … 500 500 </File> 501 501 <File 502 RelativePath=".\Intersectable.cpp"> 503 </File> 504 <File 502 505 RelativePath=".\Intersectable.h"> 503 506 </File> -
GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.cpp
r2065 r2066 144 144 KdLeaf::NewMail(); 145 145 146 cout << "here55 " << GetSize() << endl;147 148 146 ObjectPvsEntries::const_iterator it, it_end = mEntries.end(); 149 147 … … 162 160 } 163 161 case Intersectable::BVH_INTERSECTABLE: 164 { cout<< "i";162 { 165 163 BvhNode *bvhObj = static_cast<BvhNode *>(obj); 166 164 pvs += EvalBvhNodeContribution(bvhObj); … … 168 166 } 169 167 default: 168 // hack: should use assigned cost here 170 169 ++ pvs; 170 171 171 break; 172 172 } 173 173 } 174 174 175 cout << "here44 " << pvs << endl;176 175 return pvs; 177 176 } -
GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h
r2019 r2066 140 140 { 141 141 public: 142 PvsIterator<T, S>(){} 142 143 PvsIterator<T, S>() {} 144 143 145 PvsIterator<T, S>(const typename vector<PvsEntry<T, S> >::const_iterator &itCurrent, 144 146 const typename vector<PvsEntry<T, S> >::const_iterator &itEnd): … … 208 210 @param checkDirty if dirty part of the pvs should be checked for entry 209 211 (warning: linear runtime in dirty part) 210 @returns iterator on the sample. 212 @returns iterator on the sample if found, else the place where 213 it would be added in the sorted vector. 211 214 */ 212 215 bool Find(T sample, … … 222 225 223 226 /** Adds sample to PVS without checking for presence of the sample 224 pvs remains unsorted!227 warning: pvs remains unsorted! 225 228 */ 226 229 void AddSampleDirty(T sample, const float pdf); … … 402 405 void Pvs<T, S>::SimpleSort() 403 406 { 404 // sort(mEntries.begin(), mEntries.end()); 405 std::vector<PvsEntry<T, S> >::iterator it = mEntries.begin() + mLastSorted; 407 // sort(mEntries.begin(), mEntries.end()); 408 std::vector<PvsEntry<T, S> >::iterator it = mEntries.begin() + mLastSorted; 409 410 sort(it, mEntries.end()); 411 inplace_merge(mEntries.begin(), it, mEntries.end()); 406 412 407 sort(it, mEntries.end()); 408 inplace_merge(mEntries.begin(), it, mEntries.end()); 409 410 mLastSorted = (int)mEntries.size(); 411 mQueriesSinceSort = 0; 413 mLastSorted = (int)mEntries.size(); 414 mQueriesSinceSort = 0; 412 415 } 413 416 … … 635 638 const bool checkDirty) 636 639 { 637 PvsEntry<T, S> dummy(sample, PvsData()); 638 mQueriesSinceSort++; 639 640 // only check clean part 641 vector<PvsEntry<T, S> >::iterator sorted_end = mEntries.begin() + mLastSorted; 642 643 // binary search 644 it = lower_bound(mEntries.begin(), sorted_end, dummy); 645 646 if ((it != mEntries.end()) && ((*it).mObject == sample)) 647 // if (it != sorted_end) 648 return true; 649 650 // sample not found yet => search further in the unsorted part 651 if (checkDirty) { 652 653 for (it = sorted_end; (it != mEntries.end()) && ((*it).mObject != sample); ++ it) ; 654 655 if (it != mEntries.end()) 656 return true; 657 } 658 659 return false; 660 } 661 640 bool found = false; 641 642 PvsEntry<T, S> dummy(sample, PvsData()); 643 644 // only check clean part 645 vector<PvsEntry<T, S> >::iterator sorted_end = mEntries.begin() + mLastSorted; 646 647 // binary search 648 it = lower_bound(mEntries.begin(), sorted_end, dummy); 649 650 if ((it != mEntries.end()) && ((*it).mObject == sample)) 651 found = true; 652 653 // sample not found yet => search further in the unsorted part 654 if (!found && checkDirty) 655 { 656 vector<PvsEntry<T, S> >::iterator dit, dit_end = mEntries.end(); 657 658 for (dit = sorted_end; (dit != dit_end) && ((*dit).mObject != sample); ++ dit); 659 660 if (dit != dit_end) 661 { 662 found = true; 663 it = dit; 664 } 665 } 666 667 return found; 668 } 669 670 /* 671 template <typename T, typename S> 672 bool Pvs<T, S>::Find(T sample, 673 typename vector<PvsEntry<T, S> >::iterator &it, 674 const bool checkDirty) 675 { 676 PvsEntry<T, S> dummy(sample, PvsData()); 677 mQueriesSinceSort++; 678 679 // only check clean part 680 vector<PvsEntry<T, S> >::iterator sorted_end = mEntries.begin() + mLastSorted; 681 682 // binary search 683 it = lower_bound(mEntries.begin(), sorted_end, dummy); 684 685 if ((it != mEntries.end()) && ((*it).mObject == sample)) 686 return true; 687 688 // sample not found yet => search further in the unsorted part 689 if (checkDirty) 690 { 691 for (it = sorted_end; (it != mEntries.end()) && ((*it).mObject != sample); ++ it); 692 693 if (it != mEntries.end()) 694 return true; 695 } 696 697 return false; 698 } 699 */ 662 700 663 701 template <typename T, typename S> … … 674 712 template <typename T, typename S> 675 713 float Pvs<T, S>::AddSample(T sample, const float pdf) 676 { 714 {cout << "t"; 677 715 ++ mSamples; 678 716 … … 687 725 } 688 726 else 689 727 { 690 728 PvsEntry<T, S> entry(sample, pdf); 691 729 mEntries.insert(it, entry); 692 730 ++ mLastSorted; 693 731 return pdf; 694 732 } 695 733 } 696 734 … … 711 749 712 750 vector<PvsEntry<T, S> >::iterator it; 713 const bool entryFound = =Find(sample, it);751 const bool entryFound = Find(sample, it); 714 752 715 753 if (entryFound) … … 740 778 741 779 vector<PvsEntry<T, S> >::iterator it; 742 bool entryFound = Find(sample, it); 743 744 if (entryFound) { 745 S &data = (*it).mData; 780 const bool entryFound = Find(sample, it); 781 782 if (entryFound) 783 { 784 S &data = (*it).mData; 746 785 747 data.mSumPdf += pdf; 748 //contribution = pdf / data.mSumPdf; 749 750 return false; 751 } 752 else { 753 AddSampleDirty(sample, pdf); 754 //contribution = 1.0f; 755 return true; 786 data.mSumPdf += pdf; 787 //contribution = pdf / data.mSumPdf; 788 789 return false; 790 } 791 else 792 { 793 AddSampleDirty(sample, pdf); 794 //contribution = 1.0f; 795 796 return true; 756 797 } 757 798 } -
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingPreprocessor.cpp
r2049 r2066 162 162 163 163 if (samples - lastEvaluation >= mSamplesPerEvaluation) { 164 longtime = TimeDiff(startTime, GetTime());164 Real time = TimeDiff(startTime, GetTime()); 165 165 mViewCellsManager->PrintPvsStatistics(mStats); 166 166 mStats << … … 177 177 } 178 178 179 longtime = TimeDiff(startTime, GetTime());179 Real time = TimeDiff(startTime, GetTime()); 180 180 if (mTotalTime != -1 && time/1000 > mTotalTime) 181 181 break; -
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp
r2048 r2066 389 389 Vector3 point; 390 390 Vector3 normal; 391 //cout << "w";391 392 392 const int i = (int)RandomValue(0, (float)mPreprocessor.mObjects.size() - 0.5f); 393 393 -
GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj
r2053 r2066 76 76 EnableIntrinsicFunctions="TRUE" 77 77 FavorSizeOrSpeed="1" 78 OmitFramePointers="TRUE" 79 EnableFiberSafeOptimizations="TRUE" 78 80 OptimizeForProcessor="0" 79 81 OptimizeForWindowsApplication="TRUE" 80 AdditionalIncludeDirectories="..\include;..\..\..\..\..\..\NonGTP\Boost;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\MultiLevelRayTracing "82 AdditionalIncludeDirectories="..\include;..\..\..\..\..\..\NonGTP\Boost;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\MultiLevelRayTracing;Timer" 81 83 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NO_QT" 82 84 RuntimeLibrary="2" 83 RuntimeTypeInfo="TRUE" 85 EnableEnhancedInstructionSet="2" 86 RuntimeTypeInfo="FALSE" 84 87 UsePrecompiledHeader="0" 85 88 BrowseInformation="1" -
GTP/trunk/Lib/Vis/Preprocessing/src/Timer/merror.h
r2015 r2066 249 249 #define CHKGL _BLBEGIN GLenum error; \ 250 250 if ( (error = glGetError()) != GL_NO_ERROR) \ 251 EOUT( gluErrorString(error)); _BLEND;251 EOUT("here4 " << gluErrorString(error)); _BLEND; 252 252 253 253 #ifdef WIN32 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
r2017 r2066 265 265 float &contribution) 266 266 { 267 cout<<"e"; 267 268 const bool result = mPvs.AddSample(sample, pdf);//, contribution); 268 269 // have to recompute pvs size -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r2065 r2066 742 742 vector<int>::const_iterator iit, iit_end = strategies.end(); 743 743 744 cout << "===============================\n" << endl;745 744 for (iit = strategies.begin(); iit != iit_end; ++ iit) 746 745 { … … 760 759 // shoot simple ray and add it to importance samples 761 760 mPreprocessor->CastRays(simpleRays, passSamples, true); 761 762 762 cout << "cast " << samplesPerPass << " samples in " 763 763 << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 764 764 765 cout << "===============================\n" << endl;766 765 return (int)passSamples.size(); 767 766 } … … 2598 2597 } 2599 2598 #else 2599 cout<<"b"; 2600 2600 pvs.AddSample(obj, pdf); 2601 2601 #endif … … 2619 2619 Intersectable *obj, 2620 2620 const Vector3 &pt, 2621 const bool add Rays)2621 const bool addSamplesToPvs) 2622 2622 { 2623 2623 // check if we are outside of view space … … 2635 2635 2636 2636 // todo: maybe not correct for kd node pvs 2637 if (add Rays) {2637 if (addSamplesToPvs) { 2638 2638 hasAbsContribution = viewCell->GetPvs().AddSampleDirtyCheck(obj, 2639 2639 ray.mPdf); 2640 //hasAbsContribution = viewCell->GetPvs().AddSample(obj,ray.mPdf); 2640 2641 } 2641 2642 else { … … 2653 2654 absContribution = relContribution = 1.0f; 2654 2655 if (viewCell->GetPvs().RequiresResort()) 2655 viewCell->GetPvs().SimpleSort(); 2656 2657 // viewCell->GetPvs().SimpleSort(); 2656 viewCell->GetPvs().SimpleSort(); 2658 2657 2659 2658 #if CONTRIBUTION_RELATIVE_TO_PVS_SIZE … … 3310 3309 { 3311 3310 Intersectable *o = *noi; 3312 3311 cout<<"w"; 3313 3312 // $$ JB warning: pdfs are not correct at this point! 3314 3313 nPvs.AddSample(o, Limits::Small); … … 3620 3619 if (root->IsLeaf()) 3621 3620 { 3622 //cout << "updating leaf" << endl;3623 3621 // we assume that pvs is explicitly stored in leaves 3624 3622 pvs = root->GetPvs(); … … 3634 3632 // reset interior pvs 3635 3633 interior->GetPvs().Clear(); 3634 3636 3635 // reset recursive pvs 3637 3636 pvs.Clear(); … … 3655 3654 Intersectable::NewMail(); 3656 3655 3656 /////////// 3657 3657 //-- faster way of computing pvs: 3658 3658 //-- construct merged pvs by adding … … 3675 3675 if (!intersect->Mailed()) 3676 3676 { 3677 pvs.AddSample(intersect, entry.mData.mSumPdf);3678 3677 intersect->Mail(); 3678 3679 if (pvs.AddSampleDirtyCheck(intersect, entry.mData.mSumPdf)) 3680 { 3681 if (pvs.RequiresResort()) 3682 { 3683 pvs.SimpleSort(); 3684 } 3685 } 3686 3679 3687 } 3680 3688 } … … 5087 5095 } 5088 5096 5089 if (mShowVisualization)5090 {5091 // use pvs size for color coding5092 mColorCode = 1;5093 Exporter *exporter = Exporter::GetExporter("merged_view_cells_pvs.wrl");5094 5095 cout << "exporting view cells after merge (pvs size) ... ";5096 5097 if (exporter)5098 {5099 exporter->SetFilled();5100 5101 ExportViewCellsForViz(exporter, NULL, mColorCode, GetClipPlane());5102 5103 if (mExportGeometry)5104 {5105 Material m;5106 m.mDiffuseColor = RgbColor(0, 1, 0);5107 exporter->SetForcedMaterial(m);5108 exporter->SetFilled();5109 5110 exporter->ExportGeometry(objects);5111 }5112 5113 delete exporter;5114 }5115 cout << "finished" << endl;5116 }5117 5118 5097 mColorCode = savedColorCode; 5119 5098 } -
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
r2021 r2066 26 26 #define USE_FIXEDPOINT_T 0 27 27 #define COUNT_ORIGIN_OBJECTS 1 28 29 #define STORE_PVS 0 28 30 29 31 … … 822 824 leaf->SetViewCell(viewCell); 823 825 824 //-- update pvs 825 int conSamp = 0; 826 float sampCon = 0.0f; 827 AddToPvs(leaf, *tData.mRays, sampCon, conSamp); 828 829 // update scalar pvs size lookup 830 ObjectPvs &pvs = viewCell->GetPvs(); 831 mViewCellsManager->UpdateScalarPvsSize(viewCell, pvs.EvalPvsCost(), pvs.GetSize()); 832 833 834 mBspStats.contributingSamples += conSamp; 835 mBspStats.sampleContributions += (int)sampCon; 836 826 if (STORE_PVS) 827 { 828 ////////// 829 //-- update pvs 830 831 int conSamp = 0; 832 float sampCon = 0.0f; 833 834 AddToPvs(leaf, *tData.mRays, sampCon, conSamp); 835 836 // update scalar pvs size lookup 837 ObjectPvs &pvs = viewCell->GetPvs(); 838 mViewCellsManager->UpdateScalarPvsSize(viewCell, pvs.EvalPvsCost(), pvs.GetSize()); 839 840 mBspStats.contributingSamples += conSamp; 841 mBspStats.sampleContributions += (int)sampCon; 842 } 843 844 ////////// 837 845 //-- store additional info 846 838 847 if (mStoreRays) 839 848 { … … 966 975 leaf->SetViewCell(viewCell); 967 976 968 //-- update pvs 969 int conSamp = 0; 970 float sampCon = 0.0f; 971 AddToPvs(leaf, *tData.mRays, sampCon, conSamp); 972 973 // update scalar pvs size value 974 ObjectPvs &pvs = viewCell->GetPvs(); 975 mViewCellsManager->UpdateScalarPvsSize(viewCell, 976 pvs.EvalPvsCost(), 977 pvs.GetSize()); 978 979 mBspStats.contributingSamples += conSamp; 980 mBspStats.sampleContributions += (int)sampCon; 977 if (STORE_PVS) 978 { 979 ///////// 980 //-- update pvs 981 982 int conSamp = 0; 983 float sampCon = 0.0f; 984 985 AddToPvs(leaf, *tData.mRays, sampCon, conSamp); 986 987 // update scalar pvs size value 988 ObjectPvs &pvs = viewCell->GetPvs(); 989 mViewCellsManager->UpdateScalarPvsSize(viewCell, 990 pvs.EvalPvsCost(), 991 pvs.GetSize()); 992 993 mBspStats.contributingSamples += conSamp; 994 mBspStats.sampleContributions += (int)sampCon; 995 } 981 996 982 997 viewCell->mLeaves.push_back(leaf); … … 1254 1269 if (ray->mTerminationObject) 1255 1270 { 1271 cout << "m"; 1256 1272 if (vc->AddPvsSample(ray->mTerminationObject, ray->mPdf, contribution)) 1257 1273 madeContrib = true; -
GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp
r2064 r2066 1018 1018 1019 1019 if (entry) 1020 { 1020 {cout<<"a"; 1021 1021 madeContrib = 1022 1022 vc->GetPvs().AddSample(entry, ray->mPdf); -
GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.cpp
r2065 r2066 624 624 { 625 625 //Preprocessor::DeterminePvsObjects(rays); 626 627 cout << "here4";628 626 mViewCellsManager->DeterminePvsObjects(rays, true); 629 627 }
Note: See TracChangeset
for help on using the changeset viewer.