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.33 by greg, Wed Sep 2 18:59:01 2015 UTC vs.
Revision 2.34 by greg, Wed Jan 10 04:08:50 2018 UTC

# Line 210 | Line 210 | m_brdf(                        /* color a ray that hit a BRDTfunc material
210          BRDFDAT  nd;
211          RAY  sr;
212          double  mirtest=0, mirdist=0;
213 <        double  transtest=0, transdist=0;
213 >        double  transtest, transdist;
214          int  hasrefl, hastrans;
215          int  hastexture;
216          COLOR  ctmp;
# Line 241 | Line 241 | m_brdf(                        /* color a ray that hit a BRDTfunc material
241                          m->oargs.farg[8]);
242                                                  /* get modifiers */
243          raytexture(r, m->omod);
244 <        hastexture = DOT(r->pert,r->pert) > FTINY*FTINY;
244 >        hastexture = (DOT(r->pert,r->pert) > FTINY*FTINY);
245          if (hastexture) {                       /* perturb normal */
246                  nd.pdot = raynormal(nd.pnorm, r);
247          } else {
# Line 259 | Line 259 | m_brdf(                        /* color a ray that hit a BRDTfunc material
259          copycolor(nd.mcolor, r->pcol);          /* get pattern color */
260          multcolor(nd.rdiff, nd.mcolor);         /* modify diffuse values */
261          multcolor(nd.tdiff, nd.mcolor);
262 <        hasrefl = bright(nd.rdiff) > FTINY;
263 <        hastrans = bright(nd.tdiff) > FTINY;
262 >        hasrefl = (bright(nd.rdiff) > FTINY);
263 >        hastrans = (bright(nd.tdiff) > FTINY);
264 >        mirdist = transdist = r->rot;
265                                                  /* load cal file */
266          nd.dp = NULL;
267          mf = getfunc(m, 9, 0x3f, 0);
# Line 273 | Line 274 | m_brdf(                        /* color a ray that hit a BRDTfunc material
274          if ((errno == EDOM) | (errno == ERANGE))
275                  objerror(m, WARNING, "compute error");
276          else if (rayorigin(&sr, TRANS, r, ctmp) == 0) {
277 <                if (!(r->crtype & SHADOW) && hastexture) {
277 >                if (hastexture && !(r->crtype & (SHADOW|AMBIENT))) {
278                                                  /* perturb direction */
279 <                        VSUM(sr.rdir, r->rdir, r->pert, -.75);
279 >                        VSUB(sr.rdir, r->rdir, r->pert);
280                          if (normalize(sr.rdir) == 0.0) {
281                                  objerror(m, WARNING, "illegal perturbation");
282                                  VCOPY(sr.rdir, r->rdir);
# Line 286 | Line 287 | m_brdf(                        /* color a ray that hit a BRDTfunc material
287                  rayvalue(&sr);
288                  multcolor(sr.rcol, sr.rcoef);
289                  addcolor(r->rcol, sr.rcol);
290 <                if (!hastexture) {
290 >                if (!hastexture || r->crtype & (SHADOW|AMBIENT)) {
291                          transtest = 2.0*bright(sr.rcol);
292                          transdist = r->rot + sr.rt;
293                  }
294          }
295 <        if (r->crtype & SHADOW)                 /* the rest is shadow */
295 >        if (r->crtype & SHADOW) {               /* the rest is shadow */
296 >                r->rt = transdist;
297                  return(1);
298 +        }
299                                                  /* compute reflected ray */
300          setbrdfunc(&nd);
301          errno = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines