Ignore:
Timestamp:
11/10/05 01:09:53 (19 years ago)
Author:
mattausch
Message:

fixed pvs bug in bsp view cells

File:
1 edited

Legend:

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

    r398 r399  
    274274                } 
    275275 
    276                 contribution += mViewCell->GetPvs().AddSample(ray->sourceObject.mObject); 
     276                if (ray->sourceObject.mObject) 
     277                        contribution += mViewCell->GetPvs().AddSample(ray->sourceObject.mObject); 
    277278 
    278279                if (contribution > 0) 
     
    281282                        ++ contributingSamples; 
    282283                } 
    283  
    284                 // warning: not ordered 
     284                // warning: intersections not ordered 
    285285                ray->bspIntersections.push_back(Ray::BspIntersection((*it)->mMinT, this)); 
    286286        } 
     
    13921392                                // assure that we only count a object  
    13931393                                // once for the front and once for the back side of the plane 
    1394                                 AddToPvs(*ray->intersections[0].mObject, frontData.mPvs, backData.mPvs,  
    1395                                                 cf, frontId, backId, frontAndBackId); 
     1394                                IncPvs(*ray->intersections[0].mObject, frontData.mPvs, backData.mPvs,  
     1395                                          cf, frontId, backId, frontAndBackId); 
    13961396                        } 
    13971397 
    13981398                        // the source object in the origin of the ray 
    1399                         AddToPvs(*ray->sourceObject.mObject, frontData.mPvs, backData.mPvs,  
    1400                                          cf, frontId, backId, frontAndBackId); 
     1399                        if (ray->sourceObject.mObject) 
     1400                        { 
     1401                                IncPvs(*ray->sourceObject.mObject, frontData.mPvs, backData.mPvs,  
     1402                                           cf, frontId, backId, frontAndBackId); 
     1403                        } 
    14011404 
    14021405                        // use #rays to approximate volume 
     
    14291432} 
    14301433 
    1431 void BspTree::AddToPvs(Intersectable &obj, 
    1432                                            int &frontPvs, 
    1433                                            int &backPvs, 
    1434                                            const int cf,  
    1435                                            const int frontId,  
    1436                                            const int backId,  
    1437                                            const int frontAndBackId) const 
     1434void BspTree::IncPvs(Intersectable &obj, 
     1435                                         int &frontPvs, 
     1436                                         int &backPvs, 
     1437                                         const int cf,  
     1438                                         const int frontId,  
     1439                                         const int backId,  
     1440                                         const int frontAndBackId) const 
    14381441{ 
    14391442        if (cf == Ray::COINCIDENT) //TODO: really belongs to no pvs? 
     
    23112314                        } 
    23122315                } 
    2313                 if (!ray->sourceObject.mObject->Mailed()) 
    2314                 { 
    2315                         ray->sourceObject.mObject->Mail(); 
    2316                         ++ pvsSize; 
     2316                if (ray->sourceObject.mObject) 
     2317                { 
     2318                        if (!ray->sourceObject.mObject->Mailed()) 
     2319                        { 
     2320                                ray->sourceObject.mObject->Mail(); 
     2321                                ++ pvsSize; 
     2322                        } 
    23172323                } 
    23182324        } 
Note: See TracChangeset for help on using the changeset viewer.