From bb759b1a9aceb7e0f492038f978f8df09e4a0843 Mon Sep 17 00:00:00 2001 From: THoehne <77296181+THoehne@users.noreply.github.com> Date: Sun, 13 Oct 2024 19:09:15 +0200 Subject: [PATCH] Bug fixes --- .../Runtime/Core/public/Math/IntVector2.hpp | 52 +++++++++---------- .../Runtime/Core/public/Math/IntVector2.inl | 40 +++++++------- .../Runtime/Core/public/Math/IntVector3.hpp | 36 ++++++------- .../Runtime/Core/public/Math/IntVector3.inl | 40 +++++++------- .../Runtime/Core/public/Math/IntVector4.hpp | 46 ++++++++-------- .../Runtime/Core/public/Math/IntVector4.inl | 40 +++++++------- .../Source/Runtime/Core/public/Math/Line.hpp | 2 +- .../Runtime/Core/public/Math/Matrix2.hpp | 18 +++---- .../Runtime/Core/public/Math/Matrix3.hpp | 16 +++--- .../Runtime/Core/public/Math/Matrix4.hpp | 17 +++--- 10 files changed, 155 insertions(+), 152 deletions(-) diff --git a/Engine/Source/Runtime/Core/public/Math/IntVector2.hpp b/Engine/Source/Runtime/Core/public/Math/IntVector2.hpp index 25db1a7..3ee8379 100644 --- a/Engine/Source/Runtime/Core/public/Math/IntVector2.hpp +++ b/Engine/Source/Runtime/Core/public/Math/IntVector2.hpp @@ -134,7 +134,7 @@ namespace Phanes::Core::Math { */ template - TIntVector2 operator+= (TIntVector2& v1, T s); + TIntVector2& operator+= (TIntVector2& v1, T s); /** * Addition operation on same TIntVector2 (this) by a another TIntVector2. @@ -144,7 +144,7 @@ namespace Phanes::Core::Math { */ template - TIntVector2 operator+= (TIntVector2& v1, const TIntVector2& v2); + TIntVector2& operator+= (TIntVector2& v1, const TIntVector2& v2); /** * Substraction operation on same TIntVector2 (this) by a scalar. @@ -154,7 +154,7 @@ namespace Phanes::Core::Math { */ template - TIntVector2 operator-= (TIntVector2& v1, T s); + TIntVector2& operator-= (TIntVector2& v1, T s); /** * Substraction operation on same TIntVector2 (this) by a another TIntVector2. @@ -164,7 +164,7 @@ namespace Phanes::Core::Math { */ template - TIntVector2 operator-= (TIntVector2& v1, const TIntVector2& v2); + TIntVector2& operator-= (TIntVector2& v1, const TIntVector2& v2); /** @@ -175,10 +175,10 @@ namespace Phanes::Core::Math { */ template - TIntVector2 operator*= (TIntVector2& v1, T s); + TIntVector2& operator*= (TIntVector2& v1, T s); template - TIntVector2 operator*= (TIntVector2& v1, const TIntVector2& v2); + TIntVector2& operator*= (TIntVector2& v1, const TIntVector2& v2); /** * Devision of Vector @@ -190,10 +190,10 @@ namespace Phanes::Core::Math { */ template - TIntVector2 operator/= (TIntVector2& v1, T s); + TIntVector2& operator/= (TIntVector2& v1, T s); template - TIntVector2 operator/= (TIntVector2& v1, const TIntVector2& v2); + TIntVector2& operator/= (TIntVector2& v1, const TIntVector2& v2); /** * Stores the remainder of division by a scalar. @@ -203,40 +203,40 @@ namespace Phanes::Core::Math { */ template - TIntVector2 operator%= (TIntVector2& v1, const TIntVector2& v2); + TIntVector2& operator%= (TIntVector2& v1, const TIntVector2& v2); template - TIntVector2 operator%= (TIntVector2& v1, T s); + TIntVector2& operator%= (TIntVector2& v1, T s); template - inline TIntVector2 operator&= (TIntVector2& v1, const TIntVector2& v2); + inline TIntVector2& operator&= (TIntVector2& v1, const TIntVector2& v2); template - inline TIntVector2 operator&= (TIntVector2& v1, T s); + inline TIntVector2& operator&= (TIntVector2& v1, T s); template - inline TIntVector2 operator|= (TIntVector2& v1, const TIntVector2& v2); + inline TIntVector2& operator|= (TIntVector2& v1, const TIntVector2& v2); template - inline TIntVector2 operator|= (TIntVector2& v1, T s); + inline TIntVector2& operator|= (TIntVector2& v1, T s); template - inline TIntVector2 operator^= (TIntVector2& v1, const TIntVector2& v2); + inline TIntVector2& operator^= (TIntVector2& v1, const TIntVector2& v2); template - inline TIntVector2 operator^= (TIntVector2& v1, T s); + inline TIntVector2& operator^= (TIntVector2& v1, T s); template - inline TIntVector2 operator<<= (TIntVector2& v1, const TIntVector2& v2); + inline TIntVector2& operator<<= (TIntVector2& v1, const TIntVector2& v2); template - inline TIntVector2 operator<<= (TIntVector2& v1, T s); + inline TIntVector2& operator<<= (TIntVector2& v1, T s); template - inline TIntVector2 operator>>= (TIntVector2& v1, const TIntVector2& v2); + inline TIntVector2& operator>>= (TIntVector2& v1, const TIntVector2& v2); template - inline TIntVector2 operator>>= (TIntVector2& v1, T s); + inline TIntVector2& operator>>= (TIntVector2& v1, T s); /** * Scale of Vector by floating point. (> Creates a new TIntVector2) @@ -447,7 +447,7 @@ namespace Phanes::Core::Math { } template - TIntVector2 MaxV(TIntVector2& v1, const TIntVector2& v2) + TIntVector2& MaxV(TIntVector2& v1, const TIntVector2& v2) { v1.x = Phanes::Core::Math::Max(v1.x, v2.x); v1.y = Phanes::Core::Math::Max(v1.y, v2.y); @@ -465,7 +465,7 @@ namespace Phanes::Core::Math { */ template - TIntVector2 MinV(TIntVector2& v1, const TIntVector2& v2) + TIntVector2& MinV(TIntVector2& v1, const TIntVector2& v2) { v1.x = Phanes::Core::Math::Min(v1.x, v2.x); v1.y = Phanes::Core::Math::Min(v1.y, v2.y); @@ -481,7 +481,7 @@ namespace Phanes::Core::Math { /// /// template - TIntVector2 SignVectorV(TIntVector2& v1) + TIntVector2& SignVectorV(TIntVector2& v1) { v1.x = (v1.x >= 0) ? 1 : -1; v1.y = (v1.y >= 0) ? 1 : -1; @@ -497,7 +497,7 @@ namespace Phanes::Core::Math { */ template - TIntVector2 Set(TIntVector2& v1, const TIntVector2& v2) + TIntVector2& Set(TIntVector2& v1, const TIntVector2& v2) { v1 = v2; @@ -512,7 +512,7 @@ namespace Phanes::Core::Math { */ template - TIntVector2 Set(TIntVector2& v1, T x, T y) + TIntVector2& Set(TIntVector2& v1, T x, T y) { v1.x = x; v1.y = y; @@ -528,7 +528,7 @@ namespace Phanes::Core::Math { */ template - TIntVector2 NegateV(TIntVector2& v1) + TIntVector2& NegateV(TIntVector2& v1) { v1.x = -v1.x; v1.y = -v1.y; diff --git a/Engine/Source/Runtime/Core/public/Math/IntVector2.inl b/Engine/Source/Runtime/Core/public/Math/IntVector2.inl index 5f862e2..5d1d86a 100644 --- a/Engine/Source/Runtime/Core/public/Math/IntVector2.inl +++ b/Engine/Source/Runtime/Core/public/Math/IntVector2.inl @@ -37,70 +37,70 @@ namespace Phanes::Core::Math template - TIntVector2 operator+=(TIntVector2& v1, const TIntVector2& v2) + TIntVector2& operator+=(TIntVector2& v1, const TIntVector2& v2) { Detail::compute_ivec2_add::map(v1, v1, v2); return v1; } template - TIntVector2 operator+=(TIntVector2& v1, T s) + TIntVector2& operator+=(TIntVector2& v1, T s) { Detail::compute_ivec2_add::map(v1, v1, s); return v1; } template - TIntVector2 operator-=(TIntVector2& v1, const TIntVector2& v2) + TIntVector2& operator-=(TIntVector2& v1, const TIntVector2& v2) { Detail::compute_ivec2_sub::map(v1, v1, v2); return v1; } template - TIntVector2 operator-=(TIntVector2& v1, T s) + TIntVector2& operator-=(TIntVector2& v1, T s) { Detail::compute_ivec2_sub::map(v1, v1, s); return v1; } template - TIntVector2 operator*=(TIntVector2& v1, const TIntVector2& v2) + TIntVector2& operator*=(TIntVector2& v1, const TIntVector2& v2) { Detail::compute_ivec2_mul::map(v1, v1, v2); return v1; } template - TIntVector2 operator*=(TIntVector2& v1, T s) + TIntVector2& operator*=(TIntVector2& v1, T s) { Detail::compute_ivec2_mul::map(v1, v1, s); return v1; } template - TIntVector2 operator/=(TIntVector2& v1, const TIntVector2& v2) + TIntVector2& operator/=(TIntVector2& v1, const TIntVector2& v2) { Detail::compute_ivec2_div::map(v1, v1, v2); return v1; } template - TIntVector2 operator/=(TIntVector2& v1, T s) + TIntVector2& operator/=(TIntVector2& v1, T s) { Detail::compute_ivec2_div::map(v1, v1, s); return v1; } template - TIntVector2 operator%=(TIntVector2& v1, const TIntVector2& v2) + TIntVector2& operator%=(TIntVector2& v1, const TIntVector2& v2) { Detail::compute_ivec2_mod::map(v1, v1, v2); return v1; } template - TIntVector2 operator%=(TIntVector2& v1, T s) + TIntVector2& operator%=(TIntVector2& v1, T s) { Detail::compute_ivec2_mod::map(v1, v1, s); return v1; @@ -193,70 +193,70 @@ namespace Phanes::Core::Math // Bitwise operators template - TIntVector2 operator&=(TIntVector2& v1, const TIntVector2& v2) + TIntVector2& operator&=(TIntVector2& v1, const TIntVector2& v2) { Detail::compute_ivec2_and::map(v1, v1, v2); return v1; } template - TIntVector2 operator&=(TIntVector2& v1, T s) + TIntVector2& operator&=(TIntVector2& v1, T s) { Detail::compute_ivec2_and::map(v1, v1, s); return v1; } template - TIntVector2 operator|=(TIntVector2& v1, const TIntVector2& v2) + TIntVector2& operator|=(TIntVector2& v1, const TIntVector2& v2) { Detail::compute_ivec2_or::map(v1, v1, v2); return v1; } template - TIntVector2 operator|=(TIntVector2& v1, T s) + TIntVector2& operator|=(TIntVector2& v1, T s) { Detail::compute_ivec2_or::map(v1, v1, s); return v1; } template - TIntVector2 operator^=(TIntVector2& v1, const TIntVector2& v2) + TIntVector2& operator^=(TIntVector2& v1, const TIntVector2& v2) { Detail::compute_ivec2_xor::map(v1, v1, v2); return v1; } template - TIntVector2 operator^=(TIntVector2& v1, T s) + TIntVector2& operator^=(TIntVector2& v1, T s) { Detail::compute_ivec2_xor::map(v1, v1, s); return v1; } template - TIntVector2 operator<<=(TIntVector2& v1, const TIntVector2& v2) + TIntVector2& operator<<=(TIntVector2& v1, const TIntVector2& v2) { Detail::compute_ivec2_left_shift::map(v1, v1, v2); return v1; } template - TIntVector2 operator<<=(TIntVector2& v1, T s) + TIntVector2& operator<<=(TIntVector2& v1, T s) { Detail::compute_ivec2_left_shift::map(v1, v1, s); return v1; } template - TIntVector2 operator>>=(TIntVector2& v1, const TIntVector2& v2) + TIntVector2& operator>>=(TIntVector2& v1, const TIntVector2& v2) { Detail::compute_ivec2_right_shift::map(v1, v1, v2); return v1; } template - TIntVector2 operator>>=(TIntVector2& v1, T s) + TIntVector2& operator>>=(TIntVector2& v1, T s) { Detail::compute_ivec2_right_shift::map(v1, v1, s); return v1; diff --git a/Engine/Source/Runtime/Core/public/Math/IntVector3.hpp b/Engine/Source/Runtime/Core/public/Math/IntVector3.hpp index 31a9fbd..6d3bc76 100644 --- a/Engine/Source/Runtime/Core/public/Math/IntVector3.hpp +++ b/Engine/Source/Runtime/Core/public/Math/IntVector3.hpp @@ -91,7 +91,7 @@ namespace Phanes::Core::Math { */ template - inline TIntVector3 operator+= (TIntVector3& v1, T s); + inline TIntVector3& operator+= (TIntVector3& v1, T s); /** * Coponentwise addition of 3D vector to 3D vector @@ -101,7 +101,7 @@ namespace Phanes::Core::Math { */ template - inline TIntVector3 operator+= (TIntVector3& v1, const TIntVector3& v2); + inline TIntVector3& operator+= (TIntVector3& v1, const TIntVector3& v2); /** * Coponentwise substraction of scalar of 3D vector @@ -111,7 +111,7 @@ namespace Phanes::Core::Math { */ template - inline TIntVector3 operator-= (TIntVector3& v1, T s); + inline TIntVector3& operator-= (TIntVector3& v1, T s); /** * Coponentwise substraction of 3D vector to 3D vector @@ -121,7 +121,7 @@ namespace Phanes::Core::Math { */ template - inline TIntVector3 operator-= (TIntVector3& v1, const TIntVector3& v2); + inline TIntVector3& operator-= (TIntVector3& v1, const TIntVector3& v2); /** * Dot product between two 3D Vectors @@ -131,7 +131,7 @@ namespace Phanes::Core::Math { */ template - inline TIntVector3 operator*= (TIntVector3& v1, T s); + inline TIntVector3& operator*= (TIntVector3& v1, T s); /** * Division of vector by scalar @@ -141,44 +141,44 @@ namespace Phanes::Core::Math { */ template - inline TIntVector3 operator/= (TIntVector3& v1, T s); + inline TIntVector3& operator/= (TIntVector3& v1, T s); template - TIntVector2 operator%= (TIntVector2& v1, const TIntVector2& v2); + TIntVector2& operator%= (TIntVector2& v1, const TIntVector2& v2); template - TIntVector2 operator%= (TIntVector2& v1, T s); + TIntVector2& operator%= (TIntVector2& v1, T s); template - inline TIntVector2 operator&= (TIntVector2& v1, const TIntVector2& v2); + inline TIntVector2& operator&= (TIntVector2& v1, const TIntVector2& v2); template - inline TIntVector2 operator&= (TIntVector2& v1, T s); + inline TIntVector2& operator&= (TIntVector2& v1, T s); template - inline TIntVector2 operator|= (TIntVector2& v1, const TIntVector2& v2); + inline TIntVector2& operator|= (TIntVector2& v1, const TIntVector2& v2); template - inline TIntVector2 operator|= (TIntVector2& v1, T s); + inline TIntVector2& operator|= (TIntVector2& v1, T s); template - inline TIntVector2 operator^= (TIntVector2& v1, const TIntVector2& v2); + inline TIntVector2& operator^= (TIntVector2& v1, const TIntVector2& v2); template - inline TIntVector2 operator^= (TIntVector2& v1, T s); + inline TIntVector2& operator^= (TIntVector2& v1, T s); template - inline TIntVector2 operator<<= (TIntVector2& v1, const TIntVector2& v2); + inline TIntVector2& operator<<= (TIntVector2& v1, const TIntVector2& v2); template - inline TIntVector2 operator<<= (TIntVector2& v1, T s); + inline TIntVector2& operator<<= (TIntVector2& v1, T s); template - inline TIntVector2 operator>>= (TIntVector2& v1, const TIntVector2& v2); + inline TIntVector2& operator>>= (TIntVector2& v1, const TIntVector2& v2); template - inline TIntVector2 operator>>= (TIntVector2& v1, T s); + inline TIntVector2& operator>>= (TIntVector2& v1, T s); /** * Coponentwise multiplication of 3D Vectors with scalar diff --git a/Engine/Source/Runtime/Core/public/Math/IntVector3.inl b/Engine/Source/Runtime/Core/public/Math/IntVector3.inl index 8c3c0d3..619b913 100644 --- a/Engine/Source/Runtime/Core/public/Math/IntVector3.inl +++ b/Engine/Source/Runtime/Core/public/Math/IntVector3.inl @@ -44,70 +44,70 @@ namespace Phanes::Core::Math template - TIntVector3 operator+=(TIntVector3& v1, const TIntVector3& v2) + TIntVector3& operator+=(TIntVector3& v1, const TIntVector3& v2) { Detail::compute_ivec3_add::map(v1, v1, v2); return v1; } template - TIntVector3 operator+=(TIntVector3& v1, T s) + TIntVector3& operator+=(TIntVector3& v1, T s) { Detail::compute_ivec3_add::map(v1, v1, s); return v1; } template - TIntVector3 operator-=(TIntVector3& v1, const TIntVector3& v2) + TIntVector3& operator-=(TIntVector3& v1, const TIntVector3& v2) { Detail::compute_ivec3_sub::map(v1, v1, v2); return v1; } template - TIntVector3 operator-=(TIntVector3& v1, T s) + TIntVector3& operator-=(TIntVector3& v1, T s) { Detail::compute_ivec3_sub::map(v1, v1, s); return v1; } template - TIntVector3 operator*=(TIntVector3& v1, const TIntVector3& v2) + TIntVector3& operator*=(TIntVector3& v1, const TIntVector3& v2) { Detail::compute_ivec3_mul::map(v1, v1, v2); return v1; } template - TIntVector3 operator*=(TIntVector3& v1, T s) + TIntVector3& operator*=(TIntVector3& v1, T s) { Detail::compute_ivec3_mul::map(v1, v1, s); return v1; } template - TIntVector3 operator/=(TIntVector3& v1, const TIntVector3& v2) + TIntVector3& operator/=(TIntVector3& v1, const TIntVector3& v2) { Detail::compute_ivec3_div::map(v1, v1, v2); return v1; } template - TIntVector3 operator/=(TIntVector3& v1, T s) + TIntVector3& operator/=(TIntVector3& v1, T s) { Detail::compute_ivec3_div::map(v1, v1, s); return v1; } template - TIntVector3 operator%=(TIntVector3& v1, const TIntVector3& v2) + TIntVector3& operator%=(TIntVector3& v1, const TIntVector3& v2) { Detail::compute_ivec3_mod::map(v1, v1, v2); return v1; } template - TIntVector3 operator%=(TIntVector3& v1, T s) + TIntVector3& operator%=(TIntVector3& v1, T s) { Detail::compute_ivec3_mod::map(v1, v1, s); return v1; @@ -200,70 +200,70 @@ namespace Phanes::Core::Math // Bitwise operators template - TIntVector3 operator&=(TIntVector3& v1, const TIntVector3& v2) + TIntVector3& operator&=(TIntVector3& v1, const TIntVector3& v2) { Detail::compute_ivec3_and::map(v1, v1, v2); return v1; } template - TIntVector3 operator&=(TIntVector3& v1, T s) + TIntVector3& operator&=(TIntVector3& v1, T s) { Detail::compute_ivec3_and::map(v1, v1, s); return v1; } template - TIntVector3 operator|=(TIntVector3& v1, const TIntVector3& v2) + TIntVector3& operator|=(TIntVector3& v1, const TIntVector3& v2) { Detail::compute_ivec3_or::map(v1, v1, v2); return v1; } template - TIntVector3 operator|=(TIntVector3& v1, T s) + TIntVector3& operator|=(TIntVector3& v1, T s) { Detail::compute_ivec3_or::map(v1, v1, s); return v1; } template - TIntVector3 operator^=(TIntVector3& v1, const TIntVector3& v2) + TIntVector3& operator^=(TIntVector3& v1, const TIntVector3& v2) { Detail::compute_ivec3_xor::map(v1, v1, v2); return v1; } template - TIntVector3 operator^=(TIntVector3& v1, T s) + TIntVector3& operator^=(TIntVector3& v1, T s) { Detail::compute_ivec3_xor::map(v1, v1, s); return v1; } template - TIntVector3 operator<<=(TIntVector3& v1, const TIntVector3& v2) + TIntVector3& operator<<=(TIntVector3& v1, const TIntVector3& v2) { Detail::compute_ivec3_left_shift::map(v1, v1, v2); return v1; } template - TIntVector3 operator<<=(TIntVector3& v1, T s) + TIntVector3& operator<<=(TIntVector3& v1, T s) { Detail::compute_ivec3_left_shift::map(v1, v1, s); return v1; } template - TIntVector3 operator>>=(TIntVector3& v1, const TIntVector3& v2) + TIntVector3& operator>>=(TIntVector3& v1, const TIntVector3& v2) { Detail::compute_ivec3_right_shift::map(v1, v1, v2); return v1; } template - TIntVector3 operator>>=(TIntVector3& v1, T s) + TIntVector3& operator>>=(TIntVector3& v1, T s) { Detail::compute_ivec3_right_shift::map(v1, v1, s); return v1; diff --git a/Engine/Source/Runtime/Core/public/Math/IntVector4.hpp b/Engine/Source/Runtime/Core/public/Math/IntVector4.hpp index b875b04..b4b2eff 100644 --- a/Engine/Source/Runtime/Core/public/Math/IntVector4.hpp +++ b/Engine/Source/Runtime/Core/public/Math/IntVector4.hpp @@ -138,7 +138,7 @@ namespace Phanes::Core::Math { */ template - TIntVector4 operator+= (TIntVector4& v1, T s); + TIntVector4& operator+= (TIntVector4& v1, T s); /** * Addition operation on same TIntVector4 (this) by a another TIntVector4. @@ -148,7 +148,7 @@ namespace Phanes::Core::Math { */ template - TIntVector4 operator+= (TIntVector4& v1, const TIntVector4& v2); + TIntVector4& operator+= (TIntVector4& v1, const TIntVector4& v2); /** * Substraction operation on same TIntVector4 (this) by a floating point. @@ -158,7 +158,7 @@ namespace Phanes::Core::Math { */ template - TIntVector4 operator-= (TIntVector4& v1, T s); + TIntVector4& operator-= (TIntVector4& v1, T s); /** * Substraction operation on same TIntVector4 (this) by a another TIntVector4. @@ -168,7 +168,7 @@ namespace Phanes::Core::Math { */ template - TIntVector4 operator-= (TIntVector4& v1, const TIntVector4& v2); + TIntVector4& operator-= (TIntVector4& v1, const TIntVector4& v2); /** @@ -179,7 +179,7 @@ namespace Phanes::Core::Math { */ template - TIntVector4 operator*= (TIntVector4& v1, T s); + TIntVector4& operator*= (TIntVector4& v1, T s); /** * Devision of Vector @@ -191,7 +191,7 @@ namespace Phanes::Core::Math { */ template - TIntVector4 operator/= (TIntVector4& v1, T s); + TIntVector4& operator/= (TIntVector4& v1, T s); /** * Stores the remainder of division by a scalar. @@ -201,40 +201,40 @@ namespace Phanes::Core::Math { */ template - TIntVector4 operator%= (TIntVector4& v1, const TIntVector4& v2); + TIntVector4& operator%= (TIntVector4& v1, const TIntVector4& v2); template - TIntVector4 operator%= (TIntVector4& v1, T s); + TIntVector4& operator%= (TIntVector4& v1, T s); template - inline TIntVector4 operator&= (TIntVector4& v1, const TIntVector4& v2); + inline TIntVector4& operator&= (TIntVector4& v1, const TIntVector4& v2); template - inline TIntVector4 operator&= (TIntVector4& v1, T s); + inline TIntVector4& operator&= (TIntVector4& v1, T s); template - inline TIntVector4 operator|= (TIntVector4& v1, const TIntVector4& v2); + inline TIntVector4& operator|= (TIntVector4& v1, const TIntVector4& v2); template - inline TIntVector4 operator|= (TIntVector4& v1, T s); + inline TIntVector4& operator|= (TIntVector4& v1, T s); template inline TIntVector4 operator^= (TIntVector4& v1, const TIntVector4& v2); template - inline TIntVector4 operator^= (TIntVector4& v1, T s); + inline TIntVector4& operator^= (TIntVector4& v1, T s); template - inline TIntVector4 operator<<= (TIntVector4& v1, const TIntVector4& v2); + inline TIntVector4& operator<<= (TIntVector4& v1, const TIntVector4& v2); template - inline TIntVector4 operator<<= (TIntVector4& v1, T s); + inline TIntVector4& operator<<= (TIntVector4& v1, T s); template - inline TIntVector4 operator>>= (TIntVector4& v1, const TIntVector4& v2); + inline TIntVector4& operator>>= (TIntVector4& v1, const TIntVector4& v2); template - inline TIntVector4 operator>>= (TIntVector4& v1, T s); + inline TIntVector4& operator>>= (TIntVector4& v1, T s); /** * Scale of Vector by floating point. (> Creates a new TIntVector4) @@ -443,12 +443,14 @@ namespace Phanes::Core::Math { template - void Set(TIntVector4& v1, TIntVector4& v2) + TIntVector4& Set(TIntVector4& v1, TIntVector4& v2) { v1.x = v2.x; v1.y = v2.y; v1.z = v2.z; v1.w = v2.w; + + return v1; } @@ -494,7 +496,7 @@ namespace Phanes::Core::Math { /// Vector two /// Copy of v1. template - TIntVector4 MaxV(TIntVector4& v1, const TIntVector4& v2) + TIntVector4& MaxV(TIntVector4& v1, const TIntVector4& v2) { v1.x = (v1.x > v2.x) ? v1.x : v2.x; v1.y = (v1.y > v2.y) ? v1.y : v2.y; @@ -532,7 +534,7 @@ namespace Phanes::Core::Math { /// Vector two /// Copy of v1. template - TIntVector4 MinV(TIntVector4& v1, const TIntVector4& v2) + TIntVector4& MinV(TIntVector4& v1, const TIntVector4& v2) { v1.x = (v1.x < v2.x) ? v1.x : v2.x; v1.y = (v1.y < v2.y) ? v1.y : v2.y; @@ -568,7 +570,7 @@ namespace Phanes::Core::Math { /// Vector /// Copy of v1. template - TIntVector4 NegateV(TIntVector4& v1) + TIntVector4& NegateV(TIntVector4& v1) { v1.x = -v1.x; v1.y = -v1.y; @@ -609,7 +611,7 @@ namespace Phanes::Core::Math { /// Type of vector /// template - TIntVector4 SignVectorV(TIntVector4& v1) + TIntVector4& SignVectorV(TIntVector4& v1) { v1.x = (v1.x > 0) ? 1 : -1; v1.y = (v1.y > 0) ? 1 : -1; diff --git a/Engine/Source/Runtime/Core/public/Math/IntVector4.inl b/Engine/Source/Runtime/Core/public/Math/IntVector4.inl index fe78836..7f4d243 100644 --- a/Engine/Source/Runtime/Core/public/Math/IntVector4.inl +++ b/Engine/Source/Runtime/Core/public/Math/IntVector4.inl @@ -43,70 +43,70 @@ namespace Phanes::Core::Math template - TIntVector4 operator+=(TIntVector4& v1, const TIntVector4& v2) + TIntVector4& operator+=(TIntVector4& v1, const TIntVector4& v2) { Detail::compute_ivec4_add::map(v1, v1, v2); return v1; } template - TIntVector4 operator+=(TIntVector4& v1, T s) + TIntVector4& operator+=(TIntVector4& v1, T s) { Detail::compute_ivec4_add::map(v1, v1, s); return v1; } template - TIntVector4 operator-=(TIntVector4& v1, const TIntVector4& v2) + TIntVector4& operator-=(TIntVector4& v1, const TIntVector4& v2) { Detail::compute_ivec4_sub::map(v1, v1, v2); return v1; } template - TIntVector4 operator-=(TIntVector4& v1, T s) + TIntVector4& operator-=(TIntVector4& v1, T s) { Detail::compute_ivec4_sub::map(v1, v1, s); return v1; } template - TIntVector4 operator*=(TIntVector4& v1, const TIntVector4& v2) + TIntVector4& operator*=(TIntVector4& v1, const TIntVector4& v2) { Detail::compute_ivec4_mul::map(v1, v1, v2); return v1; } template - TIntVector4 operator*=(TIntVector4& v1, T s) + TIntVector4& operator*=(TIntVector4& v1, T s) { Detail::compute_ivec4_mul::map(v1, v1, s); return v1; } template - TIntVector4 operator/=(TIntVector4& v1, const TIntVector4& v2) + TIntVector4& operator/=(TIntVector4& v1, const TIntVector4& v2) { Detail::compute_ivec4_div::map(v1, v1, v2); return v1; } template - TIntVector4 operator/=(TIntVector4& v1, T s) + TIntVector4& operator/=(TIntVector4& v1, T s) { Detail::compute_ivec4_div::map(v1, v1, s); return v1; } template - TIntVector4 operator%=(TIntVector4& v1, const TIntVector4& v2) + TIntVector4& operator%=(TIntVector4& v1, const TIntVector4& v2) { Detail::compute_ivec4_mod::map(v1, v1, v2); return v1; } template - TIntVector4 operator%=(TIntVector4& v1, T s) + TIntVector4& operator%=(TIntVector4& v1, T s) { Detail::compute_ivec4_mod::map(v1, v1, s); return v1; @@ -199,70 +199,70 @@ namespace Phanes::Core::Math // Bitwise operators template - TIntVector4 operator&=(TIntVector4& v1, const TIntVector4& v2) + TIntVector4& operator&=(TIntVector4& v1, const TIntVector4& v2) { Detail::compute_ivec4_and::map(v1, v1, v2); return v1; } template - TIntVector4 operator&=(TIntVector4& v1, T s) + TIntVector4& operator&=(TIntVector4& v1, T s) { Detail::compute_ivec4_and::map(v1, v1, s); return v1; } template - TIntVector4 operator|=(TIntVector4& v1, const TIntVector4& v2) + TIntVector4& operator|=(TIntVector4& v1, const TIntVector4& v2) { Detail::compute_ivec4_or::map(v1, v1, v2); return v1; } template - TIntVector4 operator|=(TIntVector4& v1, T s) + TIntVector4& operator|=(TIntVector4& v1, T s) { Detail::compute_ivec4_or::map(v1, v1, s); return v1; } template - TIntVector4 operator^=(TIntVector4& v1, const TIntVector4& v2) + TIntVector4& operator^=(TIntVector4& v1, const TIntVector4& v2) { Detail::compute_ivec4_xor::map(v1, v1, v2); return v1; } template - TIntVector4 operator^=(TIntVector4& v1, T s) + TIntVector4& operator^=(TIntVector4& v1, T s) { Detail::compute_ivec4_xor::map(v1, v1, s); return v1; } template - TIntVector4 operator<<=(TIntVector4& v1, const TIntVector4& v2) + TIntVector4& operator<<=(TIntVector4& v1, const TIntVector4& v2) { Detail::compute_ivec4_left_shift::map(v1, v1, v2); return v1; } template - TIntVector4 operator<<=(TIntVector4& v1, T s) + TIntVector4& operator<<=(TIntVector4& v1, T s) { Detail::compute_ivec4_left_shift::map(v1, v1, s); return v1; } template - TIntVector4 operator>>=(TIntVector4& v1, const TIntVector4& v2) + TIntVector4& operator>>=(TIntVector4& v1, const TIntVector4& v2) { Detail::compute_ivec4_right_shift::map(v1, v1, v2); return v1; } template - TIntVector4 operator>>=(TIntVector4& v1, T s) + TIntVector4& operator>>=(TIntVector4& v1, T s) { Detail::compute_ivec4_right_shift::map(v1, v1, s); return v1; diff --git a/Engine/Source/Runtime/Core/public/Math/Line.hpp b/Engine/Source/Runtime/Core/public/Math/Line.hpp index 0b3deea..72257db 100644 --- a/Engine/Source/Runtime/Core/public/Math/Line.hpp +++ b/Engine/Source/Runtime/Core/public/Math/Line.hpp @@ -47,7 +47,7 @@ namespace Phanes::Core::Math */ template - TLine NormalizeV(TLine& l1) + TLine& NormalizeV(TLine& l1) { std::any diff --git a/Engine/Source/Runtime/Core/public/Math/Matrix2.hpp b/Engine/Source/Runtime/Core/public/Math/Matrix2.hpp index 0e08972..632ee53 100644 --- a/Engine/Source/Runtime/Core/public/Math/Matrix2.hpp +++ b/Engine/Source/Runtime/Core/public/Math/Matrix2.hpp @@ -139,7 +139,7 @@ namespace Phanes::Core::Math { // ====================== // template - TMatrix2 operator+= (TMatrix2& m1, T s) + TMatrix2& operator+= (TMatrix2& m1, T s) { m1(0, 0) += s; m1(0, 1) += s; @@ -150,7 +150,7 @@ namespace Phanes::Core::Math { } template - TMatrix2 operator+= (TMatrix2& m1, const TMatrix2& m2) + TMatrix2& operator+= (TMatrix2& m1, const TMatrix2& m2) { m1(0, 0) += m2(0, 0); m1(0, 1) += m2(0, 1); @@ -161,7 +161,7 @@ namespace Phanes::Core::Math { } template - TMatrix2 operator-= (TMatrix2& m1, T s) + TMatrix2& operator-= (TMatrix2& m1, T s) { m1(0, 0) -= s; m1(0, 1) -= s; @@ -172,7 +172,7 @@ namespace Phanes::Core::Math { } template - TMatrix2 operator-= (TMatrix2& m1, const TMatrix2& m2) + TMatrix2& operator-= (TMatrix2& m1, const TMatrix2& m2) { m1(0, 0) -= m2(0, 0); m1(0, 1) -= m2(0, 1); @@ -183,7 +183,7 @@ namespace Phanes::Core::Math { } template - TMatrix2 operator*= (TMatrix2& m1, T s) + TMatrix2& operator*= (TMatrix2& m1, T s) { m1.data[0][0] *= s; m1.data[0][1] *= s; @@ -194,7 +194,7 @@ namespace Phanes::Core::Math { } template - TMatrix2 operator*= (TMatrix2& m1, const TMatrix2& m2) + TMatrix2& operator*= (TMatrix2& m1, const TMatrix2& m2) { TMatrix2 c = m1; @@ -208,7 +208,7 @@ namespace Phanes::Core::Math { } template - TMatrix2 operator/= (TMatrix2& m1, T s) + TMatrix2& operator/= (TMatrix2& m1, T s) { s = (T)1.0 / s; m1.data[0][0] *= s; @@ -300,7 +300,7 @@ namespace Phanes::Core::Math { } template - TMatrix2 InverseV(TMatrix2& m1) + TMatrix2& InverseV(TMatrix2& m1) { float _1_det = 1.0f / Determinant(m1); float m00 = m1(0, 0); @@ -315,7 +315,7 @@ namespace Phanes::Core::Math { } template - TMatrix2 TransposeV(TMatrix2& m1) + TMatrix2& TransposeV(TMatrix2& m1) { Swap(m1(0, 1), m1(1, 0)); diff --git a/Engine/Source/Runtime/Core/public/Math/Matrix3.hpp b/Engine/Source/Runtime/Core/public/Math/Matrix3.hpp index 3d68475..82c740d 100644 --- a/Engine/Source/Runtime/Core/public/Math/Matrix3.hpp +++ b/Engine/Source/Runtime/Core/public/Math/Matrix3.hpp @@ -165,7 +165,7 @@ namespace Phanes::Core::Math { */ template - TMatrix3 operator+= (TMatrix3& m1, T s) + TMatrix3& operator+= (TMatrix3& m1, T s) { m1.c0 += s; m1.c1 += s; @@ -182,7 +182,7 @@ namespace Phanes::Core::Math { */ template - TMatrix3 operator+= (TMatrix3& m1, const TMatrix3& m2) + TMatrix3& operator+= (TMatrix3& m1, const TMatrix3& m2) { m1.c0 += m2.c0; m1.c1 += m2.c1; @@ -199,7 +199,7 @@ namespace Phanes::Core::Math { */ template - TMatrix3 operator-= (TMatrix3& m1, T s) + TMatrix3& operator-= (TMatrix3& m1, T s) { m1.c0 -= s; m1.c1 -= s; @@ -216,7 +216,7 @@ namespace Phanes::Core::Math { */ template - TMatrix3 operator-= (TMatrix3& m1, const TMatrix3& m2) + TMatrix3& operator-= (TMatrix3& m1, const TMatrix3& m2) { m1.c0 -= m2.c0; m1.c1 -= m2.c1; @@ -233,7 +233,7 @@ namespace Phanes::Core::Math { */ template - TMatrix3 operator*= (TMatrix3& m1, T s) + TMatrix3& operator*= (TMatrix3& m1, T s) { m1.c0 *= s; m1.c1 *= s; @@ -250,7 +250,7 @@ namespace Phanes::Core::Math { */ template - TMatrix3 operator*= (TMatrix3& m1, const TMatrix3& m2); + TMatrix3& operator*= (TMatrix3& m1, const TMatrix3& m2); /** * Multiply matrix with scalar @@ -260,7 +260,7 @@ namespace Phanes::Core::Math { */ template - TMatrix3 operator/= (TMatrix3& m1, T s) + TMatrix3& operator/= (TMatrix3& m1, T s) { s = (T)1.0 / s; m1.c0 *= s; @@ -278,7 +278,7 @@ namespace Phanes::Core::Math { */ template - TMatrix3 operator/= (TMatrix3& m1, const TMatrix3& m2) + TMatrix3& operator/= (TMatrix3& m1, const TMatrix3& m2) { m1.c0 /= m2.c0; m1.c1 /= m2.c1; diff --git a/Engine/Source/Runtime/Core/public/Math/Matrix4.hpp b/Engine/Source/Runtime/Core/public/Math/Matrix4.hpp index 6824e7b..f2ece63 100644 --- a/Engine/Source/Runtime/Core/public/Math/Matrix4.hpp +++ b/Engine/Source/Runtime/Core/public/Math/Matrix4.hpp @@ -141,7 +141,7 @@ namespace Phanes::Core::Math { // ==================== // template - TMatrix4 operator+= (TMatrix4& m1, T s) + TMatrix4& operator+= (TMatrix4& m1, T s) { m1.c0 += s; m1.c1 += s; @@ -152,7 +152,7 @@ namespace Phanes::Core::Math { } template - TMatrix4 operator+= (TMatrix4& m1, const TMatrix4& m2) + TMatrix4& operator+= (TMatrix4& m1, const TMatrix4& m2) { m1.c0 += m2.c0; m1.c1 += m2.c1; @@ -163,7 +163,7 @@ namespace Phanes::Core::Math { } template - TMatrix4 operator-= (TMatrix4& m1, T s) + TMatrix4& operator-= (TMatrix4& m1, T s) { m1.c0 -= s; m1.c1 -= s; @@ -174,7 +174,7 @@ namespace Phanes::Core::Math { } template - TMatrix4 operator-= (TMatrix4& m1, const TMatrix4& m2) + TMatrix4& operator-= (TMatrix4& m1, const TMatrix4& m2) { m1.c0 -= m2.c0; m1.c1 -= m2.c1; @@ -185,7 +185,7 @@ namespace Phanes::Core::Math { } template - TMatrix4 operator*= (TMatrix4& m1, T s) + TMatrix4& operator*= (TMatrix4& m1, T s) { m1.c0 *= s; m1.c1 *= s; @@ -195,11 +195,12 @@ namespace Phanes::Core::Math { return m1; } + // Matrix multiplication template - TMatrix4 operator*= (TMatrix4& m1, const TMatrix4& m2); + TMatrix4& operator*= (TMatrix4& m1, const TMatrix4& m2); template - TMatrix4 operator/= (TMatrix4& m1, T s) + TMatrix4& operator/= (TMatrix4& m1, T s) { s = (T)1.0 / s; m1.c0 *= s; @@ -301,7 +302,7 @@ namespace Phanes::Core::Math { bool InverseV(TMatrix4& a); template - TMatrix4 TransposeV(TMatrix4& a); + TMatrix4& TransposeV(TMatrix4& a); // =============== //