diff --git a/include/RE/N/NiPoint3.h b/include/RE/N/NiPoint3.h index 4b4a338e9..fe9ac4736 100644 --- a/include/RE/N/NiPoint3.h +++ b/include/RE/N/NiPoint3.h @@ -30,6 +30,11 @@ namespace RE NiPoint3& operator*=(float a_scalar); NiPoint3& operator/=(float a_scalar); + friend NiPoint3 operator+(float a_lhs, const NiPoint3& a_rhs); + friend NiPoint3 operator-(float a_lhs, const NiPoint3& a_rhs); + friend NiPoint3 operator*(float a_lhs, const NiPoint3& a_rhs); + friend NiPoint3 operator/(float a_lhs, const NiPoint3& a_rhs); + [[nodiscard]] NiPoint3 Cross(const NiPoint3& pt) const; [[nodiscard]] float Dot(const NiPoint3& pt) const; [[nodiscard]] float GetDistance(const NiPoint3& a_pt) const noexcept; diff --git a/src/RE/N/NiPoint3.cpp b/src/RE/N/NiPoint3.cpp index 4e353af67..a0ad7dd88 100644 --- a/src/RE/N/NiPoint3.cpp +++ b/src/RE/N/NiPoint3.cpp @@ -104,6 +104,38 @@ namespace RE return operator*=(1.0F / a_scalar); } + NiPoint3 operator+(float a_lhs, const NiPoint3& a_rhs) + { + return NiPoint3( + a_lhs + a_rhs.x, + a_lhs + a_rhs.y, + a_lhs + a_rhs.z); + } + + NiPoint3 operator-(float a_lhs, const NiPoint3& a_rhs) + { + return NiPoint3( + a_lhs - a_rhs.x, + a_lhs - a_rhs.y, + a_lhs - a_rhs.z); + } + + NiPoint3 operator*(float a_lhs, const NiPoint3& a_rhs) + { + return NiPoint3( + a_lhs * a_rhs.x, + a_lhs * a_rhs.y, + a_lhs * a_rhs.z); + } + + NiPoint3 operator/(float a_lhs, const NiPoint3& a_rhs) + { + return NiPoint3( + a_lhs / a_rhs.x, + a_lhs / a_rhs.y, + a_lhs / a_rhs.z); + } + NiPoint3 NiPoint3::Cross(const NiPoint3& a_pt) const { return NiPoint3(