12 |
|
#include <math.h> |
13 |
|
#include <ctype.h> |
14 |
|
#include "random.h" |
15 |
– |
#include "platform.h" |
16 |
– |
#include "paths.h" |
15 |
|
#include "rtio.h" |
16 |
|
#include "calcomp.h" |
17 |
|
#include "bsdfrep.h" |
20 |
|
enum {CIE_X, CIE_Y, CIE_Z}; |
21 |
|
/* assumed maximum # Klems patches */ |
22 |
|
#define MAXPATCHES 145 |
25 |
– |
/* global argv[0] */ |
26 |
– |
char *progname; |
23 |
|
/* selected basis function name */ |
24 |
|
static const char klems_full[] = "LBNL/Klems Full"; |
25 |
|
static const char klems_half[] = "LBNL/Klems Half"; |
192 |
|
for (n = npsamps; n-- > 0; ) { |
193 |
|
fo_getvec(vout, j+(n+frandom())/npsamps, abp); |
194 |
|
fi_getvec(vin, i+urand(n), abp); |
195 |
< |
ec = SDevalBSDF(&sdv, vout, vin, &bsd); |
195 |
> |
ec = SDevalBSDF(&sdv, vin, vout, &bsd); |
196 |
|
if (ec != SDEnone) |
197 |
|
goto err; |
198 |
|
sum += sdv.cieY; |
241 |
|
for (n = npsamps; n-- > 0; ) { |
242 |
|
bo_getvec(vout, j+(n+frandom())/npsamps, abp); |
243 |
|
bi_getvec(vin, i+urand(n), abp); |
244 |
< |
ec = SDevalBSDF(&sdv, vout, vin, &bsd); |
244 |
> |
ec = SDevalBSDF(&sdv, vin, vout, &bsd); |
245 |
|
if (ec != SDEnone) |
246 |
|
goto err; |
247 |
|
sum += sdv.cieY; |
273 |
|
} |
274 |
|
} |
275 |
|
/* front transmission */ |
276 |
< |
if (bsd.tf != NULL || bsd.tLamb.cieY > .002) { |
276 |
> |
if (bsd.tf != NULL || bsd.tLambFront.cieY > .002) { |
277 |
|
input_orient = 1; output_orient = -1; |
278 |
|
cfp[CIE_Y] = open_component_file(CIE_Y); |
279 |
|
if (bsd.tf != NULL && bsd.tf->comp[0].cspec[2].flags) { |
289 |
|
for (n = npsamps; n-- > 0; ) { |
290 |
|
bo_getvec(vout, j+(n+frandom())/npsamps, abp); |
291 |
|
fi_getvec(vin, i+urand(n), abp); |
292 |
< |
ec = SDevalBSDF(&sdv, vout, vin, &bsd); |
292 |
> |
ec = SDevalBSDF(&sdv, vin, vout, &bsd); |
293 |
|
if (ec != SDEnone) |
294 |
|
goto err; |
295 |
|
sum += sdv.cieY; |
338 |
|
for (n = npsamps; n-- > 0; ) { |
339 |
|
fo_getvec(vout, j+(n+frandom())/npsamps, abp); |
340 |
|
bi_getvec(vin, i+urand(n), abp); |
341 |
< |
ec = SDevalBSDF(&sdv, vout, vin, &bsd); |
341 |
> |
ec = SDevalBSDF(&sdv, vin, vout, &bsd); |
342 |
|
if (ec != SDEnone) |
343 |
|
goto err; |
344 |
|
sum += sdv.cieY; |
617 |
|
char buf[1024]; |
618 |
|
char *cp; |
619 |
|
int i, na; |
620 |
< |
|
621 |
< |
progname = argv[0]; |
620 |
> |
/* set global progname */ |
621 |
> |
fixargv0(argv[0]); |
622 |
|
esupport |= E_VARIABLE|E_FUNCTION|E_RCONST; |
623 |
|
esupport &= ~(E_INCHAN|E_OUTCHAN); |
624 |
|
scompile("PI:3.14159265358979323846", NULL, 0); |
635 |
|
single_plane_incident = 0; |
636 |
|
break; |
637 |
|
case 'f': |
638 |
< |
if (!argv[i][2]) { |
638 |
> |
if ((argv[i][0] == '-') & !argv[i][2]) { |
639 |
|
if (strchr(argv[++i], '=') != NULL) { |
640 |
|
add_wbsdf("-f", 1); |
641 |
|
add_wbsdf(argv[i], 1); |
696 |
|
fprintf(stderr, "\tor 3 arguments using Dx,Dy,Dz: bsdf(ix,iy,iz)\n"); |
697 |
|
goto userr; |
698 |
|
} |
699 |
+ |
doptimize(1); /* optimize definitions */ |
700 |
|
++eclock; |
701 |
|
if (dofwd) { |
702 |
|
input_orient = -1; |