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.26 by greg, Thu Nov 18 09:42:55 1993 UTC vs.
Revision 2.30 by greg, Mon Nov 6 12:03:20 1995 UTC

# Line 19 | Line 19 | static char SCCSid[] = "$SunId$ LBL";
19   extern double  specthresh;              /* specular sampling threshold */
20   extern double  specjitter;              /* specular sampling jitter */
21  
22 + extern int  backvis;                    /* back faces visible? */
23 +
24   static  agaussamp(), getacoords();
25  
26   /*
# Line 185 | Line 187 | register RAY  *r;
187          register int  i;
188                                                  /* easy shadow test */
189          if (r->crtype & SHADOW)
190 <                return;
190 >                return(1);
191  
192          if (m->oargs.nfargs != (m->otype == MAT_TRANS2 ? 8 : 6))
193                  objerror(m, USER, "bad number of real arguments");
# Line 201 | Line 203 | register RAY  *r;
203          nd.v_alpha = m->oargs.farg[5];
204          if (nd.u_alpha < FTINY || nd.v_alpha <= FTINY)
205                  objerror(m, USER, "roughness too small");
206 <                                                /* reorient if necessary */
207 <        if (r->rod < 0.0)
208 <                flipsurface(r);
206 >                                                /* check for back side */
207 >        if (r->rod < 0.0) {
208 >                if (!backvis && m->otype != MAT_TRANS2) {
209 >                        raytrans(r);
210 >                        return(1);
211 >                }
212 >                flipsurface(r);                 /* reorient if backvis */
213 >        }
214                                                  /* get modifiers */
215          raytexture(r, m->omod);
216          nd.pdot = raynormal(nd.pnorm, r);       /* perturb normal */
# Line 256 | Line 263 | register RAY  *r;
263                                                  /* diffuse reflection */
264          nd.rdiff = 1.0 - nd.trans - nd.rspec;
265  
266 <        if (r->ro != NULL && (r->ro->otype == OBJ_FACE ||
260 <                        r->ro->otype == OBJ_RING))
266 >        if (r->ro != NULL && isflat(r->ro->otype))
267                  nd.specfl |= SP_FLAT;
268  
269          getacoords(r, &nd);                     /* set up coordinates */
# Line 266 | Line 272 | register RAY  *r;
272                  agaussamp(r, &nd);
273  
274          if (nd.rdiff > FTINY) {         /* ambient from this side */
275 <                ambient(ctmp, r);
275 >                ambient(ctmp, r, nd.pnorm);
276                  if (nd.specfl & SP_RBLT)
277                          scalecolor(ctmp, 1.0-nd.trans);
278                  else
# Line 276 | Line 282 | register RAY  *r;
282          }
283          if (nd.tdiff > FTINY) {         /* ambient from other side */
284                  flipsurface(r);
285 <                ambient(ctmp, r);
285 >                ambient(ctmp, r, nd.pnorm);
286                  if (nd.specfl & SP_TBLT)
287                          scalecolor(ctmp, nd.trans);
288                  else
# Line 287 | Line 293 | register RAY  *r;
293          }
294                                          /* add direct component */
295          direct(r, diraniso, &nd);
296 +
297 +        return(1);
298   }
299  
300  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines