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.50 by greg, Thu May 26 06:55:22 2005 UTC vs.
Revision 2.51 by greg, Tue May 31 18:01:09 2005 UTC

# Line 13 | Line 13 | static const char RCSid[] = "$Id$";
13   #include  "source.h"
14   #include  "otypes.h"
15   #include  "otspecial.h"
16 + #include  "random.h"
17  
18   #define  MAXCSET        ((MAXSET+1)*2-1)        /* maximum check set size */
19  
# Line 96 | Line 97 | rayorigin(             /* start new ray from old one */
97                          r->rweight *= exp(-re);
98          }
99          rayclear(r);
100 +        if (maxdepth <= 0 && rc != NULL) {      /* Russian roulette */
101 +                if (minweight <= 0.0)
102 +                        error(USER, "zero ray weight in Russian roulette");
103 +                if (maxdepth < 0 && r->rlvl > -maxdepth)
104 +                        return(-1);             /* upper reflection limit */
105 +                if (r->rweight >= minweight)
106 +                        return(0);
107 +                if (frandom() < r->rweight/minweight)
108 +                        return(-1);
109 +                rw = minweight/r->rweight;      /* promote survivor */
110 +                scalecolor(r->rcoef, rw);
111 +                r->rweight = minweight;
112 +                return(0);
113 +        }
114          return(r->rlvl <= maxdepth && r->rweight >= minweight ? 0 : -1);
115   }
116  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines