--- ray/src/cv/bsdf2ttree.c 2016/03/06 01:13:17 2.36 +++ ray/src/cv/bsdf2ttree.c 2017/02/17 22:31:49 2.40 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: bsdf2ttree.c,v 2.36 2016/03/06 01:13:17 schorsch Exp $"; +static const char RCSid[] = "$Id: bsdf2ttree.c,v 2.40 2017/02/17 22:31:49 greg Exp $"; #endif /* * Load measured BSDF interpolant and write out as XML file with tensor tree. @@ -27,7 +27,7 @@ static int samp_order = 6; const double ssamp_thresh = 0.35; /* number of super-samples */ #ifndef NSSAMP -#define NSSAMP 100 +#define NSSAMP 64 #endif /* limit on number of RBF lobes */ static int lobe_lim = 15000; @@ -38,7 +38,7 @@ static int do_prog = 79; static char *wrapBSDF[MAXCARG] = {"wrapBSDF", "-U"}; static int wbsdfac = 2; -/* Add argument to wrapBSDF, allocating space if isstatic */ +/* Add argument to wrapBSDF, allocating space if !isstatic */ static void add_wbsdf(const char *arg, int isstatic) { @@ -206,7 +206,6 @@ eval_isotropic(char *funame) eval_rbfcol(&sdv, rbf, iovec+3); bsdf = sdv.cieY; if (rbf_colorimetry == RBCtristimulus) { - c_ccvt(&sdv.spec, C_CSXY); uv[0] = uv[1] = 1. / (-2.*sdv.spec.cx + 12.*sdv.spec.cy + 3.); uv[0] *= 4.*sdv.spec.cx; @@ -250,14 +249,14 @@ eval_isotropic(char *funame) #endif } if (pctcull >= 0) - fwrite(&bsdf, sizeof(bsdf), 1, ofp); + putbinary(&bsdf, sizeof(bsdf), 1, ofp); else fprintf(ofp, "\t%.3e\n", bsdf); if (rbf_colorimetry == RBCtristimulus) { if (pctcull >= 0) { - fwrite(&uv[0], sizeof(*uv), 1, uvfp[0]); - fwrite(&uv[1], sizeof(*uv), 1, uvfp[1]); + putbinary(&uv[0], sizeof(*uv), 1, uvfp[0]); + putbinary(&uv[1], sizeof(*uv), 1, uvfp[1]); } else { fprintf(uvfp[0], "\t%.3e\n", uv[0]); fprintf(uvfp[1], "\t%.3e\n", uv[1]); @@ -398,7 +397,6 @@ eval_anisotropic(char *funame) eval_rbfcol(&sdv, rbf, iovec+3); bsdf = sdv.cieY; if (rbf_colorimetry == RBCtristimulus) { - c_ccvt(&sdv.spec, C_CSXY); uv[0] = uv[1] = 1. / (-2.*sdv.spec.cx + 12.*sdv.spec.cy + 3.); uv[0] *= 4.*sdv.spec.cx; @@ -443,14 +441,14 @@ eval_anisotropic(char *funame) #endif } if (pctcull >= 0) - fwrite(&bsdf, sizeof(bsdf), 1, ofp); + putbinary(&bsdf, sizeof(bsdf), 1, ofp); else fprintf(ofp, "\t%.3e\n", bsdf); if (rbf_colorimetry == RBCtristimulus) { if (pctcull >= 0) { - fwrite(&uv[0], sizeof(*uv), 1, uvfp[0]); - fwrite(&uv[1], sizeof(*uv), 1, uvfp[1]); + putbinary(&uv[0], sizeof(*uv), 1, uvfp[0]); + putbinary(&uv[1], sizeof(*uv), 1, uvfp[1]); } else { fprintf(uvfp[0], "\t%.3e\n", uv[0]); fprintf(uvfp[1], "\t%.3e\n", uv[1]);