--- ray/src/rt/rview.c 1991/07/18 14:42:58 1.19 +++ ray/src/rt/rview.c 1992/09/09 22:19:42 2.7 @@ -1,4 +1,4 @@ -/* Copyright (c) 1987 Regents of the University of California */ +/* Copyright (c) 1992 Regents of the University of California */ #ifndef lint static char SCCSid[] = "$SunId$ LBL"; @@ -36,7 +36,11 @@ double shadcert = .25; /* shadow certainty */ int directrelay = 0; /* number of source relays */ int vspretest = 128; /* virtual source pretest density */ int directinvis = 0; /* sources invisible? */ +double srcsizerat = 0.; /* maximum ratio source size/dist. */ +double specthresh = .3; /* specular sampling threshold */ +double specjitter = 1.; /* specular sampling jitter */ + int maxdepth = 4; /* maximum recursion depth */ double minweight = 1e-2; /* minimum ray weight */ @@ -62,9 +66,9 @@ int pdepth; /* image depth in current frame */ static char *reserve_mem = NULL; /* pre-allocated reserve memory */ -#define RESERVE_AMT 8192 /* amount of memory to reserve */ +#define RESERVE_AMT 32768 /* amount of memory to reserve */ -#define CTRL(c) ('c'-'@') +#define CTRL(c) ((c)-'@') quit(code) /* quit program */ @@ -169,7 +173,6 @@ command(prompt) /* get/execute command */ char *prompt; { #define badcom(s) strncmp(s, inpbuf, args-inpbuf-1) - double atof(); char inpbuf[256]; char *args; again: @@ -222,7 +225,16 @@ again: break; case 'm': /* move camera */ if (badcom("move")) +#ifdef MSTATS + { + if (badcom("memory")) + goto commerr; + printmemstats(stderr); + break; + } +#else goto commerr; +#endif getmove(args); break; case 'r': /* rotate/repaint */ @@ -239,7 +251,7 @@ again: goto commerr; getpivot(args); break; - case CTRL(R): /* redraw */ + case CTRL('R'): /* redraw */ redraw(); break; case 'w': /* write */ @@ -251,10 +263,10 @@ again: if (badcom("quit")) goto commerr; quit(0); - case CTRL(C): /* interrupt */ + case CTRL('C'): /* interrupt */ goto again; #ifdef SIGTSTP - case CTRL(Z): /* stop */ + case CTRL('Z'): /* stop */ devclose(); kill(0, SIGTSTP); /* pc stops here */ @@ -299,8 +311,10 @@ rsample() /* sample the image */ if (rl == NULL) return; pl = (PNODE **)malloc(xsiz*sizeof(PNODE *)); - if (pl == NULL) + if (pl == NULL) { + free((char *)rl); return; + } /* * Initialize the bottom row. */ @@ -316,7 +330,7 @@ rsample() /* sample the image */ /* sample the image */ for (y = 0; /* y < ysiz */ ; y++) { for (x = 0; x < xsiz-1; x++) { - if (dev->inpready) + if (dev->inpready || errno == ENOMEM) goto escape; /* * Test super-pixel to the right. @@ -332,7 +346,7 @@ rsample() /* sample the image */ if (y >= ysiz-1) break; for (x = 0; x < xsiz; x++) { - if (dev->inpready) + if (dev->inpready || errno == ENOMEM) goto escape; /* * Find super-pixel at this position in next row. @@ -387,10 +401,10 @@ int pd; if (p->kid == NULL) { /* subdivide */ if ((p->kid = newptree()) == NULL) - return(growth); + return(0); /* * The following paint order can leave a black pixel - * when redraw() is called in (*dev->paintr)(). + * if redraw() is called in (*dev->paintr)(). */ if (p->x >= mx && p->y >= my) pcopy(p, p->kid+UR);