diff --git a/Source/Engine/Core/Math/Math.h b/Source/Engine/Core/Math/Math.h index 46e85247f..bd498bb1a 100644 --- a/Source/Engine/Core/Math/Math.h +++ b/Source/Engine/Core/Math/Math.h @@ -157,6 +157,11 @@ namespace Math return value < 0 ? -value : value; } + static FORCE_INLINE int32 Mod(const int32 a, const int32 b) + { + return (int32)fmodf((float)a, (float)b); + } + static FORCE_INLINE float Mod(const float a, const float b) { return fmodf(a, b); diff --git a/Source/Engine/Core/Math/Vector2.h b/Source/Engine/Core/Math/Vector2.h index e7201d80b..cdbeda8e4 100644 --- a/Source/Engine/Core/Math/Vector2.h +++ b/Source/Engine/Core/Math/Vector2.h @@ -457,6 +457,11 @@ public: return Vector2Base(a.X > b.X ? a.X : b.X, a.Y > b.Y ? a.Y : b.Y); } + static Vector2Base Mod(const Vector2Base& a, const Vector2Base& b) + { + return Vector2Base(Math::Mod(a.X, b.X), Math::Mod(a.Y, b.Y)); + } + static Vector2Base Floor(const Vector2Base& v) { return Vector2Base(Math::Floor(v.X), Math::Floor(v.Y)); diff --git a/Source/Engine/Core/Math/Vector3.h b/Source/Engine/Core/Math/Vector3.h index 7e34031ae..d7390c499 100644 --- a/Source/Engine/Core/Math/Vector3.h +++ b/Source/Engine/Core/Math/Vector3.h @@ -512,6 +512,11 @@ public: return Vector3Base(a.X > b.X ? a.X : b.X, a.Y > b.Y ? a.Y : b.Y, a.Z > b.Z ? a.Z : b.Z); } + static Vector3Base Mod(const Vector3Base& a, const Vector3Base& b) + { + return Vector3Base(Math::Mod(a.X, b.X), Math::Mod(a.Y, b.Y), Math::Mod(a.Z, b.Z)); + } + static Vector3Base Floor(const Vector3Base& v) { return Vector3Base(Math::Floor(v.X), Math::Floor(v.Y), Math::Floor(v.Z)); diff --git a/Source/Engine/Core/Math/Vector4.h b/Source/Engine/Core/Math/Vector4.h index 7c87b6d1a..41881f54d 100644 --- a/Source/Engine/Core/Math/Vector4.h +++ b/Source/Engine/Core/Math/Vector4.h @@ -423,6 +423,11 @@ public: } public: + static Vector4Base Mod(const Vector4Base& a, const Vector4Base& b) + { + return Vector4Base(Math::Mod(a.X, b.X), Math::Mod(a.Y, b.Y), Math::Mod(a.Z, b.Z), Math::Mod(a.W, b.W)); + } + static Vector4Base Floor(const Vector4Base& v) { return Vector4Base(Math::Floor(v.X), Math::Floor(v.Y), Math::Floor(v.Z), Math::Floor(v.W));