summaryrefslogtreecommitdiff
path: root/Runtime/Math
diff options
context:
space:
mode:
Diffstat (limited to 'Runtime/Math')
-rw-r--r--Runtime/Math/Math.h11
-rw-r--r--Runtime/Math/Vector2.cpp4
-rw-r--r--Runtime/Math/Vector2.h6
-rw-r--r--Runtime/Math/Vector3.cpp4
-rw-r--r--Runtime/Math/Vector3.h18
-rw-r--r--Runtime/Math/Vector4.cpp4
-rw-r--r--Runtime/Math/Vector4.h19
7 files changed, 31 insertions, 35 deletions
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<int> Vector2i;
typedef Internal::Vector2T<float> Vector2f;
+typedef Vector2f Vector2;
+
+typedef Internal::Vector3T<float> Vector3f;
+typedef Internal::Vector3T<int> Vector3i;
+typedef Vector3f Vector3;
+typedef Internal::Vector4T<float> Vector4f;
+typedef Internal::Vector4T<int> 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<T> Vector2T<T>::zero = Vector2T(0, 0);
template<typename T>
Vector2T<T> Vector2T<T>::one = Vector2T(1, 1);
-
- typedef Internal::Vector2T<float> Vector2;
-
}
-
-typedef Internal::Vector2T<float> 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<typename T>
+ 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<typename T>
+ Vector3T<T> Vector3T<T>::zero = Vector3T(0, 0, 0);
+ template<typename T>
+ Vector3T<T> Vector3T<T>::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<typename T>
+ 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<typename T>
+ Vector4T<T> Vector4T<T>::zero = Vector4T(0, 0, 0, 0);
+ template<typename T>
+ Vector4T<T> Vector4T<T>::one = Vector4T(1, 1, 1, 1);
}