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

Comparing ray/src/hd/rhd_geom.c (file contents):
Revision 3.6 by gwlarson, Fri Jan 29 11:11:14 1999 UTC vs.
Revision 3.13 by schorsch, Mon Jul 21 22:30:18 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1999 Silicon Graphics, Inc. */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ SGI";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Geometry drawing operations for OpenGL driver.
6   */
7  
8 + #include <string.h>
9 +
10   #include "radogl.h"
11   #include "rhdriver.h"
12  
# Line 19 | Line 18 | static char SCCSid[] = "$SunId$ SGI";
18   #endif
19  
20   int     gmPortals = 0;                  /* current portal GL list id */
21 + static int      Nlists = 0;             /* number of lists allocated */
22   static char     *curportlist[MAXPORT];  /* current portal list */
23   static char     *newportlist[MAXPORT];  /* new portal file list */
24  
25   static struct gmEntry {
26          char    *gfile;                 /* geometry file name */
27          FVECT   cent;                   /* centroid */
28 <        FLOAT   rad;                    /* radius */
28 >        RREAL   rad;                    /* radius */
29          int     listid;                 /* display list identifier */
30 +        int     nlists;                 /* number of lists allocated */
31   } gmCurrent[MAXGEO], gmNext[MAXGEO];    /* current and next list */
32  
33   #define FORALLGEOM(ot,i)        for (i=0;i<MAXGEO&&ot[i].gfile!=NULL;i++)
# Line 51 | Line 52 | char   *file;
52                                          /* check if copy in current list */
53          FORALLGEOM(gmCurrent, j)
54                  if (!strcmp(file, gmCurrent[j].gfile)) {
55 <                        copystruct(&gmNext[i], &gmCurrent[j]);
55 >                        gmNext[i] = gmCurrent[j];
56                          return;
57                  }
58                                          /* else load new octree */
59 <        gmNext[i].gfile = file;
59 >        gmNext[i].gfile = savestr(file);
60          dolights = 0;
61          domats = 1;
62 <        gmNext[i].listid = rgl_octlist(file, gmNext[i].cent, &gmNext[i].rad);
62 >        gmNext[i].listid = rgl_octlist(file, gmNext[i].cent, &gmNext[i].rad,
63 >                                        &gmNext[i].nlists);
64          gmNext[i].rad *= 1.732;         /* go to corners */
65   #ifdef DEBUG
66          fprintf(stderr, "Loaded octree \"%s\" into listID %d with radius %f\n",
# Line 75 | Line 77 | gmEndGeom()                    /* make next list current */
77                  FORALLGEOM(gmNext, j)
78                          if (gmNext[j].listid == gmCurrent[i].listid)
79                                  break;
80 <                if (j >= MAXGEO || gmNext[j].gfile == NULL)
81 <                        glDeleteLists(gmCurrent[i].listid, 1);  /* not found */
80 >                if (j >= MAXGEO || gmNext[j].gfile == NULL) {
81 >                        glDeleteLists(gmCurrent[i].listid,      /* not found */
82 >                                        gmCurrent[i].nlists);
83 >                        freestr(gmCurrent[i].gfile);
84 >                }
85          }
86 <        bcopy((char *)gmNext, (char *)gmCurrent, sizeof(gmNext));
87 <        bzero((char *)gmNext, sizeof(gmNext));
86 >        memcpy((void *)gmCurrent, (void *)gmNext, sizeof(gmNext));
87 >        memset((void *)gmNext, '\0', sizeof(gmNext));
88   }
89  
90  
# Line 175 | Line 180 | gmEndPortal()                  /* close portal list and return GL lis
180          FORALLPORT(newportlist, n);
181          if (!n) {                       /* free old GL list */
182                  if (gmPortals)
183 <                        glDeleteLists(gmPortals, 1);
183 >                        glDeleteLists(gmPortals, Nlists);
184                  gmPortals = 0;
185          } else
186                  qsort(newportlist, n, sizeof(char *), sstrcmp);
# Line 188 | Line 193 | gmEndPortal()                  /* close portal list and return GL lis
193                          FORALLPORT(newportlist, n);
194                          dolights = 0;
195                          domats = 0;
196 <                        gmPortals = rgl_filelist(n, newportlist);
196 >                        gmPortals = rgl_filelist(n, newportlist, &Nlists);
197                          break;
198                  }
199          FORALLPORT(curportlist, n)              /* free old file list */
200                  freestr(curportlist[n]);
201 <        bcopy((char *)newportlist, (char *)curportlist, sizeof(newportlist));
202 <        bzero((char *)newportlist, sizeof(newportlist));
201 >        memcpy((void *)curportlist, (void *)newportlist, sizeof(newportlist));
202 >        memset((void *)newportlist, '\0', sizeof(newportlist));
203          return(gmPortals);                      /* return GL list id */
204   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines