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.36 by schorsch, Sun Jul 27 22:12:02 2003 UTC vs.
Revision 3.37 by schorsch, Thu Jan 1 11:21:55 2004 UTC

# Line 22 | Line 22 | static int     maxcbeam = 0;   /* size of cbeam array */
22  
23   VIEWPOINT       cureye;         /* current eye position */
24  
25 + static int newcbeam(void);
26 + static int cbeamcmp(const void *cb1, const void *cb2);
27 + static int cbeamcmp2(const void *cb1, const void *cb2);
28 + static int findcbeam(int hd, int bi);
29 + static int getcbeam(int hd, int bi);
30 + static void cbeamsort(int adopt);
31  
32 < int
33 < newcbeam()              /* allocate new entry at end of cbeam array */
32 >
33 > static int
34 > newcbeam(void)          /* allocate new entry at end of cbeam array */
35   {
36          int     i;
37  
# Line 43 | Line 50 | newcbeam()             /* allocate new entry at end of cbeam arra
50   }
51  
52  
53 < int
54 < cbeamcmp(cb1, cb2)      /* compare two cbeam entries for sort: keep orphans */
55 < register PACKHEAD       *cb1, *cb2;
53 > static int
54 > cbeamcmp(       /* compare two cbeam entries for sort: keep orphans */
55 >        const void      *cb1,
56 >        const void      *cb2
57 > )
58   {
59          register int    c;
60  
61 <        if ((c = cb1->bi - cb2->bi))    /* sort on beam index first */
61 >        if ((c = ((PACKHEAD*)cb1)->bi - ((PACKHEAD*)cb2)->bi))  /* sort on beam index first */
62                  return(c);
63 <        return(cb1->hd - cb2->hd);      /* use hd to resolve matches */
63 >        return(((PACKHEAD*)cb1)->hd - ((PACKHEAD*)cb2)->hd);    /* use hd to resolve matches */
64   }
65  
66  
67 < int
68 < cbeamcmp2(cb1, cb2)     /* compare two cbeam entries for sort: no orphans */
69 < register PACKHEAD       *cb1, *cb2;
67 > static int
68 > cbeamcmp2(      /* compare two cbeam entries for sort: no orphans */
69 >        const void      *cb1,
70 >        const void      *cb2
71 > )
72   {
73          register int    c;
74  
75 <        if (!cb1->nr)                   /* put orphans at the end, unsorted */
76 <                return(cb2->nr);
77 <        if (!cb2->nr)
75 >        if (!((PACKHEAD*)cb1)->nr)                      /* put orphans at the end, unsorted */
76 >                return(((PACKHEAD*)cb2)->nr);
77 >        if (!((PACKHEAD*)cb2)->nr)
78                  return(-1);
79 <        if ((c = cb1->bi - cb2->bi))    /* sort on beam index first */
79 >        if ((c = ((PACKHEAD*)cb1)->bi - ((PACKHEAD*)cb2)->bi))  /* sort on beam index first */
80                  return(c);
81 <        return(cb1->hd - cb2->hd);      /* use hd to resolve matches */
81 >        return(((PACKHEAD*)cb1)->hd - ((PACKHEAD*)cb2)->hd);    /* use hd to resolve matches */
82   }
83  
84  
85 < int
86 < findcbeam(hd, bi)       /* find the specified beam in our sorted list */
87 < int     hd, bi;
85 > static int
86 > findcbeam(      /* find the specified beam in our sorted list */
87 >        int     hd,
88 >        int     bi
89 > )
90   {
91          PACKHEAD        cb;
92          register PACKHEAD       *p;
# Line 89 | Line 102 | int    hd, bi;
102   }
103  
104  
105 < int
106 < getcbeam(hd, bi)        /* get the specified beam, allocating as necessary */
107 < register int    hd;
108 < int     bi;
105 > static int
106 > getcbeam(       /* get the specified beam, allocating as necessary */
107 >        register int    hd,
108 >        int     bi
109 > )
110   {
111          register int    n;
112                                  /* first, look in sorted list */
# Line 113 | Line 127 | int    bi;
127   }
128  
129  
130 < cbeamsort(adopt)        /* sort our beam list, possibly turning out orphans */
131 < int     adopt;
130 > static void
131 > cbeamsort(      /* sort our beam list, possibly turning out orphans */
132 >        int     adopt
133 > )
134   {
135          register int    i;
136  
# Line 133 | Line 149 | int    adopt;
149   }
150  
151  
152 < beam_init(fresh)                /* clear beam list for new view(s) */
153 < int     fresh;
152 > extern void
153 > beam_init(              /* clear beam list for new view(s) */
154 >        int     fresh
155 > )
156   {
157          register int    i;
158  
# Line 147 | Line 165 | int    fresh;
165   }
166  
167  
168 < int16 *
169 < beam_view(vn, hr, vr)           /* add beam view (if advisable) */
170 < VIEW    *vn;
171 < int     hr, vr;
168 > extern int16 *
169 > beam_view(              /* add beam view (if advisable) */
170 >        VIEW    *vn,
171 >        int     hr,
172 >        int     vr
173 > )
174   {
175          int16   *slist;
176          BEAMLIST        blist;
# Line 196 | Line 216 | int    hr, vr;
216   }
217  
218  
219 < int
220 < beam_sync(all)                  /* update beam list on server */
221 < int     all;
219 > extern int
220 > beam_sync(                      /* update beam list on server */
221 >        int     all
222 > )
223   {
224                                          /* set new eye position */
225          serv_request(DR_VIEWPOINT, sizeof(VIEWPOINT), (char *)&cureye);
# Line 208 | Line 229 | int    all;
229          if (all) {
230                  if (ncbeams > 0)
231                          serv_request(DR_NEWSET,
232 <                                        ncbeams*sizeof(PACKHEAD), cbeam);
232 >                                        ncbeams*sizeof(PACKHEAD), (char *)cbeam);
233          } else {
234                  if (ncbeams+xcbeams > 0)
235                          serv_request(DR_ADJSET,
236 <                                (ncbeams+xcbeams)*sizeof(PACKHEAD), cbeam);
236 >                                (ncbeams+xcbeams)*sizeof(PACKHEAD), (char *)cbeam);
237          }
238          xcbeams = 0;                    /* truncate our list */
239          return(ncbeams);
240   }
241  
242  
243 < gridlines(f)                    /* run through holodeck section grid lines */
244 < int     (*f)();
243 > extern void
244 > gridlines(                      /* run through holodeck section grid lines */
245 >        void    (*f)(FVECT wp[2])
246 > )
247   {
248          register int    hd, w, i;
249          int     g0, g1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines