25 |
|
#define sscanvec(s,v) (sscanf(s,"%lf %lf %lf",v,v+1,v+2)==3) |
26 |
|
#endif |
27 |
|
|
28 |
< |
static int niflush; /* flushes since newimage() */ |
28 |
> |
static unsigned long niflush; /* flushes since newimage() */ |
29 |
|
|
30 |
|
int |
31 |
|
getrect( /* get a box */ |
155 |
|
extern int ray_pnprocs; |
156 |
|
static unsigned long lastflush = 0; |
157 |
|
static RAY thisray; |
158 |
+ |
int flushintvl; |
159 |
|
double h, v; |
160 |
|
|
161 |
|
if (p->xmax - p->xmin <= 0 || p->ymax - p->ymin <= 0) { /* empty */ |
186 |
|
copycolor(p->v, thisray.rcol); |
187 |
|
scalecolor(p->v, exposure); |
188 |
|
|
189 |
+ |
while (p->kid != NULL) { /* need to propogate down */ |
190 |
+ |
int mx = (p->xmin + p->xmax) >> 1; |
191 |
+ |
int my = (p->ymin + p->ymax) >> 1; |
192 |
+ |
int ki; |
193 |
+ |
if (p->x >= mx) |
194 |
+ |
ki = (p->y >= my) ? UR : DR; |
195 |
+ |
else |
196 |
+ |
ki = (p->y >= my) ? UL : DL; |
197 |
+ |
pcopy(p, p->kid+ki); |
198 |
+ |
p = p->kid + ki; |
199 |
+ |
} |
200 |
+ |
|
201 |
|
(*dev->paintr)(greyscale?greyof(p->v):p->v, |
202 |
|
p->xmin, p->ymin, p->xmax, p->ymax); |
203 |
|
|
204 |
< |
if (dev->flush != NULL && raynum - lastflush >= ray_pnprocs * |
205 |
< |
(ambounce > 0 && niflush < WFLUSH ? niflush : WFLUSH)) { |
204 |
> |
if (ambounce <= 0) /* shall we check for input? */ |
205 |
> |
flushintvl = ray_pnprocs*WFLUSH; |
206 |
> |
else if (niflush < WFLUSH) |
207 |
> |
flushintvl = ray_pnprocs*niflush/(ambounce+1); |
208 |
> |
else |
209 |
> |
flushintvl = ray_pnprocs*WFLUSH/(ambounce+1); |
210 |
> |
|
211 |
> |
if (dev->flush != NULL && raynum - lastflush >= flushintvl) { |
212 |
|
lastflush = raynum; |
213 |
|
(*dev->flush)(); |
214 |
|
niflush++; |
218 |
|
|
219 |
|
|
220 |
|
int |
221 |
< |
waitrays(void) /* finish up pending rays */ |
221 |
> |
waitrays(void) /* finish up pending rays */ |
222 |
|
{ |
223 |
|
int nwaited = 0; |
224 |
|
int rval; |