--- ray/src/common/testBSDF.c 2017/02/02 04:46:38 1.9 +++ ray/src/common/testBSDF.c 2018/05/10 01:41:33 1.13 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: testBSDF.c,v 1.9 2017/02/02 04:46:38 greg Exp $"; +static const char RCSid[] = "$Id: testBSDF.c,v 1.13 2018/05/10 01:41:33 greg Exp $"; #endif /* * Simple test program to demonstrate BSDF operation. @@ -24,10 +24,10 @@ Usage(const char *prog) printf(" i\t\t\t\t Report general information (metadata)\n"); printf(" c\t\t\t\t Report diffuse and specular components\n"); printf(" q theta_i phi_i theta_o phi_o\t Query BSDF for given path (CIE-XYZ)\n"); - printf(" s[r|t][s|d] N theta phi\t\t\t Generate N ray directions & colors at given incidence\n"); - printf(" h[s|d] theta phi\t\t\t Report hemispherical scatteromg at given incidence\n"); - printf(" r[s|d] theta phi\t\t\t Report hemispherical reflection at given incidence\n"); - printf(" t[s|d] theta phi\t\t\t Report hemispherical transmission at given incidence\n"); + printf(" s[r|t][s|d] N theta phi\t Generate N ray directions & colors at given incidence\n"); + printf(" h[s|d] theta phi\t\t Report hemispherical scattering at given incidence\n"); + printf(" r[s|d] theta phi\t\t Report hemispherical reflection at given incidence\n"); + printf(" t[s|d] theta phi\t\t Report hemispherical transmission at given incidence\n"); printf(" a theta phi [t2 p2]\t\t Report resolution (in proj. steradians) for given direction(s)\n"); printf(" ^D\t\t\t\t Quit program\n"); } @@ -47,6 +47,10 @@ vec_from_deg(FVECT v, double theta, double phi) static void printXYZ(const char *intro, const SDValue *vp) { + if (vp->cieY <= 1e-9) { + printf("%s0 0 0\n", intro); + return; + } printf("%s%.3e %.3e %.3e\n", intro, vp->spec.cx/vp->spec.cy*vp->cieY, vp->cieY, @@ -104,7 +108,11 @@ main(int argc, char *argv[]) printf("Manufacturer: '%s'\n", bsdf->makr); printf("Width, Height, Thickness (m): %.4e, %.4e, %.4e\n", bsdf->dim[0], bsdf->dim[1], bsdf->dim[2]); - printf("Has geometry: %s\n", bsdf->mgf ? "yes" : "no"); + if (bsdf->mgf) + printf("Has geometry: %lu bytes\n", + (unsigned long)strlen(bsdf->mgf)); + else + printf("Has geometry: no\n"); continue; case 'C': /* report constant values */ if (!bsdf) @@ -191,7 +199,7 @@ main(int argc, char *argv[]) vec_from_deg(vin, atof(sskip2(cp,1)), atof(sskip2(cp,2))); if (*sskip2(cp,4)) { vec_from_deg(vout, atof(sskip2(cp,3)), atof(sskip2(cp,4))); - if (SDreportError(SDsizeBSDF(proja, vin, vout, + if (SDreportError(SDsizeBSDF(proja, vout, vin, SDqueryMin+SDqueryMax, bsdf), stderr)) continue; } else if (SDreportError(SDsizeBSDF(proja, vin, NULL,