- Timestamp:
- 08/15/05 20:50:00 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/include/Polygon3.h
r235 r238 48 48 /** Deletes all polygons om the queue. 49 49 */ 50 static void DeletePolygons(Polygon Queue*polys);50 static void DeletePolygons(PolygonContainer *polys); 51 51 52 52 /// vertices are connected in counterclockwise order. -
trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env
r237 r238 60 60 BspTree { 61 61 # splitPlaneStrategy leastSplits 62 splitPlaneStrategy nextPolygon 62 splitPlaneStrategy balancedTree 63 # splitPlaneStrategy nextPolygon 63 64 # constructionMethod viewCells 64 65 constructionMethod sceneGeometry 66 maxCandidates 20 67 maxViewCells 100 65 68 Termination { 66 69 maxPolygons 4 -
trunk/VUT/GtpVisibilityPreprocessor/src/Environment.cpp
r235 r238 1170 1170 "-bsp_construction_method=", 1171 1171 "viewCells"); 1172 1173 RegisterOption("BspTree.maxCandidates", 1174 optInt, 1175 "-bsp_max_candidates=", 1176 "20"); 1177 1178 RegisterOption("BspTree.maxViewCells", 1179 optInt, 1180 "-bsp_max_viewcells=", 1181 "100"); 1172 1182 } 1173 1183 -
trunk/VUT/GtpVisibilityPreprocessor/src/Plane3.h
r237 r238 44 44 { 45 45 const Vector3 v = b - a; // line from A to B 46 47 46 float dv = DotProd(mNormal, v); 48 47 float u = 0; 49 48 50 if ( dv)49 if (signum(dv) != 0) 51 50 { 52 51 u = - Distance(a) / dv; 53 Debug << "t: " << u << ", dv: " << dv << endl;52 Debug << "t: " << u << ", b - a: " << v << ", norm: " << mNormal << ", dist(a): " << - Distance(a) << ", dv: " << dv << endl; 54 53 if (coplanar) (*coplanar) = false; 55 54 } 56 55 else { 57 Debug << "OHOH: " << u << endl;58 56 if (coplanar) (*coplanar) = true; 59 57 } 60 58 if (t) (*t) = u; 61 Debug << " A: " << a << ", B: " << b << ", result: " << (a + (u * v)) << endl;59 Debug << "result of intersection with A: " << a << ", B: " << b << ":\n" << (a + u * b - u * a) << "\n" << (a + u*v) << "\n\n"; 62 60 63 return a + (u * v); 61 return a + u * b - u * a; // NOTE: gives better precision than calclulating a + u * v 62 //return a + (u * v); 64 63 } 65 64 -
trunk/VUT/GtpVisibilityPreprocessor/src/Polygon3.cpp
r237 r238 1 1 #include "Polygon3.h" 2 2 #include "Mesh.h" 3 4 #define SIDE_TOLERANCE 0.002 3 5 4 6 Polygon3::Polygon3() … … 21 23 } 22 24 23 Plane3 Polygon3::GetSupportingPlane() 25 Plane3 Polygon3::GetSupportingPlane() const 24 26 { 27 Debug << "creating plane using vertices: " << mVertices[0] << mVertices[1] << mVertices[2] << endl; 28 Vector3 v1 = mVertices[0] - mVertices[1]; 29 Vector3 v2 = mVertices[2] - mVertices[1]; 30 Debug << "plane has vectors " << v1 << v2 << endl; 25 31 return Plane3(mVertices[0], mVertices[1], mVertices[2]); 26 32 } 27 33 28 void Polygon3::DeletePolygons(Polygon Queue*polys)34 void Polygon3::DeletePolygons(PolygonContainer *polys) 29 35 { 30 // don't need to store polygon information = delete polygons36 // don't need to store polygon information => delete polygons 31 37 while(!polys->empty()) 32 38 { 33 Polygon3 *poly = polys-> front();34 polys->pop ();39 Polygon3 *poly = polys->back(); 40 polys->pop_back(); 35 41 DEL_PTR(poly); 36 42 } … … 42 48 Vector3 ptA = mVertices[mVertices.size() - 1]; 43 49 44 int sideA = partition->Side(ptA );50 int sideA = partition->Side(ptA, SIDE_TOLERANCE); 45 51 46 52 VertexContainer::const_iterator it; 53 54 Debug << "\n\nvertex A: " << ptA << ", side A: " << sideA << " (" << partition->Distance(ptA) << ")"; 47 55 48 56 // find line - plane intersections … … 50 58 { 51 59 Vector3 ptB = (*it); 52 int sideB = partition->Side(ptB); 60 int sideB = partition->Side(ptB, SIDE_TOLERANCE); 61 Debug << " <=> vertex B: " << ptB << ", side B: " << sideB << " (" << partition->Distance(ptB) << ")\n\n"; 53 62 54 63 // vertices on different sides => split … … 62 71 // add vertex to both polygons 63 72 front->mVertices.push_back(splitPt); 64 back->mVertices.push_back(splitPt); 73 back->mVertices.push_back(splitPt); Debug << "front and back polygon + " << splitPt << endl; 65 74 66 75 ++ splits; 67 76 } 68 front->mVertices.push_back(ptB); 77 front->mVertices.push_back(ptB); Debug << "front polygon + " << ptB << endl; 69 78 } 70 79 else if (sideB < 0) … … 77 86 // add vertex to both polygons 78 87 front->mVertices.push_back(splitPt); 79 back->mVertices.push_back(splitPt); 88 back->mVertices.push_back(splitPt); Debug << "front and back polygon + " << splitPt << endl; 80 89 81 90 ++ splits; 82 91 } 83 back->mVertices.push_back(ptB); 92 back->mVertices.push_back(ptB); Debug << "back polygon + " << ptB << endl; 84 93 } 85 94 else … … 87 96 // vertex on plane => add vertex to both polygons 88 97 front->mVertices.push_back(ptB); 89 back->mVertices.push_back(ptB); 98 back->mVertices.push_back(ptB); Debug << "front and back polygon + " << ptB << endl; 90 99 } 91 100 92 101 ptA = ptB; 93 102 sideA = sideB; 103 Debug << "vertex A: " << ptA << ", side A: " << sideA << " (" << partition->Distance(ptA) << ")"; 94 104 } 105 Debug << "\n*********************\n"; 95 106 } 96 107 97 int Polygon3::Side(Plane3 *plane) 108 int Polygon3::Side(const Plane3 &plane) const 109 { 110 int classification = ClassifyPlane(plane); 111 112 if (classification == BACK_SIDE) 113 return -1; 114 else if (classification == FRONT_SIDE) 115 return 1; 116 117 return 0; 118 } 119 120 int Polygon3::ClassifyPlane(const Plane3 &plane) const 98 121 { 99 122 VertexContainer::const_iterator it; … … 102 125 bool onBackSide = false; 103 126 104 // find line -plane intersections127 // find possible line-plane intersections 105 128 for (it = mVertices.begin(); it != mVertices.end(); ++ it) 106 129 { 107 int side = plane ->Side(*it);130 int side = plane.Side(*it, SIDE_TOLERANCE); 108 131 109 132 if (side > 0) … … 116 139 } 117 140 118 if (onFrontSide && onBackSide) // split 141 if (onFrontSide && onBackSide) // split //TODO: check if through vvertex 119 142 { 120 143 return SPLIT; … … 131 154 } 132 155 156 // plane and polygon are coincident 133 157 return COINCIDENT; 134 158 } -
trunk/VUT/GtpVisibilityPreprocessor/src/Polygon3.h
r237 r238 13 13 class Face; 14 14 15 16 /** Queue storing a soup of polygons used during BSP tree construction 15 /** Container storing polygons used during BSP tree construction 17 16 */ 18 typedef queue<Polygon3 *> PolygonQueue;17 typedef vector<Polygon3 *> PolygonContainer; 19 18 20 19 /** Class representing a general planar polygon in 3d. … … 32 31 /** Returns supporting plane of this polygon. 33 32 */ 34 Plane3 GetSupportingPlane() ;33 Plane3 GetSupportingPlane() const; 35 34 36 35 /** Splits polygon. … … 44 43 enum {BACK_SIDE, FRONT_SIDE, SPLIT, COINCIDENT}; 45 44 46 /** Side of the plane where the polygon is located.45 /** Classify polygon with respect to the plane. 47 46 @returns one of BACK_SIDE, FRONT_SIDE, SPLIT, COINCIDENT 48 47 */ 49 int Side(Plane3 *plane); 48 int ClassifyPlane(const Plane3 &plane) const; 49 50 /** Side of the polygon with respect to the plane. 51 @returns 1 if on front side, -1 if on back side, 0 else. 52 */ 53 int Side(const Plane3 &plane) const; 50 54 51 55 /** Deletes all polygons om the queue. 52 56 */ 53 static void DeletePolygons(Polygon Queue*polys);57 static void DeletePolygons(PolygonContainer *polys); 54 58 55 59 /// vertices are connected in counterclockwise order. -
trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.cpp
r237 r238 68 68 69 69 char constructionMethodStr[64]; 70 int maxViewCells = 0; 70 71 72 environment->GetIntValue("BspTree.maxViewCells", maxViewCells); 71 73 environment->GetStringValue("BspTree.constructionMethod", constructionMethodStr); 72 74 … … 90 92 91 93 // derive viewcells from the scene objects 92 ViewCell::DeriveViewCells(objects, mViewcells, 1000);94 ViewCell::DeriveViewCells(objects, mViewcells, maxViewCells); 93 95 94 96 mBspTree->Construct(mViewcells); -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
r237 r238 4 4 #include "common.h" 5 5 #include "ViewCell.h" 6 #include <stack>7 6 #include "Environment.h" 8 7 #include "Polygon3.h" 8 9 #include <stack> 10 #include <time.h> 11 #include <iomanip> 9 12 10 13 int BspTree::sTermMaxPolygons = 10; 11 14 int BspTree::sTermMaxDepth = 20; 12 15 int BspTree::sSplitPlaneStrategy = NEXT_POLYGON; 13 16 int BspTree::sMaxCandidates = 10; 14 17 15 18 /****************************************************************/ … … 85 88 } 86 89 87 void BspInterior::SplitPolygons(Polygon Queue*polys,88 Polygon Queue*frontPolys,89 Polygon Queue*backPolys,90 void BspInterior::SplitPolygons(PolygonContainer *polys, 91 PolygonContainer *frontPolys, 92 PolygonContainer *backPolys, 90 93 int &splits) 91 94 { 92 93 { 94 Polygon3 *poly = polys-> front();95 96 polys->pop ();95 while (!polys->empty()) 96 { 97 Polygon3 *poly = polys->back(); 98 99 polys->pop_back(); 97 100 98 101 Debug << (*poly); 99 102 100 int result = poly-> Side(&mPlane);103 int result = poly->ClassifyPlane(mPlane); 101 104 102 105 Polygon3 *front_piece = NULL; … … 106 109 { 107 110 case Polygon3::COINCIDENT: 108 //break; //TODO: comment in 111 Debug << "coincident\n"; 112 break; // do nothing 109 113 case Polygon3::FRONT_SIDE: 110 frontPolys->push(poly); 114 Debug << "front\n"; 115 frontPolys->push_back(poly); 111 116 break; 112 117 case Polygon3::BACK_SIDE: 113 backPolys->push(poly); 118 Debug << "back\n"; 119 backPolys->push_back(poly); 114 120 break; 115 121 case Polygon3::SPLIT: … … 117 123 back_piece = new Polygon3(); 118 124 125 Debug << "\n\n**************SPLIT***************\n"; 126 Debug << "Split plane: " << mPlane << "\noriginal " << (*poly) << endl; 127 119 128 //-- split polygon 120 129 poly->Split(&mPlane, front_piece, back_piece, splits); 121 130 122 Debug << "SPLIT, plane: " << mPlane << "\norginal: " << (*poly) << "\nback: " << (*back_piece) << "\nfront: " << (*front_piece) << endl; 123 backPolys->push(back_piece); 124 frontPolys->push(front_piece); 125 131 Debug << "new front " << (*front_piece) << endl; 132 Debug << "new back " << (*back_piece) << endl; 133 134 frontPolys->push_back(front_piece); 135 backPolys->push_back(back_piece); 136 126 137 // don't need polygon anymore 127 138 DEL_PTR(poly); … … 129 140 break; 130 141 default: 142 Debug << "SHOULD NEVER COME HERE\n"; 131 143 break; 132 144 } … … 160 172 { 161 173 mRoot = new BspLeaf(); 174 Randomize(); // initialise random generator for heuristics 162 175 } 163 176 … … 170 183 { 171 184 app << "===== BspTree statistics ===============\n"; 185 186 app << setprecision(4); 172 187 173 188 app << "#N_RAYS Number of rays )\n" … … 200 215 objectRefs/(double)Leaves() << "\n"; 201 216 202 // app << setprecision(4);203 204 217 app << "#N_PEMPTYLEAVES ( Percentage of leaves with zero query domains )\n"<< 205 218 zeroQueryNodes*100/(double)Leaves()<<endl; … … 255 268 void BspTree::InsertViewCell(ViewCell *viewCell) 256 269 { 270 Debug << "Inserting view cells\n"; 257 271 std::stack<BspTraversalData> tStack; 258 272 259 Polygon Queuepolys;273 PolygonContainer polys; 260 274 // copy polygon information to guide the split process 261 275 CopyMesh2Polygons(viewCell->GetMesh(), polys); … … 275 289 276 290 // filter polygons down the tree. 277 Polygon Queue *frontPolys = new PolygonQueue();278 Polygon Queue *backPolys = new PolygonQueue();291 PolygonContainer *frontPolys = new PolygonContainer(); 292 PolygonContainer *backPolys = new PolygonContainer(); 279 293 280 294 int splits = 0; … … 289 303 delete frontPolys; 290 304 291 if (backPolys > 0) // if polygons on this side of bsp tree305 if (backPolys->size() > 0) // if polygons on this side of bsp tree 292 306 tStack.push(BspTraversalData(interior->GetBack(), interior->GetParent(), 293 307 backPolys, tData.mDepth + 1)); … … 319 333 } 320 334 321 void BspTree::CopyMesh2Polygons(Mesh *mesh, Polygon Queue&polys)335 void BspTree::CopyMesh2Polygons(Mesh *mesh, PolygonContainer &polys) 322 336 { 323 337 FaceContainer::const_iterator fi; … … 327 341 { 328 342 Polygon3 *poly = new Polygon3((*fi), mesh); 329 polys.push (poly);330 } 331 } 332 333 void BspTree::Copy2PolygonSoup(const ObjectContainer &objects, Polygon Queue &polys)343 polys.push_back(poly); 344 } 345 } 346 347 void BspTree::Copy2PolygonSoup(const ObjectContainer &objects, PolygonContainer &polys, int maxPolys) 334 348 { 335 349 ObjectContainer::const_iterator it, it_end = objects.end(); 336 350 337 int limit = m in((int)objects.size(), 1);351 int limit = maxPolys != 0 ? min((int)objects.size(), maxPolys) : (int)objects.size(); 338 352 339 353 //for (it = objects.begin(); it != it_end; ++ it) … … 375 389 376 390 std::stack<BspTraversalData> tStack; 377 Polygon Queue *polys = new PolygonQueue();391 PolygonContainer *polys = new PolygonContainer(); 378 392 379 393 // copy mesh instance polygons into one big polygon soup 380 Copy2PolygonSoup(objects, *polys );394 Copy2PolygonSoup(objects, *polys, 100); 381 395 382 396 BspTraversalData tData(mRoot, mRoot->GetParent(), polys, 0); … … 395 409 { 396 410 //Debug << "Subdividing node\n"; 397 398 PolygonQueue *backPolys = new PolygonQueue(); 399 PolygonQueue *frontPolys = new PolygonQueue(); 400 411 PolygonContainer *backPolys = new PolygonContainer(); 412 PolygonContainer *frontPolys = new PolygonContainer(); 413 int polySize = tData.mPolygons->size(); 401 414 BspNode *node = SubdivideNode(dynamic_cast<BspLeaf *>(tData.mNode), 402 415 tData.mParent, … … 404 417 tData.mDepth, 405 418 viewCell, 406 backPolys,407 frontPolys);408 419 frontPolys, 420 backPolys); 421 Debug << "Level " << tData.mDepth << ", all: " << polySize << ", front: " << frontPolys->size() << ", back: " << backPolys->size() << endl; 409 422 if (!node->IsLeaf()) // node was subdivided 410 423 { … … 423 436 } 424 437 425 Plane3 BspTree::SelectPlane(PolygonQueue *polyQueue) 426 { 427 // TODO: more sophisticated criteria 428 switch (sSplitPlaneStrategy) 429 { 430 case LEAST_SPLITS: 431 break; 432 case NEXT_POLYGON: 433 return polyQueue->front()->GetSupportingPlane(); 434 break; 435 default: 436 break; 437 } 438 Plane3 BspTree::SelectPlane(PolygonContainer *polygons) const 439 { 440 // most simple strategy: just take next polygon 441 if (sSplitPlaneStrategy == NEXT_POLYGON) 442 { 443 Debug << "simple plane selection\n"; 444 return polygons->front()->GetSupportingPlane(); 445 } 446 447 return SelectPlaneHeuristics(polygons, sMaxCandidates); 448 } 449 450 Plane3 BspTree::SelectPlaneHeuristics(PolygonContainer *polygons, int maxTests) const 451 { 452 Debug << "selecting plane heuristics\n"; 453 454 int bestValue = 999999; 455 456 Plane3 *bestPlane = NULL; 457 458 int limit = min((int)polygons->size(), maxTests); 459 460 for (int i = 0; i < limit; ++i) 461 { 462 int candidateIdx = Random((int)polygons->size()); 463 Plane3 candidatePlane = (*polygons)[candidateIdx]->GetSupportingPlane(); 464 Debug << "choosing new candidate: " << limit << endl; 465 // evaluate current candidate 466 int candidateValue = EvalSplitPlane(polygons, candidatePlane); 467 468 if (candidateValue < bestValue) 469 { 470 bestPlane = &candidatePlane; 471 bestValue = candidateValue; 472 Debug << "new plane value " << bestValue << endl; 473 } 474 } 475 Debug << "%%%%%%%%%%found value: " << bestValue << endl; 476 477 return *bestPlane; 478 } 479 480 int BspTree::EvalSplitPlane(PolygonContainer *polygons, const Plane3 &candidatePlane) const 481 { 482 PolygonContainer::const_iterator it; 483 484 int sum = 0, sum2 = 0; 485 486 for (it = polygons->begin(); it < polygons->end(); ++ it) 487 { 488 int classification = (*it)->ClassifyPlane(candidatePlane); 489 490 if ((sSplitPlaneStrategy == BALANCED_TREE) || (sSplitPlaneStrategy == COMBINED)) 491 { 492 sum += EvalForBalancedTree(classification); 493 } 494 495 if ((sSplitPlaneStrategy == LEAST_SPLITS) || (sSplitPlaneStrategy == COMBINED)) 496 { 497 sum2 += EvalForLeastSplits(classification); 498 } 499 } 500 501 // return linear combination of both sums 502 return abs(sum) + abs(sum2); 503 } 504 505 int BspTree::EvalForBalancedTree(const int classification) 506 { 507 if (classification == Polygon3::FRONT_SIDE) 508 return 1; 509 else if (classification == Polygon3::BACK_SIDE) 510 return -1; 511 512 return 0; 513 } 514 515 int BspTree::EvalForLeastSplits(const int classification) 516 { 517 if (classification == Polygon3::SPLIT) 518 return 1; 519 520 return 0; 438 521 } 439 522 440 523 BspNode *BspTree::SubdivideNode(BspLeaf *leaf, 441 524 BspInterior *parent, 442 Polygon Queue*polys,525 PolygonContainer *polys, 443 526 const int depth, 444 527 ViewCell *viewCell, 445 Polygon Queue*frontPolys,446 Polygon Queue*backPolys)528 PolygonContainer *frontPolys, 529 PolygonContainer *backPolys) 447 530 { 448 531 // terminate traversal … … 460 543 // split polygon according to current plane 461 544 int splits = 0; 545 int polySize = polys->size(); 546 462 547 node->SplitPolygons(polys, frontPolys, backPolys, splits); 548 Debug << "$$ " << polySize << " " << frontPolys->size() << " " << backPolys->size() << endl; 463 549 mStat.splits += splits; 464 550 … … 485 571 environment->GetIntValue("BspTree.Termination.maxDepth", sTermMaxDepth); 486 572 environment->GetIntValue("BspTree.Termination.maxPolygons", sTermMaxPolygons); 573 environment->GetIntValue("BspTree.maxCandidates", sMaxCandidates); 487 574 488 575 //-- extract strategy to choose the next split plane … … 497 584 else if (strcmp(splitPlaneStrategyStr, "leastSplits") == 0) 498 585 sSplitPlaneStrategy = BspTree::LEAST_SPLITS; 586 else if (strcmp(splitPlaneStrategyStr, "balancedTree") == 0) 587 sSplitPlaneStrategy = BspTree::BALANCED_TREE; 499 588 else 500 589 { … … 508 597 // the node became a leaf -> evaluate stats for leafs 509 598 BspLeaf *leaf = dynamic_cast<BspLeaf *>(data.mNode); 599 600 Debug << "evaluating leaf stats\n"; 510 601 511 602 if (data.mDepth >= mTermMaxDepth) -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h
r237 r238 16 16 class Polygon3; 17 17 18 /** Queuestoring a soup of polygons used during BSP tree construction18 /** Container storing a soup of polygons used during BSP tree construction 19 19 */ 20 typedef std:: queue<Polygon3 *> PolygonQueue;20 typedef std::vector<Polygon3 *> PolygonContainer; 21 21 22 22 class BspTreeStatistics // TODO: should have common superclass with KdTreeStatistics … … 143 143 @param splits number of splits 144 144 */ 145 void SplitPolygons(PolygonQueue *polys, PolygonQueue *frontPolys, PolygonQueue *backPolys, int &splits); 145 void SplitPolygons(PolygonContainer *polys, PolygonContainer *frontPolys, 146 PolygonContainer *backPolys, int &splits); 146 147 147 148 friend ostream &operator<<(ostream &s, const BspInterior &A) … … 194 195 BspInterior *mParent; 195 196 /// polygonal data for splitting 196 Polygon Queue*mPolygons;197 PolygonContainer *mPolygons; 197 198 /// current depth 198 199 int mDepth; … … 200 201 BspTraversalData() {} 201 202 202 BspTraversalData(BspNode *node, BspInterior *parent, Polygon Queue*polys, const int depth):203 BspTraversalData(BspNode *node, BspInterior *parent, PolygonContainer *polys, const int depth): 203 204 mNode(node), mParent(parent), mPolygons(polys), mDepth(depth) {} 204 205 }; … … 231 232 232 233 protected: 234 235 /** Evaluates plane classification with respect to the plane's 236 contribution for a balanced tree. 237 */ 238 static inline int EvalForBalancedTree(const int classficiation); 239 /** Evaluates plane classification with respect to the plane's 240 contribution for a minimum number splits in the tree. 241 */ 242 static inline int EvalForLeastSplits(const int classification); 243 244 /** Evaluates the contribution of the candidate split plane. 245 */ 246 int EvalSplitPlane(PolygonContainer *polygons, const Plane3 &candidatePlane) const; 247 248 /** Evaluates tree stats in the BSP tree leafs. 249 */ 233 250 void EvaluateLeafStats(const BspTraversalData &data); 234 251 … … 241 258 242 259 /** Selects a splitting plane. 243 @param poly Queuethe polygon data on which the split decition is based244 */ 245 Plane3 SelectPlane(Polygon Queue *polyQueue);260 @param polygons the polygon data on which the split decition is based 261 */ 262 Plane3 SelectPlane(PolygonContainer *polygons) const; 246 263 247 264 /** Filters next viewcell down the tree and inserts it into the appropriate leaves … … 259 276 */ 260 277 BspNode *SubdivideNode(BspLeaf *leaf, BspInterior *parent, 261 Polygon Queue*polys, const int depth,278 PolygonContainer *polys, const int depth, 262 279 ViewCell *viewCell, 263 Polygon Queue *frontPolys, PolygonQueue*backPolys);280 PolygonContainer *frontPolys, PolygonContainer *backPolys); 264 281 265 282 /** Filters polygons down the tree. … … 269 286 @param backPolys returns the polygons in the back of the split plane 270 287 */ 271 void FilterPolygons(BspInterior *node, PolygonQueue *polys, 272 PolygonQueue *frontPolys, PolygonQueue *backPolys); 288 void FilterPolygons(BspInterior *node, PolygonContainer *polys, 289 PolygonContainer *frontPolys, PolygonContainer *backPolys); 290 291 /** Selects the split plane in order to get a balanced tree. 292 @param polygons container of polygons 293 @param maxTests the maximal number of candidate tests 294 */ 295 Plane3 SelectPlaneHeuristics(PolygonContainer *polygons, int maxTests) const; 273 296 274 297 /** Extracts the meshes of the objects and copies them into the mesh. 275 298 */ 276 static void Copy2PolygonSoup(const ObjectContainer &objects, Polygon Queue &polys);299 static void Copy2PolygonSoup(const ObjectContainer &objects, PolygonContainer &polys, int maxPolys); 277 300 278 301 /** copy this mesh into polygons. 279 302 */ 280 static void CopyMesh2Polygons(Mesh *mesh, Polygon Queue&polys);303 static void CopyMesh2Polygons(Mesh *mesh, PolygonContainer &polys); 281 304 282 305 /// Pointer to the root of the tree … … 293 316 294 317 /// Strategies for choosing next split plane. 295 enum {NEXT_POLYGON, LEAST_SPLITS };318 enum {NEXT_POLYGON, LEAST_SPLITS, BALANCED_TREE, COMBINED}; 296 319 297 320 public: … … 303 326 /// maximal possible depth 304 327 static int sTermMaxDepth; 305 328 /// strategy to get the best split plane 306 329 static int sSplitPlaneStrategy; 330 /// number of candidates evaluated for the next split plane 331 static int sMaxCandidates; 307 332 }; 308 333
Note: See TracChangeset
for help on using the changeset viewer.