diff --git a/Code/Framework/AzCore/AzCore/Math/Vector2.h b/Code/Framework/AzCore/AzCore/Math/Vector2.h index b2b1ceeb4d..7c37d74135 100644 --- a/Code/Framework/AzCore/AzCore/Math/Vector2.h +++ b/Code/Framework/AzCore/AzCore/Math/Vector2.h @@ -180,6 +180,13 @@ namespace AZ bool IsGreaterEqualThan(const Vector2& v) const; //! @} + //! Floor/Ceil/Round functions, operate on each component individually, result will be a new Vector2. + //! @{ + Vector2 GetFloor() const; + Vector2 GetCeil() const; + Vector2 GetRound() const; // Ties to even (banker's rounding) + //! @} + //! Min/Max functions, operate on each component individually, result will be a new Vector2. //! @{ Vector2 GetMin(const Vector2& v) const; diff --git a/Code/Framework/AzCore/AzCore/Math/Vector2.inl b/Code/Framework/AzCore/AzCore/Math/Vector2.inl index 80b2a43475..086be2bbc3 100644 --- a/Code/Framework/AzCore/AzCore/Math/Vector2.inl +++ b/Code/Framework/AzCore/AzCore/Math/Vector2.inl @@ -398,6 +398,24 @@ namespace AZ } + AZ_MATH_INLINE Vector2 Vector2::GetFloor() const + { + return Vector2(Simd::Vec2::Floor(m_value)); + } + + + AZ_MATH_INLINE Vector2 Vector2::GetCeil() const + { + return Vector2(Simd::Vec2::Ceil(m_value)); + } + + + AZ_MATH_INLINE Vector2 Vector2::GetRound() const + { + return Vector2(Simd::Vec2::Round(m_value)); + } + + AZ_MATH_INLINE Vector2 Vector2::GetMin(const Vector2& v) const { #if AZ_TRAIT_USE_PLATFORM_SIMD_SCALAR diff --git a/Code/Framework/AzCore/AzCore/Math/Vector3.h b/Code/Framework/AzCore/AzCore/Math/Vector3.h index 4bf0a18894..821dc8292c 100644 --- a/Code/Framework/AzCore/AzCore/Math/Vector3.h +++ b/Code/Framework/AzCore/AzCore/Math/Vector3.h @@ -211,6 +211,13 @@ namespace AZ bool IsGreaterEqualThan(const Vector3& rhs) const; //! @} + //! Floor/Ceil/Round functions, operate on each component individually, result will be a new Vector3. + //! @{ + Vector3 GetFloor() const; + Vector3 GetCeil() const; + Vector3 GetRound() const; // Ties to even (banker's rounding) + //! @} + //! Min/Max functions, operate on each component individually, result will be a new Vector3. //! @{ Vector3 GetMin(const Vector3& v) const; diff --git a/Code/Framework/AzCore/AzCore/Math/Vector3.inl b/Code/Framework/AzCore/AzCore/Math/Vector3.inl index 56baac5aa1..879ade38cf 100644 --- a/Code/Framework/AzCore/AzCore/Math/Vector3.inl +++ b/Code/Framework/AzCore/AzCore/Math/Vector3.inl @@ -481,6 +481,24 @@ namespace AZ } + AZ_MATH_INLINE Vector3 Vector3::GetFloor() const + { + return Vector3(Simd::Vec3::Floor(m_value)); + } + + + AZ_MATH_INLINE Vector3 Vector3::GetCeil() const + { + return Vector3(Simd::Vec3::Ceil(m_value)); + } + + + AZ_MATH_INLINE Vector3 Vector3::GetRound() const + { + return Vector3(Simd::Vec3::Round(m_value)); + } + + AZ_MATH_INLINE Vector3 Vector3::GetMin(const Vector3& v) const { #if AZ_TRAIT_USE_PLATFORM_SIMD_SCALAR diff --git a/Code/Framework/AzCore/AzCore/Math/Vector4.h b/Code/Framework/AzCore/AzCore/Math/Vector4.h index 6bd67e8831..eaa18bbaff 100644 --- a/Code/Framework/AzCore/AzCore/Math/Vector4.h +++ b/Code/Framework/AzCore/AzCore/Math/Vector4.h @@ -189,6 +189,13 @@ namespace AZ bool IsGreaterEqualThan(const Vector4& rhs) const; //! @} + //! Floor/Ceil/Round functions, operate on each component individually, result will be a new Vector4. + //! @{ + Vector4 GetFloor() const; + Vector4 GetCeil() const; + Vector4 GetRound() const; // Ties to even (banker's rounding) + //! @} + //! Min/Max functions, operate on each component individually, result will be a new Vector4. //! @{ Vector4 GetMin(const Vector4& v) const; diff --git a/Code/Framework/AzCore/AzCore/Math/Vector4.inl b/Code/Framework/AzCore/AzCore/Math/Vector4.inl index 4b4cf2f84f..001dfb6a4d 100644 --- a/Code/Framework/AzCore/AzCore/Math/Vector4.inl +++ b/Code/Framework/AzCore/AzCore/Math/Vector4.inl @@ -464,6 +464,24 @@ namespace AZ } + AZ_MATH_INLINE Vector4 Vector4::GetFloor() const + { + return Vector4(Simd::Vec4::Floor(m_value)); + } + + + AZ_MATH_INLINE Vector4 Vector4::GetCeil() const + { + return Vector4(Simd::Vec4::Ceil(m_value)); + } + + + AZ_MATH_INLINE Vector4 Vector4::GetRound() const + { + return Vector4(Simd::Vec4::Round(m_value)); + } + + AZ_MATH_INLINE Vector4 Vector4::GetMin(const Vector4& v) const { #if AZ_TRAIT_USE_PLATFORM_SIMD_SCALAR