Ignore:
Timestamp:
03/05/07 11:07:44 (17 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.cpp

    r2105 r2187  
    238238   
    239239                                         
     240VssRay *RayCaster::RequestRay(const Vector3 &origin,  
     241                                                          const Vector3 &termination,  
     242                                                          Intersectable *originObject,  
     243                                                          Intersectable *terminationObject,  
     244                                                          const int pass,  
     245                                                          const float pdf) 
     246{ 
     247 #if DEBUG_RAYCAST 
     248        Debug<<"PR2a"<<flush; 
     249#endif 
     250         
     251        // old method: always allocate 
     252        if (1) return new VssRay(origin, termination, originObject, terminationObject, pass, pdf); 
     253 
     254        VssRay *vssRay = mVssRayPool.Alloc(); 
     255 
     256#if DEBUG_RAYCAST 
     257        Debug<<"PR2b"<<flush; 
     258#endif 
     259         
     260        *vssRay = VssRay(origin, termination, originObject, terminationObject, pass, pdf); 
     261 
     262#if DEBUG_RAYCAST 
     263        Debug<<"PR2c"<<flush; 
     264#endif 
     265 
     266        return vssRay; 
     267} 
     268 
    240269 
    241270int 
     
    306335 
    307336          if (!pruneInvalidRays || hitA.mObject) { 
    308 #if DEBUG_RAYCAST 
    309                 Debug<<"PR2a"<<flush; 
    310 #endif 
    311                  
    312                 VssRay *vssRay = mVssRayPool.Alloc(); 
    313  
    314 #if DEBUG_RAYCAST 
    315                 Debug<<"PR2b"<<flush; 
    316 #endif 
    317                 *vssRay = VssRay( 
    318                                                  !castDoubleRay ? simpleRay.mOrigin : clipB, 
     337 
     338                  VssRay *vssRay =  
     339                          RequestRay(!castDoubleRay ? simpleRay.mOrigin : clipB, 
    319340                                                 hitA.mPoint, 
    320341                                                 hitB.mObject, 
     
    323344                                                 1.0f //simpleRay.mPdf 
    324345                                                 ); 
    325 #if DEBUG_RAYCAST 
    326                 Debug<<"PR2c"<<flush; 
    327 #endif 
    328                  
     346 
    329347                if (validA) 
    330348                  vssRay->mFlags |= VssRay::Valid; 
     
    344362        if (castDoubleRay && (!pruneInvalidRays || hitB.mObject)) 
    345363        { 
    346                 VssRay *vssRay = mVssRayPool.Alloc(); 
    347  
    348                 *vssRay = VssRay( 
    349                         clipA, 
    350                         hitB.mPoint, 
    351                         hitA.mObject, 
    352                         hitB.mObject, 
    353                         mPreprocessor.mPass, 
    354                         1.0f //simpleRay.mPdf 
    355                         ); 
     364                VssRay *vssRay = RequestRay( 
     365                                                                        clipA, 
     366                                                                        hitB.mPoint, 
     367                                                                        hitA.mObject, 
     368                                                                        hitB.mObject, 
     369                                                                        mPreprocessor.mPass, 
     370                                                                        1.0f //simpleRay.mPdf 
     371                                                                        ); 
    356372 
    357373                if (validB) 
     
    381397                                        const bool pruneInvalidRays ) 
    382398{ 
    383   SimpleRayContainer::const_iterator rit, rit_end = rays.end(); 
    384    
    385   for (rit = rays.begin(); rit != rit_end; ++ rit) { 
    386         CastRay( 
     399        SimpleRayContainer::const_iterator rit, rit_end = rays.end(); 
     400 
     401        for (rit = rays.begin(); rit != rit_end; ++ rit) { 
     402                CastRay( 
    387403                        *rit,                            
    388404                        vssRays, 
     
    390406                        castDoubleRay, 
    391407                        pruneInvalidRays); 
    392   } 
    393    
    394 } 
    395  
    396 } 
     408        } 
     409} 
     410 
     411 
     412} 
Note: See TracChangeset for help on using the changeset viewer.