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.32 by greg, Tue Oct 17 18:22:47 1995 UTC vs.
Revision 2.33 by greg, Tue Oct 24 13:33:23 1995 UTC

# Line 109 | Line 109 | int  ar;
109   setambacc(newa)                         /* set ambient accuracy */
110   double  newa;
111   {
112 <        static double  oldambacc = -1.0;
112 >        double  ambdiff;
113  
114 <        ambacc = newa < 0.0 ? 0.0 : newa;       /* may be done already */
115 <        if (oldambacc < -FTINY)
116 <                oldambacc = ambacc;     /* do nothing first call */
117 <        if (fabs(newa - oldambacc) < 0.01)
118 <                return;                 /* insignificant -- don't bother */
119 <        if (ambacc <= FTINY)
120 <                return;                 /* cannot build new tree */
121 <                                        /* else need to rebuild tree */
122 <        sortambvals(1);
123 <        oldambacc = ambacc;             /* remeber setting for next call */
114 >        if (newa < 0.0)
115 >                newa = 0.0;
116 >        ambdiff = fabs(newa - ambacc);
117 >        if (ambdiff >= .01 && (ambacc = newa) > FTINY && nambvals > 0)
118 >                sortambvals(1);                 /* rebuild tree */
119   }
120  
121  
# Line 216 | Line 211 | register RAY  *r;
211                  scalecolor(acol, 1.0/d);
212                  return;
213          }
214 <        rdepth++;
214 >        rdepth++;                               /* need to cache new value */
215          d = makeambient(acol, r, rdepth-1);
216          rdepth--;
217          if (d > FTINY)
# Line 336 | Line 331 | int  al;
331          FVECT   gp, gd;
332                                                  /* compute weight */
333          amb.weight = pow(AVGREFL, (double)al);
334 <        if (r->rweight < 0.2*amb.weight)        /* heuristic */
334 >        if (r->rweight < 0.1*amb.weight)        /* heuristic */
335                  amb.weight = r->rweight;
336                                                  /* compute ambient */
337          amb.rad = doambient(acol, r, amb.weight, gp, gd);
338 <        if (amb.rad == 0.0)
338 >        if (amb.rad <= FTINY)
339                  return(0.0);
340                                                  /* store it */
341          VCOPY(amb.pos, r->rop);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines