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.27 by greg, Wed Apr 24 16:27:56 1996 UTC vs.
Revision 2.32 by gwlarson, Thu Aug 6 10:30:38 1998 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1996 Regents of the University of California */
1 > /* Copyright (c) 1998 Silicon Graphics, Inc. */
2  
3   #ifndef lint
4 < static char SCCSid[] = "$SunId$ LBL";
4 > static char SCCSid[] = "$SunId$ SGI";
5   #endif
6  
7   /*
# Line 54 | Line 54 | register RAY  *r, *ro;
54   int  rt;
55   double  rw;
56   {
57 +        double  re;
58 +
59          if ((r->parent = ro) == NULL) {         /* primary ray */
60                  r->rlvl = 0;
61                  r->rweight = rw;
# Line 82 | Line 84 | double  rw;
84                  copycolor(r->albedo, ro->albedo);
85                  r->gecc = ro->gecc;
86                  r->slights = ro->slights;
85                r->rweight = ro->rweight * rw;
87                  r->crtype = ro->crtype | (r->rtype = rt);
88                  VCOPY(r->rorg, ro->rop);
89 +                r->rweight = ro->rweight * rw;
90 +                                                /* estimate absorption */
91 +                re = colval(ro->cext,RED) < colval(ro->cext,GRN) ?
92 +                                colval(ro->cext,RED) : colval(ro->cext,GRN);
93 +                if (colval(ro->cext,BLU) < re) re = colval(ro->cext,BLU);
94 +                if (re > 0.)
95 +                        r->rweight *= exp(-re*ro->rot);
96          }
97          rayclear(r);
98          return(r->rlvl <= maxdepth && r->rweight >= minweight ? 0 : -1);
# Line 96 | Line 104 | register RAY  *r;
104   {
105          r->rno = raynum++;
106          r->newcset = r->clipset;
107 +        r->robj = OVOID;
108          r->ro = NULL;
109 <        r->rot = FHUGE;
109 >        r->rt = r->rot = FHUGE;
110          r->pert[0] = r->pert[1] = r->pert[2] = 0.0;
111          setcolor(r->pcol, 1.0, 1.0, 1.0);
112          setcolor(r->rcol, 0.0, 0.0, 0.0);
104        r->rt = 0.0;
113   }
114  
115  
# Line 269 | Line 277 | double  coef;
277                  backmat = rayshade(&br, back);
278                                          /* check for transparency */
279          if (backmat ^ foremat)
280 <                if (backmat)
280 >                if (!foremat && coef > FTINY)
281                          raytrans(&fr);
282 <                else
282 >                else if (!backmat && coef < 1.0-FTINY)
283                          raytrans(&br);
284                                          /* mix perturbations */
285          for (i = 0; i < 3; i++)
# Line 554 | Line 562 | OBJECT  *cxs;
562          checkset(oset, cxs);                    /* eliminate double-checking */
563          for (i = oset[0]; i > 0; i--) {
564                  o = objptr(oset[i]);
565 <                (*ofun[o->otype].funp)(o, r);
565 >                if ((*ofun[o->otype].funp)(o, r))
566 >                        r->robj = oset[i];
567          }
568          if (r->ro == NULL)
569                  return(0);                      /* no scores yet */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines