static void WritePortalFile_r(const node_t* const node) { int i; portal_t* p; Winding* w; dplane_t plane2; if (!node->contents) { WritePortalFile_r(node->children[0]); WritePortalFile_r(node->children[1]); return; } if (node->contents == CONTENTS_SOLID) { return; } for (p = node->portals; p;) { w = p->winding; if (w && p->nodes[0] == node) { if (p->nodes[0]->contents == p->nodes[1]->contents) { // write out to the file // sometimes planes get turned around when they are very near // the changeover point between different axis. interpret the // plane the same way vis will, and flip the side orders if needed w->getPlane(plane2); if (DotProduct(p->plane.normal, plane2.normal) < 1.0 - ON_EPSILON) { // backwards... fprintf(pf, "%u %i %i ", w->m_NumPoints, p->nodes[1]->visleafnum, p->nodes[0]->visleafnum); } else { fprintf(pf, "%u %i %i ", w->m_NumPoints, p->nodes[0]->visleafnum, p->nodes[1]->visleafnum); } for (i = 0; i < w->m_NumPoints; i++) { fprintf(pf, "(%f %f %f) ", w->m_Points[i][0], w->m_Points[i][1], w->m_Points[i][2]); } fprintf(pf, "\n"); } } if (p->nodes[0] == node) { p = p->next[0]; } else { p = p->next[1]; } } }