-void Portal_RecursiveFlow_ExactMarkSurfaces(portalrecursioninfo_t *info, int *mark, int nummarksurfaces, int firstclipplane, int numclipplanes)
-{
- int i, j, *elements;
- vec3_t trimins, trimaxs;
- msurface_t *surf;
- for (i = 0;i < nummarksurfaces;i++, mark++)
- {
- if (!info->surfacemark[*mark])
- {
- surf = info->model->brushq1.surfaces + *mark;
- if (surf->poly_numverts)
- {
- if (surf->flags & SURF_PLANEBACK)
- {
- if (DotProduct(info->eye, surf->plane->normal) > surf->plane->dist)
- continue;
- }
- else
- {
- if (DotProduct(info->eye, surf->plane->normal) < surf->plane->dist)
- continue;
- }
- if (Portal_PortalThroughPortalPlanes(&portalplanes[firstclipplane], numclipplanes, surf->poly_verts, surf->poly_numverts, &portaltemppoints2[0][0], 256) < 3)
- continue;
- }
- else
- {
- for (j = 0, elements = surf->mesh.data_element3i;j < surf->mesh.num_triangles;j++, elements += 3)
- {
- VectorCopy((surf->mesh.data_vertex3f + elements[0] * 3), trianglepoints[0]);
- VectorCopy((surf->mesh.data_vertex3f + elements[1] * 3), trianglepoints[1]);
- VectorCopy((surf->mesh.data_vertex3f + elements[2] * 3), trianglepoints[2]);
- if (PointInfrontOfTriangle(info->eye, trianglepoints[0], trianglepoints[1], trianglepoints[2]))
- {
- trimins[0] = min(trianglepoints[0][0], min(trianglepoints[1][0], trianglepoints[2][0]));
- trimaxs[0] = max(trianglepoints[0][0], max(trianglepoints[1][0], trianglepoints[2][0]));
- trimins[1] = min(trianglepoints[0][1], min(trianglepoints[1][1], trianglepoints[2][1]));
- trimaxs[1] = max(trianglepoints[0][1], max(trianglepoints[1][1], trianglepoints[2][1]));
- trimins[2] = min(trianglepoints[0][2], min(trianglepoints[1][2], trianglepoints[2][2]));
- trimaxs[2] = max(trianglepoints[0][2], max(trianglepoints[1][2], trianglepoints[2][2]));
- if (BoxesOverlap(trimins, trimaxs, info->boxmins, info->boxmaxs))
- if (Portal_PortalThroughPortalPlanes(&portalplanes[firstclipplane], numclipplanes, trianglepoints[0], 3, &portaltemppoints2[0][0], 256) >= 3)
- break;
- }
- }
- if (j == surf->mesh.num_triangles)
- continue;
- }
- info->surfacemark[*mark] = true;
- }
- }
-}
-
-void Portal_RecursiveFlow (portalrecursioninfo_t *info, mleaf_t *leaf, int firstclipplane, int numclipplanes)