Ignore:
Timestamp:
08/17/05 18:01:16 (19 years ago)
Author:
mattausch
Message:

added output functions and castray method for bsp viewcells

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp

    r241 r242  
    77#include "Polygon3.h" 
    88#include "Ray.h" 
    9  
     9#include "AxisAlignedBox3.h" 
    1010#include <stack> 
    1111#include <time.h> 
     
    110110                { 
    111111                        case Polygon3::COINCIDENT: 
    112                                 break; // do nothing 
     112                                break; // TODO: compare normals 
    113113                        case Polygon3::FRONT_SIDE: 
    114114                                frontPolys->push_back(poly); 
     
    676676} 
    677677 
     678AxisAlignedBox3 BspTree::GetBoundingBox() const 
     679{ 
     680        return mBox; 
     681} 
     682 
     683BspNode *BspTree::GetRoot() const 
     684{ 
     685        return mRoot; 
     686} 
     687 
    678688void BspTree::EvaluateLeafStats(const BspTraversalData &data) 
    679689{ 
     
    723733         
    724734        float position; 
    725  
     735         
    726736        while (1) // endless loop 
    727737        { 
     
    742752                        if (entSide < 0) 
    743753                        { 
    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)  
    751757                                        continue; 
    752                                 }  
    753                         } 
     758                                         
     759                                farChild = in->GetFront(); // plane splits ray 
     760 
    754761                        } else if (entSide > 0) 
    755762                        { 
    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) 
    763766                                        continue; 
    764                                 } 
     767 
     768                                farChild = in->GetBack();        // plane splits ray                     
    765769                        } 
    766                         else // ray and plane are coincident // DOTO: WHAT IN THIS CASE ? 
     770                        else // ray and plane are coincident // WHAT TO DO IN THIS CASE ? 
    767771                        { 
    768                                 //node = in->GetFront(); 
     772                                node = in->GetFront(); 
    769773                                continue; 
    770774                        } 
    771775 
    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 
    781779                        tStack.push(BspRayTraversalData(farChild, extp, maxt)); 
    782780 
    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); 
    787783                } else // compute intersections with objects in leaf 
    788784                { 
     
    813809                        mint = maxt; 
    814810                        BspRayTraversalData &s  = tStack.top(); 
     811 
    815812                        node = s.mNode; 
    816813                        extp = s.mExitPoint; 
Note: See TracChangeset for help on using the changeset viewer.