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

Comparing ray/src/hd/rhdisp.c (file contents):
Revision 3.11 by gregl, Tue Dec 9 17:12:15 1997 UTC vs.
Revision 3.12 by gregl, Thu Dec 11 09:37:43 1997 UTC

# Line 14 | Line 14 | static char SCCSid[] = "$SunId$ SGI";
14   #include "selcall.h"
15   #include <ctype.h>
16  
17 + #ifndef VIEWHISTLEN
18 + #define VIEWHISTLEN     2       /* number of remembered views */
19 + #endif
20 +
21   HOLO    *hdlist[HDMAX+1];       /* global holodeck list */
22  
23   char    cmdlist[DC_NCMDS][8] = DC_INIT;
# Line 58 | Line 62 | char   *argv[];
62                                  printview();
63                          if (inp & DEV_NEWVIEW)
64                                  new_view(&odev.v);
65 +                        if (inp & DEV_LASTVIEW)
66 +                                new_view(NULL);
67                          if (inp & DEV_SHUTDOWN)
68                                  serv_request(DR_SHUTDOWN, 0, NULL);
69 <                        if (inp & DEV_REDRAW) {
70 <                                imm_mode = 1;   /* preempt updates */
65 <                                beam_sync();
66 <                        }
69 >                        if (inp & DEV_REDRAW)
70 >                                imm_mode = beam_sync() > 0;
71                          if (inp & DEV_WAIT)
72                                  pause = 1;
73                          if (inp & DEV_RESUME) {
# Line 190 | Line 194 | register PACKHEAD      *p;
194  
195  
196   new_view(v)                     /* change view parameters */
197 < VIEW    *v;
197 > register VIEW   *v;
198   {
199 +        static VIEW     viewhist[VIEWHISTLEN];
200 +        static unsigned nhist;
201          char    *err;
202 <
203 <        do {
204 <                if ((err = setview(v)) != NULL) {
205 <                        error(COMMAND, err);
202 >                                /* restore previous view? */
203 >        if (v == NULL) {
204 >                if (nhist < 2) {
205 >                        error(COMMAND, "no previous view");
206                          return;
207                  }
208 <                if (v->type == VT_PAR) {
209 <                        error(COMMAND, "cannot handle parallel views");
210 <                        return;
211 <                }
212 <                dev_view(v);            /* update display driver */
213 <                dev_flush();            /* update screen */
214 <        } while (!beam_view(v));        /* update beam list */
208 >                nhist--;        /* get one before last setting */
209 >                v = viewhist + ((nhist-1)%VIEWHISTLEN);
210 >        } else if ((err = setview(v)) != NULL) {
211 >                error(COMMAND, err);
212 >                return;
213 >        }
214 > again:
215 >        if (v->type == VT_PAR) {
216 >                error(COMMAND, "cannot handle parallel views");
217 >                return;
218 >        }
219 >        if (!dev_view(v))       /* update display driver */
220 >                goto again;
221 >        dev_flush();            /* update screen */
222 >        if (!beam_view(v))      /* update beam list */
223 >                goto again;
224 >                                /* record new view */
225 >        if (v < viewhist || v >= viewhist+VIEWHISTLEN) {
226 >                copystruct(viewhist + (nhist%VIEWHISTLEN), v);
227 >                nhist++;
228 >        }
229   }
230  
231  
# Line 245 | Line 265 | usr_input()                    /* get user input and process it */
265                  break;
266          case DC_GETVIEW:                /* print the current view */
267                  printview();
268 +                break;
269 +        case DC_LASTVIEW:               /* restore previous view */
270 +                new_view(NULL);
271                  break;
272          case DC_PAUSE:                  /* pause the current calculation */
273          case DC_RESUME:                 /* resume the calculation */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines