--- ray/src/common/rglinst.c 1998/06/09 11:18:35 3.1 +++ ray/src/common/rglinst.c 1998/07/15 17:52:16 3.3 @@ -11,6 +11,8 @@ static char SCCSid[] = "$SunId$ SGI"; #include "radogl.h" #include "octree.h" +#define MAXLEVEL 16 /* maximum instance hierarchy level */ + typedef struct { int listid; /* our list id */ short localmatl; /* uses local material only */ @@ -72,6 +74,7 @@ register OBJREC *o; glCallList(ot->listid); if (o->oargs.nsargs > 1) { /* end transform */ + glMatrixMode(GL_MODELVIEW); glPopMatrix(); glPopAttrib(); } @@ -101,10 +104,13 @@ LUENT *lp; int loadoctrees() /* load octrees we've saved up */ { + int levelsleft = MAXLEVEL; int nocts = 0; LUTAB looptab; /* loop through new octree references */ while (ottab.tsiz) { + if (!levelsleft--) + error(USER, "too many octree levels -- instance loop?"); copystruct(&looptab, &ottab); ottab.tsiz = 0; nocts += lu_doall(&looptab, buildoctlist);