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.3 by greg, Tue Mar 27 11:39:58 1990 UTC vs.
Revision 2.4 by greg, Thu Feb 25 10:04:22 1993 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 127 | Line 126 | register RAY  *r;
126                          if (m->otype != MAT_DIELECTRIC
127                                          || r->rod > 0.0
128                                          || r->crtype & SHADOW
129 +                                        || !directvis
130                                          || m->oargs.farg[4] == 0.0
131                                          || !disperse(m, r, p.rdir, trans))
132   #endif
# Line 135 | Line 135 | register RAY  *r;
135                                  multcolor(mcolor, r->pcol);     /* modify */
136                                  scalecolor(p.rcol, trans);
137                                  addcolor(r->rcol, p.rcol);
138 <                                r->rt = r->rot + p.rt;
138 >                                if (nratio >= 1.0-FTINY && nratio <= 1.0+FTINY)
139 >                                        r->rt = r->rot + p.rt;
140                          }
141                  }
142          }
# Line 151 | Line 152 | register RAY  *r;
152  
153                  scalecolor(p.rcol, refl);       /* color contribution */
154                  addcolor(r->rcol, p.rcol);
154                if (refl > trans)
155                        r->rt = r->rot + p.rt;
155          }
156  
157          multcolor(r->rcol, mcolor);             /* multiply by transmittance */
# Line 168 | Line 167 | RAY  *r;
167   FVECT  vt;
168   double  tr;
169   {
171        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 236 | 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 ||
242 <                                DOT(sray.rdir, v2) < MINCOS)
240 >                if (DOT(sray.rdir, v2) < MINCOS)
241                          continue;                       /* bad source */
244                
242                                                  /* adjust source ray */
243  
244                  dtmp1 = DOT(v2Xdv, sray.rdir) / v2Xdvv2Xdv;
# Line 266 | 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