diff options
author | chai <chaifix@163.com> | 2019-08-07 21:08:47 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-08-07 21:08:47 +0800 |
commit | 0c391fdbce5a079cf03e483eb6174dd47806163d (patch) | |
tree | b06cd7a9d0ae0d9bb9e82f3dcb786dfce11f8628 /source/modules/asura-utils/math | |
parent | 9686368e58e25cbd6dc37d686bdd2be3f80486d6 (diff) |
*misc
Diffstat (limited to 'source/modules/asura-utils/math')
-rw-r--r-- | source/modules/asura-utils/math/curve.cpp | 0 | ||||
-rw-r--r-- | source/modules/asura-utils/math/curve.h | 0 | ||||
-rw-r--r-- | source/modules/asura-utils/math/functions.cpp | 0 | ||||
-rw-r--r-- | source/modules/asura-utils/math/functions.h | 0 | ||||
-rw-r--r-- | source/modules/asura-utils/math/matrix44.cpp | 217 | ||||
-rw-r--r-- | source/modules/asura-utils/math/matrix44.h | 96 | ||||
-rw-r--r-- | source/modules/asura-utils/math/quaternion.cpp | 0 | ||||
-rw-r--r-- | source/modules/asura-utils/math/quaternion.h | 0 | ||||
-rw-r--r-- | source/modules/asura-utils/math/rect.hpp | 50 | ||||
-rw-r--r-- | source/modules/asura-utils/math/transform.cpp | 0 | ||||
-rw-r--r-- | source/modules/asura-utils/math/transform.h | 30 | ||||
-rw-r--r-- | source/modules/asura-utils/math/vector2.hpp | 72 | ||||
-rw-r--r-- | source/modules/asura-utils/math/vector3.hpp | 235 | ||||
-rw-r--r-- | source/modules/asura-utils/math/vector4.h | 234 |
14 files changed, 0 insertions, 934 deletions
diff --git a/source/modules/asura-utils/math/curve.cpp b/source/modules/asura-utils/math/curve.cpp deleted file mode 100644 index e69de29..0000000 --- a/source/modules/asura-utils/math/curve.cpp +++ /dev/null diff --git a/source/modules/asura-utils/math/curve.h b/source/modules/asura-utils/math/curve.h deleted file mode 100644 index e69de29..0000000 --- a/source/modules/asura-utils/math/curve.h +++ /dev/null diff --git a/source/modules/asura-utils/math/functions.cpp b/source/modules/asura-utils/math/functions.cpp deleted file mode 100644 index e69de29..0000000 --- a/source/modules/asura-utils/math/functions.cpp +++ /dev/null diff --git a/source/modules/asura-utils/math/functions.h b/source/modules/asura-utils/math/functions.h deleted file mode 100644 index e69de29..0000000 --- a/source/modules/asura-utils/math/functions.h +++ /dev/null diff --git a/source/modules/asura-utils/math/matrix44.cpp b/source/modules/asura-utils/math/matrix44.cpp deleted file mode 100644 index 9ecf448..0000000 --- a/source/modules/asura-utils/math/matrix44.cpp +++ /dev/null @@ -1,217 +0,0 @@ -#include "Matrix44.h" - -#include <cstring> // memcpy -#include <cmath> - -namespace AsuraEngine -{ - namespace Math - { - - const Matrix44 Matrix44::Identity; - - // | e0 e4 e8 e12 | - // | e1 e5 e9 e13 | - // | e2 e6 e10 e14 | - // | e3 e7 e11 e15 | - - Matrix44::Matrix44() - { - SetIdentity(); - } - - Matrix44::Matrix44(const Matrix44& m) - { - memcpy(&e, &m.e, 16 * sizeof(float)); - } - - Matrix44::~Matrix44() - { - } - - void Matrix44::operator = (const Matrix44& m) - { - memcpy(&e, &m.e, 16 * sizeof(float)); - } - - void Matrix44::SetOrtho(float l, float r, float b, float t, float n, float f) - { - SetIdentity(); - float w = r - l; - float h = t - b; - float z = f - n; - e[0] = 2 / w; - e[5] = 2 / h; - e[10] = -2 / z; - e[12] = -(r + l) / w; - e[13] = -(t + b) / h; - e[14] = -(f + n) / z; - e[15] = 1; - } - - // | e0 e4 e8 e12 | - // | e1 e5 e9 e13 | - // | e2 e6 e10 e14 | - // | e3 e7 e11 e15 | - // | e0 e4 e8 e12 | - // | e1 e5 e9 e13 | - // | e2 e6 e10 e14 | - // | e3 e7 e11 e15 | - - Matrix44 Matrix44::operator * (const Matrix44 & m) const - { - Matrix44 t; - - t.e[0] = (e[0] * m.e[0]) + (e[4] * m.e[1]) + (e[8] * m.e[2]) + (e[12] * m.e[3]); - t.e[4] = (e[0] * m.e[4]) + (e[4] * m.e[5]) + (e[8] * m.e[6]) + (e[12] * m.e[7]); - t.e[8] = (e[0] * m.e[8]) + (e[4] * m.e[9]) + (e[8] * m.e[10]) + (e[12] * m.e[11]); - t.e[12] = (e[0] * m.e[12]) + (e[4] * m.e[13]) + (e[8] * m.e[14]) + (e[12] * m.e[15]); - - t.e[1] = (e[1] * m.e[0]) + (e[5] * m.e[1]) + (e[9] * m.e[2]) + (e[13] * m.e[3]); - t.e[5] = (e[1] * m.e[4]) + (e[5] * m.e[5]) + (e[9] * m.e[6]) + (e[13] * m.e[7]); - t.e[9] = (e[1] * m.e[8]) + (e[5] * m.e[9]) + (e[9] * m.e[10]) + (e[13] * m.e[11]); - t.e[13] = (e[1] * m.e[12]) + (e[5] * m.e[13]) + (e[9] * m.e[14]) + (e[13] * m.e[15]); - - t.e[2] = (e[2] * m.e[0]) + (e[6] * m.e[1]) + (e[10] * m.e[2]) + (e[14] * m.e[3]); - t.e[6] = (e[2] * m.e[4]) + (e[6] * m.e[5]) + (e[10] * m.e[6]) + (e[14] * m.e[7]); - t.e[10] = (e[2] * m.e[8]) + (e[6] * m.e[9]) + (e[10] * m.e[10]) + (e[14] * m.e[11]); - t.e[14] = (e[2] * m.e[12]) + (e[6] * m.e[13]) + (e[10] * m.e[14]) + (e[14] * m.e[15]); - - t.e[3] = (e[3] * m.e[0]) + (e[7] * m.e[1]) + (e[11] * m.e[2]) + (e[15] * m.e[3]); - t.e[7] = (e[3] * m.e[4]) + (e[7] * m.e[5]) + (e[11] * m.e[6]) + (e[15] * m.e[7]); - t.e[11] = (e[3] * m.e[8]) + (e[7] * m.e[9]) + (e[11] * m.e[10]) + (e[15] * m.e[11]); - t.e[15] = (e[3] * m.e[12]) + (e[7] * m.e[13]) + (e[11] * m.e[14]) + (e[15] * m.e[15]); - - return t; - } - - void Matrix44::operator *= (const Matrix44 & m) - { - Matrix44 t = (*this) * m; - memcpy((void*)this->e, (void*)t.e, sizeof(float) * 16); - } - - const float * Matrix44::GetElements() const - { - return e; - } - - void Matrix44::SetIdentity() - { - memset(e, 0, sizeof(float) * 16); - e[0] = e[5] = e[10] = e[15] = 1; - } - - void Matrix44::SetTranslation(float x, float y) - { - SetIdentity(); - e[12] = x; - e[13] = y; - } - - void Matrix44::SetRotation(float rad) - { - SetIdentity(); - float c = cos(rad), s = sin(rad); - e[0] = c; e[4] = -s; - e[1] = s; e[5] = c; - } - - void Matrix44::SetScale(float sx, float sy) - { - SetIdentity(); - e[0] = sx; - e[5] = sy; - } - - void Matrix44::SetShear(float kx, float ky) - { - SetIdentity(); - e[1] = ky; - e[4] = kx; - } - - void Matrix44::SetTransformation(float x, float y, float angle, float sx, float sy, float ox, float oy) - { - memset(e, 0, sizeof(float) * 16); // zero out matrix - float c = cos(angle), s = sin(angle); - // matrix multiplication carried out on paper: - // |1 x| |c -s | |sx | |1 -ox| - // | 1 y| |s c | | sy | | 1 -oy| - // | 1 | | 1 | | 1 | | 1 | - // | 1| | 1| | 1| | 1 | - // move rotate scale origin - e[10] = e[15] = 1.0f; - e[0] = c * sx; // = a - e[1] = s * sx; // = b - e[4] = -s * sy; // = c - e[5] = c * sy; // = d - e[12] = x - ox * e[0] - oy * e[4]; - e[13] = y - ox * e[1] - oy * e[5]; - } - - void Matrix44::Translate(float x, float y) - { - Matrix44 t; - t.SetTranslation(x, y); - this->operator *=(t); - } - - void Matrix44::Rotate(float rad) - { - Matrix44 t; - t.SetRotation(rad); - this->operator *=(t); - } - - void Matrix44::Scale(float sx, float sy) - { - Matrix44 t; - t.SetScale(sx, sy); - this->operator *=(t); - } - - void Matrix44::Shear(float kx, float ky) - { - Matrix44 t; - t.SetShear(kx, ky); - this->operator *=(t); - } - - void Matrix44::Transform(float x, float y, float angle, float sx, float sy, float ox, float oy) - { - Matrix44 t; - t.SetTransformation(x, y, angle, sx, sy, ox, oy); - this->operator *=(t); - } - - void Matrix44::Ortho(float left, float right, float bottom, float top, float near, float far) - { - Matrix44 t; - t.SetOrtho(left, right, bottom, top, near, far); - this->operator *=(t); - } - - // | x | - // | y | - // | 0 | - // | 1 | - // | e0 e4 e8 e12 | - // | e1 e5 e9 e13 | - // | e2 e6 e10 e14 | - // | e3 e7 e11 e15 | - - //void Matrix44::transform(Graphics::Vertex* dst, const Graphics::Vertex* src, int size) const - //{ - // for (int i = 0; i<size; ++i) - // { - // // Store in temp variables in case src = dst - // float x = (e[0] * src[i].xy.x()) + (e[4] * src[i].xy.y()) + (0) + (e[12]); - // float y = (e[1] * src[i].xy.x()) + (e[5] * src[i].xy.y()) + (0) + (e[13]); - - // dst[i].xy.Set(x, y); - // } - //} - - } // namespace Math -} // namespace JinEngine
\ No newline at end of file diff --git a/source/modules/asura-utils/math/matrix44.h b/source/modules/asura-utils/math/matrix44.h deleted file mode 100644 index 503242f..0000000 --- a/source/modules/asura-utils/math/matrix44.h +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef _ASURA_MATRIX_H_ -#define _ASURA_MATRIX_H_ - -#include <asura-utils/Classes.h> - -#include "../Scripting/Portable.hpp" - -namespace_begin(AsuraEngine) -namespace_begin(Math) - -/// ҪתõOpenGLglm::mat4 -/// https://blog.csdn.net/candycat1992/article/details/8830894 -class Matrix44 -{ -public: - - static const Matrix44 Identity; - - Matrix44(); - - Matrix44(const Matrix44& m); - - ~Matrix44(); - - void operator = (const Matrix44& m); - - void SetOrtho(float _left, float _right, float _bottom, float _top, float _near, float _far); - - Matrix44 operator * (const Matrix44 & m) const; - - void operator *= (const Matrix44 & m); - - const float* GetElements() const; - - void SetIdentity(); - - void SetTranslation(float x, float y); - - void SetRotation(float r); - - void SetScale(float sx, float sy); - - void SetShear(float kx, float ky); - - void SetTransformation(float x, float y, float angle, float sx, float sy, float ox, float oy); - - void Translate(float x, float y); - - void Rotate(float r); - - void Scale(float sx, float sy); - - void Transform(float x, float y, float angle, float sx, float sy, float ox, float oy); - - /// - /// Multiplies this Matrix44 with a shear transformation. - /// @param kx Shear along the x-axis. - /// @param ky Shear along the y-axis. - /// - void Shear(float kx, float ky); - - void Ortho(float left, float right, float bottom, float top, float near, float far); - - ///// - ///// Transforms an array of vertices by this Matrix44. The sources and - ///// destination arrays may be the same. - ///// - ///// @param dst Storage for the transformed vertices. - ///// @param src The source vertices. - ///// @param size The number of vertices. - ///// - //void transform(Graphics::Vertex* dst, const Graphics::Vertex * src, int size) const; - - /// - /// ʽ - /// - float Calculate(); - -private: - - /// - /// | e0 e4 e8 e12 | - /// | e1 e5 e9 e13 | - /// | e2 e6 e10 e14 | - /// | e3 e7 e11 e15 | - /// - float e[16]; - -}; - -namespace_end -namespace_end - -namespace AEMath = AsuraEngine::Math; - -#endif
\ No newline at end of file diff --git a/source/modules/asura-utils/math/quaternion.cpp b/source/modules/asura-utils/math/quaternion.cpp deleted file mode 100644 index e69de29..0000000 --- a/source/modules/asura-utils/math/quaternion.cpp +++ /dev/null diff --git a/source/modules/asura-utils/math/quaternion.h b/source/modules/asura-utils/math/quaternion.h deleted file mode 100644 index e69de29..0000000 --- a/source/modules/asura-utils/math/quaternion.h +++ /dev/null diff --git a/source/modules/asura-utils/math/rect.hpp b/source/modules/asura-utils/math/rect.hpp deleted file mode 100644 index 45bf1ba..0000000 --- a/source/modules/asura-utils/math/rect.hpp +++ /dev/null @@ -1,50 +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); - ~Rect() {}; - - /// - /// x,yǷrectڡ - /// - bool Contain(T x, T y); - - /// - /// Ƿཻཻľ - /// - bool Intersect(const Rect& src, Rect& intersection); - - /// - /// Ƿཻཻľ - /// - static bool Intersect(const Rect<T>& src1, const Rect<T>& src2, Rect<T>& intersection); - - void Set(T x, T y, T w, T h); - - T x, y, w, h; - }; - -#include "Rect.inc" - - // Define the most common types - typedef Rect<int> Recti; - typedef Rect<unsigned int> Rectu; - typedef Rect<float> Rectf; - typedef Rect<long> Reftl; - - } -} - -namespace AEMath = AsuraEngine::Math; - -#endif
\ No newline at end of file diff --git a/source/modules/asura-utils/math/transform.cpp b/source/modules/asura-utils/math/transform.cpp deleted file mode 100644 index e69de29..0000000 --- a/source/modules/asura-utils/math/transform.cpp +++ /dev/null diff --git a/source/modules/asura-utils/math/transform.h b/source/modules/asura-utils/math/transform.h deleted file mode 100644 index 23d0709..0000000 --- a/source/modules/asura-utils/math/transform.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef _ASURA_ENGINE_TRANSFORM_H_ -#define _ASURA_ENGINE_TRANSFORM_H_ - -#include "../scripting/Portable.hpp" - -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/modules/asura-utils/math/vector2.hpp b/source/modules/asura-utils/math/vector2.hpp deleted file mode 100644 index 326a57e..0000000 --- a/source/modules/asura-utils/math/vector2.hpp +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef _ASURA_ENGINE_VECTOR2_H__ -#define _ASURA_ENGINE_VECTOR2_H__ - -#include <asura-utils/Classes.h> - -namespace_begin(AsuraEngine) -namespace_begin(Math) - -template <typename T> -class Vector2 -{ -public: - Vector2(); - Vector2(T X, T Y); - - template <typename U> - explicit Vector2(const Vector2<U>& vector); - - void 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.inc" - -typedef Vector2<int> Vector2i; -typedef Vector2<unsigned int> Vector2u; -typedef Vector2<float> Vector2f; - -namespace_end -namespace_end - -namespace AEMath = AsuraEngine::Math; - -#endif
\ No newline at end of file diff --git a/source/modules/asura-utils/math/vector3.hpp b/source/modules/asura-utils/math/vector3.hpp deleted file mode 100644 index c526ace..0000000 --- a/source/modules/asura-utils/math/vector3.hpp +++ /dev/null @@ -1,235 +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.inc" - - // Define the most common types - typedef Vector3<int> Vector3i; - typedef Vector3<float> Vector3f; - - } -} - -namespace AEMath = AsuraEngine::Math; - -#endif
\ No newline at end of file diff --git a/source/modules/asura-utils/math/vector4.h b/source/modules/asura-utils/math/vector4.h deleted file mode 100644 index a5bf549..0000000 --- a/source/modules/asura-utils/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.inc" - - // Define the most common types - typedef Vector4<int> Vector4i; - typedef Vector4<float> Vector4f; - - } -} - -#endif
\ No newline at end of file |