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

Comparing ray/src/common/bsdf_m.c (file contents):
Revision 3.27 by greg, Sat Jun 29 21:03:44 2013 UTC vs.
Revision 3.28 by greg, Fri Mar 21 17:49:53 2014 UTC

# Line 488 | Line 488 | load_bsdf_data(SDData *sd, ezxml_t wdb, int rowinc)
488                  return RC_FORMERR;
489          }
490          for (i = 0; i < dp->ninc*dp->nout; i++) {
491 <                char  *sdnext = fskip(sdata);
491 >                char    *sdnext = fskip(sdata);
492 >                double  val;
493                  if (sdnext == NULL) {
494                          sprintf(SDerrorDetail,
495                                  "Bad/missing BSDF ScatteringData in '%s'",
# Line 498 | Line 499 | load_bsdf_data(SDData *sd, ezxml_t wdb, int rowinc)
499                  while (isspace(*sdnext))
500                          sdnext++;
501                  if (*sdnext == ',') sdnext++;
502 +                if ((val = atof(sdata)) < 0)
503 +                        val = 0;        /* don't allow negative values */
504                  if (rowinc) {
505                          int     r = i/dp->nout;
506                          int     c = i - r*dp->nout;
507 <                        mBSDF_value(dp,r,c) = atof(sdata);
507 >                        mBSDF_value(dp,r,c) = val;
508                  } else
509 <                        dp->bsdf[i] = atof(sdata);
509 >                        dp->bsdf[i] = val;
510                  sdata = sdnext;
511          }
512          return get_extrema(df);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines