--- ray/src/px/pinterp.c 1995/09/15 22:04:04 2.25 +++ ray/src/px/pinterp.c 1997/10/20 16:36:32 2.30 @@ -39,7 +39,7 @@ static char SCCSid[] = "$SunId$ LBL"; #define PACKSIZ 256 /* max. calculation packet size */ -#define RTCOM "rtrace -h- -ovl -fff " +#define RTCOM "rtrace -h- -ovl -fff -ld- -i- -I- " #define ABS(x) ((x)>0?(x):-(x)) @@ -76,6 +76,7 @@ COLR backcolr = BLKCOLR; /* background color */ COLOR backcolor = BLKCOLOR; /* background color (float) */ double backz = 0.0; /* background z value */ int normdist = 1; /* i/o normalized distance? */ +char ourfmt[LPICFMT+1] = PICFMT; /* original picture format */ double ourexp = -1; /* original picture exposure */ int expadj = 0; /* exposure adjustment (f-stops) */ double rexpadj = 1; /* real exposure adjustment */ @@ -92,7 +93,7 @@ int PDesc[3] = {-1,-1,-1}; /* rtrace process descript #define childpid (PDesc[2]) unsigned short queue[PACKSIZ][2]; /* pending pixels */ int packsiz; /* actual packet size */ -int queuesiz; /* number of pixels pending */ +int queuesiz = 0; /* number of pixels pending */ extern double movepixel(); @@ -251,7 +252,7 @@ char *argv[]; rexpadj = pow(2.0, (double)expadj); } /* set view */ - if (nextview(doblur ? stdin : NULL) == EOF) { + if (nextview(doblur ? stdin : (FILE *)NULL) == EOF) { fprintf(stderr, "%s: no view on standard input!\n", progname); exit(1); @@ -308,7 +309,8 @@ char *argv[]; ourexp = rexpadj; if (ourexp < .995 | ourexp > 1.005) fputexpos(ourexp, stdout); - fputformat(COLRFMT, stdout); + if (strcmp(ourfmt, PICFMT)) /* print format if known */ + fputformat(ourfmt, stdout); putc('\n', stdout); /* write picture */ writepicture(); @@ -334,7 +336,11 @@ char *s; if (isheadid(s)) return; if (formatval(fmt, s)) { - wrongformat = strcmp(fmt, COLRFMT); + if (globmatch(ourfmt, fmt)) { + wrongformat = 0; + strcpy(ourfmt, fmt); + } else + wrongformat = 1; return; } if (nvavg < 2) { @@ -924,6 +930,8 @@ int (*fill)(); for (x = 0; x < hresolu; x++) if (zscan(y)[x] <= 0) (*fill)(x,y); + if (fill == rcalfill) + clearqueue(); } @@ -1161,9 +1169,9 @@ clearqueue() /* process queue */ } /* mark end and get results */ bzero((char *)fbp, 6*sizeof(float)); - if (process(PDesc, fbuf, fbuf, 4*sizeof(float)*queuesiz, + if (process(PDesc, fbuf, fbuf, 4*sizeof(float)*(queuesiz+1), 6*sizeof(float)*(queuesiz+1)) != - 4*sizeof(float)*queuesiz) { + 4*sizeof(float)*(queuesiz+1)) { fprintf(stderr, "%s: error reading from rtrace process\n", progname); exit(1); @@ -1178,7 +1186,7 @@ clearqueue() /* process queue */ if (averaging) { setcolor(sscan(queue[i][1])[queue[i][0]], fbp[0], fbp[1], fbp[2]); - wscan(queue[i][1])[queue[i][0]] = MAXWT; + wscan(queue[i][1])[queue[i][0]] = 1; } else setcolr(pscan(queue[i][1])[queue[i][0]], fbp[0], fbp[1], fbp[2]);