diff options
Diffstat (limited to 'Source/Asura.Engine/Math')
-rw-r--r-- | Source/Asura.Engine/Math/Curve.cpp | 0 | ||||
-rw-r--r-- | Source/Asura.Engine/Math/Curve.h | 0 | ||||
-rw-r--r-- | Source/Asura.Engine/Math/Functions.cpp | 0 | ||||
-rw-r--r-- | Source/Asura.Engine/Math/Functions.h | 0 | ||||
-rw-r--r-- | Source/Asura.Engine/Math/Matrix44.cpp | 0 | ||||
-rw-r--r-- | Source/Asura.Engine/Math/Matrix44.h | 24 | ||||
-rw-r--r-- | Source/Asura.Engine/Math/Rect.hpp | 32 | ||||
-rw-r--r-- | Source/Asura.Engine/Math/Rect.inl | 19 | ||||
-rw-r--r-- | Source/Asura.Engine/Math/Transform.cpp | 0 | ||||
-rw-r--r-- | Source/Asura.Engine/Math/Transform.h | 30 | ||||
-rw-r--r-- | Source/Asura.Engine/Math/Vector2.hpp | 70 | ||||
-rw-r--r-- | Source/Asura.Engine/Math/Vector2.inl | 114 | ||||
-rw-r--r-- | Source/Asura.Engine/Math/Vector3.hpp | 233 | ||||
-rw-r--r-- | Source/Asura.Engine/Math/Vector3.inl | 145 | ||||
-rw-r--r-- | Source/Asura.Engine/Math/Vector4.h | 234 | ||||
-rw-r--r-- | Source/Asura.Engine/Math/Vector4.inl | 152 |
16 files changed, 0 insertions, 1053 deletions
diff --git a/Source/Asura.Engine/Math/Curve.cpp b/Source/Asura.Engine/Math/Curve.cpp deleted file mode 100644 index e69de29..0000000 --- a/Source/Asura.Engine/Math/Curve.cpp +++ /dev/null diff --git a/Source/Asura.Engine/Math/Curve.h b/Source/Asura.Engine/Math/Curve.h deleted file mode 100644 index e69de29..0000000 --- a/Source/Asura.Engine/Math/Curve.h +++ /dev/null diff --git a/Source/Asura.Engine/Math/Functions.cpp b/Source/Asura.Engine/Math/Functions.cpp deleted file mode 100644 index e69de29..0000000 --- a/Source/Asura.Engine/Math/Functions.cpp +++ /dev/null diff --git a/Source/Asura.Engine/Math/Functions.h b/Source/Asura.Engine/Math/Functions.h deleted file mode 100644 index e69de29..0000000 --- a/Source/Asura.Engine/Math/Functions.h +++ /dev/null diff --git a/Source/Asura.Engine/Math/Matrix44.cpp b/Source/Asura.Engine/Math/Matrix44.cpp deleted file mode 100644 index e69de29..0000000 --- a/Source/Asura.Engine/Math/Matrix44.cpp +++ /dev/null diff --git a/Source/Asura.Engine/Math/Matrix44.h b/Source/Asura.Engine/Math/Matrix44.h deleted file mode 100644 index 4ab3c0b..0000000 --- a/Source/Asura.Engine/Math/Matrix44.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __ASURA_ENGINE_MATRIX44_H__ -#define __ASURA_ENGINE_MATRIX44_H__ - -namespace AsuraEngine -{ - namespace Math - { - - /// - /// 4x4 - /// - class Matrix44 - { - public: - - private: - - - }; - - } -} - -#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Math/Rect.hpp b/Source/Asura.Engine/Math/Rect.hpp deleted file mode 100644 index f635007..0000000 --- a/Source/Asura.Engine/Math/Rect.hpp +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef __ASURA_ENGINE_RECT_H__ -#define __ASURA_ENGINE_RECT_H__ - -namespace AsuraEngine -{ - namespace Math - { - - template<typename T> - struct Rect - { - public: - Rect(); - ~Rect(T x, T y, T w, T h); - - template <typename U> - explicit Rect(const Rect<U>& rect); - - T x, y, w, h; - }; - -#include "Rect.inl" - - // Define the most common types - typedef Rect<int> Recti; - typedef Rect<unsigned int> Rectu; - typedef Rect<float> Rectf; - - } -} - -#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Math/Rect.inl b/Source/Asura.Engine/Math/Rect.inl deleted file mode 100644 index 891a3f8..0000000 --- a/Source/Asura.Engine/Math/Rect.inl +++ /dev/null @@ -1,19 +0,0 @@ -template <typename T> -inline Rect<T>::Rect() - : x(0) - , y(0) - , w(0) - , h(0) -{ - -} - -template <typename T> -inline Rect<T>::Rect(T X, T Y, T W, T H) - : x(X) - , y(Y) - , w(W) - , h(H) -{ - -} diff --git a/Source/Asura.Engine/Math/Transform.cpp b/Source/Asura.Engine/Math/Transform.cpp deleted file mode 100644 index e69de29..0000000 --- a/Source/Asura.Engine/Math/Transform.cpp +++ /dev/null diff --git a/Source/Asura.Engine/Math/Transform.h b/Source/Asura.Engine/Math/Transform.h deleted file mode 100644 index 33c3d4b..0000000 --- a/Source/Asura.Engine/Math/Transform.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __ASURA_ENGINE_TRANSFORM_H__ -#define __ASURA_ENGINE_TRANSFORM_H__ - -#include "Scripting/Portable.h" - -namespace AsuraEngine -{ - namespace Math - { - - class Transform - { - public: - - void Set(float x, float y, float sx, float sy, float ox, float oy, float r); - - void LoadIdentity(); - - void Move(float dx = 0, float dy = 0); - void Rotate(float r); - void Scale(float sx, float sy); - - float m[16]; //4x4 matrix - - }; - - } -} - -#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Math/Vector2.hpp b/Source/Asura.Engine/Math/Vector2.hpp deleted file mode 100644 index df78255..0000000 --- a/Source/Asura.Engine/Math/Vector2.hpp +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef __ASURA_ENGINE_VECTOR2_H__ -#define __ASURA_ENGINE_VECTOR2_H__ - -namespace AsuraEngine -{ - namespace Math - { - template <typename T> - class Vector2 - { - public: - Vector2(); - Vector2(T X, T Y); - - template <typename U> - explicit Vector2(const Vector2<U>& vector); - - Set(T X, T Y); - - T x; ///< X coordinate of the vector - T y; ///< Y coordinate of the vector - }; - - template <typename T> - Vector2<T> operator -(const Vector2<T>& right); - - template <typename T> - Vector2<T>& operator +=(Vector2<T>& left, const Vector2<T>& right); - - template <typename T> - Vector2<T>& operator -=(Vector2<T>& left, const Vector2<T>& right); - - template <typename T> - Vector2<T> operator +(const Vector2<T>& left, const Vector2<T>& right); - - template <typename T> - Vector2<T> operator -(const Vector2<T>& left, const Vector2<T>& right); - - template <typename T> - Vector2<T> operator *(const Vector2<T>& left, T right); - - template <typename T> - Vector2<T> operator *(T left, const Vector2<T>& right); - - template <typename T> - Vector2<T>& operator *=(Vector2<T>& left, T right); - - template <typename T> - Vector2<T> operator /(const Vector2<T>& left, T right); - - template <typename T> - Vector2<T>& operator /=(Vector2<T>& left, T right); - - template <typename T> - bool operator ==(const Vector2<T>& left, const Vector2<T>& right); - - template <typename T> - bool operator !=(const Vector2<T>& left, const Vector2<T>& right); - -#include "Vector2.inl" - - // Define the most common types - typedef Vector2<int> Vector2i; - typedef Vector2<unsigned int> Vector2u; - typedef Vector2<float> Vector2f; - - } -} - -#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Math/Vector2.inl b/Source/Asura.Engine/Math/Vector2.inl deleted file mode 100644 index 9e131a7..0000000 --- a/Source/Asura.Engine/Math/Vector2.inl +++ /dev/null @@ -1,114 +0,0 @@ -template <typename T> -inline Vector2<T>::Vector2() : - x(0), - y(0) -{ - -} - -template <typename T> -inline Vector2<T>::Vector2(T X, T Y) : - x(X), - y(Y) -{ - -} - -template <typename T> -template <typename U> -inline Vector2<T>::Vector2(const Vector2<U>& vector) : - x(static_cast<T>(vector.x)), - y(static_cast<T>(vector.y)) -{ -} - -template <typename T> -inline Vector2<T>::Set(T X, T Y) -{ - x = X; - y = Y; -} - -template <typename T> -inline Vector2<T> operator -(const Vector2<T>& right) -{ - return Vector2<T>(-right.x, -right.y); -} - -template <typename T> -inline Vector2<T>& operator +=(Vector2<T>& left, const Vector2<T>& right) -{ - left.x += right.x; - left.y += right.y; - - return left; -} - -template <typename T> -inline Vector2<T>& operator -=(Vector2<T>& left, const Vector2<T>& right) -{ - left.x -= right.x; - left.y -= right.y; - - return left; -} - -template <typename T> -inline Vector2<T> operator +(const Vector2<T>& left, const Vector2<T>& right) -{ - return Vector2<T>(left.x + right.x, left.y + right.y); -} - -template <typename T> -inline Vector2<T> operator -(const Vector2<T>& left, const Vector2<T>& right) -{ - return Vector2<T>(left.x - right.x, left.y - right.y); -} - -template <typename T> -inline Vector2<T> operator *(const Vector2<T>& left, T right) -{ - return Vector2<T>(left.x * right, left.y * right); -} - -template <typename T> -inline Vector2<T> operator *(T left, const Vector2<T>& right) -{ - return Vector2<T>(right.x * left, right.y * left); -} - -template <typename T> -inline Vector2<T>& operator *=(Vector2<T>& left, T right) -{ - left.x *= right; - left.y *= right; - - return left; -} - -template <typename T> -inline Vector2<T> operator /(const Vector2<T>& left, T right) -{ - return Vector2<T>(left.x / right, left.y / right); -} - -template <typename T> -inline Vector2<T>& operator /=(Vector2<T>& left, T right) -{ - left.x /= right; - left.y /= right; - - return left; -} - -template <typename T> -inline bool operator ==(const Vector2<T>& left, const Vector2<T>& right) -{ - return (left.x == right.x) && (left.y == right.y); -} - -template <typename T> -inline bool operator !=(const Vector2<T>& left, const Vector2<T>& right) -{ - return (left.x != right.x) || (left.y != right.y); -} diff --git a/Source/Asura.Engine/Math/Vector3.hpp b/Source/Asura.Engine/Math/Vector3.hpp deleted file mode 100644 index 2b23406..0000000 --- a/Source/Asura.Engine/Math/Vector3.hpp +++ /dev/null @@ -1,233 +0,0 @@ -#ifndef __ASURA_ENGINE_VECTOR3_H__ -#define __ASURA_ENGINE_VECTOR3_H__ - -namespace AsuraEngine -{ - namespace Math - { - template <typename T> - class Vector3 - { - public: - - //////////////////////////////////////////////////////////// - /// \brief Default constructor - /// - /// Creates a Vector3(0, 0, 0). - /// - //////////////////////////////////////////////////////////// - Vector3(); - - //////////////////////////////////////////////////////////// - /// \brief Construct the vector from its coordinates - /// - /// \param X X coordinate - /// \param Y Y coordinate - /// \param Z Z coordinate - /// - //////////////////////////////////////////////////////////// - Vector3(T X, T Y, T Z); - - //////////////////////////////////////////////////////////// - /// \brief Construct the vector from another type of vector - /// - /// This constructor doesn't replace the copy constructor, - /// it's called only when U != T. - /// A call to this constructor will fail to compile if U - /// is not convertible to T. - /// - /// \param vector Vector to convert - /// - //////////////////////////////////////////////////////////// - template <typename U> - explicit Vector3(const Vector3<U>& vector); - - //////////////////////////////////////////////////////////// - // Member data - //////////////////////////////////////////////////////////// - T x; ///< X coordinate of the vector - T y; ///< Y coordinate of the vector - T z; ///< Z coordinate of the vector - }; - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of unary operator - - /// - /// \param left Vector to negate - /// - /// \return Memberwise opposite of the vector - /// - //////////////////////////////////////////////////////////// - template <typename T> - Vector3<T> operator -(const Vector3<T>& left); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator += - /// - /// This operator performs a memberwise addition of both vectors, - /// and assigns the result to \a left. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return Reference to \a left - /// - //////////////////////////////////////////////////////////// - template <typename T> - Vector3<T>& operator +=(Vector3<T>& left, const Vector3<T>& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator -= - /// - /// This operator performs a memberwise subtraction of both vectors, - /// and assigns the result to \a left. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return Reference to \a left - /// - //////////////////////////////////////////////////////////// - template <typename T> - Vector3<T>& operator -=(Vector3<T>& left, const Vector3<T>& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator + - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return Memberwise addition of both vectors - /// - //////////////////////////////////////////////////////////// - template <typename T> - Vector3<T> operator +(const Vector3<T>& left, const Vector3<T>& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator - - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return Memberwise subtraction of both vectors - /// - //////////////////////////////////////////////////////////// - template <typename T> - Vector3<T> operator -(const Vector3<T>& left, const Vector3<T>& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator * - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a scalar value) - /// - /// \return Memberwise multiplication by \a right - /// - //////////////////////////////////////////////////////////// - template <typename T> - Vector3<T> operator *(const Vector3<T>& left, T right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator * - /// - /// \param left Left operand (a scalar value) - /// \param right Right operand (a vector) - /// - /// \return Memberwise multiplication by \a left - /// - //////////////////////////////////////////////////////////// - template <typename T> - Vector3<T> operator *(T left, const Vector3<T>& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator *= - /// - /// This operator performs a memberwise multiplication by \a right, - /// and assigns the result to \a left. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a scalar value) - /// - /// \return Reference to \a left - /// - //////////////////////////////////////////////////////////// - template <typename T> - Vector3<T>& operator *=(Vector3<T>& left, T right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator / - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a scalar value) - /// - /// \return Memberwise division by \a right - /// - //////////////////////////////////////////////////////////// - template <typename T> - Vector3<T> operator /(const Vector3<T>& left, T right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator /= - /// - /// This operator performs a memberwise division by \a right, - /// and assigns the result to \a left. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a scalar value) - /// - /// \return Reference to \a left - /// - //////////////////////////////////////////////////////////// - template <typename T> - Vector3<T>& operator /=(Vector3<T>& left, T right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator == - /// - /// This operator compares strict equality between two vectors. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return True if \a left is equal to \a right - /// - //////////////////////////////////////////////////////////// - template <typename T> - bool operator ==(const Vector3<T>& left, const Vector3<T>& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector3 - /// \brief Overload of binary operator != - /// - /// This operator compares strict difference between two vectors. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return True if \a left is not equal to \a right - /// - //////////////////////////////////////////////////////////// - template <typename T> - bool operator !=(const Vector3<T>& left, const Vector3<T>& right); - -#include "Vector3.inl" - - // Define the most common types - typedef Vector3<int> Vector3i; - typedef Vector3<float> Vector3f; - - } -} - -#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Math/Vector3.inl b/Source/Asura.Engine/Math/Vector3.inl deleted file mode 100644 index 3a2aa93..0000000 --- a/Source/Asura.Engine/Math/Vector3.inl +++ /dev/null @@ -1,145 +0,0 @@ - - -//////////////////////////////////////////////////////////// -template <typename T> -inline Vector3<T>::Vector3() : - x(0), - y(0), - z(0) -{ - -} - - -//////////////////////////////////////////////////////////// -template <typename T> -inline Vector3<T>::Vector3(T X, T Y, T Z) : - x(X), - y(Y), - z(Z) -{ - -} - - -//////////////////////////////////////////////////////////// -template <typename T> -template <typename U> -inline Vector3<T>::Vector3(const Vector3<U>& vector) : - x(static_cast<T>(vector.x)), - y(static_cast<T>(vector.y)), - z(static_cast<T>(vector.z)) -{ -} - - -//////////////////////////////////////////////////////////// -template <typename T> -inline Vector3<T> operator -(const Vector3<T>& left) -{ - return Vector3<T>(-left.x, -left.y, -left.z); -} - - -//////////////////////////////////////////////////////////// -template <typename T> -inline Vector3<T>& operator +=(Vector3<T>& left, const Vector3<T>& right) -{ - left.x += right.x; - left.y += right.y; - left.z += right.z; - - return left; -} - - -//////////////////////////////////////////////////////////// -template <typename T> -inline Vector3<T>& operator -=(Vector3<T>& left, const Vector3<T>& right) -{ - left.x -= right.x; - left.y -= right.y; - left.z -= right.z; - - return left; -} - - -//////////////////////////////////////////////////////////// -template <typename T> -inline Vector3<T> operator +(const Vector3<T>& left, const Vector3<T>& right) -{ - return Vector3<T>(left.x + right.x, left.y + right.y, left.z + right.z); -} - - -//////////////////////////////////////////////////////////// -template <typename T> -inline Vector3<T> operator -(const Vector3<T>& left, const Vector3<T>& right) -{ - return Vector3<T>(left.x - right.x, left.y - right.y, left.z - right.z); -} - - -//////////////////////////////////////////////////////////// -template <typename T> -inline Vector3<T> operator *(const Vector3<T>& left, T right) -{ - return Vector3<T>(left.x * right, left.y * right, left.z * right); -} - - -//////////////////////////////////////////////////////////// -template <typename T> -inline Vector3<T> operator *(T left, const Vector3<T>& right) -{ - return Vector3<T>(right.x * left, right.y * left, right.z * left); -} - - -//////////////////////////////////////////////////////////// -template <typename T> -inline Vector3<T>& operator *=(Vector3<T>& left, T right) -{ - left.x *= right; - left.y *= right; - left.z *= right; - - return left; -} - - -//////////////////////////////////////////////////////////// -template <typename T> -inline Vector3<T> operator /(const Vector3<T>& left, T right) -{ - return Vector3<T>(left.x / right, left.y / right, left.z / right); -} - - -//////////////////////////////////////////////////////////// -template <typename T> -inline Vector3<T>& operator /=(Vector3<T>& left, T right) -{ - left.x /= right; - left.y /= right; - left.z /= right; - - return left; -} - - -//////////////////////////////////////////////////////////// -template <typename T> -inline bool operator ==(const Vector3<T>& left, const Vector3<T>& right) -{ - return (left.x == right.x) && (left.y == right.y) && (left.z == right.z); -} - - -//////////////////////////////////////////////////////////// -template <typename T> -inline bool operator !=(const Vector3<T>& left, const Vector3<T>& right) -{ - return (left.x != right.x) || (left.y != right.y) || (left.z != right.z); -} diff --git a/Source/Asura.Engine/Math/Vector4.h b/Source/Asura.Engine/Math/Vector4.h deleted file mode 100644 index 13a9d8a..0000000 --- a/Source/Asura.Engine/Math/Vector4.h +++ /dev/null @@ -1,234 +0,0 @@ -#ifndef __ASURA_ENGINE_VECTOR4_H__ -#define __ASURA_ENGINE_VECTOR4_H__ - -namespace AsuraEngine -{ - namespace Math - { - template <typename T> - class Vector4 - { - public: - - //////////////////////////////////////////////////////////// - /// \brief Default constructor - /// - /// Creates a Vector4(0, 0, 0). - /// - //////////////////////////////////////////////////////////// - Vector4(); - - //////////////////////////////////////////////////////////// - /// \brief Construct the vector from its coordinates - /// - /// \param X X coordinate - /// \param Y Y coordinate - /// \param Z Z coordinate - /// - //////////////////////////////////////////////////////////// - Vector4(T X, T Y, T Z, T W); - - //////////////////////////////////////////////////////////// - /// \brief Construct the vector from another type of vector - /// - /// This constructor doesn't replace the copy constructor, - /// it's called only when U != T. - /// A call to this constructor will fail to compile if U - /// is not convertible to T. - /// - /// \param vector Vector to convert - /// - //////////////////////////////////////////////////////////// - template <typename U> - explicit Vector4(const Vector4<U>& vector); - - //////////////////////////////////////////////////////////// - // Member data - //////////////////////////////////////////////////////////// - T x; ///< X coordinate of the vector - T y; ///< Y coordinate of the vector - T z; ///< Z coordinate of the vector - T w; ///< W coordinate of the vector - }; - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of unary operator - - /// - /// \param left Vector to negate - /// - /// \return Memberwise opposite of the vector - /// - //////////////////////////////////////////////////////////// - template <typename T> - Vector4<T> operator -(const Vector4<T>& left); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator += - /// - /// This operator performs a memberwise addition of both vectors, - /// and assigns the result to \a left. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return Reference to \a left - /// - //////////////////////////////////////////////////////////// - template <typename T> - Vector4<T>& operator +=(Vector4<T>& left, const Vector4<T>& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator -= - /// - /// This operator performs a memberwise subtraction of both vectors, - /// and assigns the result to \a left. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return Reference to \a left - /// - //////////////////////////////////////////////////////////// - template <typename T> - Vector4<T>& operator -=(Vector4<T>& left, const Vector4<T>& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator + - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return Memberwise addition of both vectors - /// - //////////////////////////////////////////////////////////// - template <typename T> - Vector4<T> operator +(const Vector4<T>& left, const Vector4<T>& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator - - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return Memberwise subtraction of both vectors - /// - //////////////////////////////////////////////////////////// - template <typename T> - Vector4<T> operator -(const Vector4<T>& left, const Vector4<T>& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator * - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a scalar value) - /// - /// \return Memberwise multiplication by \a right - /// - //////////////////////////////////////////////////////////// - template <typename T> - Vector4<T> operator *(const Vector4<T>& left, T right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator * - /// - /// \param left Left operand (a scalar value) - /// \param right Right operand (a vector) - /// - /// \return Memberwise multiplication by \a left - /// - //////////////////////////////////////////////////////////// - template <typename T> - Vector4<T> operator *(T left, const Vector4<T>& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator *= - /// - /// This operator performs a memberwise multiplication by \a right, - /// and assigns the result to \a left. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a scalar value) - /// - /// \return Reference to \a left - /// - //////////////////////////////////////////////////////////// - template <typename T> - Vector4<T>& operator *=(Vector4<T>& left, T right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator / - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a scalar value) - /// - /// \return Memberwise division by \a right - /// - //////////////////////////////////////////////////////////// - template <typename T> - Vector4<T> operator /(const Vector4<T>& left, T right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator /= - /// - /// This operator performs a memberwise division by \a right, - /// and assigns the result to \a left. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a scalar value) - /// - /// \return Reference to \a left - /// - //////////////////////////////////////////////////////////// - template <typename T> - Vector4<T>& operator /=(Vector4<T>& left, T right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator == - /// - /// This operator compares strict equality between two vectors. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return True if \a left is equal to \a right - /// - //////////////////////////////////////////////////////////// - template <typename T> - bool operator ==(const Vector4<T>& left, const Vector4<T>& right); - - //////////////////////////////////////////////////////////// - /// \relates Vector4 - /// \brief Overload of binary operator != - /// - /// This operator compares strict difference between two vectors. - /// - /// \param left Left operand (a vector) - /// \param right Right operand (a vector) - /// - /// \return True if \a left is not equal to \a right - /// - //////////////////////////////////////////////////////////// - template <typename T> - bool operator !=(const Vector4<T>& left, const Vector4<T>& right); - -#include "Vector4.inl" - - // Define the most common types - typedef Vector4<int> Vector4i; - typedef Vector4<float> Vector4f; - - } -} - -#endif
\ No newline at end of file diff --git a/Source/Asura.Engine/Math/Vector4.inl b/Source/Asura.Engine/Math/Vector4.inl deleted file mode 100644 index 025bfcc..0000000 --- a/Source/Asura.Engine/Math/Vector4.inl +++ /dev/null @@ -1,152 +0,0 @@ - - -//////////////////////////////////////////////////////////// -template <typename T> -inline Vector4<T>::Vector4() : - x(0), - y(0), - z(0), - w(0) -{ - -} - - -//////////////////////////////////////////////////////////// -template <typename T> -inline Vector4<T>::Vector4(T X, T Y, T Z) : - x(X), - y(Y), - z(Z), - w(0) -{ - -} - - -//////////////////////////////////////////////////////////// -template <typename T> -template <typename U> -inline Vector4<T>::Vector4(const Vector4<U>& vector) : - x(static_cast<T>(vector.x)), - y(static_cast<T>(vector.y)), - z(static_cast<T>(vector.z)) - w(static_cast<T>(vector.w)) -{ -} - - -//////////////////////////////////////////////////////////// -template <typename T> -inline Vector4<T> operator -(const Vector4<T>& left) -{ - return Vector4<T>(-left.x, -left.y, -left.z, -left.w); -} - - -//////////////////////////////////////////////////////////// -template <typename T> -inline Vector4<T>& operator +=(Vector4<T>& left, const Vector4<T>& right) -{ - left.x += right.x; - left.y += right.y; - left.z += right.z; - left.w += right.w; - - return left; -} - - -//////////////////////////////////////////////////////////// -template <typename T> -inline Vector4<T>& operator -=(Vector4<T>& left, const Vector4<T>& right) -{ - left.x -= right.x; - left.y -= right.y; - left.z -= right.z; - left.w -= right.w; - - return left; -} - - -//////////////////////////////////////////////////////////// -template <typename T> -inline Vector4<T> operator +(const Vector4<T>& left, const Vector4<T>& right) -{ - return Vector4<T>(left.x + right.x, left.y + right.y, left.z + right.z, left.w + right.w); -} - - -//////////////////////////////////////////////////////////// -template <typename T> -inline Vector4<T> operator -(const Vector4<T>& left, const Vector4<T>& right) -{ - return Vector4<T>(left.x - right.x, left.y - right.y, left.z - right.z, left.w - right.w); -} - - -//////////////////////////////////////////////////////////// -template <typename T> -inline Vector4<T> operator *(const Vector4<T>& left, T right) -{ - return Vector4<T>(left.x * right, left.y * right, left.z * right, left.w * right); -} - - -//////////////////////////////////////////////////////////// -template <typename T> -inline Vector4<T> operator *(T left, const Vector4<T>& right) -{ - return Vector4<T>(right.x * left, right.y * left, right.z * left, right.w * left); -} - - -//////////////////////////////////////////////////////////// -template <typename T> -inline Vector4<T>& operator *=(Vector4<T>& left, T right) -{ - left.x *= right; - left.y *= right; - left.z *= right; - left.w *= right; - - return left; -} - - -//////////////////////////////////////////////////////////// -template <typename T> -inline Vector4<T> operator /(const Vector4<T>& left, T right) -{ - return Vector4<T>(left.x / right, left.y / right, left.z / right, left.w / right); -} - - -//////////////////////////////////////////////////////////// -template <typename T> -inline Vector4<T>& operator /=(Vector4<T>& left, T right) -{ - left.x /= right; - left.y /= right; - left.z /= right; - left.w /= right; - - return left; -} - - -//////////////////////////////////////////////////////////// -template <typename T> -inline bool operator ==(const Vector4<T>& left, const Vector4<T>& right) -{ - return (left.x == right.x) && (left.y == right.y) && (left.z == right.z) && (left.w == right.w); -} - - -//////////////////////////////////////////////////////////// -template <typename T> -inline bool operator !=(const Vector4<T>& left, const Vector4<T>& right) -{ - return (left.x != right.x) || (left.y != right.y) || (left.z != right.z) || (left.w != right.w); -} |