28 |
|
#define averaging (ourweigh != NULL) |
29 |
|
#define blurring (ourbpict != NULL) |
30 |
|
#define usematrix (hasmatrix & !averaging) |
31 |
< |
#define zisnorm ((!usematrix) | (ourview.type != VT_PER)) |
31 |
> |
#define zisnorm (!usematrix | (ourview.type != VT_PER)) |
32 |
|
|
33 |
|
#define MAXWT 1000. /* maximum pixel weight (averaging) */ |
34 |
|
|
64 |
|
VIEW avgview; /* average view for -B option */ |
65 |
|
int nvavg; /* number of views averaged */ |
66 |
|
|
67 |
– |
char *progname; |
68 |
– |
|
67 |
|
int fillo = F_FORE|F_BACK; /* selected fill options */ |
68 |
|
int fillsamp = 0; /* sample separation (0 == inf) */ |
69 |
|
COLR backcolr = BLKCOLR; /* background color */ |
70 |
|
COLOR backcolor = BLKCOLOR; /* background color (float) */ |
71 |
|
double backz = 0.0; /* background z value */ |
72 |
|
int normdist = 1; /* i/o normalized distance? */ |
73 |
< |
char ourfmt[LPICFMT+1] = PICFMT; /* original picture format */ |
73 |
> |
char ourfmt[MAXFMTLEN] = PICFMT; /* original picture format */ |
74 |
|
double ourexp = -1; /* original picture exposure */ |
75 |
|
int expadj = 0; /* exposure adjustment (f-stops) */ |
76 |
|
double rexpadj = 1; /* real exposure adjustment */ |
135 |
|
SET_DEFAULT_BINARY(); |
136 |
|
SET_FILE_BINARY(stdout); |
137 |
|
|
138 |
< |
progname = argv[0]; |
138 |
> |
fixargv0(argv[0]); /* sets global progname */ |
139 |
|
|
140 |
|
for (an = 1; an < argc && argv[an][0] == '-'; an++) { |
141 |
|
rval = getviewopt(&ourview, argc-an, argv+an); |
495 |
|
zin = (float *)malloc(scanlen(&tresolu)*sizeof(float)); |
496 |
|
if (zin == NULL) |
497 |
|
syserror(progname); |
498 |
< |
if ((zfd = open_float_depth(zspec, (long)tresolu.xr*tresolu.yr)) < 0) { |
499 |
< |
double zvalue; |
498 |
> |
if (isflt(zspec)) { /* depth is a constant? */ |
499 |
> |
double zvalue = atof(zspec); |
500 |
|
int x; |
501 |
< |
if (!isflt(zspec) || (zvalue = atof(zspec)) <= 0.0) |
502 |
< |
syserror(zspec); |
501 |
> |
if (zvalue <= 0.0) { |
502 |
> |
fprintf(stderr, "%s: illegal Z-value %s\n", |
503 |
> |
progname, zspec); |
504 |
> |
exit(1); |
505 |
> |
} |
506 |
|
for (x = scanlen(&tresolu); x-- > 0; ) |
507 |
|
zin[x] = zvalue; |
508 |
< |
} |
508 |
> |
zfd = -1; |
509 |
> |
} else if ((zfd = open_float_depth(zspec, (long)tresolu.xr*tresolu.yr)) < 0) |
510 |
> |
exit(1); |
511 |
|
/* compute transferrable perimeter */ |
512 |
|
xlim = (struct bound *)malloc(numscans(&tresolu)*sizeof(struct bound)); |
513 |
|
if (xlim == NULL) |
751 |
|
} |
752 |
|
pos[0] += .5 - ourview.hoff; |
753 |
|
pos[1] += .5 - ourview.voff; |
754 |
+ |
if ((pos[0] < 0) | (pos[0] >= 1-FTINY) | |
755 |
+ |
(pos[1] < 0) | (pos[1] >= 1-FTINY)) |
756 |
+ |
return(0); |
757 |
|
pos[2] -= ourview.vfore; |
758 |
|
} else { |
759 |
|
if (viewray(pt, tdir, &theirview, pos[0], pos[1]) < -FTINY) |
760 |
|
return(0); |
761 |
< |
if ((!normdist) & (theirview.type == VT_PER)) /* adjust */ |
761 |
> |
if (!normdist & (theirview.type == VT_PER)) /* adjust */ |
762 |
|
pos[2] /= DOT(theirview.vdir, tdir); |
763 |
|
pt[0] += tdir[0]*pos[2]; |
764 |
|
pt[1] += tdir[1]*pos[2]; |
765 |
|
pt[2] += tdir[2]*pos[2]; |
766 |
< |
if (viewloc(pos, &ourview, pt) <= 0) |
766 |
> |
if (viewloc(pos, &ourview, pt) != VL_GOOD) |
767 |
|
return(0); |
768 |
|
} |
763 |
– |
if ((pos[0] < 0) | (pos[0] >= 1-FTINY) | (pos[1] < 0) | (pos[1] >= 1-FTINY)) |
764 |
– |
return(0); |
769 |
|
if (!averaging) |
770 |
|
return(1); |
771 |
|
/* compute pixel weight */ |
1244 |
|
} |
1245 |
|
/* mark end and get results */ |
1246 |
|
memset((char *)fbp, '\0', 6*sizeof(float)); |
1247 |
< |
if (process(&PDesc, (char *)fbuf, (char *)fbuf, |
1247 |
> |
if (process(&PDesc, fbuf, fbuf, |
1248 |
|
4*sizeof(float)*(queuesiz+1), |
1249 |
|
6*sizeof(float)*(queuesiz+1)) != |
1250 |
|
4*sizeof(float)*(queuesiz+1)) { |