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.29 by greg, Thu Aug 21 07:05:59 2008 UTC vs.
Revision 2.38 by greg, Sat Jun 7 05:09:46 2025 UTC

# Line 13 | Line 13 | static const char      RCSid[] = "$Id$";
13   #include  <ctype.h>
14  
15   #include  "ray.h"
16 + #include  "paths.h"
17   #include  "rpaint.h"
18  
19   #define  CTRL(c)        ((c)-'@')
20  
21  
22   void
23 + quit(code)                      /* quit program */
24 + int  code;
25 + {
26 +        if (ray_pnprocs > 0)    /* close children if any */
27 +                ray_pclose(0);
28 +        if (!ray_pnprocs)       /* in parent */
29 +                devclose();
30 +        exit(code);
31 + }
32 +
33 +
34 + void
35   devopen(                                /* open device driver */
36          char  *dname
37   )
38   {
39 <        extern char  *progname, *octname;
39 >        extern char  *octname;
40          char  *id;
41          int  i;
42  
# Line 85 | Line 98 | rview(void)                            /* do a view */
98                          (*dev->comout)(buf);
99                          refine(&ptrunk, pdepth+1);
100                  }
88                if (waitrays() < 0)
89                        quit(1);
101                  if (dev->inpready)              /* noticed some input */
102                          command(": ");
103                  else                            /* finished this depth */
# Line 109 | Line 120 | again:
120                  ;
121          if (*args) *args++ = '\0';
122          else *++args = '\0';
123 +
124 +        if (waitrays() < 0)                     /* clear ray queue */
125 +                quit(1);
126          
127          switch (inpbuf[0]) {
128          case 'f':                               /* new frame (|focus|free) */
# Line 176 | Line 190 | again:
190                  break;
191          case 'm':                               /* move camera (or memstats) */
192                  if (badcom("move"))
179 #ifdef  MSTATS
180                {
181                        if (badcom("memory"))
182                                goto commerr;
183                        printmemstats(stderr);
184                        break;
185                }
186 #else
193                          goto commerr;
188 #endif
194                  getmove(args);
195                  break;
196          case 'r':                               /* rotate/repaint */
# Line 209 | Line 214 | again:
214                  }
215                  getpivot(args);
216                  break;
217 +        case 'o':                               /* origin view */
218 +                if (badcom("origin"))
219 +                        goto commerr;
220 +                getorigin(args);
221 +                break;
222          case CTRL('R'):                         /* redraw */
223                  redraw();
224                  break;
# Line 245 | Line 255 | commerr:
255                  error(COMMAND, errmsg);
256                  break;
257          }
258 +        if (newparam && ray_pnprocs)            /* drop into immediate mode */
259 +                ray_pclose(0);
260   #undef  badcom
261   }
262  
# Line 279 | Line 291 | rsample(void)                  /* sample the image */
291                                                  /* sample the image */
292          for (y = 0; /* y < ysiz */ ; y++) {
293                  for (x = 0; x < xsiz-1; x++) {
294 <                        if (dev->inpready || errno == ENOMEM)
294 >                        if (dev->inpready)
295                                  goto escape;
296                          /*
297                           * Test super-pixel to the right.
# Line 293 | Line 305 | rsample(void)                  /* sample the image */
305                  if (y >= ysiz-1)
306                          break;
307                  for (x = 0; x < xsiz; x++) {
308 <                        if (dev->inpready || errno == ENOMEM)
308 >                        if (dev->inpready)
309                                  goto escape;
310                          /*
311                           * Find super-pixel at this position in next row.
# Line 327 | Line 339 | refine(                                /* refine a node */
339   {
340          int  growth;
341          int  mx, my;
330        int  i;
342  
343          if (dev->inpready)                      /* quit for input */
344                  return(0);
# Line 395 | Line 406 | refine(                                /* refine a node */
406                          growth += refine(p->kid+DR, pd-1);
407                  if (my < pframe.u)
408                          growth += refine(p->kid+UR, pd-1);
398        }
399                                                /* recompute sum */
400        if (growth) {
401                setcolor(p->v, 0.0, 0.0, 0.0);
402                for (i = 0; i < 4; i++)
403                        addcolor(p->v, p->kid[i].v);
404                scalecolor(p->v, 0.25);
409          }
410          return(growth);
411   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines