+static void draw_plane(struct bspnode *n)
+{
+ int i;
+ float cx = 0, cy = 0, cz = 0;
+
+ for(i=0; i<n->vcount; i++) {
+ cx += n->verts[i].x;
+ cy += n->verts[i].y;
+ cz += n->verts[i].z;
+ }
+ cx /= n->vcount;
+ cy /= n->vcount;
+ cz /= n->vcount;
+
+ glPushAttrib(GL_ENABLE_BIT);
+ glDisable(GL_CULL_FACE);
+ glDisable(GL_LIGHTING);
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ glPushMatrix();
+ glTranslatef(cx, cy, cz);
+ glScalef(10, 10, 10);
+ glTranslatef(-cx, -cy, -cz);
+
+ glBegin(GL_POLYGON);
+ glColor4f(0.2, 0.3, 1.0, 0.5);
+ for(i=0; i<n->vcount; i++) {
+ glVertex3f(n->verts[i].x, n->verts[i].y, n->verts[i].z);
+ }
+ glEnd();
+
+ glBegin(GL_LINE_LOOP);
+ glColor4f(0.2, 0.3, 1.0, 0.85);
+ for(i=0; i<n->vcount; i++) {
+ glVertex3f(n->verts[i].x, n->verts[i].y, n->verts[i].z);
+ }
+ glEnd();
+
+ glPopMatrix();
+ glPopAttrib();
+}
+