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.40 by greg, Wed Nov 15 18:02:52 2023 UTC vs.
Revision 2.43 by greg, Fri Dec 13 19:05:03 2024 UTC

# Line 208 | Line 208 | m_brdf(                        /* color a ray that hit a BRDTfunc material
208          RAY  *r
209   )
210   {
211        int  hitfront = 1;
211          BRDFDAT  nd;
212          RAY  sr;
213          int  hasrefl, hastrans;
# Line 254 | Line 253 | m_brdf(                        /* color a ray that hit a BRDTfunc material
253                          nd.pnorm[i] = -nd.pnorm[i];
254                          r->pert[i] = -r->pert[i];
255                  }
257                hitfront = 0;
256          }
257          copyscolor(nd.mcolor, r->pcol);         /* get pattern color */
258          smultscolor(nd.rdiff, nd.mcolor);       /* modify diffuse values */
# Line 263 | Line 261 | m_brdf(                        /* color a ray that hit a BRDTfunc material
261          hastrans = (sintens(nd.tdiff) > FTINY);
262                                                  /* load cal file */
263          nd.dp = NULL;
264 <        mf = getfunc(m, 9, 0x3f, 0);
264 >        mf = getfunc(m, 9, 0x3F, 0);
265                                                  /* compute transmitted ray */
266          setbrdfunc(&nd);
267          errno = 0;
# Line 315 | Line 313 | m_brdf(                        /* color a ray that hit a BRDTfunc material
313          }
314                                                  /* compute ambient */
315          if (hasrefl) {
318                if (!hitfront)
319                        flipsurface(r);
316                  copyscolor(sctmp, nd.rdiff);
317                  multambient(sctmp, r, nd.pnorm);
318                  saddscolor(r->rcol, sctmp);     /* add to returned color */
323                if (!hitfront)
324                        flipsurface(r);
319          }
320          if (hastrans) {                         /* from other side */
327                if (hitfront)
328                        flipsurface(r);
321                  vtmp[0] = -nd.pnorm[0];
322                  vtmp[1] = -nd.pnorm[1];
323                  vtmp[2] = -nd.pnorm[2];
324                  copyscolor(sctmp, nd.tdiff);
325                  multambient(sctmp, r, vtmp);
326                  saddscolor(r->rcol, sctmp);
335                if (hitfront)
336                        flipsurface(r);
327          }
328          if (hasrefl | hastrans || m->oargs.sarg[6][0] != '0')
329                  direct(r, dirbrdf, &nd);        /* add direct component */
# Line 356 | Line 346 | m_brdf2(                       /* color a ray that hit a BRDF material */
346                                                  /* always a shadow */
347          if (r->crtype & SHADOW)
348                  return(1);
359                                                /* check arguments */
360        if ((m->oargs.nsargs < (hasdata(m->otype)?4:2)) | (m->oargs.nfargs <
361                        ((m->otype==MAT_TFUNC)|(m->otype==MAT_TDATA)?6:4)))
362                objerror(m, USER, "bad # arguments");
349                                                  /* check for back side */
350          if (r->rod < 0.0) {
351                  if (!backvis) {
# Line 370 | Line 356 | m_brdf2(                       /* color a ray that hit a BRDF material */
356                  flipsurface(r);                 /* reorient if backvis */
357          } else
358                  raytexture(r, m->omod);
359 +                                                /* check arguments */
360 +        if ((m->oargs.nsargs < (hasdata(m->otype)?4:2)) | (m->oargs.nfargs <
361 +                        ((m->otype==MAT_TFUNC)|(m->otype==MAT_TDATA)?6:4)))
362 +                objerror(m, USER, "bad # arguments");
363  
364          nd.mp = m;
365          nd.pr = r;
# Line 412 | Line 402 | m_brdf2(                       /* color a ray that hit a BRDF material */
402                  saddscolor(r->rcol, sctmp);     /* add to returned color */
403          }
404          if (nd.trans > FTINY) {                 /* from other side */
415                flipsurface(r);
405                  vtmp[0] = -nd.pnorm[0];
406                  vtmp[1] = -nd.pnorm[1];
407                  vtmp[2] = -nd.pnorm[2];
# Line 420 | Line 409 | m_brdf2(                       /* color a ray that hit a BRDF material */
409                  scalescolor(sctmp, nd.trans);
410                  multambient(sctmp, r, vtmp);
411                  saddscolor(r->rcol, sctmp);
423                flipsurface(r);
412          }
413                                                  /* add direct component */
414          direct(r, dirbrdf, &nd);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines