diff --git a/include/qbsp/brush.hh b/include/qbsp/brush.hh index 6c1db835..4e18a88d 100644 --- a/include/qbsp/brush.hh +++ b/include/qbsp/brush.hh @@ -35,6 +35,8 @@ typedef struct brush_s { class mapbrush_t; +plane_t Face_Plane(const face_t *face); + int Brush_ListCountWithCFlags(const brush_t *brush, int cflags); int Brush_ListCount(const brush_t *brush); int Brush_NumFaces(const brush_t *brush); diff --git a/qbsp/brush.cc b/qbsp/brush.cc index f2bfe0a5..38c453ca 100644 --- a/qbsp/brush.cc +++ b/qbsp/brush.cc @@ -44,6 +44,28 @@ typedef struct hullbrush_s { int edges[MAX_HULL_EDGES][2]; } hullbrush_t; +/* +================= +Face_Plane +================= +*/ +plane_t +Face_Plane(const face_t *face) +{ + const qbsp_plane_t *plane = &map.planes.at(face->planenum); + plane_t result; + + result.dist = plane->dist; + VectorCopy(plane->normal, result.normal); + + if (face->planeside) { + VectorScale(result.normal, -1.0, result.normal); + result.dist = -result.dist; + } + + return result; +} + /* ================= CheckFace