Changeset 353 for trunk/VUT/GtpVisibilityPreprocessor
- Timestamp:
- 10/28/05 14:06:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
r352 r353 1678 1678 return splits; 1679 1679 } 1680 1681 int BspTree::FindNeighbors(KdNode *n, vector<BspNode *> &neighbors, bool onlyUnmailed) 1680 /* 1681 void BspTree::ExtractSplitPlanes(BspNode *n, vector<Plane *> planes) 1682 { 1683 while (!n->IsRoot()) 1684 { 1685 if (!n->IsLeaf()) 1686 planes.push_back(dynamic_cast<BspInterior *>(n)->GetPlane(); 1687 1688 n = n->GetParent(); 1689 } 1690 } 1691 1692 void BspTree::ExtractGeometry(BspNode *n, PolygonContainer &polys) 1693 { 1694 vector<Plane *> planes; 1695 ExtractSplitPlanes(n, planes); 1696 1697 while (!tStack.empty()) 1698 { 1699 // filter polygons donw the tree 1700 BspSplitData tData = tStack.top(); 1701 tStack.pop(); 1702 1703 if (!tData.mNode->IsLeaf()) 1704 { 1705 BspInterior *interior = dynamic_cast<BspInterior *>(tData.mNode); 1706 if (tData.mNode != tree.GetRoot()) 1707 tData.mSides.push_back(tData.mIsFront); // add current side 1708 1709 // bounded plane is added to the polygons 1710 Polygon3 *planePoly = tree.GetBoundingBox().CrossSection(*interior->GetPlane()); 1711 1712 // do all the splits with the previous planes 1713 for (int i = 0; i < (int)tData.mPlanes.size(); ++i) 1714 { 1715 VertexContainer splitPts; 1716 Polygon3 *frontPoly = new Polygon3(); 1717 Polygon3 *backPoly = new Polygon3(); 1718 1719 if (planePoly->ClassifyPlane(*tData.mPlanes[i]) == Polygon3::SPLIT) 1720 { 1721 planePoly->Split(*tData.mPlanes[i], *frontPoly, *backPoly, splitPts); 1722 DEL_PTR(planePoly); 1723 1724 if(tData.mSides[i] == true) 1725 { 1726 planePoly = frontPoly; 1727 DEL_PTR(backPoly); 1728 } 1729 else 1730 { 1731 planePoly = backPoly; 1732 DEL_PTR(frontPoly); 1733 } 1734 } 1735 } 1736 1737 tData.mPlanes.push_back(interior->GetPlane()); // add plane to split planes 1738 1739 if (planePoly->Valid()) 1740 polys.push_back(planePoly); 1741 else 1742 { 1743 //Debug << "polygon not valid: " << *planePoly << " size: " << (int)planePoly->mVertices.size() << endl; 1744 DEL_PTR(planePoly); 1745 } 1746 // push the children on the stack 1747 tStack.push(BspSplitData(interior->GetFront(), tData.mPlanes, tData.mSides, true)); 1748 tStack.push(BspSplitData(interior->GetBack(), tData.mPlanes, tData.mSides, false)); 1749 } 1750 } 1751 ExportPolygons(polys); 1752 CLEAR_CONTAINER(polys); 1753 } 1754 1755 int BspTree::FindNeighbors(BspNode *n, vector<BspNode *> &neighbors, bool onlyUnmailed) 1682 1756 { 1683 1757 stack<BspNode *> nodeStack; … … 1715 1789 } 1716 1790 return neighbors.size(); 1717 } 1791 }*/
Note: See TracChangeset
for help on using the changeset viewer.