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

Comparing ray/src/hd/viewbeams.c (file contents):
Revision 3.2 by greg, Sat Feb 22 02:07:25 2003 UTC vs.
Revision 3.7 by schorsch, Thu Jan 1 11:21:55 2004 UTC

# Line 5 | Line 5 | static const char      RCSid[] = "$Id$";
5   * Convert view to beam list.
6   */
7  
8 + #include <string.h>
9 +
10   #include "rholo.h"
11   #include "view.h"
12   #include "random.h"
# Line 24 | Line 26 | static const char      RCSid[] = "$Id$";
26   static BEAMLIST blist;
27  
28  
29 < static
30 < add2blist(hd, bi, nr)                   /* add to beam sample list */
31 < int     hd, bi, nr;
29 > static void
30 > add2blist(                      /* add to beam sample list */
31 >        int     hd,
32 >        int     bi,
33 >        int     nr
34 > )
35   {
36          register int    i;
37  
# Line 37 | Line 42 | int    hd, bi, nr;
42                  }
43          i = blist.nb++;                         /* else add beam to list */
44          if (i % BALLOCBLK == 0) {
45 <                blist.bl = (PACKHEAD *)realloc((char *)blist.bl,
45 >                blist.bl = (PACKHEAD *)realloc((void *)blist.bl,
46                                  (i+BALLOCBLK)*sizeof(PACKHEAD));
47                  CHECK(blist.bl==NULL, SYSTEM, "out of memory in add2blist");
48          }
# Line 46 | Line 51 | int    hd, bi, nr;
51   }
52  
53  
54 < int2 *
55 < viewbeams(vp, hr, vr, blp)              /* convert view into sections/beams */
56 < VIEW    *vp;
57 < int     hr, vr;
58 < BEAMLIST        *blp;
54 > extern int16 *
55 > viewbeams(              /* convert view into sections/beams */
56 >        VIEW    *vp,
57 >        int     hr,
58 >        int     vr,
59 >        BEAMLIST        *blp
60 > )
61   {
62 <        static int2     sectlist[HDMAX+1];
63 <        int2    sectarr[MINRES+1][MINRES+1];
62 >        static int16    sectlist[HDMAX+1];
63 >        int16   sectarr[MINRES+1][MINRES+1];
64          double  d0, d1, mindist;
65          GCOORD  gc[2];
66          FVECT   rorg, rdir;
# Line 61 | Line 68 | BEAMLIST       *blp;
68          int     v;
69          register int    h, hd;
70                                                  /* clear section flags */
71 <        bzero((char *)sectlist, sizeof(sectlist));
71 >        memset((char *)sectlist, '\0', sizeof(sectlist));
72                                                  /* identify view sections */
73          for (v = 0; v <= MINRES; v++)
74                  for (h = 0; h <= MINRES; h++) {
# Line 138 | Line 145 | loopexit:
145                                                          /* add samples */
146                          add2blist(hd, hdbindex(hdlist[hd],gc), sampquant);
147                  }
148 <        copystruct(blp, &blist);                /* transfer beam list */
148 >        *blp = blist;           /* transfer beam list */
149          return(sectlist);                       /* all done! */
150   }
151  
152  
153 < int
154 < nextview(vp, fp)                        /* get next view from fp */
155 < VIEW    *vp;
156 < FILE    *fp;
153 > extern int
154 > nextview(                       /* get next view from fp */
155 >        VIEW    *vp,
156 >        FILE    *fp
157 > )
158   {
159          char    linebuf[256];
160  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines