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

Comparing ray/src/rt/dielectric.c (file contents):
Revision 1.1 by greg, Thu Feb 2 10:41:21 1989 UTC vs.
Revision 2.3 by greg, Thu Nov 19 20:30:02 1992 UTC

# Line 53 | Line 53 | m_dielectric(m, r)     /* color a ray which hit something
53   OBJREC  *m;
54   register RAY  *r;
55   {
56        double  sqrt(), pow();
56          double  cos1, cos2, nratio;
57          COLOR  mcolor;
58          double  mabsorp;
# Line 66 | Line 65 | register RAY  *r;
65          if (m->oargs.nfargs != (m->otype==MAT_DIELECTRIC ? 5 : 8))
66                  objerror(m, USER, "bad arguments");
67  
68 +        r->rt = r->rot;                         /* just use ray length */
69 +
70          raytexture(r, m->omod);                 /* get modifiers */
71  
72          cos1 = raynormal(dnorm, r);             /* cosine of theta1 */
# Line 92 | Line 93 | register RAY  *r;
93                  else
94                          setcolor(mcolor, 1.0, 1.0, 1.0);
95          }
96 <        mabsorp = intens(mcolor);
96 >        mabsorp = bright(mcolor);
97  
98          d2 = 1.0 - nratio*nratio*(1.0 - cos1*cos1);     /* compute cos theta2 */
99  
# Line 127 | Line 128 | register RAY  *r;
128                          if (m->otype != MAT_DIELECTRIC
129                                          || r->rod > 0.0
130                                          || r->crtype & SHADOW
131 +                                        || !directvis
132                                          || m->oargs.farg[4] == 0.0
133                                          || !disperse(m, r, p.rdir, trans))
134   #endif
# Line 165 | Line 167 | RAY  *r;
167   FVECT  vt;
168   double  tr;
169   {
168        double  sqrt();
170          RAY  sray, *entray;
171          FVECT  v1, v2, n1, n2;
172          FVECT  dv, v2Xdv;
173          double  v2Xdvv2Xdv;
174 <        int  sn, success = 0;
175 <        double  omega;
174 >        int  success = 0;
175 >        SRCINDEX  si;
176          FVECT  vtmp1, vtmp2;
177          double  dtmp1, dtmp2;
178          int  l1, l2;
# Line 233 | Line 234 | double  tr;
234          v2Xdvv2Xdv = DOT(v2Xdv, v2Xdv);
235  
236                                          /* check sources */
237 <        for (sn = 0; sn < nsources; sn++) {
237 >        initsrcindex(&si);
238 >        while (srcray(&sray, r, &si)) {
239  
240 <                if ((omega = srcray(&sray, r, sn)) == 0.0 ||
239 <                                DOT(sray.rdir, v2) < MINCOS)
240 >                if (DOT(sray.rdir, v2) < MINCOS)
241                          continue;                       /* bad source */
241                
242                                                  /* adjust source ray */
243  
244                  dtmp1 = DOT(v2Xdv, sray.rdir) / v2Xdvv2Xdv;
# Line 253 | Line 253 | double  tr;
253                                                  /* trace source ray */
254                  normalize(sray.rdir);
255                  rayvalue(&sray);
256 <                if (intens(sray.rcol) <= FTINY) /* missed it */
256 >                if (bright(sray.rcol) <= FTINY) /* missed it */
257                          continue;
258                  
259                  /*
# Line 263 | Line 263 | double  tr;
263                   */
264                  
265                  fcross(vtmp1, v2Xdv, sray.rdir);
266 <                dtmp1 = sqrt(omega  / v2Xdvv2Xdv / PI);
266 >                dtmp1 = sqrt(si.dom  / v2Xdvv2Xdv / PI);
267  
268                                                          /* compute first ray */
269                  for (i = 0; i < 3; i++)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines