| 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"; |
| 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 |
+ |
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 |
|
|
| 65 |
|
|
| 66 |
|
struct driver *dev = NULL; /* driver functions */ |
| 67 |
|
|
| 68 |
+ |
char rifname[128]; /* rad input file name */ |
| 69 |
+ |
|
| 70 |
|
VIEW oldview; /* previous view parameters */ |
| 71 |
|
|
| 72 |
|
PNODE ptrunk; /* the base of our image */ |
| 83 |
|
quit(code) /* quit program */ |
| 84 |
|
int code; |
| 85 |
|
{ |
| 86 |
+ |
#ifdef MSTATS |
| 87 |
+ |
if (code == 2 && errno == ENOMEM) |
| 88 |
+ |
printmemstats(stderr); |
| 89 |
+ |
#endif |
| 90 |
|
devclose(); |
| 91 |
|
exit(code); |
| 92 |
|
} |
| 198 |
|
else *++args = '\0'; |
| 199 |
|
|
| 200 |
|
switch (inpbuf[0]) { |
| 201 |
< |
case 'f': /* new frame */ |
| 202 |
< |
if (badcom("frame")) |
| 203 |
< |
goto commerr; |
| 201 |
> |
case 'f': /* new frame (or free mem.) */ |
| 202 |
> |
if (badcom("frame")) { |
| 203 |
> |
if (badcom("free")) |
| 204 |
> |
goto commerr; |
| 205 |
> |
free_objmem(); |
| 206 |
> |
break; |
| 207 |
> |
} |
| 208 |
|
getframe(args); |
| 209 |
|
break; |
| 210 |
|
case 'v': /* view */ |
| 217 |
|
goto commerr; |
| 218 |
|
lastview(args); |
| 219 |
|
break; |
| 220 |
+ |
case 'V': /* save view */ |
| 221 |
+ |
if (badcom("V")) |
| 222 |
+ |
goto commerr; |
| 223 |
+ |
saveview(args); |
| 224 |
+ |
break; |
| 225 |
+ |
case 'L': /* load view */ |
| 226 |
+ |
if (badcom("L")) |
| 227 |
+ |
goto commerr; |
| 228 |
+ |
loadview(args); |
| 229 |
+ |
break; |
| 230 |
|
case 'e': /* exposure */ |
| 231 |
|
if (badcom("exposure")) |
| 232 |
|
goto commerr; |
| 233 |
|
getexposure(args); |
| 234 |
|
break; |
| 235 |
|
case 's': /* set a parameter */ |
| 236 |
< |
if (badcom("set")) |
| 236 |
> |
if (badcom("set")) { |
| 237 |
> |
#ifdef SIGTSTP |
| 238 |
> |
if (!badcom("stop")) |
| 239 |
> |
goto dostop; |
| 240 |
> |
#endif |
| 241 |
|
goto commerr; |
| 242 |
+ |
} |
| 243 |
|
setparam(args); |
| 244 |
|
break; |
| 245 |
|
case 'n': /* new picture */ |
| 257 |
|
goto commerr; |
| 258 |
|
getaim(args); |
| 259 |
|
break; |
| 260 |
< |
case 'm': /* move camera */ |
| 260 |
> |
case 'm': /* move camera (or memstats) */ |
| 261 |
|
if (badcom("move")) |
| 262 |
|
#ifdef MSTATS |
| 263 |
|
{ |
| 273 |
|
break; |
| 274 |
|
case 'r': /* rotate/repaint */ |
| 275 |
|
if (badcom("rotate")) { |
| 276 |
< |
if (badcom("repaint")) |
| 277 |
< |
goto commerr; |
| 276 |
> |
if (badcom("repaint")) { |
| 277 |
> |
if (badcom("redraw")) |
| 278 |
> |
goto commerr; |
| 279 |
> |
redraw(); |
| 280 |
> |
break; |
| 281 |
> |
} |
| 282 |
|
getrepaint(args); |
| 283 |
|
break; |
| 284 |
|
} |
| 285 |
|
getrotate(args); |
| 286 |
|
break; |
| 287 |
|
case 'p': /* pivot view */ |
| 288 |
< |
if (badcom("pivot")) |
| 289 |
< |
goto commerr; |
| 288 |
> |
if (badcom("pivot")) { |
| 289 |
> |
if (badcom("pause")) |
| 290 |
> |
goto commerr; |
| 291 |
> |
goto again; |
| 292 |
> |
} |
| 293 |
|
getpivot(args); |
| 294 |
|
break; |
| 295 |
|
case CTRL('R'): /* redraw */ |
| 307 |
|
case CTRL('C'): /* interrupt */ |
| 308 |
|
goto again; |
| 309 |
|
#ifdef SIGTSTP |
| 310 |
< |
case CTRL('Z'): /* stop */ |
| 310 |
> |
case CTRL('Z'):; /* stop */ |
| 311 |
> |
dostop: |
| 312 |
|
devclose(); |
| 313 |
|
kill(0, SIGTSTP); |
| 314 |
|
/* pc stops here */ |
| 347 |
|
* difference, we subsample the super-pixels. The testing process |
| 348 |
|
* includes initialization of the next row. |
| 349 |
|
*/ |
| 350 |
< |
xsiz = (((pframe.r-pframe.l)<<pdepth)+hresolu-1) / hresolu; |
| 351 |
< |
ysiz = (((pframe.u-pframe.d)<<pdepth)+vresolu-1) / vresolu; |
| 350 |
> |
xsiz = (((long)(pframe.r-pframe.l)<<pdepth)+hresolu-1) / hresolu; |
| 351 |
> |
ysiz = (((long)(pframe.u-pframe.d)<<pdepth)+vresolu-1) / vresolu; |
| 352 |
|
rl = (RECT *)malloc(xsiz*sizeof(RECT)); |
| 353 |
|
if (rl == NULL) |
| 354 |
|
return; |