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.24 by greg, Thu Mar 21 15:33:05 1996 UTC vs.
Revision 2.28 by greg, Fri Mar 7 16:58:54 1997 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1995 Regents of the University of California */
1 > /* Copyright (c) 1996 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# 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 96 | Line 96 | register RAY  *r;
96   {
97          r->rno = raynum++;
98          r->newcset = r->clipset;
99 +        r->robj = OVOID;
100          r->ro = NULL;
101          r->rot = FHUGE;
102          r->pert[0] = r->pert[1] = r->pert[2] = 0.0;
# Line 189 | Line 190 | rayparticipate(r)                      /* compute ray medium participatio
190   register RAY  *r;
191   {
192          COLOR   ce, ca;
192        double  dist;
193          double  re, ge, be;
194  
195          if (intens(r->cext) <= 1./FHUGE)
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. - salbedo;           /* no scattering for sources */
201 <        if (dist <= FTINY)
202 <                return;                         /* no effective ray travel */
203 <        re = dist*colval(r->cext,RED);
204 <        ge = dist*colval(r->cext,GRN);
205 <        be = dist*colval(r->cext,BLU);
206 <        setcolor(ce,    re>92. ? 0. : exp(-re),
207 <                        ge>92. ? 0. : exp(-ge),
208 <                        be>92. ? 0. : exp(-be));
197 >        re = r->rot*colval(r->cext,RED);
198 >        ge = r->rot*colval(r->cext,GRN);
199 >        be = r->rot*colval(r->cext,BLU);
200 >        if (r->crtype & SHADOW) {               /* no scattering for sources */
201 >                re *= 1. - colval(r->albedo,RED);
202 >                ge *= 1. - colval(r->albedo,GRN);
203 >                be *= 1. - colval(r->albedo,BLU);
204 >        }
205 >        setcolor(ce,    re<=0. ? 1. : re>92. ? 0. : exp(-re),
206 >                        ge<=0. ? 1. : ge>92. ? 0. : exp(-ge),
207 >                        be<=0. ? 1. : be>92. ? 0. : exp(-be));
208          multcolor(r->rcol, ce);                 /* path absorption */
209 <        if (r->albedo <= FTINY || r->crtype & SHADOW)
209 >        if (r->crtype & SHADOW || intens(r->albedo) <= FTINY)
210                  return;                         /* no scattering */
211 <        setcolor(ca,    salbedo*colval(ambval,RED)*(1.-colval(ce,RED)),
212 <                        salbedo*colval(ambval,GRN)*(1.-colval(ce,GRN)),
213 <                        salbedo*colval(ambval,BLU)*(1.-colval(ce,BLU)));
211 >        setcolor(ca,
212 >                colval(r->albedo,RED)*colval(ambval,RED)*(1.-colval(ce,RED)),
213 >                colval(r->albedo,GRN)*colval(ambval,GRN)*(1.-colval(ce,GRN)),
214 >                colval(r->albedo,BLU)*colval(ambval,BLU)*(1.-colval(ce,BLU)));
215          addcolor(r->rcol, ca);                  /* ambient in scattering */
216          srcscatter(r);                          /* source in scattering */
217   }
# Line 555 | Line 555 | OBJECT  *cxs;
555          checkset(oset, cxs);                    /* eliminate double-checking */
556          for (i = oset[0]; i > 0; i--) {
557                  o = objptr(oset[i]);
558 <                (*ofun[o->otype].funp)(o, r);
558 >                if ((*ofun[o->otype].funp)(o, r))
559 >                        r->robj = oset[i];
560          }
561          if (r->ro == NULL)
562                  return(0);                      /* no scores yet */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines