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.8 by gwlarson, Fri Jan 29 15:33:36 1999 UTC

# Line 19 | Line 19 | static char SCCSid[] = "$SunId$ SGI";
19   #endif
20  
21   int     gmPortals = 0;                  /* current portal GL list id */
22 + static int      Nlists = 0;             /* number of lists allocated */
23   static char     *curportlist[MAXPORT];  /* current portal list */
24   static char     *newportlist[MAXPORT];  /* new portal file list */
25  
# Line 27 | Line 28 | static struct gmEntry {
28          FVECT   cent;                   /* centroid */
29          FLOAT   rad;                    /* radius */
30          int     listid;                 /* display list identifier */
31 +        int     nlists;                 /* number of lists allocated */
32   } gmCurrent[MAXGEO], gmNext[MAXGEO];    /* current and next list */
33  
34   #define FORALLGEOM(ot,i)        for (i=0;i<MAXGEO&&ot[i].gfile!=NULL;i++)
# Line 55 | Line 57 | char   *file;
57                          return;
58                  }
59                                          /* else load new octree */
60 <        gmNext[i].gfile = file;
60 >        gmNext[i].gfile = savestr(file);
61          dolights = 0;
62          domats = 1;
63 <        gmNext[i].listid = rgl_octlist(file, gmNext[i].cent, &gmNext[i].rad);
63 >        gmNext[i].listid = rgl_octlist(file, gmNext[i].cent, &gmNext[i].rad,
64 >                                        &gmNext[i].nlists);
65          gmNext[i].rad *= 1.732;         /* go to corners */
66   #ifdef DEBUG
67          fprintf(stderr, "Loaded octree \"%s\" into listID %d with radius %f\n",
# Line 75 | Line 78 | gmEndGeom()                    /* make next list current */
78                  FORALLGEOM(gmNext, j)
79                          if (gmNext[j].listid == gmCurrent[i].listid)
80                                  break;
81 <                if (j >= MAXGEO || gmNext[j].gfile == NULL)
82 <                        glDeleteLists(gmCurrent[i].listid, 1);  /* not found */
81 >                if (j >= MAXGEO || gmNext[j].gfile == NULL) {
82 >                        glDeleteLists(gmCurrent[i].listid,      /* not found */
83 >                                        gmCurrent[i].nlists);
84 >                        freestr(gmCurrent[i].gfile);
85 >                }
86          }
87          bcopy((char *)gmNext, (char *)gmCurrent, sizeof(gmNext));
88          bzero((char *)gmNext, sizeof(gmNext));
# Line 175 | Line 181 | gmEndPortal()                  /* close portal list and return GL lis
181          FORALLPORT(newportlist, n);
182          if (!n) {                       /* free old GL list */
183                  if (gmPortals)
184 <                        glDeleteLists(gmPortals, 1);
184 >                        glDeleteLists(gmPortals, Nlists);
185                  gmPortals = 0;
186          } else
187                  qsort(newportlist, n, sizeof(char *), sstrcmp);
# Line 188 | Line 194 | gmEndPortal()                  /* close portal list and return GL lis
194                          FORALLPORT(newportlist, n);
195                          dolights = 0;
196                          domats = 0;
197 <                        gmPortals = rgl_filelist(n, newportlist);
197 >                        gmPortals = rgl_filelist(n, newportlist, &Nlists);
198                          break;
199                  }
200          FORALLPORT(curportlist, n)              /* free old file list */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines