--- ray/src/rt/rview.c 1991/11/25 10:11:01 2.2 +++ 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"; @@ -38,6 +38,9 @@ int vspretest = 128; /* virtual source pretest dens 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 */ @@ -65,7 +68,7 @@ static char *reserve_mem = NULL; /* pre-allocated res #define RESERVE_AMT 32768 /* amount of memory to reserve */ -#define CTRL(c) ('c'-'@') +#define CTRL(c) ((c)-'@') quit(code) /* quit program */ @@ -170,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: @@ -249,7 +251,7 @@ again: goto commerr; getpivot(args); break; - case CTRL(R): /* redraw */ + case CTRL('R'): /* redraw */ redraw(); break; case 'w': /* write */ @@ -261,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 */ @@ -309,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. */ @@ -400,7 +404,7 @@ int pd; 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);