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.37 by gwlarson, Fri Dec 18 11:56:10 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    *hdofn[HDMAX+1];        /* holodeck section octree list */
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  
# Line 154 | 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 195 | Line 198 | disp_wait()                    /* wait for more input */
198   }
199  
200  
201 < add_holo(hdg, ofn)              /* register a new holodeck section */
201 > add_holo(hdg, gfn, pfn)         /* register a new holodeck section */
202   HDGRID  *hdg;
203 < char    *ofn;
203 > char    *gfn, *pfn;
204   {
205          VIEW    nv;
206          double  d;
# Line 212 | Line 215 | char   *ofn;
215                  error(SYSTEM, "out of memory in add_holo");
216          bcopy((char *)hdg, (char *)hdlist[hd], sizeof(HDGRID));
217          hdcompgrid(hdlist[hd]);
218 <        hdofn[hd] = savestr(ofn);
218 >        hdgfn[hd] = savestr(gfn);
219 >        hdpfn[hd] = pfn && *pfn ? savestr(pfn) : (char *)NULL;
220          if (hd)
221                  return;
222                                          /* set initial viewpoint */
# Line 267 | Line 271 | register VIEW  *v;
271          static VIEW     viewhist[VIEWHISTLEN];
272          static unsigned nhist;
273          VIEW    *dv;
274 <        int     i, res[2], *slist;
274 >        int     i, res[2];
275 >        int2    *slist;
276          char    *err;
277                                  /* restore previous view? */
278          if (v == NULL) {
# Line 300 | Line 305 | again:
305                          goto again;     /* poss. overloading dev_section()? */
306                  }
307                  DCHECK(*slist < 0, WARNING, "no visible sections in new_view");
308 <                while (*slist >= 0)
309 <                        dev_section(hdofn[*slist++]);
308 >                for ( ; *slist >= 0; slist++)
309 >                        dev_section(hdgfn[*slist], hdpfn[*slist]);
310          }
311 <        dev_section(NULL);      /* end section list */
311 >        dev_section(NULL,NULL); /* end section list */
312          dev_flush();            /* update display */
313                                  /* update server */
314          imm_mode = beam_sync(odev.firstuse) > 0;
# Line 486 | 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, buf+sizeof(HDGRID));
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 499 | 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 507 | Line 515 | serv_result()                  /* get next server result and process
515                          tmodesw = tnow;
516                  }
517   #endif
510                if (!(imm_mode = msg.type==DS_STARTIMM))
511                        dev_flush();
518                  goto noargs;
519          case DS_ACKNOW:
520          case DS_SHUTDOWN:
# Line 579 | 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