15 |
|
#ifdef BSD |
16 |
|
#include <sys/time.h> |
17 |
|
#include <sys/resource.h> |
18 |
– |
#else |
19 |
– |
#include <signal.h> |
18 |
|
#endif |
19 |
+ |
|
20 |
+ |
#include <signal.h> |
21 |
|
#include <fcntl.h> |
22 |
|
|
23 |
|
#include "view.h" |
40 |
|
double dstrsrc = 0.0; /* square source distribution */ |
41 |
|
double shadthresh = .05; /* shadow threshold */ |
42 |
|
double shadcert = .5; /* shadow certainty */ |
43 |
< |
int directrelay = 0; /* number of source relays */ |
43 |
> |
int directrelay = 1; /* number of source relays */ |
44 |
|
int vspretest = 512; /* virtual source pretest density */ |
45 |
|
int directinvis = 0; /* sources invisible? */ |
46 |
+ |
double srcsizerat = .25; /* maximum ratio source size/dist. */ |
47 |
|
|
48 |
|
int maxdepth = 6; /* maximum recursion depth */ |
49 |
|
double minweight = 5e-3; /* minimum ray weight */ |
123 |
|
float *zbar[MAXDIV+1]; /* z values */ |
124 |
|
int ypos; /* current scanline */ |
125 |
|
int ystep; /* current y step size */ |
126 |
+ |
int hstep; /* h step size */ |
127 |
|
int zfd; |
128 |
|
COLOR *colptr; |
129 |
|
float *zptr; |
169 |
|
pctdone = 100.0*i/vresolu; |
170 |
|
if (ralrm > 0) /* report init stats */ |
171 |
|
report(); |
172 |
+ |
#ifndef BSD |
173 |
+ |
else |
174 |
+ |
#endif |
175 |
+ |
signal(SIGALRM, report); |
176 |
|
ypos = vresolu-1 - i; |
177 |
< |
fillscanline(scanbar[0], zbar[0], hresolu, ypos, psample); |
178 |
< |
ystep = psample; |
177 |
> |
hstep = (psample*140+49)/99; /* quincunx sampling */ |
178 |
> |
ystep = (psample*99+70)/140; |
179 |
> |
fillscanline(scanbar[0], zbar[0], hresolu, ypos, hstep); |
180 |
|
/* compute scanlines */ |
181 |
|
for (ypos -= ystep; ypos > -ystep; ypos -= ystep) { |
182 |
|
/* bottom adjust? */ |
191 |
|
zbar[ystep] = zbar[0]; |
192 |
|
zbar[0] = zptr; |
193 |
|
/* fill base line */ |
194 |
< |
fillscanline(scanbar[0], zbar[0], hresolu, ypos, psample); |
194 |
> |
fillscanline(scanbar[0], zbar[0], hresolu, ypos, hstep); |
195 |
|
/* fill bar */ |
196 |
|
fillscanbar(scanbar, zbar, hresolu, ypos, ystep); |
197 |
|
/* write it out */ |
198 |
+ |
#ifndef BSD |
199 |
+ |
signal(SIGALRM, SIG_IGN); /* don't interrupt writes */ |
200 |
+ |
#endif |
201 |
|
for (i = ystep; i > 0; i--) { |
202 |
|
if (zfd != -1 && write(zfd, (char *)zbar[i], |
203 |
|
hresolu*sizeof(float)) |
212 |
|
pctdone = 100.0*(vresolu-1-ypos)/vresolu; |
213 |
|
if (ralrm > 0 && time((long *)0) >= tlastrept+ralrm) |
214 |
|
report(); |
215 |
+ |
#ifndef BSD |
216 |
+ |
else |
217 |
+ |
signal(SIGALRM, report); |
218 |
+ |
#endif |
219 |
|
} |
220 |
|
/* clean up */ |
221 |
|
if (zfd != -1) { |
246 |
|
register float *zline; |
247 |
|
int xres, y, xstep; |
248 |
|
{ |
249 |
+ |
static int nc = 0; /* number of calls */ |
250 |
|
int b = xstep; |
251 |
|
double z; |
252 |
|
register int i; |
253 |
|
|
254 |
|
z = pixvalue(scanline[0], 0, y); |
255 |
|
if (zline) zline[0] = z; |
256 |
< |
|
257 |
< |
for (i = xstep; i < xres-1+xstep; i += xstep) { |
256 |
> |
/* zig-zag start for quincunx pattern */ |
257 |
> |
for (i = nc++ & 1 ? xstep/2 : xstep; i < xres-1+xstep; i += xstep) { |
258 |
|
if (i >= xres) { |
259 |
|
xstep += xres-1-i; |
260 |
|
i = xres-1; |