Changeset 436 for trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
- Timestamp:
- 11/25/05 17:16:26 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
r433 r436 143 143 Polygon3 *front_piece = NULL; 144 144 Polygon3 *back_piece = NULL; 145 146 VertexContainer splitVertices;147 145 148 146 switch (cf) … … 164 162 poly->Split(mPlane, 165 163 *front_piece, 166 *back_piece, 167 splitVertices); 164 *back_piece); 168 165 169 166 ++ splits; // increase number of splits … … 698 695 facePolyMap.clear(); 699 696 700 // compu e bounding box697 // compute bounding box 701 698 Polygon3::IncludeInBox(*polys, mBox); 702 699 … … 721 718 } 722 719 720 void BspTree::Construct(const ObjectContainer &objects, const RayContainer &sampleRays) 721 { 722 mStat.nodes = 1; 723 mBox.Initialize(); // initialise BSP tree bounding box 724 725 BoundedRayContainer *rays = new BoundedRayContainer(); 726 PolygonContainer *polys = new PolygonContainer(); 727 728 // copy mesh instance polygons into one big polygon soup 729 mStat.polys = AddToPolygonSoup(objects, *polys); 730 731 RayContainer::const_iterator rit, rit_end = sampleRays.end(); 732 733 //-- store rays 734 for (rit = sampleRays.begin(); rit != rit_end; ++ rit) 735 { 736 Ray *ray = *rit; 737 ray->SetId(-1); // reset id 738 739 float minT, maxT; 740 if (BoundRay(*ray, minT, maxT)) 741 rays->push_back(new BoundedRay(ray, minT, maxT)); 742 } 743 744 Debug << "tree has " << (int)polys->size() << " polys, " << (int)sampleRays.size() << " rays" << endl; 745 Construct(polys, rays); 746 } 747 723 748 void BspTree::Construct(PolygonContainer *polys, BoundedRayContainer *rays) 724 749 { … … 736 761 737 762 mStat.Start(); 738 cout << " **** Contructing bsp tree ****\n";739 763 cout << "Contructing bsp tree ... "; 764 long startTime = GetTime(); 740 765 while (!tStack.empty()) 741 766 { 742 767 tData = tStack.top(); 768 743 769 tStack.pop(); 744 770 745 771 // subdivide leaf node 746 BspNode *subRoot = Subdivide(tStack, tData); 747 } 772 BspNode *r = Subdivide(tStack, tData); 773 774 if (r == mRoot) 775 Debug << "BSP tree construction time spent at root: " << TimeDiff(startTime, GetTime())*1e-3 << "s" << endl; 776 } 777 778 cout << "finished\n"; 748 779 749 780 mStat.Stop(); … … 1452 1483 float pFront = 0; 1453 1484 float pBack = 0; 1454 Debug << "here" << endl; 1485 1455 1486 if (mSplitPlaneStrategy & PVS) 1456 1487 { … … 1573 1604 1574 1605 // give penalty to unbalanced split 1575 if ( 0)1606 if (1) 1576 1607 if (((pFront * 0.2 + Limits::Small) > pBack) || (pFront < (pBack * 0.2 + Limits::Small))) 1577 1608 val += 0.5; … … 1583 1614 << " backpvs: " << backPvs << " pBack: " << pBack << endl << endl; 1584 1615 #endif 1585 Debug << "here2" << endl;1586 1616 return val; 1587 1617 } … … 2195 2225 backPoly = new Polygon3(); 2196 2226 2197 candidatePolys[i]->Split(halfSpaces[j], *frontPoly, 2198 *backPoly, splitPts); 2227 candidatePolys[i]->Split(halfSpaces[j], 2228 *frontPoly, 2229 *backPoly); 2199 2230 2200 2231 DEL_PTR(candidatePolys[i]); … … 2450 2481 Polygon3 *backPoly = new Polygon3(); 2451 2482 2452 VertexContainer splitPts; 2453 2454 poly->Split(splitPlane, *frontPoly, *backPoly, splitPts); 2483 poly->Split(splitPlane, *frontPoly, *backPoly); 2455 2484 2456 2485 DEL_PTR(poly); … … 2507 2536 case Polygon3::SPLIT: 2508 2537 { 2509 VertexContainer splitPts;2510 2511 2538 Polygon3 *frontPoly = new Polygon3(); 2512 2539 Polygon3 *backPoly = new Polygon3(); 2513 2540 2514 planePoly->Split(plane, *frontPoly, *backPoly , splitPts);2541 planePoly->Split(plane, *frontPoly, *backPoly); 2515 2542 DEL_PTR(planePoly); 2516 2543
Note: See TracChangeset
for help on using the changeset viewer.