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

Comparing ray/src/hd/rhdisp2.c (file contents):
Revision 3.1 by gregl, Wed Nov 19 18:01:03 1997 UTC vs.
Revision 3.3 by gregl, Thu Nov 20 18:06:35 1997 UTC

# Line 5 | Line 5 | static char SCCSid[] = "$SunId$ SGI";
5   #endif
6  
7   /*
8 < * Holodeck beam tracking
8 > * Holodeck beam tracking for display process
9   */
10  
11   #include "rholo.h"
# Line 15 | Line 15 | static char SCCSid[] = "$SunId$ SGI";
15   extern int      *getviewcells();
16  
17   typedef struct {
18 <        int     hd;             /* holodeck section number */
18 >        int     hd;             /* holodeck section number (-1 if inactive) */
19          int     i[3];           /* voxel index (may be outside section) */
20   } VOXL;                 /* a voxel */
21  
# Line 36 | Line 36 | static int     ncbeams = 0;    /* number of sorted beams in c
36   static int      xcbeams = 0;    /* extra (unregistered) beams past ncbeams */
37   static int      maxcbeam = 0;   /* size of cbeam array */
38  
39
39   struct cellact {
40          short   vi;             /* voxel index */
41          short   add;            /* zero means delete */
42   };              /* action for cell */
43  
45
44   struct beamact {
45          struct cellact  ca;     /* cell action */
46          GCOORD  gc;             /* grid coordinate */
# Line 247 | Line 245 | get_voxels(vl, vp)     /* find voxels corresponding to vie
245   VOXL    vl[8];
246   FVECT   vp;
247   {
248 +        static int      lastn = 0, lastd = -1;
249          int     n = 0;
250          FVECT   gp;
251          double  d;
# Line 277 | Line 276 | FVECT  vp;
276                          n++;
277                  }
278          }
279 <        return(n);
279 >                                        /* warn of dangerous moves */
280 >        if (n < lastn && bestd >= lastd)
281 >                error(WARNING, "moving outside holodeck section");
282 >        else if (n > lastn && bestd <= lastd)
283 >                error(WARNING, "moving inside holodeck section");
284 >        lastd = bestd;
285 >        return(lastn = n);
286   }
287  
288  
# Line 292 | Line 297 | register struct beamact        *bp;
297          copystruct(gc, gcp);
298          copystruct(gc+1, &bp->gc);
299          if ((bi = hdbindex(hdlist[voxel[bp->ca.vi].hd], gc)) <= 0)
300 <                return(0);              /* should report an error? */
300 >                error(CONSISTENCY, "bad grid coordinate in dobeam");
301          if (bp->ca.add) {               /* add it in */
302                  i = getcbeam(voxel[bp->ca.vi].hd, bi);
303                  cbeam[i].wants |= 1<<bp->ca.vi; /* say we want it */
# Line 403 | Line 408 | VIEW   *vold, *vnew;
408                  }
409                                  /* take care of list tails */
410          for (ca.add = 1; ncnt > 0; ncnt--)
411 <                docell(ngcp++, &ca);
411 >                netchange += docell(ngcp++, &ca);
412          for (ca.add = 0; ocnt > 0; ocnt--)
413 <                docell(ogcp++, &ca);
413 >                netchange -= docell(ogcp++, &ca);
414                                  /* clean up */
415          if (ocl != NULL) free((char *)ocl);
416          if (ncl != NULL) free((char *)ncl);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines