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.6 by greg, Mon Aug 5 13:52:20 1991 UTC vs.
Revision 2.5 by greg, Mon Mar 8 12:37:15 1993 UTC

# Line 16 | Line 16 | static char SCCSid[] = "$SunId$ LBL";
16  
17   #ifdef  DISPERSE
18   #include  "source.h"
19 + static  disperse();
20   #endif
21  
22   /*
# Line 53 | Line 54 | m_dielectric(m, r)     /* color a ray which hit something
54   OBJREC  *m;
55   register RAY  *r;
56   {
56        double  sqrt(), pow();
57          double  cos1, cos2, nratio;
58          COLOR  mcolor;
59          double  mabsorp;
# Line 66 | Line 66 | register RAY  *r;
66          if (m->oargs.nfargs != (m->otype==MAT_DIELECTRIC ? 5 : 8))
67                  objerror(m, USER, "bad arguments");
68  
69        r->rt = r->rot;                         /* just use ray length */
70
69          raytexture(r, m->omod);                 /* get modifiers */
70  
71          cos1 = raynormal(dnorm, r);             /* cosine of theta1 */
# Line 129 | Line 127 | register RAY  *r;
127                          if (m->otype != MAT_DIELECTRIC
128                                          || r->rod > 0.0
129                                          || r->crtype & SHADOW
130 <                                        || directinvis
130 >                                        || !directvis
131                                          || m->oargs.farg[4] == 0.0
132                                          || !disperse(m, r, p.rdir, trans))
133   #endif
# Line 138 | Line 136 | register RAY  *r;
136                                  multcolor(mcolor, r->pcol);     /* modify */
137                                  scalecolor(p.rcol, trans);
138                                  addcolor(r->rcol, p.rcol);
139 +                                if (nratio >= 1.0-FTINY && nratio <= 1.0+FTINY)
140 +                                        r->rt = r->rot + p.rt;
141                          }
142                  }
143          }
# Line 168 | Line 168 | RAY  *r;
168   FVECT  vt;
169   double  tr;
170   {
171        double  sqrt();
171          RAY  sray, *entray;
172          FVECT  v1, v2, n1, n2;
173          FVECT  dv, v2Xdv;
174          double  v2Xdvv2Xdv;
175 <        int  sn, success = 0;
176 <        double  omega;
175 >        int  success = 0;
176 >        SRCINDEX  si;
177          FVECT  vtmp1, vtmp2;
178          double  dtmp1, dtmp2;
179          int  l1, l2;
# Line 236 | Line 235 | double  tr;
235          v2Xdvv2Xdv = DOT(v2Xdv, v2Xdv);
236  
237                                          /* check sources */
238 <        for (sn = 0; sn < nsources; sn++) {
238 >        initsrcindex(&si);
239 >        while (srcray(&sray, r, &si)) {
240  
241 <                if ((omega = srcray(&sray, r, sn)) == 0.0 ||
242 <                                DOT(sray.rdir, v2) < MINCOS)
241 >                if (DOT(sray.rdir, v2) < MINCOS)
242                          continue;                       /* bad source */
244                
243                                                  /* adjust source ray */
244  
245                  dtmp1 = DOT(v2Xdv, sray.rdir) / v2Xdvv2Xdv;
# Line 266 | Line 264 | double  tr;
264                   */
265                  
266                  fcross(vtmp1, v2Xdv, sray.rdir);
267 <                dtmp1 = sqrt(omega  / v2Xdvv2Xdv / PI);
267 >                dtmp1 = sqrt(si.dom  / v2Xdvv2Xdv / PI);
268  
269                                                          /* compute first ray */
270                  for (i = 0; i < 3; i++)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines