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.34 by greg, Wed Apr 24 15:47:27 1996 UTC vs.
Revision 2.37 by gwlarson, Wed Dec 16 18:14:58 1998 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1996 Regents of the University of California */
1 > /* Copyright (c) 1998 Silicon Graphics, Inc. */
2  
3   #ifndef lint
4 < static char SCCSid[] = "$SunId$ LBL";
4 > static char SCCSid[] = "$SunId$ SGI";
5   #endif
6  
7   /*
# Line 232 | Line 232 | register RAY  *r;
232          } else
233                  nd.tdiff = nd.tspec = nd.trans = 0.0;
234                                                  /* transmitted ray */
235 <        if (nd.specfl&SP_TRAN && (nd.specfl&SP_PURE || r->crtype&SHADOW)) {
235 >        if ((nd.specfl&(SP_TRAN|SP_PURE|SP_TBLT)) == (SP_TRAN|SP_PURE)) {
236                  RAY  lr;
237                  if (rayorigin(&lr, r, TRANS, nd.tspec) == 0) {
238                          VCOPY(lr.rdir, nd.prdir);
# Line 269 | Line 269 | register RAY  *r;
269                  if (hastexture && DOT(nd.vrefl, r->ron) <= FTINY)
270                          for (i = 0; i < 3; i++)         /* safety measure */
271                                  nd.vrefl[i] = r->rdir[i] + 2.*r->rod*r->ron[i];
272 <
273 <                if (!(r->crtype & SHADOW) && nd.specfl & SP_PURE) {
274 <                        RAY  lr;
275 <                        if (rayorigin(&lr, r, REFLECTED, nd.rspec) == 0) {
276 <                                VCOPY(lr.rdir, nd.vrefl);
277 <                                rayvalue(&lr);
278 <                                multcolor(lr.rcol, nd.scolor);
279 <                                addcolor(r->rcol, lr.rcol);
280 <                                if (!hastexture && nd.specfl & SP_FLAT) {
281 <                                        mirtest = 2.*bright(lr.rcol);
282 <                                        mirdist = r->rot + lr.rt;
283 <                                }
272 >        }
273 >                                                /* reflected ray */
274 >        if ((nd.specfl&(SP_REFL|SP_PURE|SP_RBLT)) == (SP_REFL|SP_PURE)) {
275 >                RAY  lr;
276 >                if (rayorigin(&lr, r, REFLECTED, nd.rspec) == 0) {
277 >                        VCOPY(lr.rdir, nd.vrefl);
278 >                        rayvalue(&lr);
279 >                        multcolor(lr.rcol, nd.scolor);
280 >                        addcolor(r->rcol, lr.rcol);
281 >                        if (!hastexture && nd.specfl & SP_FLAT) {
282 >                                mirtest = 2.*bright(lr.rcol);
283 >                                mirdist = r->rot + lr.rt;
284                          }
285                  }
286          }
# Line 290 | Line 290 | register RAY  *r;
290          if (nd.specfl & SP_PURE && nd.rdiff <= FTINY && nd.tdiff <= FTINY)
291                  return(1);                      /* 100% pure specular */
292  
293 <        if (nd.specfl & (SP_REFL|SP_TRAN) && !(nd.specfl & SP_PURE))
294 <                gaussamp(r, &nd);
293 >        if (!(nd.specfl & SP_PURE))
294 >                gaussamp(r, &nd);               /* checks *BLT flags */
295  
296          if (nd.rdiff > FTINY) {         /* ambient from this side */
297                  ambient(ctmp, r, hastexture?nd.pnorm:r->ron);
# Line 368 | Line 368 | register NORMDAT  *np;
368                                  d = urand(ilhash(dimlist,ndims)+samplendx);
369                          multisamp(rv, 2, d);
370                          d = 2.0*PI * rv[0];
371 <                        cosp = cos(d);
372 <                        sinp = sin(d);
371 >                        cosp = tcos(d);
372 >                        sinp = tsin(d);
373                          rv[1] = 1.0 - specjitter*rv[1];
374                          if (rv[1] <= FTINY)
375                                  d = 1.0;
# Line 400 | Line 400 | register NORMDAT  *np;
400                                  d = urand(ilhash(dimlist,ndims)+1823+samplendx);
401                          multisamp(rv, 2, d);
402                          d = 2.0*PI * rv[0];
403 <                        cosp = cos(d);
404 <                        sinp = sin(d);
403 >                        cosp = tcos(d);
404 >                        sinp = tsin(d);
405                          rv[1] = 1.0 - specjitter*rv[1];
406                          if (rv[1] <= FTINY)
407                                  d = 1.0;
408                          else
409 <                                d = sqrt( -log(rv[1]) * np->alpha2 );
409 >                                d = sqrt( np->alpha2 * -log(rv[1]) );
410                          for (i = 0; i < 3; i++)
411                                  sr.rdir[i] = np->prdir[i] + d*(cosp*u[i] + sinp*v[i]);
412                          if (DOT(sr.rdir, r->ron) < -FTINY) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines