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.76 by greg, Wed Jan 10 04:08:50 2018 UTC vs.
Revision 2.77 by greg, Tue Nov 13 19:58:33 2018 UTC

# Line 182 | Line 182 | m_normal(                      /* color a ray that hit something normal *
182   {
183          NORMDAT  nd;
184          double  fest;
185        double  transtest, transdist;
186        double  mirtest, mirdist;
185          int     hastexture;
186          double  d;
187          COLOR  ctmp;
# Line 233 | Line 231 | m_normal(                      /* color a ray that hit something normal *
231          if (nd.pdot < .001)
232                  nd.pdot = .001;                 /* non-zero for dirnorm() */
233          multcolor(nd.mcolor, r->pcol);          /* modify material color */
236        mirtest = transtest = 0;
237        mirdist = transdist = r->rot;
234          nd.rspec = m->oargs.farg[3];
235                                                  /* compute Fresnel approx. */
236          if (nd.specfl & SP_PURE && nd.rspec >= FRESTHRESH) {
# Line 255 | Line 251 | m_normal(                      /* color a ray that hit something normal *
251                                  nd.specfl |= SP_TBLT;
252                          if (!hastexture || r->crtype & (SHADOW|AMBIENT)) {
253                                  VCOPY(nd.prdir, r->rdir);
258                                transtest = 2;
254                          } else {
255                                                          /* perturb */
256                                  VSUB(nd.prdir, r->rdir, r->pert);
# Line 278 | Line 273 | m_normal(                      /* color a ray that hit something normal *
273                          rayvalue(&lr);
274                          multcolor(lr.rcol, lr.rcoef);
275                          addcolor(r->rcol, lr.rcol);
276 <                        transtest *= bright(lr.rcol);
282 <                        transdist = r->rot + lr.rt;
276 >                        r->rxt = r->rot + raydistance(&lr);
277                  }
278 <        } else
285 <                transtest = 0;
278 >        }
279  
280 <        if (r->crtype & SHADOW) {               /* the rest is shadow */
288 <                r->rt = transdist;
280 >        if (r->crtype & SHADOW)                 /* the rest is shadow */
281                  return(1);
290        }
282                                                  /* get specular reflection */
283          if (nd.rspec > FTINY) {
284                  nd.specfl |= SP_REFL;
# Line 320 | Line 311 | m_normal(                      /* color a ray that hit something normal *
311                          VCOPY(lr.rdir, nd.vrefl);
312                          rayvalue(&lr);
313                          multcolor(lr.rcol, lr.rcoef);
314 +                        copycolor(r->mcol, lr.rcol);
315                          addcolor(r->rcol, lr.rcol);
316                          if (nd.specfl & SP_FLAT &&
317 <                                        !hastexture | (r->crtype & AMBIENT)) {
318 <                                mirtest = 2.*bright(lr.rcol);
327 <                                mirdist = r->rot + lr.rt;
328 <                        }
317 >                                        !hastexture | (r->crtype & AMBIENT))
318 >                                r->rmt = r->rot + raydistance(&lr);
319                  }
320          }
321                                                  /* diffuse reflection */
322          nd.rdiff = 1.0 - nd.trans - nd.rspec;
323  
324 <        if (nd.specfl & SP_PURE && nd.rdiff <= FTINY && nd.tdiff <= FTINY) {
335 <                if (mirtest > transtest+FTINY)
336 <                        r->rt = mirdist;
337 <                else if (transtest > FTINY)
338 <                        r->rt = transdist;
324 >        if (nd.specfl & SP_PURE && nd.rdiff <= FTINY && nd.tdiff <= FTINY)
325                  return(1);                      /* 100% pure specular */
326 <        }
326 >
327          if (!(nd.specfl & SP_PURE))
328                  gaussamp(&nd);                  /* checks *BLT flags */
329  
# Line 369 | Line 355 | m_normal(                      /* color a ray that hit something normal *
355          }
356                                          /* add direct component */
357          direct(r, dirnorm, &nd);
372                                        /* check distance */
373        d = bright(r->rcol);
374        if (transtest > d)
375                r->rt = transdist;
376        else if (mirtest > d)
377                r->rt = mirdist;
358  
359          return(1);
360   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines