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

Comparing ray/src/rt/ambient.c (file contents):
Revision 2.108 by greg, Tue May 14 17:39:10 2019 UTC vs.
Revision 2.110 by greg, Fri Feb 19 22:05:46 2021 UTC

# Line 583 | Line 583 | extambient(            /* extrapolate value at pv, nv */
583   )
584   {
585          const double    min_d = 0.05;
586 +        const double    max_d = 20.;
587          static FVECT    my_uvw[3];
588          FVECT           v1;
589          int             i;
# Line 602 | Line 603 | extambient(            /* extrapolate value at pv, nv */
603          for (i = 3; i--; )
604                  d += v1[i] * (ap->gdir[0]*uvw[0][i] + ap->gdir[1]*uvw[1][i]);
605          
606 <        if (d < min_d)                  /* should not use if we can avoid it */
606 >        if (d < min_d)                  /* clamp min/max scaling */
607                  d = min_d;
608 +        else if (d > max_d)
609 +                d = max_d;
610          copycolor(cr, ap->val);
611          scalecolor(cr, d);
612          return(d > min_d);
# Line 975 | Line 978 | aflock(                        /* lock/unlock ambient file */
978  
979          if (typ == fls.l_type)          /* already called? */
980                  return;
981 +
982          fls.l_type = typ;
983 <        if (fcntl(fileno(ambfp), F_SETLKW, &fls) < 0)
984 <                error(SYSTEM, "cannot (un)lock ambient file");
983 >        do
984 >                if (fcntl(fileno(ambfp), F_SETLKW, &fls) != -1)
985 >                        return;
986 >        while (errno == EINTR);
987 >        
988 >        error(SYSTEM, "cannot (un)lock ambient file");
989   }
990  
991  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines