From b37d29ee334a007b4d04f6902d50ab4b863633ec Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Fri, 24 Jun 2022 00:16:46 -0600 Subject: [PATCH] common: rename side_t -> planeside_t (side_t is used by qbsp3) --- include/common/mathlib.hh | 2 +- include/common/polylib.hh | 6 +++--- include/qbsp/brush.hh | 4 ++-- include/qbsp/qbsp.hh | 2 +- qbsp/brush.cc | 6 +++--- qbsp/brushbsp.cc | 6 +++--- qbsp/csg4.cc | 2 +- qbsp/portals.cc | 6 +++--- qbsp/surfaces.cc | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/include/common/mathlib.hh b/include/common/mathlib.hh index 2337d59f..bbb3222f 100644 --- a/include/common/mathlib.hh +++ b/include/common/mathlib.hh @@ -53,7 +53,7 @@ constexpr vec_t DIST_EPSILON = 0.0001; constexpr vec_t DEGREES_EPSILON = 0.001; constexpr vec_t DEFAULT_ON_EPSILON = 0.1; -enum side_t : int8_t +enum planeside_t : int8_t { SIDE_FRONT, SIDE_BACK, diff --git a/include/common/polylib.hh b/include/common/polylib.hh index 7d431b75..e7fea2fc 100644 --- a/include/common/polylib.hh +++ b/include/common/polylib.hh @@ -540,7 +540,7 @@ public: // dists/sides can be null, or must have (size() + 1) reserved inline std::array calc_sides( - const qplane3d &plane, vec_t *dists, side_t *sides, const vec_t &on_epsilon = DEFAULT_ON_EPSILON) const + const qplane3d &plane, vec_t *dists, planeside_t *sides, const vec_t &on_epsilon = DEFAULT_ON_EPSILON) const { std::array counts{}; @@ -554,7 +554,7 @@ public: dists[i] = dot; } - side_t side; + planeside_t side; if (dot > on_epsilon) side = SIDE_FRONT; @@ -593,7 +593,7 @@ public: const qplane3d &plane, const vec_t &on_epsilon = DEFAULT_ON_EPSILON, const bool &keepon = false) const { vec_t *dists = (vec_t *)alloca(sizeof(vec_t) * (count + 1)); - side_t *sides = (side_t *)alloca(sizeof(side_t) * (count + 1)); + planeside_t *sides = (planeside_t *)alloca(sizeof(planeside_t) * (count + 1)); std::array counts = calc_sides(plane, dists, sides, on_epsilon); diff --git a/include/qbsp/brush.hh b/include/qbsp/brush.hh index 81150ca5..1fe4d2dc 100644 --- a/include/qbsp/brush.hh +++ b/include/qbsp/brush.hh @@ -60,6 +60,6 @@ std::optional LoadBrush(const mapentity_t *src, const mapbrush_t *ma const qvec3d &rotate_offset, const rotation_t rottype, const int hullnum); void FreeBrushes(mapentity_t *ent); -int FindPlane(const qplane3d &plane, side_t *side); +int FindPlane(const qplane3d &plane, planeside_t *side); int FindPositivePlane(int planenum); -int FindPositivePlane(const qplane3d &plane, side_t *side); +int FindPositivePlane(const qplane3d &plane, planeside_t *side); diff --git a/include/qbsp/qbsp.hh b/include/qbsp/qbsp.hh index 58ba6e76..2bb0ed44 100644 --- a/include/qbsp/qbsp.hh +++ b/include/qbsp/qbsp.hh @@ -332,7 +332,7 @@ struct portal_t; struct face_t : face_fragment_t { int planenum; - side_t planeside; // which side is the front of the face + planeside_t planeside; // which side is the front of the face int texinfo; twosided contents; twosided lmshift; diff --git a/qbsp/brush.cc b/qbsp/brush.cc index b4b93d79..c4917493 100644 --- a/qbsp/brush.cc +++ b/qbsp/brush.cc @@ -206,7 +206,7 @@ static void PlaneHash_Add(const qplane3d &p, int index) * NewPlane * - Returns a global plane number and the side that will be the front */ -static int NewPlane(const qplane3d &plane, side_t *side) +static int NewPlane(const qplane3d &plane, planeside_t *side) { vec_t len = qv::length(plane.normal); @@ -235,7 +235,7 @@ static int NewPlane(const qplane3d &plane, side_t *side) * - Returns a global plane number and the side that will be the front * - if `side` is null, only an exact match will be fetched. */ -int FindPlane(const qplane3d &plane, side_t *side) +int FindPlane(const qplane3d &plane, planeside_t *side) { for (int i : map.planehash[plane_hash_fn(plane)]) { const qbsp_plane_t &p = map.planes.at(i); @@ -268,7 +268,7 @@ int FindPositivePlane(int planenum) return FindPlane(-plane, nullptr); } -int FindPositivePlane(const qplane3d &plane, side_t *side) +int FindPositivePlane(const qplane3d &plane, planeside_t *side) { int planenum = FindPlane(plane, side); int positive_plane = FindPositivePlane(planenum); diff --git a/qbsp/brushbsp.cc b/qbsp/brushbsp.cc index 7bd9d805..a90112b8 100644 --- a/qbsp/brushbsp.cc +++ b/qbsp/brushbsp.cc @@ -569,10 +569,10 @@ BrushMostlyOnSide ================== */ -side_t BrushMostlyOnSide(const bspbrush_t &brush, const qplane3d &plane) +planeside_t BrushMostlyOnSide(const bspbrush_t &brush, const qplane3d &plane) { vec_t max = 0; - side_t side = SIDE_FRONT; + planeside_t side = SIDE_FRONT; for (auto &face : brush.faces) { for (size_t j = 0; j < face.w.size(); j++) { vec_t d = qv::dot(face.w[j], plane.normal) - plane.dist; @@ -673,7 +673,7 @@ twosided> SplitBrush(std::unique_ptr bru } if (!w || WindingIsTiny(*w)) { // the brush isn't really split - side_t side = BrushMostlyOnSide(*brush, split); + planeside_t side = BrushMostlyOnSide(*brush, split); if (side == SIDE_FRONT) result.front = std::move(brush); else diff --git a/qbsp/csg4.cc b/qbsp/csg4.cc index 7c488878..fe4b445e 100644 --- a/qbsp/csg4.cc +++ b/qbsp/csg4.cc @@ -131,7 +131,7 @@ face_t *MirrorFace(const face_t *face) { face_t *newface = NewFaceFromFace(face); newface->w = face->w.flip(); - newface->planeside = static_cast(face->planeside ^ 1); + newface->planeside = static_cast(face->planeside ^ 1); newface->contents.swap(); newface->lmshift.swap(); diff --git a/qbsp/portals.cc b/qbsp/portals.cc index 501d74d3..1c1f228d 100644 --- a/qbsp/portals.cc +++ b/qbsp/portals.cc @@ -98,7 +98,7 @@ void MakeHeadnodePortals(tree_t *tree) int i, j, n; portal_t *p, *portals[6]; qbsp_plane_t bplanes[6]; - side_t side; + planeside_t side; // pad with some space so there will never be null volume leafs aabb3d bounds = tree->bounds.grow(SIDESPACE); @@ -167,7 +167,7 @@ std::optional BaseWindingForNode(node_t *node) { plane = map.planes.at(np->planenum); - const side_t keep = (np->children[0] == node) ? + const planeside_t keep = (np->children[0] == node) ? SIDE_FRONT : SIDE_BACK; w = w->clip(plane, BASE_WINDING_EPSILON, false)[keep]; @@ -247,7 +247,7 @@ void SplitNodePortals(node_t *node, portalstats_t &stats) portal_t *next_portal = nullptr; for (portal_t *p = node->portals; p ; p = next_portal) { - side_t side; + planeside_t side; if (p->nodes[SIDE_FRONT] == node) side = SIDE_FRONT; else if (p->nodes[SIDE_BACK] == node) diff --git a/qbsp/surfaces.cc b/qbsp/surfaces.cc index 5aa7255f..c19af5c3 100644 --- a/qbsp/surfaces.cc +++ b/qbsp/surfaces.cc @@ -605,7 +605,7 @@ static face_t *FaceFromPortal(portal_t *p, int pside) f->texinfo = side->texinfo; f->planenum = side->planenum; - f->planeside = static_cast(pside); + f->planeside = static_cast(pside); f->portal = p; f->lmshift = side->lmshift;