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.1 by greg, Tue Nov 12 17:09:32 1991 UTC vs.
Revision 2.7 by greg, Thu Jan 13 09:45:10 1994 UTC

# Line 27 | Line 27 | static char SCCSid[] = "$SunId$ LBL";
27   *      3 red grn blu
28   *
29   *  The color is used for the transmission at normal incidence.
30 < *  To compute transmission (tn) from transmissivity (Tn) use:
30 > *  To compute transmissivity (tn) from transmittance (Tn) use:
31   *
32   *      tn = (sqrt(.8402528435+.0072522239*Tn*Tn)-.9166530661)/.0036261119/Tn
33   *
34 < *  The transmission of standard 88% transmissivity glass is 0.96.
34 > *  The transmissivity of standard 88% transmittance glass is 0.96.
35   *  A refractive index other than the default can be used by giving
36   *  it as the fourth real argument.  The above formula no longer applies.
37   *
# Line 46 | Line 46 | m_glass(m, r)          /* color a ray which hit a thin glass s
46   OBJREC  *m;
47   register RAY  *r;
48   {
49        double  sqrt(), pow();
49          COLOR  mcolor;
50          double  pdot;
51          FVECT  pnorm;
# Line 69 | Line 68 | register RAY  *r;
68          if (r->rod < 0.0)                       /* reorient if necessary */
69                  flipsurface(r);
70          transtest = 0;
71 +        transdist = r->rot;
72                                                  /* get modifiers */
73          raytexture(r, m->omod);
74          pdot = raynormal(pnorm, r);
# Line 95 | Line 95 | register RAY  *r;
95                  if (!(r->crtype & SHADOW) &&
96                                  DOT(r->pert,r->pert) > FTINY*FTINY) {
97                          for (i = 0; i < 3; i++)         /* perturb direction */
98 <                                p.rdir[i] = r->rdir[i] - r->pert[i]/rindex;
99 <                        normalize(p.rdir);
98 >                                p.rdir[i] = r->rdir[i] +
99 >                                                2.*(1.-rindex)*r->pert[i];
100 >                        if (normalize(p.rdir) == 0.0) {
101 >                                objerror(m, WARNING, "bad perturbation");
102 >                                VCOPY(p.rdir, r->rdir);
103 >                        }
104                  } else {
105                          VCOPY(p.rdir, r->rdir);
106                          transtest = 2;
# Line 110 | Line 114 | register RAY  *r;
114          }
115  
116          if (r->crtype & SHADOW)                 /* skip reflected ray */
117 <                return;
117 >                return(1);
118                                                  /* compute reflectance */
119          for (i = 0; i < 3; i++) {
120                  d = colval(mcolor, i);
# Line 128 | Line 132 | register RAY  *r;
132          }
133          if (transtest > bright(r->rcol))
134                  r->rt = transdist;
135 +        return(1);
136   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines