| 22 |
|
.5, 1., 1. |
| 23 |
|
}; |
| 24 |
|
|
| 25 |
+ |
#ifdef _WIN32 |
| 26 |
+ |
char validf[] = "-e \"valid(s,t)=X`SYS(s,t)^2+Y`SYS(s,t)^2+Z`SYS(s,t)^2-1e-7\""; |
| 27 |
+ |
#else |
| 28 |
+ |
char validf[] = "-e 'valid(s,t)=X`SYS(s,t)^2+Y`SYS(s,t)^2+Z`SYS(s,t)^2-1e-7'"; |
| 29 |
+ |
#endif |
| 30 |
+ |
|
| 31 |
|
char *progname; |
| 32 |
|
|
| 33 |
|
/* Produce a Radiance model plotting the indicated incident direction(s) */ |
| 124 |
|
#ifdef DEBUG |
| 125 |
|
if (inpXML) |
| 126 |
|
fprintf(stderr, "Hemispherical %s: %.3f\n", |
| 127 |
< |
(output_orient > 0 ? "reflection" : "transmission"), |
| 127 |
> |
(output_orient > 0 ^ input_orient > 0 ? |
| 128 |
> |
"transmission" : "reflection"), |
| 129 |
|
SDdirectHemi(idir, SDsampSp|SDsampDf | |
| 130 |
< |
(output_orient > 0 ? |
| 131 |
< |
SDsampR : SDsampT), &myBSDF)); |
| 130 |
> |
(output_orient > 0 ^ input_orient > 0 ? |
| 131 |
> |
SDsampT : SDsampR), &myBSDF)); |
| 132 |
|
else if (rbf == NULL) |
| 133 |
|
fputs("Empty RBF\n", stderr); |
| 134 |
|
else |
| 135 |
|
fprintf(stderr, "Hemispherical %s: %.3f\n", |
| 136 |
< |
(output_orient > 0 ? "reflection" : "transmission"), |
| 136 |
> |
(output_orient > 0 ^ input_orient > 0 ? |
| 137 |
> |
"transmission" : "reflection"), |
| 138 |
|
rbf->vtotal); |
| 139 |
|
#endif |
| 140 |
+ |
printf("# Incident direction (theta,phi) = (%.2f,%.2f) deg.\n\n", |
| 141 |
+ |
(180./M_PI)*theta, (180./M_PI)*phi); |
| 142 |
|
printf("void trans tmat\n0\n0\n7 %f %f %f .04 .04 .9 1\n", |
| 143 |
|
colarr[n][0], colarr[n][1], colarr[n][2]); |
| 144 |
|
if (showPeaks && rbf != NULL) { |
| 146 |
|
1.-colarr[n][0], 1.-colarr[n][1], 1.-colarr[n][2]); |
| 147 |
|
for (i = 0; i < rbf->nrbf; i++) { |
| 148 |
|
ovec_from_pos(odir, rbf->rbfa[i].gx, rbf->rbfa[i].gy); |
| 149 |
< |
bsdf = eval_rbfrep(rbf, odir) / (output_orient*odir[2]); |
| 149 |
> |
bsdf = eval_rbfrep(rbf, odir); |
| 150 |
|
bsdf = log(bsdf + 1e-5) - min_log; |
| 151 |
|
printf("pmat sphere p%d\n0\n0\n4 %f %f %f %f\n", |
| 152 |
|
i+1, odir[0]*bsdf, odir[1]*bsdf, odir[2]*bsdf, |
| 154 |
|
} |
| 155 |
|
} |
| 156 |
|
fflush(stdout); |
| 157 |
< |
sprintf(buf, "gensurf tmat bsdf%d - - - %d %d", n+1, |
| 158 |
< |
GRIDRES-1, GRIDRES-1); |
| 157 |
> |
sprintf(buf, "gensurf tmat bsdf%d - - - %d %d %s", n+1, |
| 158 |
> |
GRIDRES-1, GRIDRES-1, validf); |
| 159 |
|
fp = popen(buf, "w"); |
| 160 |
|
if (fp == NULL) { |
| 161 |
|
fprintf(stderr, "%s: cannot open '| %s'\n", progname, buf); |
| 171 |
|
return(1); |
| 172 |
|
bsdf = sval.cieY; |
| 173 |
|
} else |
| 174 |
< |
bsdf = eval_rbfrep(rbf, odir) / |
| 165 |
< |
(output_orient*odir[2]); |
| 174 |
> |
bsdf = eval_rbfrep(rbf, odir); |
| 175 |
|
bsdf = log(bsdf + 1e-5) - min_log; |
| 176 |
|
fprintf(fp, "%.8e %.8e %.8e\n", |
| 177 |
|
odir[0]*bsdf, odir[1]*bsdf, odir[2]*bsdf); |