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

Comparing ray/src/rt/raytrace.c (file contents):
Revision 2.51 by greg, Tue May 31 18:01:09 2005 UTC vs.
Revision 2.52 by greg, Tue Jun 21 15:06:50 2005 UTC

# Line 97 | Line 97 | rayorigin(             /* start new ray from old one */
97                          r->rweight *= exp(-re);
98          }
99          rayclear(r);
100 +        if (r->crtype & SHADOW)                 /* shadow commitment */
101 +                return(0);
102          if (maxdepth <= 0 && rc != NULL) {      /* Russian roulette */
103                  if (minweight <= 0.0)
104                          error(USER, "zero ray weight in Russian roulette");
# Line 346 | Line 348 | raydist(               /* compute (cumulative) ray distance */
348  
349   extern void
350   raycontrib(             /* compute (cumulative) ray contribution */
351 <        COLOR  rc,
351 >        double  rc[3],
352          const RAY  *r,
353          int  flags
354   )
355   {
356 <        COLOR   eext, ext1;
357 <        
356 <        setcolor(eext, 0., 0., 0.);
357 <        setcolor(rc, 1., 1., 1.);
356 >        double  eext[3];
357 >        int     i;
358  
359 +        eext[0] = eext[1] = eext[2] = 0.;
360 +        rc[0] = rc[1] = rc[2] = 1.;
361 +
362          while (r != NULL && r->crtype&flags) {
363 <                multcolor(rc, r->rcoef);
364 <                copycolor(ext1, r->cext);
365 <                scalecolor(ext1, r->rot);
366 <                addcolor(eext, ext1);
363 >                for (i = 3; i--; ) {
364 >                        rc[i] *= colval(r->rcoef,i);
365 >                        eext[i] += r->rot * colval(r->cext,i);
366 >                }
367                  r = r->parent;
368          }
369 <        if (intens(eext) > FTINY) {
370 <                setcolor(ext1,  exp(-colval(eext,RED)),
371 <                                exp(-colval(eext,GRN)),
369 <                                exp(-colval(eext,BLU)));
370 <                multcolor(rc, ext1);
371 <        }
369 >        for (i = 3; i--; )
370 >                rc[i] *= (eext[i] <= FTINY) ? 1. :
371 >                                (eext[i] > 300.) ? 0. : exp(-eext[i]);
372   }
373  
374  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines