--- ray/src/util/cmbsdf.c 2015/04/17 01:47:03 2.3 +++ ray/src/util/cmbsdf.c 2016/03/22 03:56:17 2.5 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: cmbsdf.c,v 2.3 2015/04/17 01:47:03 greg Exp $"; +static const char RCSid[] = "$Id: cmbsdf.c,v 2.5 2016/03/22 03:56:17 greg Exp $"; #endif /* * Load and convert BSDF into color coefficient matrix representation. @@ -36,8 +36,7 @@ cm_bsdf(const COLOR diffBSDF, const SDMat *bsdf) setcolor(mp, .0f, .0f, .0f); } else if (bsdf->chroma != NULL) { C_COLOR cxy; - c_decodeChroma(&cxy, - bsdf->chroma[r*bsdf->ninc + c]); + c_decodeChroma(&cxy, mBSDF_chroma(bsdf,c,r)); ccy2rgb(&cxy, f, mp); } else setcolor(mp, f, f, f); @@ -103,8 +102,7 @@ cm_bsdf_recip(const COLOR diffBSDF, const SDMat *bsdf) setcolor(mp, .0f, .0f, .0f); } else if (bsdf->chroma != NULL) { C_COLOR cxy; - c_decodeChroma(&cxy, - bsdf->chroma[ro*bsdf->ninc + ri]); + c_decodeChroma(&cxy, mBSDF_chroma(bsdf,ri,ro)); ccy2rgb(&cxy, f, mp); } else setcolor(mp, f, f, f); @@ -151,7 +149,7 @@ cm_loadBTDF(char *fname) fpath = getpath(fname, getrlibpath(), R_OK); if (fpath == NULL) { sprintf(errmsg, "cannot find BSDF file '%s'", fname); - error(USER, errmsg); + error(SYSTEM, errmsg); } SDclearBSDF(&myBSDF, fname); /* load XML and check type */ ec = SDloadFile(&myBSDF, fpath);