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? */ |
38 |
> |
int directvis = 1; /* sources visible? */ |
39 |
|
double srcsizerat = 0.; /* maximum ratio source size/dist. */ |
40 |
|
|
41 |
|
double specthresh = .3; /* specular sampling threshold */ |
58 |
|
|
59 |
|
struct driver *dev = NULL; /* driver functions */ |
60 |
|
|
61 |
+ |
char rifname[128]; /* rad input file name */ |
62 |
+ |
|
63 |
|
VIEW oldview; /* previous view parameters */ |
64 |
|
|
65 |
|
PNODE ptrunk; /* the base of our image */ |
76 |
|
quit(code) /* quit program */ |
77 |
|
int code; |
78 |
|
{ |
79 |
+ |
#ifdef MSTATS |
80 |
+ |
if (code == 2 && errno == ENOMEM) |
81 |
+ |
printmemstats(stderr); |
82 |
+ |
#endif |
83 |
|
devclose(); |
84 |
|
exit(code); |
85 |
|
} |
191 |
|
else *++args = '\0'; |
192 |
|
|
193 |
|
switch (inpbuf[0]) { |
194 |
< |
case 'f': /* new frame */ |
195 |
< |
if (badcom("frame")) |
196 |
< |
goto commerr; |
194 |
> |
case 'f': /* new frame (or free mem.) */ |
195 |
> |
if (badcom("frame")) { |
196 |
> |
if (badcom("free")) |
197 |
> |
goto commerr; |
198 |
> |
free_objmem(); |
199 |
> |
break; |
200 |
> |
} |
201 |
|
getframe(args); |
202 |
|
break; |
203 |
|
case 'v': /* view */ |
210 |
|
goto commerr; |
211 |
|
lastview(args); |
212 |
|
break; |
213 |
+ |
case 'V': /* save view */ |
214 |
+ |
if (badcom("V")) |
215 |
+ |
goto commerr; |
216 |
+ |
saveview(args); |
217 |
+ |
break; |
218 |
+ |
case 'L': /* load view */ |
219 |
+ |
if (badcom("L")) |
220 |
+ |
goto commerr; |
221 |
+ |
loadview(args); |
222 |
+ |
break; |
223 |
|
case 'e': /* exposure */ |
224 |
|
if (badcom("exposure")) |
225 |
|
goto commerr; |
226 |
|
getexposure(args); |
227 |
|
break; |
228 |
|
case 's': /* set a parameter */ |
229 |
< |
if (badcom("set")) |
229 |
> |
if (badcom("set")) { |
230 |
> |
#ifdef SIGTSTP |
231 |
> |
if (!badcom("stop")) |
232 |
> |
goto dostop; |
233 |
> |
#endif |
234 |
|
goto commerr; |
235 |
+ |
} |
236 |
|
setparam(args); |
237 |
|
break; |
238 |
|
case 'n': /* new picture */ |
250 |
|
goto commerr; |
251 |
|
getaim(args); |
252 |
|
break; |
253 |
< |
case 'm': /* move camera */ |
253 |
> |
case 'm': /* move camera (or memstats) */ |
254 |
|
if (badcom("move")) |
255 |
|
#ifdef MSTATS |
256 |
|
{ |
266 |
|
break; |
267 |
|
case 'r': /* rotate/repaint */ |
268 |
|
if (badcom("rotate")) { |
269 |
< |
if (badcom("repaint")) |
270 |
< |
goto commerr; |
269 |
> |
if (badcom("repaint")) { |
270 |
> |
if (badcom("redraw")) |
271 |
> |
goto commerr; |
272 |
> |
redraw(); |
273 |
> |
break; |
274 |
> |
} |
275 |
|
getrepaint(args); |
276 |
|
break; |
277 |
|
} |
278 |
|
getrotate(args); |
279 |
|
break; |
280 |
|
case 'p': /* pivot view */ |
281 |
< |
if (badcom("pivot")) |
282 |
< |
goto commerr; |
281 |
> |
if (badcom("pivot")) { |
282 |
> |
if (badcom("pause")) |
283 |
> |
goto commerr; |
284 |
> |
goto again; |
285 |
> |
} |
286 |
|
getpivot(args); |
287 |
|
break; |
288 |
|
case CTRL('R'): /* redraw */ |
300 |
|
case CTRL('C'): /* interrupt */ |
301 |
|
goto again; |
302 |
|
#ifdef SIGTSTP |
303 |
< |
case CTRL('Z'): /* stop */ |
303 |
> |
case CTRL('Z'):; /* stop */ |
304 |
> |
dostop: |
305 |
|
devclose(); |
306 |
|
kill(0, SIGTSTP); |
307 |
|
/* pc stops here */ |
340 |
|
* difference, we subsample the super-pixels. The testing process |
341 |
|
* includes initialization of the next row. |
342 |
|
*/ |
343 |
< |
xsiz = (((pframe.r-pframe.l)<<pdepth)+hresolu-1) / hresolu; |
344 |
< |
ysiz = (((pframe.u-pframe.d)<<pdepth)+vresolu-1) / vresolu; |
343 |
> |
xsiz = (((long)(pframe.r-pframe.l)<<pdepth)+hresolu-1) / hresolu; |
344 |
> |
ysiz = (((long)(pframe.u-pframe.d)<<pdepth)+vresolu-1) / vresolu; |
345 |
|
rl = (RECT *)malloc(xsiz*sizeof(RECT)); |
346 |
|
if (rl == NULL) |
347 |
|
return; |