ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/pmapkdt.c
(Generate patch)

Comparing ray/src/rt/pmapkdt.c (file contents):
Revision 1.2 by rschregle, Mon Aug 14 21:12:10 2017 UTC vs.
Revision 1.3 by rschregle, Wed Jan 24 19:39:05 2018 UTC

# Line 346 | Line 346 | static void kdT_FindNearest (PhotonMap *pmap, const fl
346     if (norm && DOT(norm, p -> norm) <= PMAP_NORM_TOL * 127 * frandom())
347        return;
348        
349 <   if (isContribPmap(pmap) && pmap -> srcContrib) {
350 <      /* Lookup in contribution photon map */
351 <      OBJREC *srcMod;
352 <      const int srcIdx = photonSrcIdx(pmap, p);
353 <      
354 <      if (srcIdx < 0 || srcIdx >= nsources)
355 <         error(INTERNAL, "invalid light source index in photon map");
356 <      
357 <      srcMod = findmaterial(source [srcIdx].so);
349 >   if (isContribPmap(pmap)) {
350 >      /* Lookup in contribution photon map; filter according to emitting
351 >       * light source if contrib list set, else accept all */
352 >      
353 >      if (pmap -> srcContrib) {
354 >         OBJREC *srcMod;
355 >         const int srcIdx = photonSrcIdx(pmap, p);
356 >        
357 >         if (srcIdx < 0 || srcIdx >= nsources)
358 >            error(INTERNAL, "invalid light source index in photon map");
359 >        
360 >         srcMod = findmaterial(source [srcIdx].so);
361  
362 <      /* Reject photon if contributions from light source which emitted it
363 <       * are not sought */
364 <      if (!lu_find(pmap -> srcContrib, srcMod -> oname) -> data)
365 <         return;
362 >         /* Reject photon if contributions from light source which emitted it
363 >          * are not sought */
364 >         if (!lu_find(pmap -> srcContrib, srcMod -> oname) -> data)
365 >            return;
366 >      }
367  
368        /* Reject non-caustic photon if lookup for caustic contribs */
369        if (pmap -> lookupCaustic & !p -> caustic)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines