From 5d9dcb4bebe45c359aee77273b7cf3ad977ae465 Mon Sep 17 00:00:00 2001 From: assiduous Date: Sat, 25 Nov 2023 15:25:17 -0800 Subject: [PATCH] Matrix2x2: added ToVec4 and FromVec4 methods --- Common/interface/BasicMath.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Common/interface/BasicMath.hpp b/Common/interface/BasicMath.hpp index d61a20d52..5675a9a5d 100644 --- a/Common/interface/BasicMath.hpp +++ b/Common/interface/BasicMath.hpp @@ -938,6 +938,18 @@ template struct Matrix2x2 { return Matrix2x2::MakeMatrix(Data()); } + + template + constexpr Vector4 ToVec4() const + { + return Vector4{static_cast(_11), static_cast(_12), static_cast(_21), static_cast(_22)}; + } + + template + static constexpr Matrix2x2 FromVec4(const Vector4& v) + { + return Matrix2x2{static_cast(v.x), static_cast(v.y), static_cast(v.z), static_cast(v.w)}; + } }; template