1 |
< |
/* Copyright (c) 1992 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1995 Regents of the University of California */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
38 |
|
int directvis = 1; /* sources visible? */ |
39 |
|
double srcsizerat = 0.; /* maximum ratio source size/dist. */ |
40 |
|
|
41 |
+ |
COLOR cextinction = BLKCOLOR; /* global extinction coefficient */ |
42 |
+ |
double salbedo = 0.; /* global scattering albedo */ |
43 |
+ |
double seccg = 0.; /* global scattering eccentricity */ |
44 |
+ |
double ssampdist = 0.; /* scatter sampling distance */ |
45 |
+ |
|
46 |
|
double specthresh = .3; /* specular sampling threshold */ |
47 |
|
double specjitter = 1.; /* specular sampling jitter */ |
48 |
|
|
49 |
+ |
int backvis = 1; /* back face visibility */ |
50 |
+ |
|
51 |
|
int maxdepth = 4; /* maximum recursion depth */ |
52 |
|
double minweight = 1e-2; /* minimum ray weight */ |
53 |
|
|
54 |
|
COLOR ambval = BLKCOLOR; /* ambient value */ |
55 |
+ |
int ambvwt = 0; /* initial weight for ambient value */ |
56 |
|
double ambacc = 0.2; /* ambient accuracy */ |
57 |
|
int ambres = 8; /* ambient resolution */ |
58 |
|
int ambdiv = 32; /* ambient divisions */ |
66 |
|
|
67 |
|
struct driver *dev = NULL; /* driver functions */ |
68 |
|
|
69 |
+ |
char rifname[128]; /* rad input file name */ |
70 |
+ |
|
71 |
|
VIEW oldview; /* previous view parameters */ |
72 |
|
|
73 |
|
PNODE ptrunk; /* the base of our image */ |
84 |
|
quit(code) /* quit program */ |
85 |
|
int code; |
86 |
|
{ |
87 |
+ |
#ifdef MSTATS |
88 |
+ |
if (code == 2 && errno == ENOMEM) |
89 |
+ |
printmemstats(stderr); |
90 |
+ |
#endif |
91 |
|
devclose(); |
92 |
|
exit(code); |
93 |
|
} |
199 |
|
else *++args = '\0'; |
200 |
|
|
201 |
|
switch (inpbuf[0]) { |
202 |
< |
case 'f': /* new frame */ |
203 |
< |
if (badcom("frame")) |
204 |
< |
goto commerr; |
202 |
> |
case 'f': /* new frame (or free mem.) */ |
203 |
> |
if (badcom("frame")) { |
204 |
> |
if (badcom("free")) |
205 |
> |
goto commerr; |
206 |
> |
free_objmem(); |
207 |
> |
break; |
208 |
> |
} |
209 |
|
getframe(args); |
210 |
|
break; |
211 |
|
case 'v': /* view */ |
218 |
|
goto commerr; |
219 |
|
lastview(args); |
220 |
|
break; |
221 |
+ |
case 'V': /* save view */ |
222 |
+ |
if (badcom("V")) |
223 |
+ |
goto commerr; |
224 |
+ |
saveview(args); |
225 |
+ |
break; |
226 |
+ |
case 'L': /* load view */ |
227 |
+ |
if (badcom("L")) |
228 |
+ |
goto commerr; |
229 |
+ |
loadview(args); |
230 |
+ |
break; |
231 |
|
case 'e': /* exposure */ |
232 |
|
if (badcom("exposure")) |
233 |
|
goto commerr; |
234 |
|
getexposure(args); |
235 |
|
break; |
236 |
|
case 's': /* set a parameter */ |
237 |
< |
if (badcom("set")) |
237 |
> |
if (badcom("set")) { |
238 |
> |
#ifdef SIGTSTP |
239 |
> |
if (!badcom("stop")) |
240 |
> |
goto dostop; |
241 |
> |
#endif |
242 |
|
goto commerr; |
243 |
+ |
} |
244 |
|
setparam(args); |
245 |
|
break; |
246 |
|
case 'n': /* new picture */ |
258 |
|
goto commerr; |
259 |
|
getaim(args); |
260 |
|
break; |
261 |
< |
case 'm': /* move camera */ |
261 |
> |
case 'm': /* move camera (or memstats) */ |
262 |
|
if (badcom("move")) |
263 |
|
#ifdef MSTATS |
264 |
|
{ |
274 |
|
break; |
275 |
|
case 'r': /* rotate/repaint */ |
276 |
|
if (badcom("rotate")) { |
277 |
< |
if (badcom("repaint")) |
278 |
< |
goto commerr; |
277 |
> |
if (badcom("repaint")) { |
278 |
> |
if (badcom("redraw")) |
279 |
> |
goto commerr; |
280 |
> |
redraw(); |
281 |
> |
break; |
282 |
> |
} |
283 |
|
getrepaint(args); |
284 |
|
break; |
285 |
|
} |
286 |
|
getrotate(args); |
287 |
|
break; |
288 |
|
case 'p': /* pivot view */ |
289 |
< |
if (badcom("pivot")) |
290 |
< |
goto commerr; |
289 |
> |
if (badcom("pivot")) { |
290 |
> |
if (badcom("pause")) |
291 |
> |
goto commerr; |
292 |
> |
goto again; |
293 |
> |
} |
294 |
|
getpivot(args); |
295 |
|
break; |
296 |
|
case CTRL('R'): /* redraw */ |
308 |
|
case CTRL('C'): /* interrupt */ |
309 |
|
goto again; |
310 |
|
#ifdef SIGTSTP |
311 |
< |
case CTRL('Z'): /* stop */ |
311 |
> |
case CTRL('Z'):; /* stop */ |
312 |
> |
dostop: |
313 |
|
devclose(); |
314 |
|
kill(0, SIGTSTP); |
315 |
|
/* pc stops here */ |
348 |
|
* difference, we subsample the super-pixels. The testing process |
349 |
|
* includes initialization of the next row. |
350 |
|
*/ |
351 |
< |
xsiz = (((pframe.r-pframe.l)<<pdepth)+hresolu-1) / hresolu; |
352 |
< |
ysiz = (((pframe.u-pframe.d)<<pdepth)+vresolu-1) / vresolu; |
351 |
> |
xsiz = (((long)(pframe.r-pframe.l)<<pdepth)+hresolu-1) / hresolu; |
352 |
> |
ysiz = (((long)(pframe.u-pframe.d)<<pdepth)+vresolu-1) / vresolu; |
353 |
|
rl = (RECT *)malloc(xsiz*sizeof(RECT)); |
354 |
|
if (rl == NULL) |
355 |
|
return; |