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.36 by greg, Tue Mar 20 03:37:08 2012 UTC

# Line 19 | Line 19 | static const char      RCSid[] = "$Id$";
19  
20  
21   void
22 + quit(code)                      /* quit program */
23 + int  code;
24 + {
25 +        if (ray_pnprocs > 0)    /* close children if any */
26 +                ray_pclose(0);
27 +        if (!ray_pnprocs)       /* in parent */
28 +                devclose();
29 +        exit(code);
30 + }
31 +
32 +
33 + void
34   devopen(                                /* open device driver */
35          char  *dname
36   )
# Line 85 | Line 97 | rview(void)                            /* do a view */
97                          (*dev->comout)(buf);
98                          refine(&ptrunk, pdepth+1);
99                  }
88                if (waitrays() < 0)
89                        quit(1);
100                  if (dev->inpready)              /* noticed some input */
101                          command(": ");
102                  else                            /* finished this depth */
# Line 109 | Line 119 | again:
119                  ;
120          if (*args) *args++ = '\0';
121          else *++args = '\0';
122 +
123 +        if (waitrays() < 0)                     /* clear ray queue */
124 +                quit(1);
125          
126          switch (inpbuf[0]) {
127          case 'f':                               /* new frame (|focus|free) */
# Line 176 | Line 189 | again:
189                  break;
190          case 'm':                               /* move camera (or memstats) */
191                  if (badcom("move"))
179 #ifdef  MSTATS
180                {
181                        if (badcom("memory"))
182                                goto commerr;
183                        printmemstats(stderr);
184                        break;
185                }
186 #else
192                          goto commerr;
188 #endif
193                  getmove(args);
194                  break;
195          case 'r':                               /* rotate/repaint */
# Line 245 | Line 249 | commerr:
249                  error(COMMAND, errmsg);
250                  break;
251          }
252 +        if (newparam && ray_pnprocs)            /* drop into immediate mode */
253 +                ray_pclose(0);
254   #undef  badcom
255   }
256  
# Line 279 | Line 285 | rsample(void)                  /* sample the image */
285                                                  /* sample the image */
286          for (y = 0; /* y < ysiz */ ; y++) {
287                  for (x = 0; x < xsiz-1; x++) {
288 <                        if (dev->inpready || errno == ENOMEM)
288 >                        if (dev->inpready)
289                                  goto escape;
290                          /*
291                           * Test super-pixel to the right.
# Line 293 | Line 299 | rsample(void)                  /* sample the image */
299                  if (y >= ysiz-1)
300                          break;
301                  for (x = 0; x < xsiz; x++) {
302 <                        if (dev->inpready || errno == ENOMEM)
302 >                        if (dev->inpready)
303                                  goto escape;
304                          /*
305                           * Find super-pixel at this position in next row.
# Line 327 | Line 333 | refine(                                /* refine a node */
333   {
334          int  growth;
335          int  mx, my;
330        int  i;
336  
337          if (dev->inpready)                      /* quit for input */
338                  return(0);
# Line 395 | Line 400 | refine(                                /* refine a node */
400                          growth += refine(p->kid+DR, pd-1);
401                  if (my < pframe.u)
402                          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);
403          }
404          return(growth);
405   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines