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

Comparing ray/src/rt/m_brdf.c (file contents):
Revision 1.12 by greg, Fri Jun 28 10:04:02 1991 UTC vs.
Revision 1.13 by greg, Wed Jul 10 09:35:26 1991 UTC

# Line 191 | Line 191 | register RAY  *r;
191          BRDFDAT  nd;
192          double  transtest, transdist;
193          COLOR  ctmp;
194 <        double  dtmp;
194 >        double  dtmp, tspect, rspecr;
195          register int  i;
196                                                  /* check arguments */
197          switch (m->otype) {
# Line 260 | Line 260 | register RAY  *r;
260                                                  /* set special variables */
261          setbrdfunc(&nd);
262                                                  /* compute transmitted ray */
263 +        tspect = 0.;
264          if (m->otype == MAT_BRTDF && nd.tspec > FTINY) {
265                  RAY  sr;
266                  errno = 0;
# Line 269 | Line 270 | register RAY  *r;
270                  scalecolor(ctmp, nd.tspec);
271                  if (errno)
272                          objerror(m, WARNING, "compute error");
273 <                else if ((dtmp = bright(ctmp)) > FTINY &&
274 <                                rayorigin(&sr, r, TRANS, dtmp) == 0) {
273 >                else if ((tspect = bright(ctmp)) > FTINY &&
274 >                                rayorigin(&sr, r, TRANS, tspect) == 0) {
275                          if (DOT(r->pert,r->pert) > FTINY*FTINY) {
276                                  for (i = 0; i < 3; i++) /* perturb direction */
277                                          sr.rdir[i] = r->rdir[i] -
# Line 290 | Line 291 | register RAY  *r;
291          if (r->crtype & SHADOW)                 /* the rest is shadow */
292                  return;
293                                                  /* compute reflected ray */
294 +        rspecr = 0.;
295          if (m->otype == MAT_BRTDF && nd.rspec > FTINY) {
296                  RAY  sr;
297                  errno = 0;
# Line 299 | Line 301 | register RAY  *r;
301                  scalecolor(ctmp, nd.rspec);
302                  if (errno)
303                          objerror(m, WARNING, "compute error");
304 <                else if ((dtmp = bright(ctmp)) > FTINY &&
305 <                                rayorigin(&sr, r, REFLECTED, dtmp) == 0) {
304 >                else if ((rspecr = bright(ctmp)) > FTINY &&
305 >                                rayorigin(&sr, r, REFLECTED, rspecr) == 0) {
306                          for (i = 0; i < 3; i++)
307                                  sr.rdir[i] = r->rdir[i] +
308                                                  2.0*nd.pdot*nd.pnorm[i];
# Line 310 | Line 312 | register RAY  *r;
312                  }
313          }
314                                                  /* compute ambient */
315 <        if (nd.rdiff > FTINY) {
315 >        if ((dtmp = 1.0-nd.trans-rspecr) > FTINY) {
316                  ambient(ctmp, r);
317 <                if (m->otype == MAT_BRTDF)
316 <                        scalecolor(ctmp, nd.rdiff);
317 <                else
318 <                        scalecolor(ctmp, 1.0-nd.trans);
317 >                scalecolor(ctmp, dtmp);
318                  multcolor(ctmp, nd.mcolor);     /* modified by material color */
319                  addcolor(r->rcol, ctmp);        /* add to returned color */
320          }
321 <        if (nd.tdiff > FTINY) {                 /* from other side */
321 >        if ((dtmp = nd.trans-tspect) > FTINY) { /* from other side */
322                  flipsurface(r);
323                  ambient(ctmp, r);
324 <                if (m->otype == MAT_BRTDF)
326 <                        scalecolor(ctmp, nd.tdiff);
327 <                else
328 <                        scalecolor(ctmp, nd.trans);
324 >                scalecolor(ctmp, dtmp);
325                  multcolor(ctmp, nd.mcolor);
326                  addcolor(r->rcol, ctmp);
327                  flipsurface(r);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines