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 2.18 by greg, Sun Sep 26 15:51:15 2010 UTC vs.
Revision 2.21 by greg, Sat Jan 25 18:27:39 2014 UTC

# Line 50 | Line 50 | m_glass(               /* color a ray which hit a thin glass surfac
50          COLOR  mcolor;
51          double  pdot;
52          FVECT  pnorm;
53 <        double  rindex, cos2;
53 >        double  rindex=0, cos2;
54          COLOR  trans, refl;
55          int  hastexture, hastrans;
56          double  d, r1e, r1m;
# Line 65 | Line 65 | m_glass(               /* color a ray which hit a thin glass surfac
65                  rindex = m->oargs.farg[3];      /* use their value */
66          else
67                  objerror(m, USER, "bad arguments");
68 +                                                /* check back face visibility */
69 +        if (!backvis && r->rod <= 0.0) {
70 +                raytrans(r);
71 +                return(1);
72 +        }
73                                                  /* check transmission */
74          setcolor(mcolor, m->oargs.farg[0], m->oargs.farg[1], m->oargs.farg[2]);
75          if ((hastrans = (intens(mcolor) > 1e-15))) {
# Line 112 | Line 117 | m_glass(               /* color a ray which hit a thin glass surfac
117                                                  /* transmitted ray */
118                  if (rayorigin(&p, TRANS, r, trans) == 0) {
119                          if (!(r->crtype & SHADOW) && hastexture) {
120 <                                for (i = 0; i < 3; i++) /* perturb direction */
116 <                                        p.rdir[i] = r->rdir[i] +
117 <                                                2.*(1.-rindex)*r->pert[i];
120 >                                VSUM(p.rdir, r->rdir, r->pert, 2.*(1.-rindex));
121                                  if (normalize(p.rdir) == 0.0) {
122                                          objerror(m, WARNING, "bad perturbation");
123                                          VCOPY(p.rdir, r->rdir);
# Line 143 | Line 146 | m_glass(               /* color a ray which hit a thin glass surfac
146          }
147                                                  /* reflected ray */
148          if (rayorigin(&p, REFLECTED, r, refl) == 0) {
149 <                for (i = 0; i < 3; i++)
147 <                        p.rdir[i] = r->rdir[i] + 2.0*pdot*pnorm[i];
149 >                VSUM(p.rdir, r->rdir, pnorm, 2.*pdot);
150                  checknorm(p.rdir);
151                  rayvalue(&p);
152                  multcolor(p.rcol, p.rcoef);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines