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 2.13 by greg, Mon Nov 6 12:03:22 1995 UTC vs.
Revision 2.14 by greg, Wed Nov 22 09:27:53 1995 UTC

# Line 200 | Line 200 | register RAY  *r;
200          double  transtest, transdist;
201          int  hasrefl, hastrans;
202          COLOR  ctmp;
203 +        FVECT  vtmp;
204          register MFUNC  *mf;
205          register int  i;
206                                                  /* check arguments */
# Line 289 | Line 290 | register RAY  *r;
290          }
291                                                  /* compute ambient */
292          if (hasrefl) {
293 <                if (nd.pdot < 0.0)
293 >                if (nd.pdot < 0.0) {
294                          flipsurface(r);
295 <                ambient(ctmp, r, nd.pnorm);
295 >                        vtmp[0] = -nd.pnorm[0];
296 >                        vtmp[1] = -nd.pnorm[1];
297 >                        vtmp[2] = -nd.pnorm[2];
298 >                } else
299 >                        VCOPY(vtmp, nd.pnorm);
300 >                ambient(ctmp, r, vtmp);
301                  multcolor(ctmp, nd.rdiff);
302                  addcolor(r->rcol, ctmp);        /* add to returned color */
303                  if (nd.pdot < 0.0)
304                          flipsurface(r);
305          }
306          if (hastrans) {                         /* from other side */
307 <                if (nd.pdot > 0.0)
307 >                if (nd.pdot > 0.0) {
308                          flipsurface(r);
309 <                ambient(ctmp, r, nd.pnorm);
309 >                        vtmp[0] = -nd.pnorm[0];
310 >                        vtmp[1] = -nd.pnorm[1];
311 >                        vtmp[2] = -nd.pnorm[2];
312 >                } else
313 >                        VCOPY(vtmp, nd.pnorm);
314 >                ambient(ctmp, r, vtmp);
315                  multcolor(ctmp, nd.tdiff);
316                  addcolor(r->rcol, ctmp);
317                  if (nd.pdot > 0.0)
# Line 323 | Line 334 | register RAY  *r;
334   {
335          BRDFDAT  nd;
336          COLOR  ctmp;
337 +        FVECT  vtmp;
338          double  dtmp;
339                                                  /* always a shadow */
340          if (r->crtype & SHADOW)
# Line 384 | Line 396 | register RAY  *r;
396          }
397          if (nd.trans > FTINY) {         /* from other side */
398                  flipsurface(r);
399 <                ambient(ctmp, r, nd.pnorm);
399 >                vtmp[0] = -nd.pnorm[0];
400 >                vtmp[1] = -nd.pnorm[1];
401 >                vtmp[2] = -nd.pnorm[2];
402 >                ambient(ctmp, r, vtmp);
403                  scalecolor(ctmp, nd.trans);
404                  multcolor(ctmp, nd.mcolor);
405                  addcolor(r->rcol, ctmp);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines