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

Comparing ray/src/rt/glass.c (file contents):
Revision 1.1 by greg, Thu Feb 2 10:41:24 1989 UTC vs.
Revision 1.8 by greg, Fri May 10 08:51:00 1991 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1986 Regents of the University of California */
1 > /* Copyright (c) 1991 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 50 | Line 50 | register RAY  *r;
50          double  cos2;
51          COLOR  trans, refl;
52          double  d, r1;
53 +        double  transtest, transdist;
54          RAY  p;
55          register int  i;
56  
# Line 60 | Line 61 | register RAY  *r;
61  
62          if (r->rod < 0.0)                       /* reorient if necessary */
63                  flipsurface(r);
64 +        r->rt = r->rot;                         /* default ray length */
65 +        transtest = 0;
66                                                  /* get modifiers */
67          raytexture(r, m->omod);
68          pdot = raynormal(pnorm, r);
# Line 80 | Line 83 | register RAY  *r;
83                  colval(trans,i) = (1.0-r1)*(1.0-r1)*d / (1.0 - r1*r1*d*d);
84          }
85                                                  /* transmitted ray */
86 <        if (rayorigin(&p, r, TRANS, intens(trans)) == 0) {
87 <                VCOPY(p.rdir, r->rdir);
86 >        if (rayorigin(&p, r, TRANS, bright(trans)) == 0) {
87 >                if (DOT(r->pert,r->pert) > FTINY*FTINY) {
88 >                        for (i = 0; i < 3; i++)         /* perturb direction */
89 >                                p.rdir[i] = r->rdir[i] - r->pert[i]/RINDEX;
90 >                        normalize(p.rdir);
91 >                } else {
92 >                        VCOPY(p.rdir, r->rdir);
93 >                        transtest = 2;
94 >                }
95                  rayvalue(&p);
96                  multcolor(p.rcol, r->pcol);     /* modify */
97                  multcolor(p.rcol, trans);
98                  addcolor(r->rcol, p.rcol);
99 +                transtest *= bright(p.rcol);
100 +                transdist = r->rot + p.rt;
101          }
102 +
103          if (r->crtype & SHADOW)                 /* skip reflected ray */
104                  return;
105                                                  /* compute reflectance */
# Line 96 | Line 109 | register RAY  *r;
109                  colval(refl,i) = r1 * (1.0 + (1.0-2.0*r1)*d) / (1.0 - r1*r1*d);
110          }
111                                                  /* reflected ray */
112 <        if (rayorigin(&p, r, REFLECTED, intens(refl)) == 0) {
112 >        if (rayorigin(&p, r, REFLECTED, bright(refl)) == 0) {
113                  for (i = 0; i < 3; i++)
114                          p.rdir[i] = r->rdir[i] + 2.0*pdot*pnorm[i];
115                  rayvalue(&p);
116                  multcolor(p.rcol, refl);
117                  addcolor(r->rcol, p.rcol);
118          }
119 +        if (transtest > bright(r->rcol))
120 +                r->rt = transdist;
121   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines