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.40 by greg, Mon Mar 3 00:10:51 2003 UTC vs.
Revision 2.46 by greg, Thu Aug 28 03:22:16 2003 UTC

# Line 1 | Line 1
1   #ifndef lint
2 < static const char       RCSid[] = "$Id$";
2 > static const char RCSid[] = "$Id$";
3   #endif
4   /*
5   *  normal.c - shading function for normal materials.
# Line 15 | Line 15 | static const char      RCSid[] = "$Id$";
15  
16   #include  "ray.h"
17  
18 + #include  "ambient.h"
19 +
20   #include  "otypes.h"
21  
22   #include  "random.h"
# Line 23 | Line 25 | static const char      RCSid[] = "$Id$";
25   #define  MAXITER        10              /* maximum # specular ray attempts */
26   #endif
27                                          /* estimate of Fresnel function */
28 < #define  FRESNE(ci)     (exp(-6.0*(ci)) - 0.00247875217)
28 > #define  FRESNE(ci)     (exp(-5.85*(ci)) - 0.00287989916)
29  
30   static void  gaussamp();
31  
# Line 87 | Line 89 | double  omega;                 /* light source size */
89  
90                                  /* Fresnel estimate */
91          ldiff = np->rdiff;
92 <        if (np->specfl & SP_PURE && (np->rspec > FTINY & ldiff > FTINY))
92 >        if (np->specfl & SP_PURE && (np->rspec > FTINY) & (ldiff > FTINY))
93                  ldiff *= 1. - FRESNE(fabs(ldot));
94  
95          if (ldot > FTINY && ldiff > FTINY) {
# Line 197 | Line 199 | register RAY  *r;
199          nd.alpha2 = m->oargs.farg[4];
200          if ((nd.alpha2 *= nd.alpha2) <= FTINY)
201                  nd.specfl |= SP_PURE;
200        if (r->ro != NULL && isflat(r->ro->otype))
201                nd.specfl |= SP_FLAT;
202  
203 <        if (hastexture = DOT(r->pert,r->pert) > FTINY*FTINY)
203 >        if ( (hastexture = (DOT(r->pert,r->pert) > FTINY*FTINY)) ) {
204                  nd.pdot = raynormal(nd.pnorm, r);       /* perturb normal */
205 <        else {
205 >        } else {
206                  VCOPY(nd.pnorm, r->ron);
207                  nd.pdot = r->rod;
208          }
209 +        if (r->ro != NULL && isflat(r->ro->otype))
210 +                nd.specfl |= SP_FLAT;
211          if (nd.pdot < .001)
212                  nd.pdot = .001;                 /* non-zero for dirnorm() */
213          multcolor(nd.mcolor, r->pcol);          /* modify material color */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines