From 3ab7d7fcc455573b62f134011f27dd9d80c500a7 Mon Sep 17 00:00:00 2001 From: Wiktor Kocielski Date: Sat, 2 Dec 2023 15:29:49 +0300 Subject: [PATCH] Add Half to Vector2/Vector4 --- Source/Engine/Core/Math/Vector2.cpp | 2 ++ Source/Engine/Core/Math/Vector2.h | 3 +++ Source/Engine/Core/Math/Vector4.cpp | 2 ++ Source/Engine/Core/Math/Vector4.h | 3 +++ 4 files changed, 10 insertions(+) diff --git a/Source/Engine/Core/Math/Vector2.cpp b/Source/Engine/Core/Math/Vector2.cpp index ec168de33..63e6fc4c5 100644 --- a/Source/Engine/Core/Math/Vector2.cpp +++ b/Source/Engine/Core/Math/Vector2.cpp @@ -15,6 +15,8 @@ const Float2 Float2::Zero(0.0f); template<> const Float2 Float2::One(1.0f); template<> +const Float2 Float2::Half(0.5f); +template<> const Float2 Float2::UnitX(1.0f, 0.0f); template<> const Float2 Float2::UnitY(0.0f, 1.0f); diff --git a/Source/Engine/Core/Math/Vector2.h b/Source/Engine/Core/Math/Vector2.h index cea03ec10..cce77788a 100644 --- a/Source/Engine/Core/Math/Vector2.h +++ b/Source/Engine/Core/Math/Vector2.h @@ -44,6 +44,9 @@ public: // Vector with all components equal 1 static FLAXENGINE_API const Vector2Base One; + // Vector with all components equal 0.5 + static FLAXENGINE_API const Vector2Base Half; + // Vector X=1, Y=0 static FLAXENGINE_API const Vector2Base UnitX; diff --git a/Source/Engine/Core/Math/Vector4.cpp b/Source/Engine/Core/Math/Vector4.cpp index b5fa7a81d..372fde6db 100644 --- a/Source/Engine/Core/Math/Vector4.cpp +++ b/Source/Engine/Core/Math/Vector4.cpp @@ -17,6 +17,8 @@ const Float4 Float4::Zero(0.0f); template<> const Float4 Float4::One(1.0f); template<> +const Float4 Float4::Half(0.5f); +template<> const Float4 Float4::UnitX(1.0f, 0.0f, 0.0f, 0.0f); template<> const Float4 Float4::UnitY(0.0f, 1.0f, 0.0f, 0.0f); diff --git a/Source/Engine/Core/Math/Vector4.h b/Source/Engine/Core/Math/Vector4.h index 1cc6d4db8..7edb97ce5 100644 --- a/Source/Engine/Core/Math/Vector4.h +++ b/Source/Engine/Core/Math/Vector4.h @@ -54,6 +54,9 @@ public: // Vector with all components equal 1 static FLAXENGINE_API const Vector4Base One; + // Vector with all components equal 0.5 + static FLAXENGINE_API const Vector4Base Half; + // Vector X=1, Y=0, Z=0, W=0 static FLAXENGINE_API const Vector4Base UnitX;