From d7c051cecf0db9056e94d5e80146aa0b066e606b Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 4 Nov 2021 13:49:05 +0800 Subject: *text alignment --- Runtime/Math/Math.h | 11 +++++++++-- Runtime/Math/Vector2.cpp | 4 ---- Runtime/Math/Vector2.h | 6 ------ Runtime/Math/Vector3.cpp | 4 ---- Runtime/Math/Vector3.h | 18 +++++++++++------- Runtime/Math/Vector4.cpp | 4 ---- Runtime/Math/Vector4.h | 19 +++++++++++-------- 7 files changed, 31 insertions(+), 35 deletions(-) delete mode 100644 Runtime/Math/Vector2.cpp delete mode 100644 Runtime/Math/Vector3.cpp delete mode 100644 Runtime/Math/Vector4.cpp (limited to 'Runtime/Math') diff --git a/Runtime/Math/Math.h b/Runtime/Math/Math.h index 80f23f7..0d1590e 100644 --- a/Runtime/Math/Math.h +++ b/Runtime/Math/Math.h @@ -8,11 +8,18 @@ #include "Rect.h" #include "MathHelper.h" -typedef Internal::Vector3 Vector3; -typedef Internal::Vector4 Vector4; + typedef Internal::Matrix44 Matrix44; typedef Internal::Rect Rect; typedef Internal::Vector2T Vector2i; typedef Internal::Vector2T Vector2f; +typedef Vector2f Vector2; + +typedef Internal::Vector3T Vector3f; +typedef Internal::Vector3T Vector3i; +typedef Vector3f Vector3; +typedef Internal::Vector4T Vector4f; +typedef Internal::Vector4T Vector4i; +typedef Vector4f Vector4; diff --git a/Runtime/Math/Vector2.cpp b/Runtime/Math/Vector2.cpp deleted file mode 100644 index 185e66f..0000000 --- a/Runtime/Math/Vector2.cpp +++ /dev/null @@ -1,4 +0,0 @@ -#include "Vector2.h" - -Internal::Vector2 Internal::Vector2::one = Internal::Vector2(1, 1); -Internal::Vector2 Internal::Vector2::zero = Internal::Vector2(0, 0); diff --git a/Runtime/Math/Vector2.h b/Runtime/Math/Vector2.h index f13e522..7c519b8 100644 --- a/Runtime/Math/Vector2.h +++ b/Runtime/Math/Vector2.h @@ -53,10 +53,4 @@ namespace Internal Vector2T Vector2T::zero = Vector2T(0, 0); template Vector2T Vector2T::one = Vector2T(1, 1); - - typedef Internal::Vector2T Vector2; - } - -typedef Internal::Vector2T Vector2; - diff --git a/Runtime/Math/Vector3.cpp b/Runtime/Math/Vector3.cpp deleted file mode 100644 index 13bc9fd..0000000 --- a/Runtime/Math/Vector3.cpp +++ /dev/null @@ -1,4 +0,0 @@ -#include "Vector3.h" - -Internal::Vector3 Internal::Vector3::one = Internal::Vector3(1, 1, 1); -Internal::Vector3 Internal::Vector3::zero = Internal::Vector3(0, 0, 0); diff --git a/Runtime/Math/Vector3.h b/Runtime/Math/Vector3.h index e81e880..c7e5232 100644 --- a/Runtime/Math/Vector3.h +++ b/Runtime/Math/Vector3.h @@ -3,17 +3,17 @@ namespace Internal { - - struct Vector3 + template + struct Vector3T { - float x, y, z; - Vector3(float x = 0, float y = 0, float z = 0) + T x, y, z; + Vector3T(T x = 0, T y = 0, T z = 0) { this->x = x; this->y = y; this->z = z; } - inline void Set(float x, float y, float z) + inline void Set(T x, T y, T z) { this->x = x; this->y = y; @@ -21,11 +21,15 @@ namespace Internal } - static Vector3 zero; - static Vector3 one; + static Vector3T zero; + static Vector3T one; }; + template + Vector3T Vector3T::zero = Vector3T(0, 0, 0); + template + Vector3T Vector3T::one = Vector3T(1, 1, 1); } #endif \ No newline at end of file diff --git a/Runtime/Math/Vector4.cpp b/Runtime/Math/Vector4.cpp deleted file mode 100644 index 1d392b7..0000000 --- a/Runtime/Math/Vector4.cpp +++ /dev/null @@ -1,4 +0,0 @@ -#include "Vector4.h" - -Internal::Vector4 Internal::Vector4::one = Internal::Vector4(1, 1, 1, 1); -Internal::Vector4 Internal::Vector4::zero = Internal::Vector4(0, 0, 0, 0); diff --git a/Runtime/Math/Vector4.h b/Runtime/Math/Vector4.h index c0f99f2..e56a1a7 100644 --- a/Runtime/Math/Vector4.h +++ b/Runtime/Math/Vector4.h @@ -2,12 +2,12 @@ namespace Internal { - - struct Vector4 + template + struct Vector4T { - float x, y, z, w; + T x, y, z, w; - Vector4(float x = 0, float y = 0, float z = 0, float w = 0) + Vector4T(T x = 0, T y = 0, T z = 0, T w = 0) { this->x = x; this->y = y; @@ -15,7 +15,7 @@ namespace Internal this->w = w; } - inline void Set(float x, float y, float z, float w) + inline void Set(T x, T y, T z, T w) { this->x = x; this->y = y; @@ -23,10 +23,13 @@ namespace Internal this->w = w; } - - static Vector4 zero; - static Vector4 one; + static Vector4T zero; + static Vector4T one; }; + template + Vector4T Vector4T::zero = Vector4T(0, 0, 0, 0); + template + Vector4T Vector4T::one = Vector4T(1, 1, 1, 1); } -- cgit v1.1-26-g67d0