Changeset 1557 for GTP/trunk/Lib
- Timestamp:
- 10/03/06 10:10:01 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r1548 r1557 608 608 const ObjectContainer &objects) 609 609 { 610 switch (mObjectSpaceSubdivisionType)611 {612 case BV_BASED_OBJ_SUBDIV:613 Debug << "old bv hierarchy:\n " << mBvHierarchy->mBvhStats << endl;614 cout << "\nresetting bv hierarchy" << endl;615 mHierarchyStats.nodes -= mBvHierarchy->mBvhStats.nodes;616 610 #if 0 617 611 DEL_PTR(mBvHierarchy); … … 620 614 621 615 PrepareObjectSpaceSubdivision(sampleRays, objects); 622 #else 623 mBvHierarchy->Reset(sampleRays, objects); 616 return; 624 617 #endif 625 break; 618 619 if (!ObjectSpaceSubdivisionConstructed()) 620 { 621 return PrepareObjectSpaceSubdivision(sampleRays, objects); 622 } 623 624 switch (mObjectSpaceSubdivisionType) 625 { 626 case BV_BASED_OBJ_SUBDIV: 627 cout << "\nreseting bv hierarchy" << endl; 628 Debug << "old bv hierarchy:\n " << mBvHierarchy->mBvhStats << endl; 629 630 mHierarchyStats.nodes -= mBvHierarchy->mBvhStats.nodes; 631 mTQueue.Push(mBvHierarchy->Reset(sampleRays, objects)); 632 mTotalCost = mBvHierarchy->mTotalCost; 633 break; 634 626 635 case KD_BASED_OBJ_SUBDIV: 627 636 // TODO … … 630 639 break; 631 640 } 641 } 642 643 644 void HierarchyManager::ResetViewSpaceSubdivision(const VssRayContainer &sampleRays, 645 const ObjectContainer &objects) 646 { 647 DEL_PTR(mBvHierarchy); 648 mBvHierarchy = new BvHierarchy(); 649 mBvHierarchy->mHierarchyManager = this; 650 651 PrepareViewSpaceSubdivision(sampleRays, objects); 652 return; 632 653 } 633 654 … … 639 660 mHierarchyStats.Reset(); 640 661 mHierarchyStats.Start(); 641 642 662 mHierarchyStats.nodes = 2; 643 663 644 645 664 mTotalCost = (float)objects.size(); 646 665 Debug << "setting total cost to " << mTotalCost << endl; … … 655 674 mSavedViewSpaceSubdivisionType = mViewSpaceSubdivisionType; 656 675 mViewSpaceSubdivisionType = NO_VIEWSPACE_SUBDIV; 657 658 // start with object space subdivision 659 PrepareObjectSpaceSubdivision(sampleRays, objects); 660 661 // process object space candidates 662 RunConstruction(false); 663 664 mViewSpaceSubdivisionType = mSavedViewSpaceSubdivisionType; 665 666 const int limit = 2; 667 for (int i = 0; i < limit; ++ i) 668 { 669 // again run object space subdivision on the view cells 676 677 const int limit = 4; 678 int i = 0; 679 680 // render cost optimization 681 // start with object space partiton 682 // then optimizate view space partition for the current osp 683 // and vice versa until iteration depth is reached. 684 while (1) 685 { 686 // first run object space subdivision 670 687 ResetObjectSpaceSubdivision(sampleRays, objects); 671 688 672 689 // process object space candidates 673 690 RunConstruction(false); 674 691 675 ///////////////// 676 // now do view space subdivison using the current object space partition 677 // ResetViewSpaceSubdivision(sampleRays, objects); 678 692 if ((++ i) >= limit) 693 break; 694 695 ///////////////// 696 // do view space subdivison with respect to the object space partition 697 ResetViewSpaceSubdivision(sampleRays, objects); 698 679 699 // process view space candidates 680 700 RunConstruction(false); 681 682 cout << "íteration " << i << " of " << limit << " finished" << endl; 701 mViewSpaceSubdivisionType = mSavedViewSpaceSubdivisionType; 702 703 if ((++ i) >= limit) 704 break; 705 706 cout << "iteration " << i << " of " << limit << " finished" << endl; 683 707 } 684 708 -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h
r1551 r1557 315 315 const ObjectContainer &objects); 316 316 317 void HierarchyManager::ResetViewSpaceSubdivision( 318 const VssRayContainer &rays, 319 const ObjectContainer &objects); 320 317 321 protected: 318 322 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.cpp
r1553 r1557 174 174 { 175 175 Randomize(); // initialise random generator for heuristics 176 mOutOfBoundsCell = new BspViewCell();177 mOutOfBoundsCell->SetId(-1); 176 mOutOfBoundsCell = GetOrCreateOutOfBoundsCell(); 177 178 178 ///////// 179 179 //-- termination criteria for autopartition … … 277 277 278 278 279 BspViewCell *BspTree::GetOrCreateOutOfBoundsCell() 280 { 281 if (!mOutOfBoundsCell) 282 { 283 mOutOfBoundsCell = new BspViewCell(); 284 mOutOfBoundsCell->SetId(OUT_OF_BOUNDS_ID); 285 mOutOfBoundsCell->SetValid(false); 286 } 287 288 return mOutOfBoundsCell; 289 } 290 279 291 int BspTree::SplitPolygons(const Plane3 &plane, 280 292 PolygonContainer &polys, … … 420 432 if (mOutOfBoundsCellPartOfTree) 421 433 { 422 cout << "here223 " << mOutOfBoundsCell << endl;423 434 // out of bounds cell not part of tree => 424 435 // delete manually 425 436 DEL_PTR(mOutOfBoundsCell); 426 } else cout << "here991 " << endl;437 } 427 438 } 428 439 … … 999 1010 // add predefined view cell to leaf 1000 1011 viewCell = dynamic_cast<BspViewCell *>(tData.mViewCell); 1001 1002 /// out of bounds cell can be handled as any other cell 1012 1013 // from now on out of bounds cell can be handled as any other cell, 1014 // responsibility for deleting has been shifted 1003 1015 if (viewCell == mOutOfBoundsCell) 1016 { 1004 1017 mOutOfBoundsCellPartOfTree = true; 1018 } 1005 1019 } 1006 1020 … … 2364 2378 2365 2379 2366 2367 2380 void BspTree::ConstructGeometry(ViewCell *vc, 2368 2381 BspNodeGeometry &vcGeom) const … … 2379 2392 for (it = leaves.begin(); it != it_end; ++ it) 2380 2393 { 2394 // per definition out of bounds cell has zero volume 2395 if ((*it) == mOutOfBoundsCell) 2396 continue; 2397 2381 2398 BspViewCell *bspVc = dynamic_cast<BspViewCell *>(*it); 2382 2399 vector<BspLeaf *>::const_iterator bit, bit_end = bspVc->mLeaves.end(); -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.h
r1551 r1557 89 89 Vector3 CenterOfMass() const; 90 90 91 /** Returns true if this geometry is well shaped. 92 */ 91 93 bool Valid() const; 92 93 94 94 95 friend ostream &operator<<(ostream &s, const BspNodeGeometry &a) … … 101 102 } 102 103 104 /** Number of polygons. 105 */ 103 106 int Size() const; 107 /** Returns the polygons in a container. 108 */ 104 109 const PolygonContainer &GetPolys(); 105 110 … … 679 684 */ 680 685 void SetViewCellsTree(ViewCellsTree *vct); 681 686 687 /** Returns view cell representing the empty view space. 688 */ 689 BspViewCell *GetOrCreateOutOfBoundsCell(); 690 682 691 protected: 683 692 … … 1071 1080 1072 1081 bool mOutOfBoundsCellPartOfTree; 1082 1083 1073 1084 private: 1074 1085 … … 1093 1104 static void GenerateUniqueIdsForPvs(); 1094 1105 1106 /////////// 1095 1107 //-- unique ids for PVS criterium 1108 1096 1109 static int sFrontId; 1097 1110 static int sBackId; -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1551 r1557 1965 1965 for (vit = mViewCells.begin(); vit != vit_end; ++ vit) 1966 1966 { 1967 if ((*vit)->GetId() != -1) 1967 if ((*vit)->GetId() != OUT_OF_BOUNDS_ID) 1968 { 1968 1969 mViewCells[i]->SetId(i ++); 1970 } 1969 1971 } 1970 1972 } … … 2988 2990 const AxisAlignedPlane *clipPlane 2989 2991 ) const 2990 { cout << "here55543 " << vc->GetId() << endl;2992 { 2991 2993 // out of bounds cell 2992 if (vc->GetId() == -1) 2993 return; 2994 //if (vc->GetId() == OUT_OF_BOUNDS_ID) return; 2994 2995 2995 2996 // export mesh if available … … 4500 4501 { 4501 4502 // out of bounds cell 4502 if (vc->GetId() == -1) 4503 return; 4504 4503 //if (vc->GetId() == OUT_OF_BOUNDS_ID) return; 4505 4504 if (clipPlane) 4506 4505 { -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r1551 r1557 54 54 float mRenderBudget; 55 55 56 /// some characteristic values could be here 57 56 // some characteristic values could be stored as well 58 57 }; 59 60 58 61 59 /** Manages different higher order operations on the view cells. -
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
r1551 r1557 75 75 if (randomize) Randomize(); // initialise random generator for heuristics 76 76 77 ////////////////// 77 78 //-- termination criteria for autopartition 79 78 80 Environment::GetSingleton()->GetIntValue("VspBspTree.Termination.maxDepth", mTermMaxDepth); 79 81 Environment::GetSingleton()->GetIntValue("VspBspTree.Termination.minPvs", mTermMinPvs); … … 86 88 Environment::GetSingleton()->GetIntValue("VspBspTree.Termination.maxViewCells", mMaxViewCells); 87 89 88 //-- max cost ratio for early tree termination 90 //////////////////////// 91 //-- cost ratios for early tree termination 89 92 Environment::GetSingleton()->GetFloatValue("VspBspTree.Termination.maxCostRatio", mTermMaxCostRatio); 90 91 93 Environment::GetSingleton()->GetFloatValue("VspBspTree.Termination.minGlobalCostRatio", mTermMinGlobalCostRatio); 92 94 Environment::GetSingleton()->GetIntValue("VspBspTree.Termination.globalCostMissTolerance", mTermGlobalCostMissTolerance); 93 95 96 /////////// 94 97 //-- factors for bsp tree split plane heuristics 98 95 99 Environment::GetSingleton()->GetFloatValue("VspBspTree.Factor.pvs", mPvsFactor); 96 100 Environment::GetSingleton()->GetFloatValue("VspBspTree.Termination.ct_div_ci", mCtDivCi); 97 101 98 102 ////////// 99 103 //-- partition criteria 104 100 105 Environment::GetSingleton()->GetIntValue("VspBspTree.maxPolyCandidates", mMaxPolyCandidates); 101 106 Environment::GetSingleton()->GetIntValue("VspBspTree.maxRayCandidates", mMaxRayCandidates); … … 108 113 Environment::GetSingleton()->GetBoolValue("VspBspTree.splitUseOnlyDrivingAxis", mOnlyDrivingAxis); 109 114 115 ////////////////////// 110 116 //-- termination criteria for axis aligned split 111 117 Environment::GetSingleton()->GetFloatValue("VspBspTree.Termination.AxisAligned.maxRayContribution", … … 114 120 mTermMinRaysForAxisAligned); 115 121 116 //Environment::GetSingleton()->GetFloatValue("VspBspTree.maxTotalMemory", mMaxTotalMemory);117 122 Environment::GetSingleton()->GetFloatValue("VspBspTree.maxStaticMemory", mMaxMemory); 118 123 … … 136 141 Environment::GetSingleton()->GetBoolValue("VspBspTree.Construction.useDrivingAxisForMaxCost", mUseDrivingAxisIfMaxCostViolated); 137 142 143 ///////// 138 144 //-- debug output 139 145 … … 148 154 Debug << "max view cells: " << mMaxViewCells << endl; 149 155 Debug << "max polygon candidates: " << mMaxPolyCandidates << endl; 150 //Debug << "max plane candidates: " << mMaxRayCandidates << endl;151 156 Debug << "randomize: " << randomize << endl; 152 157 … … 195 200 } 196 201 202 Debug << endl; 197 203 198 204 mLocalSubdivisionCandidates = new vector<SortableEntry>; 199 200 Debug << endl;201 205 } 202 206 … … 213 217 { 214 218 mOutOfBoundsCell = new BspViewCell(); 215 mOutOfBoundsCell->SetId( -1);219 mOutOfBoundsCell->SetId(OUT_OF_BOUNDS_ID); 216 220 mOutOfBoundsCell->SetValid(false); 217 221 } … … 3003 3007 for (it = leaves.begin(); it != it_end; ++ it) 3004 3008 { 3009 if ((*it) == mOutOfBoundsCell) 3010 continue; 3011 3005 3012 BspViewCell *bspVc = dynamic_cast<BspViewCell *>(*it); 3006 3013 vector<BspLeaf *>::const_iterator bit, bit_end = bspVc->mLeaves.end(); -
GTP/trunk/Lib/Vis/Preprocessing/src/common.h
r1287 r1557 511 511 #endif 512 512 513 #endif 514 515 516 517 518 519 520 521 522 523 513 /** view cell id belonging to empty view space. 514 */ 515 #define OUT_OF_BOUNDS_ID -1 516 517 #endif 518 519 520 521 522 523 524 525 526 527
Note: See TracChangeset
for help on using the changeset viewer.