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.6 by greg, Thu Nov 18 09:43:00 1993 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines