| 196 |
|
for (n = npsamps; n-- > 0; ) { |
| 197 |
|
fo_getvec(vout, j+(n+frandom())/npsamps, abp); |
| 198 |
|
fi_getvec(vin, i+urand(n), abp); |
| 199 |
< |
ec = SDevalBSDF(&sdv, vout, vin, &bsd); |
| 199 |
> |
ec = SDevalBSDF(&sdv, vin, vout, &bsd); |
| 200 |
|
if (ec != SDEnone) |
| 201 |
|
goto err; |
| 202 |
|
sum += sdv.cieY; |
| 245 |
|
for (n = npsamps; n-- > 0; ) { |
| 246 |
|
bo_getvec(vout, j+(n+frandom())/npsamps, abp); |
| 247 |
|
bi_getvec(vin, i+urand(n), abp); |
| 248 |
< |
ec = SDevalBSDF(&sdv, vout, vin, &bsd); |
| 248 |
> |
ec = SDevalBSDF(&sdv, vin, vout, &bsd); |
| 249 |
|
if (ec != SDEnone) |
| 250 |
|
goto err; |
| 251 |
|
sum += sdv.cieY; |
| 277 |
|
} |
| 278 |
|
} |
| 279 |
|
/* front transmission */ |
| 280 |
< |
if (bsd.tf != NULL || bsd.tLamb.cieY > .002) { |
| 280 |
> |
if (bsd.tf != NULL || bsd.tLambFront.cieY > .002) { |
| 281 |
|
input_orient = 1; output_orient = -1; |
| 282 |
|
cfp[CIE_Y] = open_component_file(CIE_Y); |
| 283 |
|
if (bsd.tf != NULL && bsd.tf->comp[0].cspec[2].flags) { |
| 293 |
|
for (n = npsamps; n-- > 0; ) { |
| 294 |
|
bo_getvec(vout, j+(n+frandom())/npsamps, abp); |
| 295 |
|
fi_getvec(vin, i+urand(n), abp); |
| 296 |
< |
ec = SDevalBSDF(&sdv, vout, vin, &bsd); |
| 296 |
> |
ec = SDevalBSDF(&sdv, vin, vout, &bsd); |
| 297 |
|
if (ec != SDEnone) |
| 298 |
|
goto err; |
| 299 |
|
sum += sdv.cieY; |
| 342 |
|
for (n = npsamps; n-- > 0; ) { |
| 343 |
|
fo_getvec(vout, j+(n+frandom())/npsamps, abp); |
| 344 |
|
bi_getvec(vin, i+urand(n), abp); |
| 345 |
< |
ec = SDevalBSDF(&sdv, vout, vin, &bsd); |
| 345 |
> |
ec = SDevalBSDF(&sdv, vin, vout, &bsd); |
| 346 |
|
if (ec != SDEnone) |
| 347 |
|
goto err; |
| 348 |
|
sum += sdv.cieY; |
| 576 |
|
} |
| 577 |
|
#endif |
| 578 |
|
|
| 579 |
< |
#define HEAD_BUFLEN 8192 |
| 579 |
> |
#define HEAD_BUFLEN 10240 |
| 580 |
|
static char head_buf[HEAD_BUFLEN]; |
| 581 |
|
static int cur_headlen = 0; |
| 582 |
|
|
| 618 |
|
main(int argc, char *argv[]) |
| 619 |
|
{ |
| 620 |
|
int dofwd = 0, dobwd = 1; |
| 621 |
< |
char buf[2048]; |
| 621 |
> |
char buf[1024]; |
| 622 |
|
char *cp; |
| 623 |
|
int i, na; |
| 624 |
|
|
| 639 |
|
single_plane_incident = 0; |
| 640 |
|
break; |
| 641 |
|
case 'f': |
| 642 |
< |
if (!argv[i][2]) { |
| 642 |
> |
if ((argv[i][0] == '-') & !argv[i][2]) { |
| 643 |
|
if (strchr(argv[++i], '=') != NULL) { |
| 644 |
|
add_wbsdf("-f", 1); |
| 645 |
|
add_wbsdf(argv[i], 1); |
| 700 |
|
fprintf(stderr, "\tor 3 arguments using Dx,Dy,Dz: bsdf(ix,iy,iz)\n"); |
| 701 |
|
goto userr; |
| 702 |
|
} |
| 703 |
+ |
doptimize(1); /* optimize definitions */ |
| 704 |
|
++eclock; |
| 705 |
|
if (dofwd) { |
| 706 |
|
input_orient = -1; |
| 731 |
|
if (i < argc) { /* open input files if given */ |
| 732 |
|
int nbsdf = 0; |
| 733 |
|
for ( ; i < argc; i++) { /* interpolate each component */ |
| 733 |
– |
char pbuf[256]; |
| 734 |
|
FILE *fpin = fopen(argv[i], "rb"); |
| 735 |
|
if (fpin == NULL) { |
| 736 |
|
fprintf(stderr, "%s: cannot open BSDF interpolant '%s'\n", |
| 737 |
|
progname, argv[i]); |
| 738 |
|
return(1); |
| 739 |
|
} |
| 740 |
< |
sprintf(pbuf, "%s:\n", argv[i]); |
| 741 |
< |
record2header(pbuf); |
| 740 |
> |
sprintf(buf, "%s:\n", argv[i]); |
| 741 |
> |
record2header(buf); |
| 742 |
|
sir_headshare = &record2header; |
| 743 |
|
if (!load_bsdf_rep(fpin)) |
| 744 |
|
return(1); |
| 745 |
|
fclose(fpin); |
| 746 |
|
done_header(); |
| 747 |
< |
sprintf(pbuf, "Interpolating component '%s'", argv[i]); |
| 748 |
< |
prog_start(pbuf); |
| 747 |
> |
sprintf(buf, "Interpolating component '%s'", argv[i]); |
| 748 |
> |
prog_start(buf); |
| 749 |
|
eval_rbf(); |
| 750 |
|
} |
| 751 |
|
return(wrap_up()); |
| 752 |
|
} |
| 753 |
|
SET_FILE_BINARY(stdin); /* load from stdin */ |
| 754 |
+ |
record2header("<stdin>:\n"); |
| 755 |
+ |
sir_headshare = &record2header; |
| 756 |
|
if (!load_bsdf_rep(stdin)) |
| 757 |
|
return(1); |
| 758 |
+ |
done_header(); |
| 759 |
|
prog_start("Interpolating from standard input"); |
| 760 |
|
eval_rbf(); /* resample dist. */ |
| 761 |
|
return(wrap_up()); |