--- ray/src/rt/rpict.c 1991/06/18 10:27:16 1.26 +++ ray/src/rt/rpict.c 1991/09/19 13:55:53 1.32 @@ -40,6 +40,9 @@ double dstrpix = 0.67; /* square pixel distribution double dstrsrc = 0.0; /* square source distribution */ double shadthresh = .05; /* shadow threshold */ double shadcert = .5; /* shadow certainty */ +int directrelay = 0; /* number of source relays */ +int vspretest = 512; /* virtual source pretest density */ +int directinvis = 0; /* sources invisible? */ int maxdepth = 6; /* maximum recursion depth */ double minweight = 5e-3; /* minimum ray weight */ @@ -164,6 +167,10 @@ char *zfile, *oldfile; pctdone = 100.0*i/vresolu; if (ralrm > 0) /* report init stats */ report(); +#ifndef BSD + else +#endif + signal(SIGALRM, report); ypos = vresolu-1 - i; fillscanline(scanbar[0], zbar[0], hresolu, ypos, psample); ystep = psample; @@ -185,6 +192,9 @@ char *zfile, *oldfile; /* fill bar */ fillscanbar(scanbar, zbar, hresolu, ypos, ystep); /* write it out */ +#ifndef BSD + signal(SIGALRM, SIG_IGN); /* don't interrupt writes */ +#endif for (i = ystep; i > 0; i--) { if (zfd != -1 && write(zfd, (char *)zbar[i], hresolu*sizeof(float)) @@ -199,6 +209,10 @@ char *zfile, *oldfile; pctdone = 100.0*(vresolu-1-ypos)/vresolu; if (ralrm > 0 && time((long *)0) >= tlastrept+ralrm) report(); +#ifndef BSD + else + signal(SIGALRM, report); +#endif } /* clean up */ if (zfd != -1) { @@ -351,7 +365,7 @@ int x, y; /* pixel position */ rayorigin(&thisray, NULL, PRIMARY, 1.0); - samplendx = 3*y + x; /* set pixel index */ + samplendx = pixnumber(x,y,hresolu,vresolu); /* set pixel index */ rayvalue(&thisray); /* trace ray */ @@ -410,4 +424,16 @@ char *oldfile; return(y); writerr: error(SYSTEM, "write error in salvage"); +} + + +int +pixnumber(x, y, xres, yres) /* compute pixel index (brushed) */ +register int x, y; +int xres, yres; +{ + x -= y; + while (x < 0) + x += xres; + return((((x>>2)*yres + y) << 2) + (x & 3)); }