- Timestamp:
- 08/29/06 09:52:56 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/GtpVisibility.sln
r1264 r1293 32 32 {80DECC17-BDDD-4412-8CF8-F7C1C17A7436} = {80DECC17-BDDD-4412-8CF8-F7C1C17A7436} 33 33 {101A7691-74F3-48B4-96A3-CF35578F5900} = {101A7691-74F3-48B4-96A3-CF35578F5900} 34 {7319E499-473D-4CE5-9983-725D6E68A55D} = {7319E499-473D-4CE5-9983-725D6E68A55D} 34 35 EndProjectSection 35 36 EndProject … … 37 38 ProjectSection(ProjectDependencies) = postProject 38 39 {80DECC17-BDDD-4412-8CF8-F7C1C17A7436} = {80DECC17-BDDD-4412-8CF8-F7C1C17A7436} 40 {7319E499-473D-4CE5-9983-725D6E68A55D} = {7319E499-473D-4CE5-9983-725D6E68A55D} 39 41 EndProjectSection 40 42 EndProject -
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1291 r1293 639 639 640 640 Debug << "\n§§§§ eval local cost §§§§" << endl 641 << "back pvs: " << (int)objectsBack.size() << " front pvs: " << objectsFront.size() << " total pvs: " << nTotalObjects << endl641 << "back pvs: " << (int)objectsBack.size() << " front pvs: " << (int)objectsFront.size() << " total pvs: " << nTotalObjects << endl 642 642 << "back p: " << volBack / viewSpaceVol << " front p " << volFront / viewSpaceVol << " p: " << totalVol / viewSpaceVol << endl 643 643 << "old rc: " << oldRenderCost / viewSpaceVol << " new rc: " << newRenderCost / viewSpaceVol << endl … … 814 814 { 815 815 if (mUseCostHeuristics) 816 { cout << "a";816 { 817 817 //-- partition objects using heuristics 818 818 nCostRatio[axis] = … … 824 824 } 825 825 else 826 { cout << "b";826 { 827 827 nCostRatio[axis] = 828 828 EvalLocalObjectPartition( … … 849 849 backObjects = nBackObjects[bestAxis]; 850 850 851 Debug << "val: " << nCostRatio[bestAxis] << " axis: " << bestAxis << endl;851 //Debug << "val: " << nCostRatio[bestAxis] << " axis: " << bestAxis << endl; 852 852 return nCostRatio[bestAxis]; 853 853 } … … 1107 1107 { 1108 1108 // rather use the simple version 1109 return object->mBvhLeaf; 1109 if (object->mBvhLeaf) 1110 { 1111 return object->mBvhLeaf; 1112 } 1110 1113 1111 1114 /////////////////////////////////////// … … 1133 1136 1134 1137 if (IsObjectInLeaf(leaf, object)) 1138 { 1135 1139 return leaf; 1140 } 1136 1141 } 1137 1142 else -
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r1288 r1293 2450 2450 "1000"); 2451 2451 2452 RegisterOption("Hierarchy.Construction.type", 2453 optInt, 2454 "hierarchy_construction_type=", 2455 "0"); 2456 2457 2452 2458 ////////////////////////////////////////////////////////////////////////////////// 2453 2459 } -
GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.cpp
r1287 r1293 117 117 white.mDiffuseColor.g = 1; 118 118 white.mDiffuseColor.b = 1; 119 int objSize = 0; 120 119 121 120 for (it = leaves.begin(); it != it_end; ++ it) 122 121 { … … 146 145 SetFilled(); 147 146 ExportGeometry(leaf->mObjects); 148 objSize += leaf->mObjects.size();149 147 } 150 148 } -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r1291 r1293 96 96 "Hierarchy.Termination.globalCostMissTolerance", mTermGlobalCostMissTolerance); 97 97 98 Environment::GetSingleton()->GetIntValue( 99 "Hierarchy.Construction.type", mConstructionType); 100 98 101 //Debug << "max depth: " << mTermMaxDepth << endl; 99 102 Debug << "min global cost ratio: " << mTermMinGlobalCostRatio << endl; … … 144 147 SubdivisionCandidate *vsc = 145 148 mVspTree->PrepareConstruction(sampleRays, forcedViewSpace, viewSpaceRays); 149 146 150 mTQueue.Push(vsc); 147 151 148 SubdivisionCandidate *osc = 149 mOspTree->PrepareConstruction(sampleRays, objects, objectSpaceRays); 150 151 mTQueue.Push(osc); 152 SubdivisionCandidate *osc; 153 154 switch (mObjectSpaceSubdivisonType) 155 { 156 case KD_BASED_OBJ_SUBDIV: 157 osc = mOspTree->PrepareConstruction(sampleRays, objects, objectSpaceRays); 158 mTQueue.Push(osc); 159 break; 160 case BV_BASED_OBJ_SUBDIV: 161 osc = mBvHierarchy->PrepareConstruction(sampleRays, objects); 162 mTQueue.Push(osc); 163 break; 164 default: 165 break; 166 } 152 167 } 153 168 … … 204 219 205 220 void HierarchyManager::Construct(const VssRayContainer &sampleRays, 206 const ObjectContainer &objects, 207 AxisAlignedBox3 *forcedViewSpace) 221 const ObjectContainer &objects, 222 AxisAlignedBox3 *forcedViewSpace) 223 { 224 switch (mConstructionType) 225 { 226 case 0: 227 ConstructSequential(sampleRays, objects, forcedViewSpace); 228 break; 229 case 1: 230 ConstructInterleaved(sampleRays, objects, forcedViewSpace); 231 break; 232 default: 233 break; 234 } 235 } 236 237 238 void HierarchyManager::ConstructInterleaved(const VssRayContainer &sampleRays, 239 const ObjectContainer &objects, 240 AxisAlignedBox3 *forcedViewSpace) 208 241 { 209 242 RayInfoContainer *objectSpaceRays = new RayInfoContainer(); … … 211 244 212 245 // prepare vsp and osp trees for traversal 213 PrepareConstruction(sampleRays, objects, forcedViewSpace, *viewSpaceRays, *objectSpaceRays); 214 215 mVspTree->mVspStats.Reset(); 216 mVspTree->mVspStats.Start(); 217 246 PrepareConstruction(sampleRays, 247 objects, 248 forcedViewSpace, 249 *viewSpaceRays, 250 *objectSpaceRays); 251 218 252 mHierarchyStats.Reset(); 219 253 mHierarchyStats.Start(); … … 232 266 bool HierarchyManager::ApplySubdivisionCandidate(SubdivisionCandidate *sc) 233 267 { 234 const bool globalTerminationCriteriaMet = 235 GlobalTerminationCriteriaMet(sc); 268 const bool globalTerminationCriteriaMet = GlobalTerminationCriteriaMet(sc); 236 269 237 270 const bool vspSplit = (sc->Type() == SubdivisionCandidate::VIEW_SPACE); … … 297 330 if (repair) RepairQueue(); 298 331 299 cout << "candidate: " << splitCandidate->Type() << ", priority: " << splitCandidate->GetPriority() << endl; 332 cout << "candidate: " << splitCandidate->Type() << ", priority: " 333 << splitCandidate->GetPriority() << endl; 300 334 } 301 335 … … 305 339 306 340 307 void HierarchyManager::Construct3(const VssRayContainer &sampleRays,308 const ObjectContainer &objects,309 AxisAlignedBox3 *forcedViewSpace)310 {311 // construct only view space partition312 // object kd tree is taken for osp313 314 mVspTree->mVspStats.Reset();315 mVspTree->mVspStats.Start();316 317 RayInfoContainer *viewSpaceRays = new RayInfoContainer();318 319 SubdivisionCandidate *sc =320 mVspTree->PrepareConstruction(sampleRays, forcedViewSpace, *viewSpaceRays);321 322 mTQueue.Push(sc);323 324 cout << "starting vsp construction ... " << endl;325 326 long startTime = GetTime();327 328 RunConstruction(false);329 330 cout << "finished in " << TimeDiff(startTime, GetTime())*1e-3 << " secs" << endl;331 mVspTree->mVspStats.Stop();332 }333 334 335 341 bool HierarchyManager::FinishedConstruction() const 336 342 { … … 339 345 340 346 341 void HierarchyManager::CollectObjectSpaceDirtyList(SubdivisionCandidateContainer &dirtyList) 347 void HierarchyManager::CollectObjectSpaceDirtyList( 348 SubdivisionCandidateContainer &dirtyList) 342 349 { 343 350 switch (mObjectSpaceSubdivisonType) … … 535 542 536 543 exporter->SetWireframe(); 537 const int maxPvs = 0;//mOspTree.GetStatistics().maxPvs;538 539 544 exporter->ExportOspTree(*mOspTree, 0); 540 545 } 541 546 542 547 543 void HierarchyManager::Construct 2(const VssRayContainer &sampleRays,544 const ObjectContainer &objects,545 AxisAlignedBox3 *forcedViewSpace)548 void HierarchyManager::ConstructSequential(const VssRayContainer &sampleRays, 549 const ObjectContainer &objects, 550 AxisAlignedBox3 *forcedViewSpace) 546 551 { 547 552 // rays clipped in view space and in object space -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h
r1288 r1293 150 150 ~HierarchyManager(); 151 151 152 void Construct( 153 const VssRayContainer &sampleRays, 154 const ObjectContainer &objects, 155 AxisAlignedBox3 *forcedViewSpace); 156 152 157 /** Constructs the view space and object space subdivision from a given set of rays 153 158 and a set of objects. … … 155 160 @param objects the set of objects 156 161 */ 157 void Construct(const VssRayContainer &sampleRays, 158 const ObjectContainer &objects, 159 AxisAlignedBox3 *forcedViewSpace); 160 161 /** Constructs first view cells, then object space partition. 162 */ 163 void Construct2(const VssRayContainer &sampleRays, 164 const ObjectContainer &objects, 165 AxisAlignedBox3 *forcedViewSpace); 166 167 /** Constructs only vsp tree. 168 */ 169 void Construct3(const VssRayContainer &sampleRays, 170 const ObjectContainer &objects, 171 AxisAlignedBox3 *forcedViewSpace); 162 void ConstructInterleaved( 163 const VssRayContainer &sampleRays, 164 const ObjectContainer &objects, 165 AxisAlignedBox3 *forcedViewSpace); 166 167 /** Constructs first view space hierarchy, then object space hierarchy. 168 */ 169 void ConstructSequential( 170 const VssRayContainer &sampleRays, 171 const ObjectContainer &objects, 172 AxisAlignedBox3 *forcedViewSpace); 172 173 173 174 enum … … 266 267 protected: 267 268 269 int mConstructionType; 268 270 int mObjectSpaceSubdivisonType; 269 271 -
GTP/trunk/Lib/Vis/Preprocessing/src/Intersectable.h
r1281 r1293 66 66 }; 67 67 68 Intersectable(): mMailbox(0), mReferences(0) {}68 Intersectable(): mMailbox(0), mReferences(0), mBvhLeaf(0) {} 69 69 70 70 void SetId(const int id) { mId = id; } -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r1292 r1293 483 483 Debug << "hierarchy manager: osp" << endl; 484 484 // HACK for testing if per kd evaluation works!! 485 const bool ishack = true;485 const bool ishack = false; 486 486 if (ishack) 487 487 hierarchyManager = new HierarchyManager(mVspTree, mKdTree); … … 852 852 VssRay *vssRay = NULL; 853 853 int hits = 0; 854 854 int hittriangle; 855 855 Vector3 pointA, pointB; 856 856 Vector3 normalA, normalB; … … 858 858 float dist; 859 859 860 int hittriangle;861 860 double normal[3]; 861 #ifdef GTP_INTERNAL 862 862 hittriangle = mlrtaIntersectAS(&viewPoint.x, 863 863 &direction.x, 864 864 normal, 865 865 dist); 866 #else 867 hittriangle = -1; 868 #endif 866 869 if (hittriangle !=-1 ) { 867 870 if (hittriangle >= mFaceParents.size()) 868 cerr<<"Warning: tr aingle index out of range! "<<hittriangle<<endl;871 cerr<<"Warning: triangle index out of range! "<<hittriangle<<endl; 869 872 else { 870 873 objectA = mFaceParents[hittriangle].mObject; … … 879 882 880 883 Vector3 dir = -direction; 884 #ifdef GTP_INTERNAL 881 885 hittriangle = mlrtaIntersectAS(&viewPoint.x, 882 886 &dir.x, 883 887 normal, 884 888 dist); 889 #else 890 hittriangle = -1; 891 #endif 892 885 893 if (hittriangle !=-1 ) { 886 894 if (hittriangle >= mFaceParents.size()) … … 1325 1333 int hittriangle; 1326 1334 double n[3]; 1335 1336 #ifdef GTP_INTERNAL 1327 1337 hittriangle = mlrtaIntersectAS(&viewPoint.x, 1328 1338 &direction.x, 1329 1339 n, 1330 1340 dist); 1341 1342 #else 1343 hittriangle = -1; 1344 #endif 1345 1331 1346 if (hittriangle !=-1 ) { 1332 1347 if (hittriangle >= mFaceParents.size()) -
GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.cpp
r1291 r1293 154 154 KdIntersectable *kdObj = dynamic_cast<KdIntersectable *>(obj); 155 155 pvs += CountNewObjectsInKdNode(kdObj); 156 cout << "z";157 156 break; 158 157 } 159 158 case Intersectable::BVH_INTERSECTABLE: 160 159 { 161 cout << "x";162 160 BvhIntersectable *bvhObj = dynamic_cast<BvhIntersectable *>(obj); 163 161 pvs += CountNewObjectsInBvhNode(bvhObj); 164 162 break; 165 163 } 166 default: cout << "y";164 default: 167 165 ++ pvs; 168 166 break; -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1291 r1293 4805 4805 Debug << "saved rays: " << (int)savedRays.size() << endl; 4806 4806 4807 //mHierarchyManager->Construct(constructionRays, objects, &mViewSpaceBox); 4808 mHierarchyManager->Construct2(constructionRays, objects, &mViewSpaceBox); 4807 mHierarchyManager->Construct(constructionRays, objects, &mViewSpaceBox); 4809 4808 4810 4809 VssRayContainer::const_iterator vit, vit_end = constructionRays.end(); -
GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp
r1292 r1293 2628 2628 Debug << "rays size: " << (int)rays.size() << endl; 2629 2629 2630 2630 2631 //-- prepare view space partition 2631 2632 … … 2930 2931 BvhLeaf *bvhleaf = mHierarchyManager->mBvHierarchy->GetLeaf(obj); 2931 2932 2932 if ( !bvhleaf->Mailed())2933 if (bvhleaf && !bvhleaf->Mailed()) 2933 2934 { 2934 2935 bvhleaf->Mail();
Note: See TracChangeset
for help on using the changeset viewer.