diff --git a/include/qbsp/brush.hh b/include/qbsp/brush.hh index 39de1f11..9ecf1a56 100644 --- a/include/qbsp/brush.hh +++ b/include/qbsp/brush.hh @@ -50,6 +50,6 @@ bool PlaneInvEqual(const qbsp_plane_t *p1, const qbsp_plane_t *p2); bool BoundBrush (brush_t *brush); vec_t BrushVolume (const brush_t *brush); -int BrushMostlyOnSide (const brush_t *brush, const plane_t *plane); +int BrushMostlyOnSide (const brush_t *brush, const vec3_t normal, vec_t dist); #endif diff --git a/qbsp/brush.cc b/qbsp/brush.cc index 46ff4beb..c0b1078b 100644 --- a/qbsp/brush.cc +++ b/qbsp/brush.cc @@ -1282,7 +1282,7 @@ BrushMostlyOnSide from q3map ================== */ -int BrushMostlyOnSide (const brush_t *brush, const plane_t *plane) +int BrushMostlyOnSide (const brush_t *brush, const vec3_t planenormal, vec_t planedist) { vec_t max; int side; @@ -1296,7 +1296,7 @@ int BrushMostlyOnSide (const brush_t *brush, const plane_t *plane) continue; for (int j=0 ; jnumpoints ; j++) { - const vec_t d = DotProduct (w->points[j], plane->normal) - plane->dist; + const vec_t d = DotProduct (w->points[j], planenormal) - planedist; if (d > max) { max = d; side = SIDE_FRONT; diff --git a/qbsp/test_qbsp.cc b/qbsp/test_qbsp.cc index c9bf3044..071fb158 100644 --- a/qbsp/test_qbsp.cc +++ b/qbsp/test_qbsp.cc @@ -156,11 +156,10 @@ TEST(qbsp, BrushVolume) { TEST(qbsp, BrushMostlyOnSide1) { brush_t *brush = load128x128x32Brush(); - plane_t plane1; - VectorSet(plane1.normal, -1, 0, 0); - plane1.dist = -100; + vec3_t plane1normal = { -1, 0, 0 }; + vec_t plane1dist = -100; - EXPECT_EQ(SIDE_FRONT, BrushMostlyOnSide(brush, &plane1)); + EXPECT_EQ(SIDE_FRONT, BrushMostlyOnSide(brush, plane1normal, plane1dist)); FreeMem(brush, BRUSH, 1); } @@ -168,11 +167,10 @@ TEST(qbsp, BrushMostlyOnSide1) { TEST(qbsp, BrushMostlyOnSide2) { brush_t *brush = load128x128x32Brush(); - plane_t plane2; - VectorSet(plane2.normal, 1, 0, 0); - plane2.dist = 100; + vec3_t plane1normal = { 1, 0, 0 }; + vec_t plane1dist = 100; - EXPECT_EQ(SIDE_BACK, BrushMostlyOnSide(brush, &plane2)); + EXPECT_EQ(SIDE_BACK, BrushMostlyOnSide(brush, plane1normal, plane1dist)); FreeMem(brush, BRUSH, 1); }