| 22 |
|
|
| 23 |
|
FUN ofun[NUMOTYPE] = INIT_OTYPE; |
| 24 |
|
|
| 25 |
+ |
static int nextlist, nlistleft = 0; |
| 26 |
|
|
| 27 |
+ |
|
| 28 |
|
static |
| 29 |
|
initotypes() /* initialize ofun array */ |
| 30 |
|
{ |
| 71 |
|
int |
| 72 |
|
newglist() /* allocate an OGL list id */ |
| 73 |
|
{ |
| 74 |
< |
static int nextlist, nleft = 0; |
| 73 |
< |
|
| 74 |
< |
if (!nleft--) { |
| 74 |
> |
if (!nlistleft--) { |
| 75 |
|
nextlist = glGenLists(NLIST2ALLOC); |
| 76 |
< |
nleft = NLIST2ALLOC-1; |
| 76 |
> |
if (!nextlist) |
| 77 |
> |
error(SYSTEM, "no list space left in newglist"); |
| 78 |
> |
nlistleft = NLIST2ALLOC-1; |
| 79 |
|
} |
| 80 |
|
return(nextlist++); |
| 81 |
|
} |
| 95 |
|
|
| 96 |
|
|
| 97 |
|
int |
| 98 |
< |
rgl_filelist(ic, inp) /* load scene files into display list */ |
| 98 |
> |
rgl_filelist(ic, inp, nl) /* load scene files into display list */ |
| 99 |
|
int ic; |
| 100 |
|
char **inp; |
| 101 |
+ |
int *nl; /* returned number of lists (optional) */ |
| 102 |
|
{ |
| 103 |
|
int listid; |
| 104 |
|
|
| 113 |
|
glEndList(); /* end of top display list */ |
| 114 |
|
lightdefs(); /* define light sources */ |
| 115 |
|
loadoctrees(); /* load octrees (sublists) for instances */ |
| 116 |
+ |
if (nl != NULL) /* return total number of lists allocated */ |
| 117 |
+ |
*nl = nextlist - listid; |
| 118 |
|
return(listid); /* all done -- return list id */ |
| 119 |
|
} |
| 120 |
|
|
| 121 |
|
|
| 122 |
|
int |
| 123 |
< |
rgl_octlist(fname, cent, radp) /* load octree objects into display list */ |
| 123 |
> |
rgl_octlist(fname, cent, radp, nl) /* load scen into display list */ |
| 124 |
|
char *fname; |
| 125 |
|
FVECT cent; /* returned octree center (optional) */ |
| 126 |
|
FLOAT *radp; /* returned octree size (optional) */ |
| 127 |
+ |
int *nl; /* returned number of lists (optional) */ |
| 128 |
|
{ |
| 129 |
|
double r; |
| 130 |
|
int listid; |
| 143 |
|
glEndList(); /* close top list */ |
| 144 |
|
lightdefs(); /* define light sources */ |
| 145 |
|
loadoctrees(); /* load referenced octrees into sublists */ |
| 146 |
+ |
if (nl != NULL) /* return total number of lists allocated */ |
| 147 |
+ |
*nl = nextlist - listid; |
| 148 |
|
return(listid); |
| 149 |
|
} |
| 150 |
|
|