--- ray/src/rt/rpict.c 1991/06/24 16:10:46 1.28 +++ ray/src/rt/rpict.c 1991/09/19 13:55:53 1.32 @@ -41,7 +41,8 @@ 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 = 128; /* virtual source pretest density */ +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 */ @@ -166,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; @@ -187,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)) @@ -201,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) { @@ -353,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 */ @@ -412,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)); }