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.25 by greg, Thu May 27 15:28:03 1993 UTC vs.
Revision 2.28 by greg, Wed Dec 21 09:51:49 1994 UTC

# Line 23 | Line 23 | static char SCCSid[] = "$SunId$ LBL";
23   extern double  specthresh;              /* specular sampling threshold */
24   extern double  specjitter;              /* specular sampling jitter */
25  
26 + extern int  backvis;                    /* back faces visible? */
27 +
28   static  gaussamp();
29  
30   /*
# Line 158 | Line 160 | register RAY  *r;
160          register int  i;
161                                                  /* easy shadow test */
162          if (r->crtype & SHADOW && m->otype != MAT_TRANS)
163 <                return;
163 >                return(1);
164  
165          if (m->oargs.nfargs != (m->otype == MAT_TRANS ? 7 : 5))
166                  objerror(m, USER, "bad number of arguments");
# Line 173 | Line 175 | register RAY  *r;
175          nd.alpha2 = m->oargs.farg[4];
176          if ((nd.alpha2 *= nd.alpha2) <= FTINY)
177                  nd.specfl |= SP_PURE;
178 <                                                /* reorient if necessary */
179 <        if (r->rod < 0.0)
180 <                flipsurface(r);
178 >                                                /* check for back side */
179 >        if (r->rod < 0.0) {
180 >                if (!backvis && m->otype != MAT_TRANS) {
181 >                        raytrans(r);
182 >                        return(1);
183 >                }
184 >                flipsurface(r);                 /* reorient if backvis */
185 >        }
186                                                  /* get modifiers */
187          raytexture(r, m->omod);
188          nd.pdot = raynormal(nd.pnorm, r);       /* perturb normal */
# Line 183 | Line 190 | register RAY  *r;
190                  nd.pdot = .001;                 /* non-zero for dirnorm() */
191          multcolor(nd.mcolor, r->pcol);          /* modify material color */
192          transtest = 0;
193 +        transdist = r->rot;
194                                                  /* get specular component */
195          if ((nd.rspec = m->oargs.farg[3]) > FTINY) {
196                  nd.specfl |= SP_REFL;
# Line 254 | Line 262 | register RAY  *r;
262                  transtest = 0;
263  
264          if (r->crtype & SHADOW)                 /* the rest is shadow */
265 <                return;
265 >                return(1);
266                                                  /* diffuse reflection */
267          nd.rdiff = 1.0 - nd.trans - nd.rspec;
268  
269          if (nd.specfl & SP_PURE && nd.rdiff <= FTINY && nd.tdiff <= FTINY)
270 <                return;                         /* 100% pure specular */
270 >                return(1);                      /* 100% pure specular */
271  
272          if (r->ro != NULL && (r->ro->otype == OBJ_FACE ||
273                          r->ro->otype == OBJ_RING))
# Line 293 | Line 301 | register RAY  *r;
301                                          /* check distance */
302          if (transtest > bright(r->rcol))
303                  r->rt = transdist;
304 +
305 +        return(1);
306   }
307  
308  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines