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.6 by greg, Tue May 7 17:45:51 1991 UTC vs.
Revision 1.7 by greg, Wed May 8 08:27:46 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 61 | Line 62 | register RAY  *r;
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 82 | Line 84 | register RAY  *r;
84          }
85                                                  /* transmitted ray */
86          if (rayorigin(&p, r, TRANS, bright(trans)) == 0) {
87 <                for (i = 0; i < 3; i++)         /* perturb direction */
88 <                        p.rdir[i] = r->rdir[i] - r->pert[i]/RINDEX;
89 <                normalize(p.rdir);
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 >                        transtest = 2;
93                  rayvalue(&p);
94                  multcolor(p.rcol, r->pcol);     /* modify */
95                  multcolor(p.rcol, trans);
96                  addcolor(r->rcol, p.rcol);
97 <                if (bright(p.rcol) > .5)
98 <                        r->rt = r->rot + p.rt;
97 >                transtest *= bright(p.rcol);
98 >                transdist = r->rot + p.rt;
99          }
100  
101          if (r->crtype & SHADOW)                 /* skip reflected ray */
# Line 109 | Line 114 | register RAY  *r;
114                  multcolor(p.rcol, refl);
115                  addcolor(r->rcol, p.rcol);
116          }
117 +        if (transtest > bright(r->rcol))
118 +                r->rt = transdist;
119   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines