ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/aniso.c
(Generate patch)

Comparing ray/src/rt/aniso.c (file contents):
Revision 2.35 by greg, Tue Feb 25 02:47:22 2003 UTC vs.
Revision 2.38 by greg, Wed Mar 12 04:59:05 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   *  Shading functions for anisotropic materials.
# Line 192 | Line 192 | register RAY  *r;
192  
193          if (m->oargs.nfargs != (m->otype == MAT_TRANS2 ? 8 : 6))
194                  objerror(m, USER, "bad number of real arguments");
195 +                                                /* check for back side */
196 +        if (r->rod < 0.0) {
197 +                if (!backvis && m->otype != MAT_TRANS2) {
198 +                        raytrans(r);
199 +                        return(1);
200 +                }
201 +                raytexture(r, m->omod);
202 +                flipsurface(r);                 /* reorient if backvis */
203 +        } else
204 +                raytexture(r, m->omod);
205 +                                                /* get material color */
206          nd.mp = m;
207          nd.rp = r;
197                                                /* get material color */
208          setcolor(nd.mcolor, m->oargs.farg[0],
209                             m->oargs.farg[1],
210                             m->oargs.farg[2]);
# Line 204 | Line 214 | register RAY  *r;
214          nd.v_alpha = m->oargs.farg[5];
215          if (nd.u_alpha < FTINY || nd.v_alpha <= FTINY)
216                  objerror(m, USER, "roughness too small");
217 <                                                /* check for back side */
208 <        if (r->rod < 0.0) {
209 <                if (!backvis && m->otype != MAT_TRANS2) {
210 <                        raytrans(r);
211 <                        return(1);
212 <                }
213 <                flipsurface(r);                 /* reorient if backvis */
214 <        }
215 <                                                /* get modifiers */
216 <        raytexture(r, m->omod);
217 >
218          nd.pdot = raynormal(nd.pnorm, r);       /* perturb normal */
219          if (nd.pdot < .001)
220                  nd.pdot = .001;                 /* non-zero for diraniso() */
# Line 264 | Line 265 | register RAY  *r;
265                                                  /* diffuse reflection */
266          nd.rdiff = 1.0 - nd.trans - nd.rspec;
267  
268 <        if (r->ro != NULL && isflat(r->ro->otype))
268 >        if (r->ro != NULL && isflat(r->ro->otype) &&
269 >                        DOT(r->pert,r->pert) <= FTINY*FTINY)
270                  nd.specfl |= SP_FLAT;
271  
272          getacoords(r, &nd);                     /* set up coordinates */
# Line 317 | Line 319 | register ANISODAT  *np;
319          errno = 0;
320          for (i = 0; i < 3; i++)
321                  np->u[i] = evalue(mf->ep[i]);
322 <        if (errno) {
322 >        if (errno == EDOM || errno == ERANGE) {
323                  objerror(np->mp, WARNING, "compute error");
324                  np->specfl |= SP_BADU;
325                  return;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines