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.12 by greg, Tue Mar 3 16:20:02 1992 UTC vs.
Revision 2.13 by greg, Thu Apr 16 13:31:28 1992 UTC

# Line 186 | Line 186 | register RAY  *r;
186                  else
187                          setcolor(nd.scolor, 1.0, 1.0, 1.0);
188                  scalecolor(nd.scolor, nd.rspec);
189 <                                                /* improved model */
190 <                dtmp = exp(-BSPEC(m)*nd.pdot);
191 <                for (i = 0; i < 3; i++)
192 <                        colval(nd.scolor,i) += (1.0-colval(nd.scolor,i))*dtmp;
193 <                nd.rspec += (1.0-nd.rspec)*dtmp;
194 <                                                /* check threshold */
195 <                if (specthresh > FTINY &&
196 <                                ((specthresh >= 1.-FTINY ||
197 <                                specthresh + (.05 - .1*frandom()) > nd.rspec)))
189 >                if (nd.specfl & SP_PURE) {              /* improved model */
190 >                        dtmp = exp(-BSPEC(m)*nd.pdot);
191 >                        for (i = 0; i < 3; i++)
192 >                                colval(nd.scolor,i) +=
193 >                                                (1.0-colval(nd.scolor,i))*dtmp;
194 >                        nd.rspec += (1.0-nd.rspec)*dtmp;
195 >                } else if (specthresh > FTINY &&        /* check threshold */
196 >                                (specthresh >= 1.-FTINY ||
197 >                                specthresh > nd.rspec))
198                          nd.specfl |= SP_RBLT;
199                                                  /* compute reflected ray */
200                  for (i = 0; i < 3; i++)
# Line 221 | Line 221 | register RAY  *r;
221                  if (nd.tspec > FTINY) {
222                          nd.specfl |= SP_TRAN;
223                                                          /* check threshold */
224 <                        if (specthresh > FTINY &&
225 <                                        ((specthresh >= 1.-FTINY ||
226 <                                        specthresh +
227 <                                            (.05 - .1*frandom()) > nd.tspec)))
224 >                        if (!(nd.specfl & SP_PURE) && specthresh > FTINY &&
225 >                                        (specthresh >= 1.-FTINY ||
226 >                                        specthresh > nd.tspec))
227                                  nd.specfl |= SP_TBLT;
228                          if (r->crtype & SHADOW ||
229                                          DOT(r->pert,r->pert) <= FTINY*FTINY) {
# Line 310 | Line 309 | register NORMDAT  *np;
309          double  rv[2];
310          double  d, sinp, cosp;
311          register int  i;
312 +                                        /* quick test */
313 +        if ((np->specfl & (SP_REFL|SP_RBLT)) != SP_REFL &&
314 +                        (np->specfl & (SP_TRAN|SP_TBLT)) != SP_TRAN)
315 +                return;
316                                          /* set up sample coordinates */
317          v[0] = v[1] = v[2] = 0.0;
318          for (i = 0; i < 3; i++)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines