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

Comparing ray/src/util/dctimestep.c (file contents):
Revision 2.20 by greg, Tue Aug 7 18:17:17 2012 UTC vs.
Revision 2.21 by greg, Tue Oct 16 15:53:04 2012 UTC

# Line 355 | Line 355 | cm_bsdf(const COLOR bsdfLamb, const COLOR specCol, con
355   static CMATRIX *
356   cm_loadBSDF(char *fname, COLOR cLamb)
357   {
358 <        CMATRIX *Tmat;
359 <        char    *fpath;
360 <        SDError ec;
361 <        SDData  myBSDF;
362 <        COLOR   bsdfLamb, specCol;
358 >        CMATRIX         *Tmat;
359 >        char            *fpath;
360 >        SDError         ec;
361 >        SDData          myBSDF;
362 >        SDSpectralDF    *tdf;
363 >        COLOR           bsdfLamb, specCol;
364                                          /* find path to BSDF file */
365          fpath = getpath(fname, getrlibpath(), R_OK);
366          if (fpath == NULL) {
# Line 371 | Line 372 | cm_loadBSDF(char *fname, COLOR cLamb)
372          if (ec)
373                  error(USER, transSDError(ec));
374          ccy2rgb(&myBSDF.tLamb.spec, myBSDF.tLamb.cieY/PI, bsdfLamb);
375 <        if (myBSDF.tf == NULL) {        /* no non-Lambertian transmission? */
375 >        tdf = (myBSDF.tf != NULL) ? myBSDF.tf : myBSDF.tb;
376 >        if (tdf == NULL) {              /* no non-Lambertian transmission? */
377                  if (cLamb != NULL)
378                          copycolor(cLamb, bsdfLamb);
379                  SDfreeBSDF(&myBSDF);
380                  return(NULL);
381          }
382 <        if (myBSDF.tf->ncomp != 1 || myBSDF.tf->comp[0].func != &SDhandleMtx) {
382 >        if (tdf->ncomp != 1 || tdf->comp[0].func != &SDhandleMtx) {
383                  sprintf(errmsg, "unsupported BSDF '%s'", fpath);
384                  error(USER, errmsg);
385          }
386                                          /* convert BTDF to matrix */
387 <        ccy2rgb(&myBSDF.tf->comp[0].cspec[0], 1., specCol);
388 <        Tmat = cm_bsdf(bsdfLamb, specCol, (SDMat *)myBSDF.tf->comp[0].dist);
387 >        ccy2rgb(&tdf->comp[0].cspec[0], 1., specCol);
388 >        Tmat = cm_bsdf(bsdfLamb, specCol, (SDMat *)tdf->comp[0].dist);
389          if (cLamb != NULL)              /* Lambertian is included */
390                  setcolor(cLamb, .0, .0, .0);
391                                          /* free BSDF and return */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines