- Timestamp:
- 10/03/05 18:05:31 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env
r303 r304 8 8 # filename glasgow1.x3d 9 9 # filename vienna.x3d 10 #filename ../data/vienna/vienna-simple.x3d11 filename ../data/vienna/viewcells-25-sel.x3d10 filename ../data/vienna/vienna-simple.x3d 11 # filename ../data/vienna/viewcells-25-sel.x3d 12 12 # filename ../data/atlanta/atlanta2.x3d 13 13 # filename ../data/soda/soda.dat … … 15 15 # viewcells ../data/atlanta/atlanta_viewcells_large.x3d 16 16 # viewcells ../data/atlanta/atlanta_viewcells_large2.x3d 17 viewcells ../data/vienna/viewcells-25-sel.x3d18 #viewcells ../data/vienna/viewcells-25.x3d17 # viewcells ../data/vienna/viewcells-25-sel.x3d 18 viewcells ../data/vienna/viewcells-25.x3d 19 19 # viewcells ../data/vienna/viewcells-large-sel.x3d 20 20 } … … 73 73 # vertical axis = 64 74 74 75 splitPlaneStrategy 4 75 76 # least splits + balanced polygons 76 77 #splitPlaneStrategy 12 77 splitPlaneStrategy 3278 78 79 #axis aligned + vertical axis 79 80 #splitPlaneStrategy 66 … … 89 90 90 91 # constructionMethod rays 91 #constructionMethod viewCells92 constructionMethod sceneGeometry93 maxCandidates 2592 constructionMethod viewCells 93 # constructionMethod sceneGeometry 94 maxCandidates 0 94 95 maxViewCells 999999 95 96 Termination { -
trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.cpp
r303 r304 102 102 break; 103 103 case BspTree::SCENE_GEOMETRY: 104 #if 0105 104 CLEAR_CONTAINER(mViewCells); // we generate new view cells 106 105 mSceneGraph->CollectObjects(&objects); 107 106 mBspTree->Construct(objects, &mViewCells); 108 #else109 for (int i=0; i< mViewCells.size(); ++i)110 objects.push_back(mViewCells[i]);111 112 mBspTree->Construct(objects, &dummy);113 #endif114 107 break; 115 108 case BspTree::RAYS: -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
r303 r304 260 260 mRoot(NULL), 261 261 mViewCell(viewCell), 262 mStore Polys(true)263 //mStore Polys(false)262 mStoreSplitPolys(true) 263 //mStoreSplitPolys(false) 264 264 { 265 265 Randomize(); // initialise random generator for heuristics … … 405 405 &coincident, 406 406 splits, 407 mStore Polys);407 mStoreSplitPolys); 408 408 409 409 // extract view cells associated with the split polygons … … 422 422 423 423 // don't need coincident polygons anymore 424 interior->ProcessPolygons(&coincident, mStore Polys);424 interior->ProcessPolygons(&coincident, mStoreSplitPolys); 425 425 426 426 //Debug << "split node on level " << tData.mDepth << " bk: " << backPolys->size() << " frnt: " << frontPolys->size() << endl; … … 542 542 mStat.polys = Copy2PolygonSoup(objects, *polys); 543 543 544 bool tmpStorePolys = mStore Polys;545 mStore Polys = false;544 bool tmpStorePolys = mStoreSplitPolys; 545 mStoreSplitPolys = false; 546 546 547 547 // construct tree from polygon soup 548 548 Construct(polys, viewCells); 549 549 550 mStore Polys = tmpStorePolys;550 mStoreSplitPolys = tmpStorePolys; 551 551 // filter scene bounding box down the tree in order to store split polygons 552 if (mStore Polys)552 if (mStoreSplitPolys) 553 553 { 554 554 Mesh *polyMesh = new Mesh(); … … 627 627 628 628 // remaining polygons are discarded or added to node 629 tData.mNode->ProcessPolygons(tData.mPolygons, mStore Polys);629 tData.mNode->ProcessPolygons(tData.mPolygons, mStoreSplitPolys); 630 630 DEL_PTR(tData.mPolygons); 631 631 … … 660 660 661 661 // don't need coincident polygons anymore 662 interior->ProcessPolygons(&coincident, mStore Polys);662 interior->ProcessPolygons(&coincident, mStoreSplitPolys); 663 663 664 664 // push the children on the stack … … 721 721 int splits = 0; 722 722 723 interior->SplitPolygons(polys, frontPolys, backPolys, coincident, splits, mStore Polys);723 interior->SplitPolygons(polys, frontPolys, backPolys, coincident, splits, mStoreSplitPolys); 724 724 725 725 mStat.splits += splits; … … 885 885 /*int axis = box.Size().DrivingAxis(); 886 886 Vector3 norm(0,0,0); norm[axis] = 1; 887 Vector3 pt = (box.Min()[axis] + box.Max()[axis]) * 0.5f;*/ 888 889 //return Plane3(norm, pt); 887 Vector3 position = (box.Min()[axis] + box.Max()[axis]) * 0.5f; 888 return Plane3(norm, position);*/ 890 889 } 891 890 … … 905 904 int bestPlaneIdx = 0; 906 905 907 int limit = Min((int)polys.size(), maxTests); 906 int limit = maxTests > 0 ? Min((int)polys.size(), maxTests) : (int)polys.size(); 907 908 int candidateIdx = limit; 908 909 909 910 for (int i = 0; i < limit; ++ i) 910 911 { 911 int candidateIdx = GetNextCandidateIdx((int)polys.size()); 912 candidateIdx = GetNextCandidateIdx(candidateIdx, polys, (int)polys.size() - i - i); 913 912 914 Plane3 candidatePlane = polys[candidateIdx]->GetSupportingPlane(); 915 913 916 914 917 // evaluate current candidate … … 926 929 } 927 930 928 int BspTree::GetNextCandidateIdx(const int max) const 929 { 930 return Random(max); // TODO: avoid testing same plane 2 times 931 int BspTree::GetNextCandidateIdx(int currentIdx, PolygonContainer &polys, int max) const 932 { 933 #if 0 934 int candidateIdx = Random(max); // TODO: avoid testing same plane 2 times 935 936 // swap candidates 937 Polygon *p = polys[candidateIdx]; 938 polys[candidateIdx] = polys[max]; 939 polys[max] = p; 940 941 return max; 942 #else 943 return ++ currentIdx; 944 #endif 931 945 } 932 946 … … 1179 1193 bool BspTree::StorePolys() const 1180 1194 { 1181 return mStore Polys;1195 return mStoreSplitPolys; 1182 1196 } 1183 1197 -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h
r303 r304 445 445 446 446 /** returns next candidate index 447 @param the current candidate index 447 448 @param max the range of candidates 448 449 */ 449 inline int GetNextCandidateIdx( const int max) const;450 inline int GetNextCandidateIdx(int currentIdx, const int max) const; 450 451 451 452 /** Helper function which extracts a view cell on the front and the back -
trunk/VUT/GtpVisibilityPreprocessor/src/main.cpp
r303 r304 41 41 // if BSP tree construction method needs predefined view cells 42 42 43 if ( 1)//(BspTree::sConstructionMethod == BspTree::VIEW_CELLS)43 if (BspTree::sConstructionMethod == BspTree::VIEW_CELLS) 44 44 { 45 45 if (vcFilename != "")
Note: See TracChangeset
for help on using the changeset viewer.