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.45 by schorsch, Sun Jul 27 22:12:03 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 23 | Line 23 | static const char      RCSid[] = "$Id$";
23   #define  MAXITER        10              /* maximum # specular ray attempts */
24   #endif
25                                          /* estimate of Fresnel function */
26 < #define  FRESNE(ci)     (exp(-6.0*(ci)) - 0.00247875217)
26 > #define  FRESNE(ci)     (exp(-5.85*(ci)) - 0.00287989916)
27  
28   static void  gaussamp();
29  
# Line 87 | Line 87 | double  omega;                 /* light source size */
87  
88                                  /* Fresnel estimate */
89          ldiff = np->rdiff;
90 <        if (np->specfl & SP_PURE && (np->rspec > FTINY & ldiff > FTINY))
90 >        if (np->specfl & SP_PURE && (np->rspec > FTINY) & (ldiff > FTINY))
91                  ldiff *= 1. - FRESNE(fabs(ldot));
92  
93          if (ldot > FTINY && ldiff > FTINY) {
# Line 182 | Line 182 | register RAY  *r;
182                          raytrans(r);
183                          return(1);
184                  }
185 +                raytexture(r, m->omod);
186                  flipsurface(r);                 /* reorient if backvis */
187 <        }
187 >        } else
188 >                raytexture(r, m->omod);
189          nd.mp = m;
190          nd.rp = r;
191                                                  /* get material color */
# Line 195 | Line 197 | register RAY  *r;
197          nd.alpha2 = m->oargs.farg[4];
198          if ((nd.alpha2 *= nd.alpha2) <= FTINY)
199                  nd.specfl |= SP_PURE;
200 <        if (r->ro != NULL && isflat(r->ro->otype))
201 <                nd.specfl |= SP_FLAT;
200 <                                                /* get modifiers */
201 <        raytexture(r, m->omod);
202 <        if (hastexture = DOT(r->pert,r->pert) > FTINY*FTINY)
200 >
201 >        if ( (hastexture = (DOT(r->pert,r->pert) > FTINY*FTINY)) ) {
202                  nd.pdot = raynormal(nd.pnorm, r);       /* perturb normal */
203 <        else {
203 >        } else {
204                  VCOPY(nd.pnorm, r->ron);
205                  nd.pdot = r->rod;
206          }
207 +        if (r->ro != NULL && isflat(r->ro->otype))
208 +                nd.specfl |= SP_FLAT;
209          if (nd.pdot < .001)
210                  nd.pdot = .001;                 /* non-zero for dirnorm() */
211          multcolor(nd.mcolor, r->pcol);          /* modify material color */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines