- Timestamp:
- 10/03/05 18:57:58 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env
r304 r305 73 73 # vertical axis = 64 74 74 75 splitPlaneStrategy 475 splitPlaneStrategy 64 76 76 # least splits + balanced polygons 77 77 #splitPlaneStrategy 12 … … 92 92 constructionMethod viewCells 93 93 # constructionMethod sceneGeometry 94 maxCandidates 094 maxCandidates 25 95 95 maxViewCells 999999 96 96 Termination { 97 97 maxPolysForAxisAligned 50 98 maxPolygons 598 maxPolygons 0 99 99 maxDepth 100 100 100 } -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
r304 r305 260 260 mRoot(NULL), 261 261 mViewCell(viewCell), 262 mStoreSplitPolys(true)263 //mStoreSplitPolys(false)262 //mStoreSplitPolys(true) 263 mStoreSplitPolys(false) 264 264 { 265 265 Randomize(); // initialise random generator for heuristics … … 622 622 } 623 623 //-- add viewcell stored in split polygon 624 else if ( leaf->GetViewCell())624 else if (!leaf->GetViewCell()) 625 625 leaf->SetViewCell(tData.mViewCell); 626 626 //else Debug << "Leaf already has view cell " << endl; … … 843 843 } 844 844 845 Plane3 BspTree::SelectPlane(BspLeaf *leaf, const PolygonContainer &polys) const845 Plane3 BspTree::SelectPlane(BspLeaf *leaf, PolygonContainer &polys) 846 846 { 847 847 if (polys.size() == 0) … … 899 899 } 900 900 901 Plane3 BspTree::SelectPlaneHeuristics( const PolygonContainer &polys, int maxTests) const901 Plane3 BspTree::SelectPlaneHeuristics(PolygonContainer &polys, int maxTests) 902 902 { 903 903 float lowestCost = MAX_FLOAT; … … 907 907 908 908 int candidateIdx = limit; 909 909 PolygonContainer debugPolys;bool dist = true; 910 910 for (int i = 0; i < limit; ++ i) 911 911 { 912 candidateIdx = GetNextCandidateIdx(candidateIdx, polys , (int)polys.size() - i - i);912 candidateIdx = GetNextCandidateIdx(candidateIdx, polys); 913 913 914 914 Plane3 candidatePlane = polys[candidateIdx]->GetSupportingPlane(); 915 916 915 917 916 // evaluate current candidate … … 923 922 lowestCost = candidateCost; 924 923 } 925 } 924 for (int i=0; i < debugPolys.size(); ++i) 925 if (polys[candidateIdx] == debugPolys[i]) 926 { 927 Debug << "FATAL ERROR" << endl; 928 dist = false; 929 } 930 debugPolys.push_back(polys[candidateIdx]); 931 } 932 926 933 //Debug << "Plane lowest cost: " << lowestCost << endl; 927 934 if (!dist) 935 Debug << "FATAL ERROR DUPLICATE TESTS!!" << endl; 928 936 return polys[bestPlaneIdx]->GetSupportingPlane(); 929 937 } 930 938 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 945 } 946 947 float BspTree::EvalSplitPlane(const PolygonContainer &polys, const Plane3 &candidatePlane) const 939 int BspTree::GetNextCandidateIdx(int currentIdx, PolygonContainer &polys) 940 { 941 int candidateIdx = Random(currentIdx--); 942 943 // swap candidates to avoid testing same plane 2 times 944 Polygon3 *p = polys[candidateIdx]; 945 polys[candidateIdx] = polys[currentIdx]; 946 polys[currentIdx] = p; 947 948 return currentIdx; 949 } 950 951 float BspTree::EvalSplitPlane(PolygonContainer &polys, const Plane3 &candidatePlane) 948 952 { 949 953 float val = 0; -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h
r304 r305 359 359 @returns the cost of the candidate split plane 360 360 */ 361 float EvalSplitPlane( const PolygonContainer &polys, const Plane3 &candidatePlane) const;361 float EvalSplitPlane(PolygonContainer &polys, const Plane3 &candidatePlane); 362 362 363 363 /** Evaluates tree stats in the BSP tree leafs. … … 377 377 @param polys the polygon list on which the split decition is based 378 378 */ 379 Plane3 SelectPlane(BspLeaf *leaf, const PolygonContainer &polys) const;379 Plane3 SelectPlane(BspLeaf *leaf, PolygonContainer &polys); 380 380 381 381 /** Filters next view cell down the tree and inserts it into the appropriate leaves … … 416 416 @param maxTests the maximal number of candidate tests 417 417 */ 418 Plane3 SelectPlaneHeuristics( const PolygonContainer &polys, const int maxTests) const;418 Plane3 SelectPlaneHeuristics(PolygonContainer &polys, const int maxTests); 419 419 420 420 /** Extracts the meshes of the objects and copies them into the mesh. … … 444 444 int CastRay(Ray &ray); 445 445 446 /** returns next candidate index 446 /** returns next candidate index and reorders polygons so no candidate is chosen two times 447 447 @param the current candidate index 448 448 @param max the range of candidates 449 449 */ 450 in line int GetNextCandidateIdx(int currentIdx, const int max) const;450 int GetNextCandidateIdx(int currentIdx, PolygonContainer &polys); 451 451 452 452 /** Helper function which extracts a view cell on the front and the back -
trunk/VUT/GtpVisibilityPreprocessor/src/main.cpp
r304 r305 40 40 41 41 // if BSP tree construction method needs predefined view cells 42 43 42 if (BspTree::sConstructionMethod == BspTree::VIEW_CELLS) 44 43 { … … 72 71 if (exporter) 73 72 { 74 Debug << Exporting complementary view cells" << endl;73 Debug << "Exporting complementary view cells" << endl; 75 74 exporter->ExportViewCells(&vc_compl); // export view cells 76 75 delete exporter;
Note: See TracChangeset
for help on using the changeset viewer.