ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/rview.c
(Generate patch)

Comparing ray/src/rt/rview.c (file contents):
Revision 2.3 by greg, Thu Dec 19 14:54:46 1991 UTC vs.
Revision 2.10 by greg, Wed Feb 10 14:03:01 1993 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1987 Regents of the University of California */
1 > /* Copyright (c) 1992 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 26 | Line 26 | int  ndims = 0;                                /* number of sampling dimensions */
26   int  samplendx = 0;                     /* index for this sample */
27  
28   int  psample = 8;                       /* pixel sample size */
29 < double  maxdiff = .15;                  /* max. sample difference */
29 > double  maxdiff = .15;                  /* max. sample difference */
30  
31 < double  exposure = 1.0;                 /* exposure for scene */
31 > double  exposure = 1.0;                 /* exposure for scene */
32  
33 < double  dstrsrc = 0.0;                  /* square source distribution */
34 < double  shadthresh = .1;                /* shadow threshold */
35 < double  shadcert = .25;                 /* shadow certainty */
33 > double  dstrsrc = 0.0;                  /* square source distribution */
34 > double  shadthresh = .1;                /* shadow threshold */
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? */
39 < double  srcsizerat = 0.;                /* maximum ratio source size/dist. */
38 > int  directvis = 1;                     /* sources visible? */
39 > double  srcsizerat = 0.;                /* maximum ratio source size/dist. */
40  
41 + double  specthresh = .3;                /* specular sampling threshold */
42 + double  specjitter = 1.;                /* specular sampling jitter */
43 +
44   int  maxdepth = 4;                      /* maximum recursion depth */
45 < double  minweight = 1e-2;               /* minimum ray weight */
45 > double  minweight = 1e-2;               /* minimum ray weight */
46  
47   COLOR  ambval = BLKCOLOR;               /* ambient value */
48 < double  ambacc = 0.2;                   /* ambient accuracy */
48 > double  ambacc = 0.2;                   /* ambient accuracy */
49   int  ambres = 8;                        /* ambient resolution */
50   int  ambdiv = 32;                       /* ambient divisions */
51   int  ambssamp = 0;                      /* ambient super-samples */
# Line 65 | Line 68 | static char  *reserve_mem = NULL;      /* pre-allocated res
68  
69   #define RESERVE_AMT     32768           /* amount of memory to reserve */
70  
71 < #define  CTRL(c)        ('c'-'@')
71 > #define  CTRL(c)        ((c)-'@')
72  
73  
74   quit(code)                      /* quit program */
75   int  code;
76   {
77 + #ifdef MSTATS
78 +        if (code == 2 && errno == ENOMEM)
79 +                printmemstats(stderr);
80 + #endif
81          devclose();
82          exit(code);
83   }
# Line 92 | Line 99 | char  *dname;
99                                  error(USER, errmsg);
100                          } else
101                                  return;
102 + #ifndef NIX                                                
103                                                  /* not there, try exec */
104          if ((dev = comm_init(dname, id)) == NULL) {
105                  sprintf(errmsg, "cannot start device \"%s\"", dname);
106                  error(USER, errmsg);
107          }
108 + #endif
109   }
110  
111  
# Line 169 | Line 178 | freereserves()                 /* free memory reserves */
178   command(prompt)                 /* get/execute command */
179   char  *prompt;
180   {
181 < #define  badcom(s)      strncmp(s, inpbuf, args-inpbuf-1)
181 > #define  badcom(s)      strncmp(s, inpbuf, args-inpbuf-1)
182          char  inpbuf[256];
183          char  *args;
184   again:
# Line 180 | Line 189 | again:
189          else *++args = '\0';
190          
191          switch (inpbuf[0]) {
192 <        case 'f':                               /* new frame */
193 <                if (badcom("frame"))
194 <                        goto commerr;
192 >        case 'f':                               /* new frame (or free mem.) */
193 >                if (badcom("frame")) {
194 >                        if (badcom("free"))
195 >                                goto commerr;
196 >                        free_objmem();
197 >                        break;
198 >                }
199                  getframe(args);
200                  break;
201          case 'v':                               /* view */
# Line 220 | Line 233 | again:
233                          goto commerr;
234                  getaim(args);
235                  break;
236 <        case 'm':                               /* move camera */
236 >        case 'm':                               /* move camera (or memstats) */
237                  if (badcom("move"))
238 < #ifdef  MSTATS
238 > #ifdef  MSTATS
239                  {
240                          if (badcom("memory"))
241                                  goto commerr;
# Line 248 | Line 261 | again:
261                          goto commerr;
262                  getpivot(args);
263                  break;
264 <        case CTRL(R):                           /* redraw */
264 >        case CTRL('R'):                         /* redraw */
265                  redraw();
266                  break;
267          case 'w':                               /* write */
# Line 260 | Line 273 | again:
273                  if (badcom("quit"))
274                          goto commerr;
275                  quit(0);
276 <        case CTRL(C):                           /* interrupt */
276 >        case CTRL('C'):                         /* interrupt */
277                  goto again;
278 < #ifdef  SIGTSTP
279 <        case CTRL(Z):                           /* stop */
278 > #ifdef  SIGTSTP
279 >        case CTRL('Z'):                         /* stop */
280                  devclose();
281                  kill(0, SIGTSTP);
282                  /* pc stops here */
# Line 283 | Line 296 | commerr:
296                  error(COMMAND, errmsg);
297                  break;
298          }
299 < #undef  badcom
299 > #undef  badcom
300   }
301  
302  
# Line 293 | Line 306 | rsample()                      /* sample the image */
306          RECT  r;
307          PNODE  *p;
308          register RECT  *rl;
309 <        register PNODE  **pl;
309 >        register PNODE  **pl;
310          register int  x;
311          /*
312           *     We initialize the bottom row in the image at our current
313 <         * resolution.  During sampling, we check super-pixels to the
313 >         * resolution.  During sampling, we check super-pixels to the
314           * right and above by calling bigdiff().  If there is a significant
315           * difference, we subsample the super-pixels.  The testing process
316           * includes initialization of the next row.
# Line 308 | Line 321 | rsample()                      /* sample the image */
321          if (rl == NULL)
322                  return;
323          pl = (PNODE **)malloc(xsiz*sizeof(PNODE *));
324 <        if (pl == NULL)
324 >        if (pl == NULL) {
325 >                free((char *)rl);
326                  return;
327 +        }
328          /*
329           * Initialize the bottom row.
330           */
# Line 375 | Line 390 | escape:
390  
391   int
392   refine(p, xmin, ymin, xmax, ymax, pd)           /* refine a node */
393 < register PNODE  *p;
393 > register PNODE  *p;
394   int  xmin, ymin, xmax, ymax;
395   int  pd;
396   {
# Line 399 | Line 414 | int  pd;
414                          return(0);
415                  /*
416                   *  The following paint order can leave a black pixel
417 <                 *  when redraw() is called in (*dev->paintr)().
417 >                 *  if redraw() is called in (*dev->paintr)().
418                   */
419                  if (p->x >= mx && p->y >= my)
420                          pcopy(p, p->kid+UR);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines