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 |
|
|
72 |
|
COLOR backcolor = BLKCOLOR; /* background color (float) */ |
73 |
|
double backz = 0.0; /* background z value */ |
74 |
|
int normdist = 1; /* i/o normalized distance? */ |
75 |
< |
char ourfmt[LPICFMT+1] = PICFMT; /* original picture format */ |
75 |
> |
char ourfmt[MAXFMTLEN] = PICFMT; /* original picture format */ |
76 |
|
double ourexp = -1; /* original picture exposure */ |
77 |
|
int expadj = 0; /* exposure adjustment (f-stops) */ |
78 |
|
double rexpadj = 1; /* real exposure adjustment */ |
361 |
|
void *p |
362 |
|
) |
363 |
|
{ |
364 |
< |
char fmt[32]; |
364 |
> |
char fmt[MAXFMTLEN]; |
365 |
|
|
366 |
|
if (isheadid(s)) |
367 |
|
return(0); |
394 |
|
{ |
395 |
|
char linebuf[256]; |
396 |
|
char *err; |
397 |
< |
register int i; |
397 |
> |
int i; |
398 |
|
|
399 |
|
if (fp != NULL) { |
400 |
|
do /* get new view */ |
431 |
|
static void |
432 |
|
compavgview(void) /* compute average view */ |
433 |
|
{ |
434 |
< |
register int i; |
434 |
> |
int i; |
435 |
|
double f; |
436 |
|
|
437 |
|
if (nvavg < 2) |
497 |
|
zin = (float *)malloc(scanlen(&tresolu)*sizeof(float)); |
498 |
|
if (zin == NULL) |
499 |
|
syserror(progname); |
500 |
< |
if ((zfd = open(zspec, O_RDONLY)) == -1) { |
501 |
< |
double zvalue; |
502 |
< |
register int x; |
503 |
< |
if (!isflt(zspec) || (zvalue = atof(zspec)) <= 0.0) |
504 |
< |
syserror(zspec); |
500 |
> |
if (isflt(zspec)) { /* depth is a constant? */ |
501 |
> |
double zvalue = atof(zspec); |
502 |
> |
int x; |
503 |
> |
if (zvalue <= 0.0) { |
504 |
> |
fprintf(stderr, "%s: illegal Z-value %s\n", |
505 |
> |
progname, zspec); |
506 |
> |
exit(1); |
507 |
> |
} |
508 |
|
for (x = scanlen(&tresolu); x-- > 0; ) |
509 |
|
zin[x] = zvalue; |
510 |
< |
} |
510 |
> |
zfd = -1; |
511 |
> |
} else if ((zfd = open_float_depth(zspec, (long)tresolu.xr*tresolu.yr)) < 0) |
512 |
> |
exit(1); |
513 |
|
/* compute transferrable perimeter */ |
514 |
|
xlim = (struct bound *)malloc(numscans(&tresolu)*sizeof(struct bound)); |
515 |
|
if (xlim == NULL) |
563 |
|
|
564 |
|
static int |
565 |
|
pixform( /* compute view1 to view2 matrix */ |
566 |
< |
register MAT4 xfmat, |
567 |
< |
register VIEW *vw1, |
568 |
< |
register VIEW *vw2 |
566 |
> |
MAT4 xfmat, |
567 |
> |
VIEW *vw1, |
568 |
> |
VIEW *vw2 |
569 |
|
) |
570 |
|
{ |
571 |
< |
double m4t[4][4]; |
571 |
> |
MAT4 m4t; |
572 |
|
|
573 |
|
if ((vw1->type != VT_PER) & (vw1->type != VT_PAR)) |
574 |
|
return(0); |
617 |
|
FVECT pos; |
618 |
|
struct position lastx, newpos; |
619 |
|
double wt; |
620 |
< |
register int x; |
620 |
> |
int x; |
621 |
|
|
622 |
|
lastx.z = 0; |
623 |
|
for (x = xl->max; x >= xl->min; x--) { |
655 |
|
int l1, l2, c1, c2; /* side lengths and counters */ |
656 |
|
int p1isy; /* p0p1 along y? */ |
657 |
|
int x1, y1; /* p1 position */ |
658 |
< |
register int x, y; /* final position */ |
658 |
> |
int x, y; /* final position */ |
659 |
|
|
660 |
|
/* compute vector p0p1 */ |
661 |
|
if (fillo&F_FORE && ABS(p1->z-p0->z) <= zt) { |
722 |
|
|
723 |
|
static double |
724 |
|
movepixel( /* reposition image point */ |
725 |
< |
register FVECT pos |
725 |
> |
FVECT pos |
726 |
|
) |
727 |
|
{ |
728 |
|
FVECT pt, tdir, odir; |
753 |
|
} |
754 |
|
pos[0] += .5 - ourview.hoff; |
755 |
|
pos[1] += .5 - ourview.voff; |
756 |
+ |
if ((pos[0] < 0) | (pos[0] >= 1-FTINY) | |
757 |
+ |
(pos[1] < 0) | (pos[1] >= 1-FTINY)) |
758 |
+ |
return(0); |
759 |
|
pos[2] -= ourview.vfore; |
760 |
|
} else { |
761 |
|
if (viewray(pt, tdir, &theirview, pos[0], pos[1]) < -FTINY) |
762 |
|
return(0); |
763 |
< |
if ((!normdist) & (theirview.type == VT_PER)) /* adjust */ |
764 |
< |
pos[2] *= sqrt(1. + pos[0]*pos[0]*theirview.hn2 |
757 |
< |
+ pos[1]*pos[1]*theirview.vn2); |
763 |
> |
if (!normdist & (theirview.type == VT_PER)) /* adjust */ |
764 |
> |
pos[2] /= DOT(theirview.vdir, tdir); |
765 |
|
pt[0] += tdir[0]*pos[2]; |
766 |
|
pt[1] += tdir[1]*pos[2]; |
767 |
|
pt[2] += tdir[2]*pos[2]; |
768 |
< |
viewloc(pos, &ourview, pt); |
762 |
< |
if (pos[2] <= 0) |
768 |
> |
if (viewloc(pos, &ourview, pt) != VL_GOOD) |
769 |
|
return(0); |
770 |
|
} |
765 |
– |
if ((pos[0] < 0) | (pos[0] >= 1-FTINY) | (pos[1] < 0) | (pos[1] >= 1-FTINY)) |
766 |
– |
return(0); |
771 |
|
if (!averaging) |
772 |
|
return(1); |
773 |
|
/* compute pixel weight */ |
787 |
|
|
788 |
|
static int |
789 |
|
getperim( /* compute overlapping image area */ |
790 |
< |
register struct bound *xl, |
790 |
> |
struct bound *xl, |
791 |
|
struct bound *yl, |
792 |
|
float *zline, |
793 |
|
int zfd |
795 |
|
{ |
796 |
|
int step; |
797 |
|
FVECT pos; |
798 |
< |
register int x, y; |
798 |
> |
int x, y; |
799 |
|
/* set up step size */ |
800 |
|
if (scanlen(&tresolu) < numscans(&tresolu)) |
801 |
|
step = scanlen(&tresolu)/NSTEPS; |
879 |
|
{ |
880 |
|
int *yback, xback; |
881 |
|
int y; |
882 |
< |
register int x, i; |
882 |
> |
int x, i; |
883 |
|
/* get back buffer */ |
884 |
|
yback = (int *)malloc(hresolu*sizeof(int)); |
885 |
|
if (yback == NULL) |
986 |
|
fillfunc_t *fill |
987 |
|
) |
988 |
|
{ |
989 |
< |
register int x, y; |
989 |
> |
int x, y; |
990 |
|
|
991 |
|
for (y = 0; y < vresolu; y++) |
992 |
|
for (x = 0; x < hresolu; x++) |
1000 |
|
static int |
1001 |
|
clipaft(void) /* perform aft clipping as indicated */ |
1002 |
|
{ |
1003 |
< |
register int x, y; |
1003 |
> |
int x, y; |
1004 |
|
int adjtest = (ourview.type == VT_PER) & zisnorm; |
1005 |
|
double tstdist; |
1006 |
|
double yzn2, vx; |
1039 |
|
{ |
1040 |
|
COLOR cval; |
1041 |
|
double d; |
1042 |
< |
register int i; |
1042 |
> |
int i; |
1043 |
|
|
1044 |
|
if (!blurring) |
1045 |
|
return(0); |
1079 |
|
writepicture(void) /* write out picture (alters buffer) */ |
1080 |
|
{ |
1081 |
|
int y; |
1082 |
< |
register int x; |
1082 |
> |
int x; |
1083 |
|
double d; |
1084 |
|
|
1085 |
|
fprtresolu(hresolu, vresolu, stdout); |
1122 |
|
for (y = vresolu-1; y >= 0; y--) { |
1123 |
|
if (donorm) { |
1124 |
|
double vx, yzn2, d; |
1125 |
< |
register int x; |
1125 |
> |
int x; |
1126 |
|
yzn2 = (y+.5)/vresolu + ourview.voff - .5; |
1127 |
|
yzn2 = 1. + yzn2*yzn2*ourview.vn2; |
1128 |
|
for (x = 0; x < hresolu; x++) { |
1166 |
|
char combuf[512]; |
1167 |
|
char *argv[64]; |
1168 |
|
int rval; |
1169 |
< |
register char **wp, *cp; |
1169 |
> |
char **wp, *cp; |
1170 |
|
|
1171 |
< |
if (PDesc.running) { |
1171 |
> |
if (PDesc.flags & PF_RUNNING) { |
1172 |
|
fprintf(stderr, "%s: too many calculations\n", progname); |
1173 |
|
exit(1); |
1174 |
|
} |
1203 |
|
static void |
1204 |
|
caldone(void) /* done with calculation */ |
1205 |
|
{ |
1206 |
< |
if (!PDesc.running) |
1206 |
> |
if (!(PDesc.flags & PF_RUNNING)) |
1207 |
|
return; |
1208 |
|
clearqueue(); |
1209 |
|
close_process(&PDesc); |
1230 |
|
{ |
1231 |
|
FVECT orig, dir; |
1232 |
|
float fbuf[6*(PACKSIZ+1)]; |
1233 |
< |
register float *fbp; |
1234 |
< |
register int i; |
1233 |
> |
float *fbp; |
1234 |
> |
int i; |
1235 |
|
double vx, vy; |
1236 |
|
|
1237 |
|
if (queuesiz == 0) |