33 |
|
double dstrsrc = 0.0; /* square source distribution */ |
34 |
|
double shadthresh = .1; /* shadow threshold */ |
35 |
|
double shadcert = .25; /* shadow certainty */ |
36 |
+ |
int directrelay = 0; /* number of source relays */ |
37 |
+ |
int vspretest = 128; /* virtual source pretest density */ |
38 |
+ |
int directinvis = 0; /* sources invisible? */ |
39 |
+ |
double srcsizerat = 0.; /* maximum ratio source size/dist. */ |
40 |
|
|
41 |
|
int maxdepth = 4; /* maximum recursion depth */ |
42 |
|
double minweight = 1e-2; /* minimum ray weight */ |
63 |
|
|
64 |
|
static char *reserve_mem = NULL; /* pre-allocated reserve memory */ |
65 |
|
|
66 |
< |
#define RESERVE_AMT 8192 /* amount of memory to reserve */ |
66 |
> |
#define RESERVE_AMT 32768 /* amount of memory to reserve */ |
67 |
|
|
68 |
< |
#define CTRL(c) ('c'-'@') |
68 |
> |
#define CTRL(c) ((c)-'@') |
69 |
|
|
70 |
|
|
71 |
|
quit(code) /* quit program */ |
170 |
|
char *prompt; |
171 |
|
{ |
172 |
|
#define badcom(s) strncmp(s, inpbuf, args-inpbuf-1) |
169 |
– |
double atof(); |
173 |
|
char inpbuf[256]; |
174 |
|
char *args; |
175 |
|
again: |
222 |
|
break; |
223 |
|
case 'm': /* move camera */ |
224 |
|
if (badcom("move")) |
225 |
+ |
#ifdef MSTATS |
226 |
+ |
{ |
227 |
+ |
if (badcom("memory")) |
228 |
+ |
goto commerr; |
229 |
+ |
printmemstats(stderr); |
230 |
+ |
break; |
231 |
+ |
} |
232 |
+ |
#else |
233 |
|
goto commerr; |
234 |
+ |
#endif |
235 |
|
getmove(args); |
236 |
|
break; |
237 |
|
case 'r': /* rotate/repaint */ |
248 |
|
goto commerr; |
249 |
|
getpivot(args); |
250 |
|
break; |
251 |
< |
case CTRL(R): /* redraw */ |
251 |
> |
case CTRL('R'): /* redraw */ |
252 |
|
redraw(); |
253 |
|
break; |
254 |
|
case 'w': /* write */ |
260 |
|
if (badcom("quit")) |
261 |
|
goto commerr; |
262 |
|
quit(0); |
263 |
< |
case CTRL(C): /* interrupt */ |
263 |
> |
case CTRL('C'): /* interrupt */ |
264 |
|
goto again; |
265 |
|
#ifdef SIGTSTP |
266 |
< |
case CTRL(Z): /* stop */ |
266 |
> |
case CTRL('Z'): /* stop */ |
267 |
|
devclose(); |
268 |
|
kill(0, SIGTSTP); |
269 |
|
/* pc stops here */ |
325 |
|
/* sample the image */ |
326 |
|
for (y = 0; /* y < ysiz */ ; y++) { |
327 |
|
for (x = 0; x < xsiz-1; x++) { |
328 |
< |
if (dev->inpready) |
328 |
> |
if (dev->inpready || errno == ENOMEM) |
329 |
|
goto escape; |
330 |
|
/* |
331 |
|
* Test super-pixel to the right. |
341 |
|
if (y >= ysiz-1) |
342 |
|
break; |
343 |
|
for (x = 0; x < xsiz; x++) { |
344 |
< |
if (dev->inpready) |
344 |
> |
if (dev->inpready || errno == ENOMEM) |
345 |
|
goto escape; |
346 |
|
/* |
347 |
|
* Find super-pixel at this position in next row. |
396 |
|
if (p->kid == NULL) { /* subdivide */ |
397 |
|
|
398 |
|
if ((p->kid = newptree()) == NULL) |
399 |
< |
return(growth); |
399 |
> |
return(0); |
400 |
|
/* |
401 |
|
* The following paint order can leave a black pixel |
402 |
|
* when redraw() is called in (*dev->paintr)(). |