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.4 by greg, Wed May 30 19:56:58 1990 UTC vs.
Revision 2.8 by greg, Tue Dec 5 11:46:00 1995 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;
61 <        double  refl, trans, transbright;
61 >        double  refl, trans;
62          FVECT  dnorm;
63          double  d1, d2;
64          RAY  p;
# Line 83 | Line 84 | register RAY  *r;
84                  setcolor(mcolor, pow(m->oargs.farg[0], r->rot),
85                                   pow(m->oargs.farg[1], r->rot),
86                                   pow(m->oargs.farg[2], r->rot));
87 +                multcolor(mcolor, r->pcol);     /* modify */
88          } else {                                /* outside */
89                  nratio = 1.0 / nratio;
90                  if (m->otype == MAT_INTERFACE)
# Line 115 | Line 117 | register RAY  *r;
117  
118                  refl /= 2.0;
119                  trans = 1.0 - refl;
118                transbright = -FTINY;
120  
121                  if (rayorigin(&p, r, REFRACTED, mabsorp*trans) == 0) {
122  
# Line 128 | Line 129 | register RAY  *r;
129                          if (m->otype != MAT_DIELECTRIC
130                                          || r->rod > 0.0
131                                          || r->crtype & SHADOW
132 +                                        || !directvis
133                                          || m->oargs.farg[4] == 0.0
134                                          || !disperse(m, r, p.rdir, trans))
135   #endif
136                          {
137                                  rayvalue(&p);
136                                multcolor(mcolor, r->pcol);     /* modify */
138                                  scalecolor(p.rcol, trans);
139                                  addcolor(r->rcol, p.rcol);
140 <                                transbright = bright(p.rcol);
141 <                                r->rt = r->rot + p.rt;
140 >                                if (nratio >= 1.0-FTINY && nratio <= 1.0+FTINY)
141 >                                        r->rt = r->rot + p.rt;
142                          }
143                  }
144          }
# Line 153 | Line 154 | register RAY  *r;
154  
155                  scalecolor(p.rcol, refl);       /* color contribution */
156                  addcolor(r->rcol, p.rcol);
156                if (bright(p.rcol) > transbright)
157                        r->rt = r->rot + p.rt;
157          }
158  
159          multcolor(r->rcol, mcolor);             /* multiply by transmittance */
160 +
161 +        return(1);
162   }
163  
164  
# Line 170 | Line 171 | RAY  *r;
171   FVECT  vt;
172   double  tr;
173   {
173        double  sqrt();
174          RAY  sray, *entray;
175          FVECT  v1, v2, n1, n2;
176          FVECT  dv, v2Xdv;
177          double  v2Xdvv2Xdv;
178 <        int  sn, success = 0;
179 <        double  omega;
178 >        int  success = 0;
179 >        SRCINDEX  si;
180          FVECT  vtmp1, vtmp2;
181          double  dtmp1, dtmp2;
182          int  l1, l2;
# Line 238 | Line 238 | double  tr;
238          v2Xdvv2Xdv = DOT(v2Xdv, v2Xdv);
239  
240                                          /* check sources */
241 <        for (sn = 0; sn < nsources; sn++) {
241 >        initsrcindex(&si);
242 >        while (srcray(&sray, r, &si)) {
243  
244 <                if ((omega = srcray(&sray, r, sn)) == 0.0 ||
244 <                                DOT(sray.rdir, v2) < MINCOS)
244 >                if (DOT(sray.rdir, v2) < MINCOS)
245                          continue;                       /* bad source */
246                
246                                                  /* adjust source ray */
247  
248                  dtmp1 = DOT(v2Xdv, sray.rdir) / v2Xdvv2Xdv;
# Line 268 | Line 267 | double  tr;
267                   */
268                  
269                  fcross(vtmp1, v2Xdv, sray.rdir);
270 <                dtmp1 = sqrt(omega  / v2Xdvv2Xdv / PI);
270 >                dtmp1 = sqrt(si.dom  / v2Xdvv2Xdv / PI);
271  
272                                                          /* compute first ray */
273                  for (i = 0; i < 3; i++)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines