diff --git a/include/qbsp/brush.hh b/include/qbsp/brush.hh index 38df1de9..8ea0420f 100644 --- a/include/qbsp/brush.hh +++ b/include/qbsp/brush.hh @@ -80,8 +80,5 @@ struct bspbrush_t using bspbrush_vector_t = std::vector>; -qplane3d Face_Plane(const face_t *face); -qplane3d Face_Plane(const side_t *face); - bspbrush_t LoadBrush(const mapentity_t *src, const mapbrush_t *mapbrush, const contentflags_t &contents, const int hullnum); void CreateBrushWindings(bspbrush_t *brush); \ No newline at end of file diff --git a/qbsp/brush.cc b/qbsp/brush.cc index e3067156..c24100e0 100644 --- a/qbsp/brush.cc +++ b/qbsp/brush.cc @@ -55,21 +55,6 @@ std::unique_ptr bspbrush_t::copy_unique() const return std::make_unique(*this); } -/* -================= -Face_Plane -================= -*/ -qplane3d Face_Plane(const face_t *face) -{ - return face->get_plane(); -} - -qplane3d Face_Plane(const side_t *face) -{ - return face->get_plane(); -} - /* ================= CheckFace @@ -235,13 +220,13 @@ void CreateBrushWindings(bspbrush_t *brush) for (int i = 0; i < brush->sides.size(); i++) { side_t *side = &brush->sides[i]; - w = BaseWindingForPlane(Face_Plane(side)); + w = BaseWindingForPlane(side->get_plane()); for (int j = 0; j < brush->sides.size() && w; j++) { if (i == j) continue; if (brush->sides[j].bevel) continue; - qplane3d plane = -Face_Plane(&brush->sides[j]); + const qplane3d &plane = map.planes[brush->sides[j].planenum ^ 1]; w = w->clip(plane, qbsp_options.epsilon.value(), false)[SIDE_FRONT]; // CLIP_EPSILON); } diff --git a/qbsp/brushbsp.cc b/qbsp/brushbsp.cc index 169fc3f6..a0693b49 100644 --- a/qbsp/brushbsp.cc +++ b/qbsp/brushbsp.cc @@ -136,8 +136,8 @@ static vec_t BrushVolume(const bspbrush_t &brush) if (!side.w.size()) { continue; } - auto plane = Face_Plane(&side); - vec_t d = -(qv::dot(corner, plane.normal) - plane.dist); + auto &plane = side.get_plane(); + vec_t d = -(qv::dot(corner, plane.get_normal()) - plane.get_dist()); vec_t area = side.w.area(); volume += d * area; } @@ -465,7 +465,7 @@ static twosided> SplitBrush(std::unique_ptrclip(Face_Plane(&face)); + auto [frontOpt, backOpt] = w->clip(face.get_plane()); w = backOpt; } diff --git a/tests/test_qbsp.cc b/tests/test_qbsp.cc index e13ef23e..8901ee1a 100644 --- a/tests/test_qbsp.cc +++ b/tests/test_qbsp.cc @@ -1842,16 +1842,16 @@ TEST_CASE("BrushFromBounds") { if (side.w.directional_equal(top_winding)) { found++; - auto plane = Face_Plane(&side); - CHECK(plane.normal == qvec3d{0,0,1}); - CHECK(plane.dist == 32); + auto &plane = side.get_plane(); + CHECK(plane.get_normal() == qvec3d{0,0,1}); + CHECK(plane.get_dist() == 32); } if (side.w.directional_equal(bottom_winding)) { found++; - auto plane = Face_Plane(&side); - CHECK(plane.normal == qvec3d{0,0,-1}); - CHECK(plane.dist == -2); + auto plane = side.get_plane(); + CHECK(plane.get_normal() == qvec3d{0,0,-1}); + CHECK(plane.get_dist() == -2); } } CHECK(found == 2);