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.40 by gwlarson, Thu Mar 4 10:14:52 1999 UTC

# Line 24 | Line 24 | static char SCCSid[] = "$SunId$ SGI";
24  
25   HOLO    *hdlist[HDMAX+1];       /* global holodeck list */
26  
27 + char    *hdgfn[HDMAX];          /* holodeck section geometry list */
28 + char    *hdpfn[HDMAX];          /* section portal list */
29 +
30   char    cmdlist[DC_NCMDS][8] = DC_INIT;
31  
32   int     imm_mode = 0;           /* bundles are being delivered immediately */
# Line 88 | Line 91 | char   *argv[];
91                          inp = dev_input();
92                          if (inp & DFL(DC_SETVIEW))
93                                  new_view(&odev.v);
94 +                        else if (inp & DFL(DC_LASTVIEW))
95 +                                new_view(NULL);
96 +                        if (inp & DFL(DC_REDRAW))
97 +                                imm_mode = beam_sync(1) > 0;
98                          if (inp & DFL(DC_GETVIEW))
99                                  printview();
93                        if (inp & DFL(DC_LASTVIEW))
94                                new_view(NULL);
100                          if (inp & DFL(DC_FOCUS))
101                                  set_focus(odev_args);
102                          if (inp & DFL(DC_KILL)) {
# Line 110 | Line 115 | char   *argv[];
115                          }
116                          if (inp & DFL(DC_PAUSE))
117                                  pause = 1;
113                        if (inp & DFL(DC_REDRAW))
114                                imm_mode = beam_sync(1) > 0;
118                          if (inp & DFL(DC_QUIT))
119                                  serv_request(DR_SHUTDOWN, 0, NULL);
120                  }
# Line 152 | Line 155 | disp_wait()                    /* wait for more input */
155          int     n;
156          register int    i;
157                                  /* see if we can avoid select call */
158 +        if (hdlist[0] == NULL)
159 +                return(RDY_SRV);        /* initialize first */
160          flgs = 0;               /* flag what's ready already */
161          if (imm_mode || stdin->_cnt > 0)
162                  flgs |= RDY_SRV;
# Line 193 | Line 198 | disp_wait()                    /* wait for more input */
198   }
199  
200  
201 < add_holo(hdg)                   /* register a new holodeck section */
201 > add_holo(hdg, gfn, pfn)         /* register a new holodeck section */
202   HDGRID  *hdg;
203 + char    *gfn, *pfn;
204   {
205          VIEW    nv;
206          double  d;
# Line 209 | Line 215 | HDGRID *hdg;
215                  error(SYSTEM, "out of memory in add_holo");
216          bcopy((char *)hdg, (char *)hdlist[hd], sizeof(HDGRID));
217          hdcompgrid(hdlist[hd]);
218 +        hdgfn[hd] = savestr(gfn);
219 +        hdpfn[hd] = pfn && *pfn ? savestr(pfn) : (char *)NULL;
220          if (hd)
221                  return;
222                                          /* set initial viewpoint */
# Line 264 | Line 272 | register VIEW  *v;
272          static unsigned nhist;
273          VIEW    *dv;
274          int     i, res[2];
275 +        int2    *slist;
276          char    *err;
277                                  /* restore previous view? */
278          if (v == NULL) {
# Line 279 | Line 288 | again:
288                  error(COMMAND, err);
289                  return;
290          }
291 +        if (!dev_view(v))       /* notify display driver */
292 +                goto again;
293          if (v->type == VT_PAR) {
294                  error(COMMAND, "cannot handle parallel views");
295                  return;
296          }
297 <        if (!dev_view(v))       /* notify display driver */
298 <                goto again;
299 <        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])) {
297 >        beam_init(odev.firstuse);       /* compute new beam set */
298 >        for (i = 0; (dv = dev_auxview(i, res)) != NULL; i++) {
299 >                if ((slist = beam_view(dv, res[0], res[1])) == NULL) {
300                          if (!nhist) {
301                                  error(COMMAND, "invalid starting view");
302                                  return;
303                          }
304                          copystruct(v, viewhist + ((nhist-1)%VIEWHISTLEN));
305 <                        goto again;
306 <                }      
305 >                        goto again;     /* poss. overloading dev_section()? */
306 >                }
307 >                DCHECK(*slist < 0, WARNING, "no visible sections in new_view");
308 >                for ( ; *slist >= 0; slist++)
309 >                        dev_section(hdgfn[*slist], hdpfn[*slist]);
310 >        }
311 >        dev_section(NULL,NULL); /* end section list */
312 >        dev_flush();            /* update display */
313                                  /* update server */
314 <        imm_mode = beam_sync(0) > 0;
314 >        imm_mode = beam_sync(odev.firstuse) > 0;
315                                  /* record new view */
316          if (v < viewhist || v >= viewhist+VIEWHISTLEN) {
317                  copystruct(viewhist + (nhist%VIEWHISTLEN), v);
# Line 477 | Line 491 | serv_result()                  /* get next server result and process
491                  disp_bundle((PACKHEAD *)buf);
492                  break;
493          case DS_ADDHOLO:
494 <                if (msg.nbytes != sizeof(HDGRID))
494 >                if (msg.nbytes < sizeof(HDGRID)+2)
495                          error(INTERNAL, "bad holodeck record from server");
496 <                add_holo((HDGRID *)buf);
496 >                add_holo((HDGRID *)buf, buf+sizeof(HDGRID),
497 >                        buf+sizeof(HDGRID)+strlen(buf+sizeof(HDGRID))+1);
498                  break;
499          case DS_OUTSECT:
500                  do_outside = 1;
# Line 490 | Line 505 | serv_result()                  /* get next server result and process
505                  break;
506          case DS_STARTIMM:
507          case DS_ENDIMM:
508 +                if (!(imm_mode = msg.type==DS_STARTIMM))
509 +                        dev_flush();
510   #ifdef DEBUG
511                  {
512                          time_t  tnow = time(NULL);
# Line 498 | Line 515 | serv_result()                  /* get next server result and process
515                          tmodesw = tnow;
516                  }
517   #endif
501                if (!(imm_mode = msg.type==DS_STARTIMM))
502                        dev_flush();
518                  goto noargs;
519          case DS_ACKNOW:
520          case DS_SHUTDOWN:
# Line 529 | Line 544 | char   *p;
544          MSGHEAD msg;
545          int     m;
546                                  /* consistency checks */
547 < #ifdef DEBUG
548 <        if (nbytes < 0 || nbytes > 0 & p == NULL)
534 <                error(CONSISTENCY, "bad buffer handed to serv_request");
535 < #endif
547 >        DCHECK(nbytes < 0 || nbytes > 0 & p == NULL,
548 >                        CONSISTENCY, "bad buffer handed to serv_request");
549                                  /* get server's attention for big request */
550          if (nbytes >= BIGREQSIZ-sizeof(MSGHEAD)) {
551                  serv_request(DR_ATTEN, 0, NULL);
# Line 572 | Line 585 | register char  *s;
585   quit(code)                      /* clean up and exit */
586   int     code;
587   {
588 +        if (code)
589 +                exit(code);
590          if (odev.v.type)
591                  dev_close();
592 <        exit(code);
592 >        exit(0);
593   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines