From 31f046b912d2d9a00e74a202a483aca12c277185 Mon Sep 17 00:00:00 2001 From: Scrabx3 Date: Sat, 24 Aug 2024 15:40:48 +0200 Subject: [PATCH] NiMatrix3 plus & minus ops --- include/RE/N/NiMatrix3.h | 2 ++ src/RE/N/NiMatrix3.cpp | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/include/RE/N/NiMatrix3.h b/include/RE/N/NiMatrix3.h index b49076388..905c18022 100644 --- a/include/RE/N/NiMatrix3.h +++ b/include/RE/N/NiMatrix3.h @@ -38,6 +38,8 @@ namespace RE bool operator==(const NiMatrix3& a_rhs) const; bool operator!=(const NiMatrix3& a_rhs) const; + NiMatrix3 operator+(const NiMatrix3& a_rhs) const; + NiMatrix3 operator-(const NiMatrix3& a_rhs) const; NiMatrix3 operator*(const NiMatrix3& a_rhs) const; NiPoint3 operator*(const NiPoint3& a_point) const; NiMatrix3 operator*(float a_scalar) const; diff --git a/src/RE/N/NiMatrix3.cpp b/src/RE/N/NiMatrix3.cpp index 8b9150bdb..0d40b73b0 100644 --- a/src/RE/N/NiMatrix3.cpp +++ b/src/RE/N/NiMatrix3.cpp @@ -221,4 +221,34 @@ namespace RE return result; } + NiMatrix3 NiMatrix3::operator+(const NiMatrix3& a_rhs) const + { + NiMatrix3 result; + result.entry[0][0] = entry[0][0] + a_rhs.entry[0][0]; + result.entry[0][1] = entry[0][1] + a_rhs.entry[0][1]; + result.entry[0][2] = entry[0][2] + a_rhs.entry[0][2]; + result.entry[1][0] = entry[1][0] + a_rhs.entry[1][0]; + result.entry[1][1] = entry[1][1] + a_rhs.entry[1][1]; + result.entry[1][2] = entry[1][2] + a_rhs.entry[1][2]; + result.entry[2][0] = entry[2][0] + a_rhs.entry[2][0]; + result.entry[2][1] = entry[2][1] + a_rhs.entry[2][1]; + result.entry[2][2] = entry[2][2] + a_rhs.entry[2][2]; + return result; + } + + NiMatrix3 NiMatrix3::operator-(const NiMatrix3& a_rhs) const + { + NiMatrix3 result; + result.entry[0][0] = entry[0][0] - a_rhs.entry[0][0]; + result.entry[0][1] = entry[0][1] - a_rhs.entry[0][1]; + result.entry[0][2] = entry[0][2] - a_rhs.entry[0][2]; + result.entry[1][0] = entry[1][0] - a_rhs.entry[1][0]; + result.entry[1][1] = entry[1][1] - a_rhs.entry[1][1]; + result.entry[1][2] = entry[1][2] - a_rhs.entry[1][2]; + result.entry[2][0] = entry[2][0] - a_rhs.entry[2][0]; + result.entry[2][1] = entry[2][1] - a_rhs.entry[2][1]; + result.entry[2][2] = entry[2][2] - a_rhs.entry[2][2]; + return result; + } + }