--- ray/src/hd/rhd_geom.c 1998/12/20 20:35:43 3.2 +++ ray/src/hd/rhd_geom.c 1999/01/29 15:04:03 3.7 @@ -1,4 +1,4 @@ -/* Copyright (c) 1998 Silicon Graphics, Inc. */ +/* Copyright (c) 1999 Silicon Graphics, Inc. */ #ifndef lint static char SCCSid[] = "$SunId$ SGI"; @@ -33,7 +33,7 @@ static struct gmEntry { #define FORALLPORT(pl,i) for (i=0;i= MAXGEO || gmNext[j].gfile == NULL) + if (j >= MAXGEO || gmNext[j].gfile == NULL) { glDeleteLists(gmCurrent[i].listid, 1); /* not found */ + freestr(gmCurrent[i].gfile); + } } bcopy((char *)gmNext, (char *)gmCurrent, sizeof(gmNext)); bzero((char *)gmNext, sizeof(gmNext)); @@ -83,24 +86,34 @@ gmEndGeom() /* make next list current */ int -gmDrawGeom(clearports) /* draw current list of octrees (and ports) */ -int clearports; +gmDrawGeom() /* draw current list of octrees */ { register int n; FORALLGEOM(gmCurrent, n) glCallList(gmCurrent[n].listid); - if (!n | !clearports | !gmPortals) - return(n); - /* mark alpha channel over the portals */ - glPushAttrib(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT); + return(n); +} + + +gmDrawPortals(r, g, b, a) /* draw portals with specific RGBA value */ +int r, g, b, a; +{ + if (!gmPortals || r<0 & g<0 & b<0 & a<0) + return; + glPushAttrib(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT| + GL_POLYGON_BIT|GL_LIGHTING_BIT); + glDisable(GL_LIGHTING); + glDisable(GL_DITHER); + glShadeModel(GL_FLAT); + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + /* don't actually write depth */ glDepthMask(GL_FALSE); - glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE); - glClear(GL_COLOR_BUFFER_BIT); - glColor4ub(0, 0, 0, 0xff); /* write alpha buffer as mask */ + /* draw only selected channels */ + glColorMask(r>=0, g>=0, b>=0, a>=0); + glColor4ub(r&0xff, g&0xff, b&0xff, a&0xff); glCallList(gmPortals); /* draw them portals */ glPopAttrib(); - return(n); } @@ -134,11 +147,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 */