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.39 by greg, Tue Feb 25 02:47:22 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 182 | Line 184 | register RAY  *r;
184                          raytrans(r);
185                          return(1);
186                  }
187 +                raytexture(r, m->omod);
188                  flipsurface(r);                 /* reorient if backvis */
189 <        }
189 >        } else
190 >                raytexture(r, m->omod);
191          nd.mp = m;
192          nd.rp = r;
193                                                  /* get material color */
# Line 195 | Line 199 | register RAY  *r;
199          nd.alpha2 = m->oargs.farg[4];
200          if ((nd.alpha2 *= nd.alpha2) <= FTINY)
201                  nd.specfl |= SP_PURE;
202 <        if (r->ro != NULL && isflat(r->ro->otype))
203 <                nd.specfl |= SP_FLAT;
200 <                                                /* get modifiers */
201 <        raytexture(r, m->omod);
202 <        if (hastexture = DOT(r->pert,r->pert) > FTINY*FTINY)
202 >
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