- Timestamp:
- 10/12/06 01:05:47 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1610 r1614 115 115 } 116 116 117 void BvhLeaf::CollectObjects(ObjectContainer &objects) 118 { 119 ObjectContainer::const_iterator oit, oit_end = objects.end(); 120 for (oit = objects.begin(); oit != oit_end; ++ oit) 121 { 122 objects.push_back(*oit); 123 } 124 } 117 125 118 126 /******************************************************************/ … … 161 169 } 162 170 171 172 void BvhInterior::CollectObjects(ObjectContainer &objects) 173 { 174 mFront->CollectObjects(objects); 175 mBack->CollectObjects(objects); 176 } 163 177 164 178 -
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.h
r1589 r1614 182 182 void SetParent(BvhInterior *parent); 183 183 184 // collects all objects under this node 185 virtual void CollectObjects(ObjectContainer &objects) = 0; 184 186 /** The bounding box specifies the node extent. 185 187 */ … … 255 257 return s << A.mBoundingBox; 256 258 } 257 259 virtual void CollectObjects(ObjectContainer &objects); 258 260 protected: 259 261 … … 291 293 mSubdivisionCandidate = candidate; 292 294 } 293 295 virtual void CollectObjects(ObjectContainer &objects); 294 296 public: 295 297 -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r1610 r1614 1103 1103 } 1104 1104 1105 } 1105 1106 void HierarchyManager::ExportBoundingBoxes(OUT_STREAM &stream, const ObjectContainer &objects) 1107 { 1108 stream << "<BoundingBoxes>" << endl; 1109 1110 if (mObjectSpaceSubdivisionType == KD_BASED_OBJ_SUBDIV) 1111 { 1112 KdIntersectableMap::const_iterator kit, kit_end = mOspTree->mKdIntersectables.end(); 1113 1114 int id = 0; 1115 for (kit = mOspTree->mKdIntersectables.begin(); kit != kit_end; ++ kit, ++ id) 1116 { 1117 Intersectable *obj = (*kit).second; 1118 const AxisAlignedBox3 box = obj->GetBox(); 1119 1120 obj->SetId(id); 1121 1122 stream << "<BoundingBox" << " id=\"" << id << "\"" 1123 << " min=\"" << box.Min().x << " " << box.Min().y << " " << box.Min().z << "\"" 1124 << " max=\"" << box.Max().x << " " << box.Max().y << " " << box.Max().z << "\" />" << endl; 1125 } 1126 } 1127 else 1128 { 1129 ObjectContainer::const_iterator oit, oit_end = objects.end(); 1130 1131 for (oit = objects.begin(); oit != oit_end; ++ oit) 1132 { 1133 const AxisAlignedBox3 box = (*oit)->GetBox(); 1134 1135 stream << "<BoundingBox" << " id=\"" << (*oit)->GetId() << "\"" 1136 << " min=\"" << box.Min().x << " " << box.Min().y << " " << box.Min().z << "\"" 1137 << " max=\"" << box.Max().x << " " << box.Max().y << " " << box.Max().z << "\" />" << endl; 1138 } 1139 } 1140 1141 stream << "</BoundingBoxes>" << endl; 1142 } 1143 1144 } -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h
r1589 r1614 225 225 } 226 226 227 void ExportBoundingBoxes(OUT_STREAM &stream, const ObjectContainer &objects); 228 227 229 228 230 protected: … … 333 335 const VssRayContainer &rays, 334 336 const ObjectContainer &objects); 337 335 338 336 339 protected: -
GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.h
r1613 r1614 589 589 AxisAlignedBox3 mBox; 590 590 KdTreeStatistics mStat; 591 591 public: 592 592 /// stores the kd node intersectables used for pvs 593 593 KdIntersectableMap mKdIntersectables; -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
r1605 r1614 13 13 #include "ViewCellsManager.h" 14 14 #include "Exporter.h" 15 #include "BvHierarchy.h" 16 15 17 16 18 … … 2375 2377 for (it = viewCell->GetPvs().mEntries.begin(); it != it_end; ++ it) 2376 2378 { 2377 stream << (*it).first->GetId() << " "; 2379 Intersectable *obj = (*it).first; 2380 // hack: just output full pvs 2381 if (obj->Type() == Intersectable::BVH_INTERSECTABLE) 2382 { 2383 ObjectContainer objects; 2384 BvhNode *node = dynamic_cast<BvhIntersectable *>(obj)->GetItem(); 2385 node->CollectObjects(objects); 2386 2387 ObjectContainer::const_iterator oit, oit_end = objects.end(); 2388 for (oit = objects.begin(); oit != oit_end; ++ oit) 2389 { 2390 stream << (*oit)->GetId() << " "; 2391 } 2392 } 2393 else 2394 { 2395 stream << (*it).first->GetId() << " "; 2396 } 2378 2397 } 2379 2398 } -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1613 r1614 660 660 //-- export bounding boxes 661 661 stream << "<BoundingBoxes>" << endl; 662 ObjectContainer::const_iterator oit, oit_end = objects.end(); 662 #if USE_KD_PVS 663 KdIntersectableMap::const_iterator kit, kit_end = GetPreprocessor()->mKdTree->mKdIntersectables.end(); 664 665 int id = 0; 666 for (kit = GetPreprocessor()->mKdTree->mKdIntersectables.begin(); kit != kit_end; ++ kit, ++ id) 667 { 668 Intersectable *obj = (*kit).second; 669 const AxisAlignedBox3 box = obj->GetBox(); 670 671 obj->SetId(id); 672 673 stream << "<BoundingBox" << " id=\"" << id << "\"" 674 << " min=\"" << box.Min().x << " " << box.Min().y << " " << box.Min().z << "\"" 675 << " max=\"" << box.Max().x << " " << box.Max().y << " " << box.Max().z << "\" />" << endl; 676 } 677 #else 678 ObjectContainer::const_iterator oit, oit_end = objects.end(); 663 679 664 680 for (oit = objects.begin(); oit != oit_end; ++ oit) … … 672 688 << " max=\"" << box.Max().x << " " << box.Max().y << " " << box.Max().z << "\" />" << endl; 673 689 } 674 690 #endif 675 691 stream << "</BoundingBoxes>" << endl; 676 692 } … … 5339 5355 //-- The bounding boxes are used to identify 5340 5356 //-- the objects in the rendering engine 5341 5342 stream << "<BoundingBoxes>" << endl; 5343 ObjectContainer::const_iterator oit, oit_end = objects.end(); 5344 5345 for (oit = objects.begin(); oit != oit_end; ++ oit) 5346 { 5347 const AxisAlignedBox3 box = (*oit)->GetBox(); 5348 stream << "<BoundingBox" << " id=\"" << (*oit)->GetId() << "\"" 5349 << " min=\"" << box.Min().x << " " << box.Min().y << " " << box.Min().z << "\"" 5350 5351 << " max=\"" << box.Max().x << " " << box.Max().y << " " << box.Max().z << "\" />" << endl; 5352 } 5353 5354 stream << "</BoundingBoxes>" << endl; 5357 mHierarchyManager->ExportBoundingBoxes(stream, objects); 5355 5358 } 5356 5359
Note: See TracChangeset
for help on using the changeset viewer.