- {
- int i, j;
- square *sq;
- GLfloat s = 1.0 / iexp (3, countdown);
- s *= 3;
-
- glDeleteLists (sp->sponge_list0, 1);
- glDeleteLists (sp->sponge_list1, 1);
- glDeleteLists (sp->sponge_list2, 1);
-
- for (j = 0; j < 3; j++)
- {
- sq = sp->squares;
- glNewList ((j == 0 ? sp->sponge_list0 :
- j == 1 ? sp->sponge_list1 :
- sp->sponge_list2),
- GL_COMPILE);
- glPushMatrix();
- glTranslatef (-1.5, -1.5, -1.5);
- glScalef(s, s, s);
-
- for (i = 0; i < sp->squares_fp; i++)
- {
- if ((j == 0 && sq->nx != 0) ||
- (j == 1 && sq->ny != 0) ||
- (j == 2 && sq->nz != 0))
- {
- glBegin (wireframe_p ? GL_LINE_LOOP : GL_QUADS);
- glNormal3i (sq->nx, sq->ny, sq->nz);
- if (sq->nz)
- {
- glVertex3i (sq->x1, sq->y0, sq->z0);
- glVertex3i (sq->x1, sq->y1, sq->z0);
- glVertex3i (sq->x0, sq->y1, sq->z0);
- glVertex3i (sq->x0, sq->y0, sq->z0);
- }
- else if (sq->ny)
- {
- glVertex3i (sq->x1, sq->y0, sq->z0);
- glVertex3i (sq->x1, sq->y0, sq->z1);
- glVertex3i (sq->x0, sq->y0, sq->z1);
- glVertex3i (sq->x0, sq->y0, sq->z0);
- }
- else
- {
- glVertex3i (sq->x0, sq->y1, sq->z0);
- glVertex3i (sq->x0, sq->y1, sq->z1);
- glVertex3i (sq->x0, sq->y0, sq->z1);
- glVertex3i (sq->x0, sq->y0, sq->z0);
- }
- glEnd();
- }
- sq++;
- }
- glPopMatrix();
- glEndList();
- }
- }