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.36 by gwlarson, Thu Dec 10 10:45:54 1998 UTC vs.
Revision 3.37 by gwlarson, Fri Dec 18 11:56:10 1998 UTC

# Line 24 | Line 24 | static char SCCSid[] = "$SunId$ SGI";
24  
25   HOLO    *hdlist[HDMAX+1];       /* global holodeck list */
26  
27 + char    *hdofn[HDMAX+1];        /* holodeck section octree list */
28 +
29   char    cmdlist[DC_NCMDS][8] = DC_INIT;
30  
31   int     imm_mode = 0;           /* bundles are being delivered immediately */
# Line 88 | Line 90 | char   *argv[];
90                          inp = dev_input();
91                          if (inp & DFL(DC_SETVIEW))
92                                  new_view(&odev.v);
93 +                        else if (inp & DFL(DC_LASTVIEW))
94 +                                new_view(NULL);
95 +                        if (inp & DFL(DC_REDRAW))
96 +                                imm_mode = beam_sync(1) > 0;
97                          if (inp & DFL(DC_GETVIEW))
98                                  printview();
93                        if (inp & DFL(DC_LASTVIEW))
94                                new_view(NULL);
99                          if (inp & DFL(DC_FOCUS))
100                                  set_focus(odev_args);
101                          if (inp & DFL(DC_KILL)) {
# Line 110 | Line 114 | char   *argv[];
114                          }
115                          if (inp & DFL(DC_PAUSE))
116                                  pause = 1;
113                        if (inp & DFL(DC_REDRAW))
114                                imm_mode = beam_sync(1) > 0;
117                          if (inp & DFL(DC_QUIT))
118                                  serv_request(DR_SHUTDOWN, 0, NULL);
119                  }
# Line 193 | Line 195 | disp_wait()                    /* wait for more input */
195   }
196  
197  
198 < add_holo(hdg)                   /* register a new holodeck section */
198 > add_holo(hdg, ofn)              /* register a new holodeck section */
199   HDGRID  *hdg;
200 + char    *ofn;
201   {
202          VIEW    nv;
203          double  d;
# Line 209 | Line 212 | HDGRID *hdg;
212                  error(SYSTEM, "out of memory in add_holo");
213          bcopy((char *)hdg, (char *)hdlist[hd], sizeof(HDGRID));
214          hdcompgrid(hdlist[hd]);
215 +        hdofn[hd] = savestr(ofn);
216          if (hd)
217                  return;
218                                          /* set initial viewpoint */
# Line 263 | Line 267 | register VIEW  *v;
267          static VIEW     viewhist[VIEWHISTLEN];
268          static unsigned nhist;
269          VIEW    *dv;
270 <        int     i, res[2];
270 >        int     i, res[2], *slist;
271          char    *err;
272                                  /* restore previous view? */
273          if (v == NULL) {
# Line 279 | Line 283 | again:
283                  error(COMMAND, err);
284                  return;
285          }
286 +        if (!dev_view(v))       /* notify display driver */
287 +                goto again;
288          if (v->type == VT_PAR) {
289                  error(COMMAND, "cannot handle parallel views");
290                  return;
291          }
292 <        if (!dev_view(v))       /* notify display driver */
293 <                goto again;
294 <        dev_flush();            /* update screen */
289 <        beam_init(0);           /* compute new beam set */
290 <        for (i = 0; (dv = dev_auxview(i, res)) != NULL; i++)
291 <                if (!beam_view(dv, res[0], res[1])) {
292 >        beam_init(odev.firstuse);       /* compute new beam set */
293 >        for (i = 0; (dv = dev_auxview(i, res)) != NULL; i++) {
294 >                if ((slist = beam_view(dv, res[0], res[1])) == NULL) {
295                          if (!nhist) {
296                                  error(COMMAND, "invalid starting view");
297                                  return;
298                          }
299                          copystruct(v, viewhist + ((nhist-1)%VIEWHISTLEN));
300 <                        goto again;
301 <                }      
300 >                        goto again;     /* poss. overloading dev_section()? */
301 >                }
302 >                DCHECK(*slist < 0, WARNING, "no visible sections in new_view");
303 >                while (*slist >= 0)
304 >                        dev_section(hdofn[*slist++]);
305 >        }
306 >        dev_section(NULL);      /* end section list */
307 >        dev_flush();            /* update display */
308                                  /* update server */
309 <        imm_mode = beam_sync(0) > 0;
309 >        imm_mode = beam_sync(odev.firstuse) > 0;
310                                  /* record new view */
311          if (v < viewhist || v >= viewhist+VIEWHISTLEN) {
312                  copystruct(viewhist + (nhist%VIEWHISTLEN), v);
# Line 477 | Line 486 | serv_result()                  /* get next server result and process
486                  disp_bundle((PACKHEAD *)buf);
487                  break;
488          case DS_ADDHOLO:
489 <                if (msg.nbytes != sizeof(HDGRID))
489 >                if (msg.nbytes <= sizeof(HDGRID))
490                          error(INTERNAL, "bad holodeck record from server");
491 <                add_holo((HDGRID *)buf);
491 >                add_holo((HDGRID *)buf, buf+sizeof(HDGRID));
492                  break;
493          case DS_OUTSECT:
494                  do_outside = 1;
# Line 529 | Line 538 | char   *p;
538          MSGHEAD msg;
539          int     m;
540                                  /* consistency checks */
541 < #ifdef DEBUG
542 <        if (nbytes < 0 || nbytes > 0 & p == NULL)
534 <                error(CONSISTENCY, "bad buffer handed to serv_request");
535 < #endif
541 >        DCHECK(nbytes < 0 || nbytes > 0 & p == NULL,
542 >                        CONSISTENCY, "bad buffer handed to serv_request");
543                                  /* get server's attention for big request */
544          if (nbytes >= BIGREQSIZ-sizeof(MSGHEAD)) {
545                  serv_request(DR_ATTEN, 0, NULL);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines