1 |
< |
/* Copyright (c) 1998 Silicon Graphics, Inc. */ |
1 |
> |
/* Copyright (c) 1999 Silicon Graphics, Inc. */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ SGI"; |
33 |
|
|
34 |
|
#define FORALLPORT(pl,i) for (i=0;i<MAXPORT&&pl[i]!=NULL;i++) |
35 |
|
|
36 |
< |
extern char *atos(), *sskip(), *sskip2(); |
36 |
> |
extern char *nextword(); |
37 |
|
|
38 |
|
|
39 |
|
gmNewGeom(file) /* add new geometry to next list */ |
59 |
|
dolights = 0; |
60 |
|
domats = 1; |
61 |
|
gmNext[i].listid = rgl_octlist(file, gmNext[i].cent, &gmNext[i].rad); |
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", |
65 |
|
file, gmNext[i].listid, gmNext[i].rad); |
84 |
|
|
85 |
|
|
86 |
|
int |
87 |
< |
gmDrawGeom(clearports) /* draw current list of octrees (and ports) */ |
87 |
< |
int clearports; |
87 |
> |
gmDrawGeom() /* draw current list of octrees */ |
88 |
|
{ |
89 |
|
register int n; |
90 |
|
|
91 |
|
FORALLGEOM(gmCurrent, n) |
92 |
|
glCallList(gmCurrent[n].listid); |
93 |
< |
if (!n | !clearports | !gmPortals) |
94 |
< |
return(n); |
95 |
< |
/* mark alpha channel over the portals */ |
96 |
< |
glPushAttrib(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT); |
93 |
> |
return(n); |
94 |
> |
} |
95 |
> |
|
96 |
> |
|
97 |
> |
gmDrawPortals(r, g, b, a) /* draw portals with specific RGBA value */ |
98 |
> |
int r, g, b, a; |
99 |
> |
{ |
100 |
> |
if (!gmPortals || r<0 & g<0 & b<0 & a<0) |
101 |
> |
return; |
102 |
> |
glPushAttrib(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT| |
103 |
> |
GL_POLYGON_BIT|GL_LIGHTING_BIT); |
104 |
> |
glDisable(GL_LIGHTING); |
105 |
> |
glDisable(GL_DITHER); |
106 |
> |
glShadeModel(GL_FLAT); |
107 |
> |
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); |
108 |
> |
/* don't actually write depth */ |
109 |
|
glDepthMask(GL_FALSE); |
110 |
< |
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE); |
111 |
< |
glClear(GL_COLOR_BUFFER_BIT); |
112 |
< |
glColor4ub(0, 0, 0, 0xff); /* write alpha buffer as mask */ |
110 |
> |
/* draw only selected channels */ |
111 |
> |
glColorMask(r>=0, g>=0, b>=0, a>=0); |
112 |
> |
glColor4ub(r&0xff, g&0xff, b&0xff, a&0xff); |
113 |
|
glCallList(gmPortals); /* draw them portals */ |
114 |
|
glPopAttrib(); |
103 |
– |
return(n); |
115 |
|
} |
116 |
|
|
117 |
|
|
145 |
|
|
146 |
|
if (pflist == NULL) |
147 |
|
return; |
148 |
< |
while (*pflist) { |
138 |
< |
atos(newfile, sizeof(newfile), pflist); |
139 |
< |
if (!*newfile) |
140 |
< |
break; |
141 |
< |
pflist = sskip(pflist); |
148 |
> |
while ((pflist = nextword(newfile, sizeof(newfile), pflist)) != NULL) { |
149 |
|
FORALLPORT(newportlist,i) |
150 |
|
if (!strcmp(newportlist[i], newfile)) |
151 |
|
goto endloop; /* in list already */ |