Changeset 242 for trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
- Timestamp:
- 08/17/05 18:01:16 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
r241 r242 7 7 #include "Polygon3.h" 8 8 #include "Ray.h" 9 9 #include "AxisAlignedBox3.h" 10 10 #include <stack> 11 11 #include <time.h> … … 110 110 { 111 111 case Polygon3::COINCIDENT: 112 break; // do nothing112 break; // TODO: compare normals 113 113 case Polygon3::FRONT_SIDE: 114 114 frontPolys->push_back(poly); … … 676 676 } 677 677 678 AxisAlignedBox3 BspTree::GetBoundingBox() const 679 { 680 return mBox; 681 } 682 683 BspNode *BspTree::GetRoot() const 684 { 685 return mRoot; 686 } 687 678 688 void BspTree::EvaluateLeafStats(const BspTraversalData &data) 679 689 { … … 723 733 724 734 float position; 725 735 726 736 while (1) // endless loop 727 737 { … … 742 752 if (entSide < 0) 743 753 { 744 if(extSide > 0) // plane splits ray 745 { 746 node = in->GetBack(); 747 farChild = in->GetFront(); 748 } else 749 { 750 node = in->GetBack(); 754 node = in->GetBack(); 755 756 if(extSide <= 0) 751 757 continue; 752 } 753 } 758 759 farChild = in->GetFront(); // plane splits ray 760 754 761 } else if (entSide > 0) 755 762 { 756 if (extSide < 0) // plane splits ray 757 { 758 node = in->GetFront(); 759 farChild = in->GetBack(); 760 } else 761 { 762 node = in->GetFront(); 763 node = in->GetFront(); 764 765 if (extSide >= 0) 763 766 continue; 764 } 767 768 farChild = in->GetBack(); // plane splits ray 765 769 } 766 else // ray and plane are coincident // DOTO: WHATIN THIS CASE ?770 else // ray and plane are coincident // WHAT TO DO IN THIS CASE ? 767 771 { 768 //node = in->GetFront();772 node = in->GetFront(); 769 773 continue; 770 774 } 771 775 772 // case N4 or P4 773 float tdist = (position - ray.GetLoc(axis)) / ray.GetDir(axis); 774 tStack.push(RayTraversalData(farChild, extp, maxt)); 775 extp = ray.GetLoc() + ray.GetDir()*tdist; 776 maxt = tdist; 777 778 float tDist = 0; 779 extp = splitPlane->FindIntersection(entp, extp, &t); 780 776 //-- split 777 778 // push data for far child 781 779 tStack.push(BspRayTraversalData(farChild, extp, maxt)); 782 780 783 784 785 maxt = tDist; 786 } 781 // find intersection with plane between ray origin and exit point 782 extp = splitPlane->FindIntersection(ray.GetLoc(), extp, &maxt); 787 783 } else // compute intersections with objects in leaf 788 784 { … … 813 809 mint = maxt; 814 810 BspRayTraversalData &s = tStack.top(); 811 815 812 node = s.mNode; 816 813 extp = s.mExitPoint;
Note: See TracChangeset
for help on using the changeset viewer.