From a04eae50545915161253e8870e6b9844dc99eb6a Mon Sep 17 00:00:00 2001 From: Garux Date: Sun, 16 Nov 2025 22:57:32 +0500 Subject: [PATCH] simpler plane3_translated() --- libs/math/plane.h | 6 +++--- tools/quake3/q3map2/convert_bsp.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/math/plane.h b/libs/math/plane.h index 49b016bc..5bde3dfa 100644 --- a/libs/math/plane.h +++ b/libs/math/plane.h @@ -75,9 +75,9 @@ inline Plane3 plane3_normalised( const Plane3& plane ){ ); } -template -Plane3 plane3_translated( const Plane3& plane, const BasicVector3& translation ){ - return Plane3( plane.normal(), vector3_dot( plane.normal(), plane.normal() * plane.dist() + translation ) ); +template +Plane3___

plane3_translated( const Plane3___

& plane, const BasicVector3& translation ){ + return Plane3___

( plane.normal(), plane.dist() + vector3_dot( plane.normal(), translation ) ); } inline Plane3 plane3_transformed( const Plane3& plane, const Matrix4& transform ){ diff --git a/tools/quake3/q3map2/convert_bsp.cpp b/tools/quake3/q3map2/convert_bsp.cpp index 7879d7af..2fb28bf6 100644 --- a/tools/quake3/q3map2/convert_bsp.cpp +++ b/tools/quake3/q3map2/convert_bsp.cpp @@ -645,7 +645,7 @@ int ShiftBSPMain( Args& args ){ /* shift planes */ for ( bspPlane_t& plane : bspPlanes ) { - plane.dist() = vector3_dot( plane.normal(), plane.normal() * plane.dist() + shift ); + plane = plane3_translated( plane, shift ); } // fixme: engine says 'light grid mismatch', unless translation is multiple of grid size