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

Comparing ray/src/rt/normal.c (file contents):
Revision 2.49 by greg, Wed Jan 5 19:34:11 2005 UTC vs.
Revision 2.50 by greg, Tue Apr 19 01:15:06 2005 UTC

# Line 258 | Line 258 | m_normal(                      /* color a ray that hit something normal *
258                                                  /* transmitted ray */
259          if ((nd.specfl&(SP_TRAN|SP_PURE|SP_TBLT)) == (SP_TRAN|SP_PURE)) {
260                  RAY  lr;
261 <                if (rayorigin(&lr, r, TRANS, nd.tspec) == 0) {
261 >                copycolor(lr.rcoef, nd.mcolor); /* modified by color */
262 >                scalecolor(lr.rcoef, nd.tspec);
263 >                if (rayorigin(&lr, TRANS, r, lr.rcoef) == 0) {
264                          VCOPY(lr.rdir, nd.prdir);
265                          rayvalue(&lr);
266 <                        scalecolor(lr.rcol, nd.tspec);
265 <                        multcolor(lr.rcol, nd.mcolor);  /* modified by color */
266 >                        multcolor(lr.rcol, lr.rcoef);
267                          addcolor(r->rcol, lr.rcol);
268                          transtest *= bright(lr.rcol);
269                          transdist = r->rot + lr.rt;
# Line 302 | Line 303 | m_normal(                      /* color a ray that hit something normal *
303                                                  /* reflected ray */
304          if ((nd.specfl&(SP_REFL|SP_PURE|SP_RBLT)) == (SP_REFL|SP_PURE)) {
305                  RAY  lr;
306 <                if (rayorigin(&lr, r, REFLECTED, nd.rspec) == 0) {
306 >                if (rayorigin(&lr, REFLECTED, r, nd.scolor) == 0) {
307                          VCOPY(lr.rdir, nd.vrefl);
308                          rayvalue(&lr);
309 <                        multcolor(lr.rcol, nd.scolor);
309 >                        multcolor(lr.rcol, lr.rcoef);
310                          addcolor(r->rcol, lr.rcol);
311                          if (!hastexture && nd.specfl & SP_FLAT) {
312                                  mirtest = 2.*bright(lr.rcol);
# Line 323 | Line 324 | m_normal(                      /* color a ray that hit something normal *
324                  gaussamp(r, &nd);               /* checks *BLT flags */
325  
326          if (nd.rdiff > FTINY) {         /* ambient from this side */
327 <                ambient(ctmp, r, hastexture?nd.pnorm:r->ron);
327 >                copycolor(ctmp, nd.mcolor);     /* modified by material color */
328                  if (nd.specfl & SP_RBLT)
329                          scalecolor(ctmp, 1.0-nd.trans);
330                  else
331                          scalecolor(ctmp, nd.rdiff);
332 <                multcolor(ctmp, nd.mcolor);     /* modified by material color */
332 >                multambient(ctmp, r, hastexture ? nd.pnorm : r->ron);
333                  addcolor(r->rcol, ctmp);        /* add to returned color */
334          }
335          if (nd.tdiff > FTINY) {         /* ambient from other side */
336 +                copycolor(ctmp, nd.mcolor);     /* modified by color */
337 +                if (nd.specfl & SP_TBLT)
338 +                        scalecolor(ctmp, nd.trans);
339 +                else
340 +                        scalecolor(ctmp, nd.tdiff);
341                  flipsurface(r);
342                  if (hastexture) {
343                          FVECT  bnorm;
344                          bnorm[0] = -nd.pnorm[0];
345                          bnorm[1] = -nd.pnorm[1];
346                          bnorm[2] = -nd.pnorm[2];
347 <                        ambient(ctmp, r, bnorm);
347 >                        multambient(ctmp, r, bnorm);
348                  } else
349 <                        ambient(ctmp, r, r->ron);
344 <                if (nd.specfl & SP_TBLT)
345 <                        scalecolor(ctmp, nd.trans);
346 <                else
347 <                        scalecolor(ctmp, nd.tdiff);
348 <                multcolor(ctmp, nd.mcolor);     /* modified by color */
349 >                        multambient(ctmp, r, r->ron);
350                  addcolor(r->rcol, ctmp);
351                  flipsurface(r);
352          }
# Line 389 | Line 390 | gaussamp(                      /* sample gaussian specular */
390          fcross(v, np->pnorm, u);
391                                          /* compute reflection */
392          if ((np->specfl & (SP_REFL|SP_RBLT)) == SP_REFL &&
393 <                        rayorigin(&sr, r, SPECULAR, np->rspec) == 0) {
393 >                        rayorigin(&sr, SPECULAR, r, np->scolor) == 0) {
394                  dimlist[ndims++] = (int)np->mp;
395                  for (niter = 0; niter < MAXITER; niter++) {
396                          if (niter)
# Line 412 | Line 413 | gaussamp(                      /* sample gaussian specular */
413                                  sr.rdir[i] = r->rdir[i] + d*h[i];
414                          if (DOT(sr.rdir, r->ron) > FTINY) {
415                                  rayvalue(&sr);
416 <                                multcolor(sr.rcol, np->scolor);
416 >                                multcolor(sr.rcol, sr.rcoef);
417                                  addcolor(r->rcol, sr.rcol);
418                                  break;
419                          }
# Line 420 | Line 421 | gaussamp(                      /* sample gaussian specular */
421                  ndims--;
422          }
423                                          /* compute transmission */
424 +        copycolor(sr.rcoef, np->mcolor);        /* modified by color */
425 +        scalecolor(sr.rcoef, np->tspec);
426          if ((np->specfl & (SP_TRAN|SP_TBLT)) == SP_TRAN &&
427 <                        rayorigin(&sr, r, SPECULAR, np->tspec) == 0) {
427 >                        rayorigin(&sr, SPECULAR, r, sr.rcoef) == 0) {
428                  dimlist[ndims++] = (int)np->mp;
429                  for (niter = 0; niter < MAXITER; niter++) {
430                          if (niter)
# Line 442 | Line 445 | gaussamp(                      /* sample gaussian specular */
445                          if (DOT(sr.rdir, r->ron) < -FTINY) {
446                                  normalize(sr.rdir);     /* OK, normalize */
447                                  rayvalue(&sr);
448 <                                scalecolor(sr.rcol, np->tspec);
446 <                                multcolor(sr.rcol, np->mcolor); /* modified */
448 >                                multcolor(sr.rcol, sr.rcoef);
449                                  addcolor(r->rcol, sr.rcol);
450                                  break;
451                          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines