--- ray/src/hd/rhd_geom.c 1998/12/23 17:43:20 3.4 +++ ray/src/hd/rhd_geom.c 2003/05/13 17:58:33 3.10 @@ -1,9 +1,6 @@ -/* Copyright (c) 1998 Silicon Graphics, Inc. */ - #ifndef lint -static char SCCSid[] = "$SunId$ SGI"; +static const char RCSid[] = "$Id: rhd_geom.c,v 3.10 2003/05/13 17:58:33 greg Exp $"; #endif - /* * Geometry drawing operations for OpenGL driver. */ @@ -19,6 +16,7 @@ static char SCCSid[] = "$SunId$ SGI"; #endif int gmPortals = 0; /* current portal GL list id */ +static int Nlists = 0; /* number of lists allocated */ static char *curportlist[MAXPORT]; /* current portal list */ static char *newportlist[MAXPORT]; /* new portal file list */ @@ -27,13 +25,14 @@ static struct gmEntry { FVECT cent; /* centroid */ FLOAT rad; /* radius */ int listid; /* display list identifier */ + int nlists; /* number of lists allocated */ } gmCurrent[MAXGEO], gmNext[MAXGEO]; /* current and next list */ #define FORALLGEOM(ot,i) for (i=0;i= MAXGEO || gmNext[j].gfile == NULL) - glDeleteLists(gmCurrent[i].listid, 1); /* not found */ + if (j >= MAXGEO || gmNext[j].gfile == NULL) { + glDeleteLists(gmCurrent[i].listid, /* not found */ + gmCurrent[i].nlists); + freestr(gmCurrent[i].gfile); + } } - bcopy((char *)gmNext, (char *)gmCurrent, sizeof(gmNext)); - bzero((char *)gmNext, sizeof(gmNext)); + bcopy((void *)gmNext, (void *)gmCurrent, sizeof(gmNext)); + bzero((void *)gmNext, sizeof(gmNext)); } int -gmDrawGeom() /* draw current list of octrees (and ports) */ +gmDrawGeom() /* draw current list of octrees */ { register int n; @@ -144,11 +148,7 @@ char *pflist; if (pflist == NULL) return; - while (*pflist) { - atos(newfile, sizeof(newfile), pflist); - if (!*newfile) - break; - pflist = sskip(pflist); + while ((pflist = nextword(newfile, sizeof(newfile), pflist)) != NULL) { FORALLPORT(newportlist,i) if (!strcmp(newportlist[i], newfile)) goto endloop; /* in list already */ @@ -178,7 +178,7 @@ gmEndPortal() /* close portal list and return GL lis FORALLPORT(newportlist, n); if (!n) { /* free old GL list */ if (gmPortals) - glDeleteLists(gmPortals, 1); + glDeleteLists(gmPortals, Nlists); gmPortals = 0; } else qsort(newportlist, n, sizeof(char *), sstrcmp); @@ -191,12 +191,12 @@ gmEndPortal() /* close portal list and return GL lis FORALLPORT(newportlist, n); dolights = 0; domats = 0; - gmPortals = rgl_filelist(n, newportlist); + gmPortals = rgl_filelist(n, newportlist, &Nlists); break; } FORALLPORT(curportlist, n) /* free old file list */ freestr(curportlist[n]); - bcopy((char *)newportlist, (char *)curportlist, sizeof(newportlist)); - bzero((char *)newportlist, sizeof(newportlist)); + bcopy((void *)newportlist, (void *)curportlist, sizeof(newportlist)); + bzero((void *)newportlist, sizeof(newportlist)); return(gmPortals); /* return GL list id */ }