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.25 by greg, Sat Mar 30 11:18:36 1996 UTC vs.
Revision 2.26 by greg, Wed Apr 17 14:06:35 1996 UTC

# Line 27 | Line 27 | extern int  do_irrad;                  /* compute irradiance? */
27   extern COLOR  ambval;                   /* ambient value */
28  
29   extern COLOR  cextinction;              /* global extinction coefficient */
30 < extern double  salbedo;                 /* global scattering albedo */
30 > extern COLOR  salbedo;                  /* global scattering albedo */
31   extern double  seccg;                   /* global scattering eccentricity */
32   extern double  ssampdist;               /* scatter sampling distance */
33  
# Line 62 | Line 62 | double  rw;
62                  r->clipset = NULL;
63                  r->revf = raytrace;
64                  copycolor(r->cext, cextinction);
65 <                r->albedo = salbedo;
65 >                copycolor(r->albedo, salbedo);
66                  r->gecc = seccg;
67                  r->slights = NULL;
68          } else {                                /* spawned ray */
# Line 79 | Line 79 | double  rw;
79                  }
80                  r->revf = ro->revf;
81                  copycolor(r->cext, ro->cext);
82 <                r->albedo = ro->albedo;
82 >                copycolor(r->albedo, ro->albedo);
83                  r->gecc = ro->gecc;
84                  r->slights = ro->slights;
85                  r->rweight = ro->rweight * rw;
# Line 196 | Line 196 | register RAY  *r;
196                  return;                         /* no medium */
197          if ((dist = r->rot) >= FHUGE)
198                  dist = 2.*thescene.cusize;      /* what to use for infinity? */
199        if (r->crtype & SHADOW)
200                dist *= 1. - r->albedo;         /* no scattering for sources */
201        if (dist <= FTINY)
202                return;                         /* no effective ray travel */
199          re = dist*colval(r->cext,RED);
200          ge = dist*colval(r->cext,GRN);
201          be = dist*colval(r->cext,BLU);
202 <        setcolor(ce,    re>92. ? 0. : exp(-re),
203 <                        ge>92. ? 0. : exp(-ge),
204 <                        be>92. ? 0. : exp(-be));
202 >        if (r->crtype & SHADOW) {               /* no scattering for sources */
203 >                re *= 1. - colval(r->albedo,RED);
204 >                ge *= 1. - colval(r->albedo,GRN);
205 >                be *= 1. - colval(r->albedo,BLU);
206 >        }
207 >        setcolor(ce,    re<=0. ? 1. : re>92. ? 0. : exp(-re),
208 >                        ge<=0. ? 1. : ge>92. ? 0. : exp(-ge),
209 >                        be<=0. ? 1. : be>92. ? 0. : exp(-be));
210          multcolor(r->rcol, ce);                 /* path absorption */
211 <        if (r->albedo <= FTINY || r->crtype & SHADOW)
211 >        if (r->crtype & SHADOW || intens(r->albedo) <= FTINY)
212                  return;                         /* no scattering */
213 <        setcolor(ca,    r->albedo*colval(ambval,RED)*(1.-colval(ce,RED)),
214 <                        r->albedo*colval(ambval,GRN)*(1.-colval(ce,GRN)),
215 <                        r->albedo*colval(ambval,BLU)*(1.-colval(ce,BLU)));
213 >        setcolor(ca,
214 >                colval(r->albedo,RED)*colval(ambval,RED)*(1.-colval(ce,RED)),
215 >                colval(r->albedo,GRN)*colval(ambval,GRN)*(1.-colval(ce,GRN)),
216 >                colval(r->albedo,BLU)*colval(ambval,BLU)*(1.-colval(ce,BLU)));
217          addcolor(r->rcol, ca);                  /* ambient in scattering */
218          srcscatter(r);                          /* source in scattering */
219   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines