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.25 by greg, Sun Apr 21 22:58:40 2013 UTC vs.
Revision 3.28 by greg, Fri Mar 21 17:49:53 2014 UTC

# Line 170 | Line 170 | fo_getndx(const FVECT v, void *p)
170                  return -1;
171          if ((v[2] < 0) | (v[2] > 1.))
172                  return -1;
173 <        pol = 180.0/M_PI*acos(v[2]);
173 >        pol = 180.0/M_PI*Acos(v[2]);
174          azi = 180.0/M_PI*atan2(v[1], v[0]);
175          if (azi < 0.0) azi += 360.0;
176          for (li = 1; ab->lat[li].tmin <= pol; li++)
# 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);
# Line 602 | Line 605 | SDloadMtx(SDData *sd, ezxml_t wtl)
605                                          /* separate diffuse components */
606          extract_diffuse(&sd->rLambFront, sd->rf);
607          extract_diffuse(&sd->rLambBack, sd->rb);
608 <        extract_diffuse(&sd->tLamb, (sd->tf != NULL) ? sd->tf : sd->tb);
608 >        if (sd->tf != NULL)
609 >                extract_diffuse(&sd->tLamb, sd->tf);
610 >        if (sd->tb != NULL)
611 >                extract_diffuse(&sd->tLamb, sd->tb);
612                                          /* return success */
613          return SDEnone;
614   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines