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.11 by schorsch, Thu Jun 26 00:58:10 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   */
# Line 19 | Line 16 | static char SCCSid[] = "$SunId$ SGI";
16   #endif
17  
18   int     gmPortals = 0;                  /* current portal GL list id */
19 + static int      Nlists = 0;             /* number of lists allocated */
20   static char     *curportlist[MAXPORT];  /* current portal list */
21   static char     *newportlist[MAXPORT];  /* new portal file list */
22  
23   static struct gmEntry {
24          char    *gfile;                 /* geometry file name */
25          FVECT   cent;                   /* centroid */
26 <        FLOAT   rad;                    /* radius */
26 >        RREAL   rad;                    /* radius */
27          int     listid;                 /* display list identifier */
28 +        int     nlists;                 /* number of lists allocated */
29   } gmCurrent[MAXGEO], gmNext[MAXGEO];    /* current and next list */
30  
31   #define FORALLGEOM(ot,i)        for (i=0;i<MAXGEO&&ot[i].gfile!=NULL;i++)
# Line 55 | Line 54 | char   *file;
54                          return;
55                  }
56                                          /* else load new octree */
57 <        gmNext[i].gfile = file;
57 >        gmNext[i].gfile = savestr(file);
58          dolights = 0;
59          domats = 1;
60 <        gmNext[i].listid = rgl_octlist(file, gmNext[i].cent, &gmNext[i].rad);
60 >        gmNext[i].listid = rgl_octlist(file, gmNext[i].cent, &gmNext[i].rad,
61 >                                        &gmNext[i].nlists);
62          gmNext[i].rad *= 1.732;         /* go to corners */
63   #ifdef DEBUG
64          fprintf(stderr, "Loaded octree \"%s\" into listID %d with radius %f\n",
# Line 75 | Line 75 | gmEndGeom()                    /* make next list current */
75                  FORALLGEOM(gmNext, j)
76                          if (gmNext[j].listid == gmCurrent[i].listid)
77                                  break;
78 <                if (j >= MAXGEO || gmNext[j].gfile == NULL)
79 <                        glDeleteLists(gmCurrent[i].listid, 1);  /* not found */
78 >                if (j >= MAXGEO || gmNext[j].gfile == NULL) {
79 >                        glDeleteLists(gmCurrent[i].listid,      /* not found */
80 >                                        gmCurrent[i].nlists);
81 >                        freestr(gmCurrent[i].gfile);
82 >                }
83          }
84 <        bcopy((char *)gmNext, (char *)gmCurrent, sizeof(gmNext));
85 <        bzero((char *)gmNext, sizeof(gmNext));
84 >        bcopy((void *)gmNext, (void *)gmCurrent, sizeof(gmNext));
85 >        bzero((void *)gmNext, sizeof(gmNext));
86   }
87  
88  
# Line 175 | Line 178 | gmEndPortal()                  /* close portal list and return GL lis
178          FORALLPORT(newportlist, n);
179          if (!n) {                       /* free old GL list */
180                  if (gmPortals)
181 <                        glDeleteLists(gmPortals, 1);
181 >                        glDeleteLists(gmPortals, Nlists);
182                  gmPortals = 0;
183          } else
184                  qsort(newportlist, n, sizeof(char *), sstrcmp);
# Line 188 | Line 191 | gmEndPortal()                  /* close portal list and return GL lis
191                          FORALLPORT(newportlist, n);
192                          dolights = 0;
193                          domats = 0;
194 <                        gmPortals = rgl_filelist(n, newportlist);
194 >                        gmPortals = rgl_filelist(n, newportlist, &Nlists);
195                          break;
196                  }
197          FORALLPORT(curportlist, n)              /* free old file list */
198                  freestr(curportlist[n]);
199 <        bcopy((char *)newportlist, (char *)curportlist, sizeof(newportlist));
200 <        bzero((char *)newportlist, sizeof(newportlist));
199 >        bcopy((void *)newportlist, (void *)curportlist, sizeof(newportlist));
200 >        bzero((void *)newportlist, sizeof(newportlist));
201          return(gmPortals);                      /* return GL list id */
202   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines