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.3 by rschregle, Wed Jan 24 19:39:05 2018 UTC vs.
Revision 1.4 by rschregle, Thu May 31 12:34:16 2018 UTC

# Line 424 | Line 424 | void kdT_FindPhotons (struct PhotonMap *pmap, const FV
424    
425     /* Photon pos & normal stored at lower precision */
426     VCOPY(p, pos);
427 <   VCOPY(n, norm);
428 <   kdT_FindNearest(pmap, p, n, 1);
427 >   if (norm)
428 >      VCOPY(n, norm);
429 >   kdT_FindNearest(pmap, p, norm ? n : NULL, 1);
430   }
431  
432  
# Line 464 | Line 465 | static void kdT_Find1Nearest (PhotonMap *pmap, const f
465     d2 = DOT(dv, dv);
466    
467     if (d2 < pmap -> maxDist2 &&
468 <       DOT(norm, p -> norm) > PMAP_NORM_TOL * 127 * frandom()) {
468 >       (!norm || DOT(norm, p -> norm) > PMAP_NORM_TOL * 127 * frandom())) {
469        /* Closest photon so far with similar normal. We allow for tolerance
470         * to account for perturbation in the latter; note the photon normal
471         * is coded in the range [-127,127], hence we factor this in  */
# Line 483 | Line 484 | void kdT_Find1Photon (struct PhotonMap *pmap, const FV
484    
485     /* Photon pos & normal stored at lower precision */
486     VCOPY(p, pos);
487 <   VCOPY(n, norm);
488 <   kdT_Find1Nearest(pmap, p, n, &pnn, 1);
487 >   if (norm)
488 >      VCOPY(n, norm);  
489 >   kdT_Find1Nearest(pmap, p, norm ? n : NULL, &pnn, 1);
490     memcpy(photon, pnn, sizeof(Photon));
491   }
492  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines