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.9 by greg, Fri Apr 8 18:13:48 2011 UTC vs.
Revision 3.10 by greg, Tue Apr 19 21:31:22 2011 UTC

# Line 81 | Line 81 | static int     nabases = 3;    /* current number of defined b
81   static int
82   fequal(double a, double b)
83   {
84 <        if (b != .0)
84 >        if (b != 0)
85                  a = a/b - 1.;
86          return (a <= 1e-6) & (a >= -1e-6);
87   }
# Line 193 | Line 193 | fo_getndx(const FVECT v, void *p)
193  
194          if (v == NULL)
195                  return -1;
196 <        if ((v[2] < .0) | (v[2] > 1.0))
196 >        if ((v[2] < 0) | (v[2] > 1.))
197                  return -1;
198          pol = 180.0/M_PI*acos(v[2]);
199          azi = 180.0/M_PI*atan2(v[1], v[0]);
# Line 507 | Line 507 | load_bsdf_data(SDData *sd, ezxml_t wdb, int rowinc)
507          df->comp[0].dist = dp;
508          df->comp[0].func = &SDhandleMtx;
509                                          /* read BSDF data */
510 <        sdata  = ezxml_txt(ezxml_child(wdb,"ScatteringData"));
510 >        sdata = ezxml_txt(ezxml_child(wdb,"ScatteringData"));
511          if (!sdata || !*sdata) {
512                  sprintf(SDerrorDetail, "Missing BSDF ScatteringData in '%s'",
513                                  sd->name);
# Line 651 | Line 651 | SDgetMtxBSDF(float coef[SDmaxCh], const FVECT outVec,
651  
652   /* Query solid angle for vector */
653   static SDError
654 < SDqueryMtxProjSA(double *psa, const FVECT vec, int qflags, const void *dist)
654 > SDqueryMtxProjSA(double *psa, const FVECT v1, const RREAL *v2,
655 >                                        int qflags, const void *dist)
656   {
657          const SDMat     *dp = (const SDMat *)dist;
658          double          inc_psa, out_psa;
659                                          /* check arguments */
660 <        if ((psa == NULL) | (vec == NULL) | (dp == NULL))
660 >        if ((psa == NULL) | (v1 == NULL) | (dp == NULL))
661                  return SDEargument;
662 +        if (v2 == NULL)
663 +                v2 = v1;
664                                          /* get projected solid angles */
665 <        inc_psa = mBSDF_incohm(dp, mBSDF_incndx(dp, vec));
666 <        out_psa = mBSDF_outohm(dp, mBSDF_outndx(dp, vec));
665 >        out_psa = mBSDF_outohm(dp, mBSDF_outndx(dp, v1));
666 >        inc_psa = mBSDF_incohm(dp, mBSDF_incndx(dp, v2));
667  
668          switch (qflags) {               /* record based on flag settings */
669          case SDqueryVal:
# Line 679 | Line 682 | SDqueryMtxProjSA(double *psa, const FVECT vec, int qfl
682                          psa[1] = out_psa;
683                  /* fall through */
684          case SDqueryMin:
685 <                if ((inc_psa > .0) & (inc_psa < psa[0]))
685 >                if ((inc_psa > 0) & (inc_psa < psa[0]))
686                          psa[0] = inc_psa;
687 <                if ((out_psa > .0) & (out_psa < psa[0]))
687 >                if ((out_psa > 0) & (out_psa < psa[0]))
688                          psa[0] = out_psa;
689                  break;
690          }
691                                          /* make sure it's legal */
692 <        return (psa[0] <= .0) ? SDEinternal : SDEnone;
692 >        return (psa[0] <= 0) ? SDEinternal : SDEnone;
693   }
694  
695   /* Compute new cumulative distribution from BSDF */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines