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.26 by greg, Wed Oct 28 15:45:58 2015 UTC vs.
Revision 2.27 by greg, Tue Nov 13 19:58:33 2018 UTC

# Line 55 | Line 55 | m_glass(               /* color a ray which hit a thin glass surfac
55          COLOR  trans, refl;
56          int  hastexture, hastrans;
57          double  d, r1e, r1m;
58        double  transtest, transdist;
59        double  mirtest, mirdist;
58          RAY  p;
59          int  i;
60  
# Line 88 | Line 86 | m_glass(               /* color a ray which hit a thin glass surfac
86          raytexture(r, m->omod);
87          if (r->rod < 0.0)                       /* reorient if necessary */
88                  flipsurface(r);
91        mirtest = transtest = 0;
92        mirdist = transdist = r->rot;
89                                                  /* perturb normal */
90          if ( (hastexture = (DOT(r->pert,r->pert) > FTINY*FTINY)) ) {
91                  pdot = raynormal(pnorm, r);
# Line 130 | Line 126 | m_glass(               /* color a ray which hit a thin glass surfac
126                                  }
127                          } else {
128                                  VCOPY(p.rdir, r->rdir);
133                                transtest = 2;
129                          }
130                          rayvalue(&p);
131                          multcolor(p.rcol, p.rcoef);
132                          addcolor(r->rcol, p.rcol);
133 <                        transtest *= bright(p.rcol);
134 <                        transdist = r->rot + p.rt;
133 >                        if (!hastexture || r->crtype & (SHADOW|AMBIENT))
134 >                                r->rxt = r->rot + raydistance(&p);
135                  }
136          }
137 <        if (r->crtype & SHADOW) {               /* skip reflected ray */
143 <                r->rt = transdist;
137 >        if (r->crtype & SHADOW)                 /* skip reflected ray */
138                  return(1);
145        }
139                                                  /* compute reflectance */
140          for (i = 0; i < 3; i++) {
141                  d = colval(mcolor, i);
# Line 156 | Line 149 | m_glass(               /* color a ray which hit a thin glass surfac
149                  checknorm(p.rdir);
150                  rayvalue(&p);
151                  multcolor(p.rcol, p.rcoef);
152 +                copycolor(r->mcol, p.rcol);
153                  addcolor(r->rcol, p.rcol);
154                  if (r->ro != NULL && isflat(r->ro->otype) &&
155 <                                !hastexture | (r->crtype & AMBIENT)) {
156 <                        mirtest = 2.0*bright(p.rcol);
163 <                        mirdist = r->rot + p.rt;
164 <                }
155 >                                !hastexture | (r->crtype & AMBIENT))
156 >                        r->rmt = r->rot + raydistance(&p);
157          }
166                                        /* check distance */
167        d = bright(r->rcol);
168        if (transtest > d)
169                r->rt = transdist;
170        else if (mirtest > d)
171                r->rt = mirdist;
158          return(1);
159   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines