common: rename side_t -> planeside_t (side_t is used by qbsp3)

This commit is contained in:
Eric Wasylishen 2022-06-24 00:16:46 -06:00
parent 4a1c5842a3
commit b37d29ee33
9 changed files with 18 additions and 18 deletions

View File

@ -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,

View File

@ -540,7 +540,7 @@ public:
// dists/sides can be null, or must have (size() + 1) reserved
inline std::array<size_t, SIDE_TOTAL> 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<size_t, SIDE_TOTAL> 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<size_t, SIDE_TOTAL> counts = calc_sides(plane, dists, sides, on_epsilon);

View File

@ -60,6 +60,6 @@ std::optional<bspbrush_t> 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);

View File

@ -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<contentflags_t> contents;
twosided<int16_t> lmshift;

View File

@ -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);

View File

@ -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<std::unique_ptr<bspbrush_t>> SplitBrush(std::unique_ptr<bspbrush_t> 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

View File

@ -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<side_t>(face->planeside ^ 1);
newface->planeside = static_cast<planeside_t>(face->planeside ^ 1);
newface->contents.swap();
newface->lmshift.swap();

View File

@ -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<winding_t> 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)

View File

@ -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<side_t>(pside);
f->planeside = static_cast<planeside_t>(pside);
f->portal = p;
f->lmshift = side->lmshift;