Ignore:
Timestamp:
10/18/05 14:21:26 (19 years ago)
Author:
bittner
Message:

changed mailbox naming convention, added intersectable ids

File:
1 edited

Legend:

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

    r335 r339  
    2727void 
    2828SamplingPreprocessor::SetupRay(Ray &ray,  
    29                                                           const Vector3 &point,  
    30                                                           const Vector3 &direction, 
    31                                                           const int type) 
     29                                                                                                                        const Vector3 &point,  
     30                                                                                                                        const Vector3 &direction, 
     31                                                                                                                        const int type) 
    3232{ 
    3333  ray.intersections.clear(); 
     
    148148 
    149149int 
    150 SamplingPreprocessor::CastRay(Intersectable *object, Ray &ray) 
     150SamplingPreprocessor::CastRay(Intersectable *object, 
     151                                                                                                                        Ray &ray) 
    151152{ 
    152153        int sampleContributions = 0; 
    153154 
     155        long t1 = GetTime(); 
    154156        // cast ray to KD tree to find intersection with other objects 
    155157        mKdTree->CastRay(ray); 
    156          
     158        long t2 = GetTime(); 
     159 
     160        cout<<object->GetId()<<" "<<TimeDiff(t1, t2); 
     161 
    157162        if (mViewCellsType == BSP_VIEW_CELLS) 
    158         { 
    159                 // cast ray to BSP tree to get intersection with view cells 
    160                 if (mBspTree) 
    161163                { 
    162                         mBspTree->CastRay(ray); 
    163                  
    164                         sampleContributions += AddObjectSamples(object, ray); 
     164                        // cast ray to BSP tree to get intersection with view cells 
     165                        if (mBspTree) 
     166                                { 
     167                                        mBspTree->CastRay(ray); 
     168                                         
     169                                        sampleContributions += AddObjectSamples(object, ray); 
    165170                                 
    166                         if (!ray.intersections.empty()) // second intersection found 
    167                         { 
    168                                 sampleContributions +=  
    169                                         AddObjectSamples(ray.intersections[0].mObject, ray); 
    170                         } 
     171                                        if (!ray.intersections.empty()) // second intersection found 
     172                                                { 
     173                                                        sampleContributions +=  
     174                                                                AddObjectSamples(ray.intersections[0].mObject, ray); 
     175                                                } 
     176                                } 
    171177                } 
    172         } 
    173178        else 
    174         { 
    175                 if (ray.leaves.size()) { 
    176                         sampleContributions += AddNodeSamples(object, ray); 
    177                  
    178                         if (ray.intersections.size()) { 
    179                                 sampleContributions += AddNodeSamples(ray.intersections[0].mObject, ray); 
    180                         } 
    181                 }  
    182         }        
     179                { 
     180                        if (ray.leaves.size()) { 
     181                                sampleContributions += AddNodeSamples(object, ray); 
     182                                 
     183                                if (ray.intersections.size()) { 
     184                                        sampleContributions += AddNodeSamples(ray.intersections[0].mObject, ray); 
     185                                } 
     186                        }  
     187                }        
    183188         
    184189        return sampleContributions; 
Note: See TracChangeset for help on using the changeset viewer.