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

Comparing ray/src/rt/m_brdf.c (file contents):
Revision 2.35 by greg, Wed Jan 10 17:45:11 2018 UTC vs.
Revision 2.36 by greg, Tue Nov 13 19:58:33 2018 UTC

# Line 209 | Line 209 | m_brdf(                        /* color a ray that hit a BRDTfunc material
209          int  hitfront = 1;
210          BRDFDAT  nd;
211          RAY  sr;
212        double  mirtest=0, mirdist;
213        double  transtest=0, transdist;
212          int  hasrefl, hastrans;
213          int  hastexture;
214          COLOR  ctmp;
# Line 261 | Line 259 | m_brdf(                        /* color a ray that hit a BRDTfunc material
259          multcolor(nd.tdiff, nd.mcolor);
260          hasrefl = (bright(nd.rdiff) > FTINY);
261          hastrans = (bright(nd.tdiff) > FTINY);
264        mirdist = transdist = r->rot;
262                                                  /* load cal file */
263          nd.dp = NULL;
264          mf = getfunc(m, 9, 0x3f, 0);
# Line 287 | Line 284 | m_brdf(                        /* color a ray that hit a BRDTfunc material
284                  rayvalue(&sr);
285                  multcolor(sr.rcol, sr.rcoef);
286                  addcolor(r->rcol, sr.rcol);
287 <                if (!hastexture || r->crtype & (SHADOW|AMBIENT)) {
288 <                        transtest = 2.0*bright(sr.rcol);
292 <                        transdist = r->rot + sr.rt;
293 <                }
287 >                if (!hastexture || r->crtype & (SHADOW|AMBIENT))
288 >                        r->rxt = r->rot + raydistance(&sr);
289          }
290 <        if (r->crtype & SHADOW) {               /* the rest is shadow */
296 <                r->rt = transdist;
290 >        if (r->crtype & SHADOW)                 /* the rest is shadow */
291                  return(1);
292 <        }
292 >
293                                                  /* compute reflected ray */
294          setbrdfunc(&nd);
295          errno = 0;
# Line 309 | Line 303 | m_brdf(                        /* color a ray that hit a BRDTfunc material
303                  checknorm(sr.rdir);
304                  rayvalue(&sr);
305                  multcolor(sr.rcol, sr.rcoef);
306 +                copycolor(r->mcol, sr.rcol);
307                  addcolor(r->rcol, sr.rcol);
308 <                if (!hastexture && r->ro != NULL && isflat(r->ro->otype)) {
309 <                        mirtest = 2.0*bright(sr.rcol);
310 <                        mirdist = r->rot + sr.rt;
316 <                }
308 >                if (r->ro != NULL && isflat(r->ro->otype) &&
309 >                                !hastexture | (r->crtype & AMBIENT))
310 >                        r->rmt = r->rot + raydistance(&sr);
311          }
312                                                  /* compute ambient */
313          if (hasrefl) {
# Line 339 | Line 333 | m_brdf(                        /* color a ray that hit a BRDTfunc material
333          }
334          if (hasrefl | hastrans || m->oargs.sarg[6][0] != '0')
335                  direct(r, dirbrdf, &nd);        /* add direct component */
342
343        d = bright(r->rcol);                    /* set effective distance */
344        if (transtest > d)
345                r->rt = transdist;
346        else if (mirtest > d)
347                r->rt = mirdist;
336  
337          return(1);
338   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines