--- ray/src/cv/bsdf2ttree.c 2012/10/20 17:01:26 2.2 +++ ray/src/cv/bsdf2ttree.c 2012/11/07 03:04:23 2.4 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: bsdf2ttree.c,v 2.2 2012/10/20 17:01:26 greg Exp $"; +static const char RCSid[] = "$Id: bsdf2ttree.c,v 2.4 2012/11/07 03:04:23 greg Exp $"; #endif /* * Load measured BSDF interpolant and write out as XML file with tensor tree. @@ -29,14 +29,14 @@ interp_isotropic() char cmd[128]; int ix, ox, oy; FVECT ivec, ovec; - double bsdf; + float bsdf; #if DEBUG fprintf(stderr, "Writing isotropic order %d ", samp_order); if (pctcull >= 0) fprintf(stderr, "data with %d%% culling\n", pctcull); else fputs("raw data\n", stderr); #endif if (pctcull >= 0) { /* begin output */ - sprintf(cmd, "rttree_reduce -h -a -fd -r 3 -t %d -g %d", + sprintf(cmd, "rttree_reduce -h -a -ff -r 3 -t %d -g %d", pctcull, samp_order); fflush(stdout); ofp = popen(cmd, "w"); @@ -66,7 +66,8 @@ interp_isotropic() else printf("\t%.3e\n", bsdf); } - free(rbf); + if (rbf != NULL) + free(rbf); } if (pctcull >= 0) { /* finish output */ if (pclose(ofp)) { @@ -90,14 +91,14 @@ interp_anisotropic() char cmd[128]; int ix, iy, ox, oy; FVECT ivec, ovec; - double bsdf; + float bsdf; #if DEBUG fprintf(stderr, "Writing anisotropic order %d ", samp_order); if (pctcull >= 0) fprintf(stderr, "data with %d%% culling\n", pctcull); else fputs("raw data\n", stderr); #endif if (pctcull >= 0) { /* begin output */ - sprintf(cmd, "rttree_reduce -h -a -fd -r 4 -t %d -g %d", + sprintf(cmd, "rttree_reduce -h -a -ff -r 4 -t %d -g %d", pctcull, samp_order); fflush(stdout); ofp = popen(cmd, "w"); @@ -127,7 +128,8 @@ interp_anisotropic() else printf("\t%.3e\n", bsdf); } - free(rbf); + if (rbf != NULL) + free(rbf); } if (pctcull >= 0) { /* finish output */ if (pclose(ofp)) { @@ -172,7 +174,6 @@ main(int argc, char *argv[]) SET_FILE_BINARY(fpin); /* load BSDF interpolant */ if (!load_bsdf_rep(fpin)) return(1); - draw_edges(); /* xml_prologue(); /* start XML output */ if (single_plane_incident) /* resample dist. */ interp_isotropic();