From 0c391fdbce5a079cf03e483eb6174dd47806163d Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 7 Aug 2019 21:08:47 +0800 Subject: *misc --- source/modules/asura-utils/math/curve.cpp | 0 source/modules/asura-utils/math/curve.h | 0 source/modules/asura-utils/math/functions.cpp | 0 source/modules/asura-utils/math/functions.h | 0 source/modules/asura-utils/math/matrix44.cpp | 217 ----------------------- source/modules/asura-utils/math/matrix44.h | 96 ---------- source/modules/asura-utils/math/quaternion.cpp | 0 source/modules/asura-utils/math/quaternion.h | 0 source/modules/asura-utils/math/rect.hpp | 50 ------ source/modules/asura-utils/math/transform.cpp | 0 source/modules/asura-utils/math/transform.h | 30 ---- source/modules/asura-utils/math/vector2.hpp | 72 -------- source/modules/asura-utils/math/vector3.hpp | 235 ------------------------- source/modules/asura-utils/math/vector4.h | 234 ------------------------ 14 files changed, 934 deletions(-) delete mode 100644 source/modules/asura-utils/math/curve.cpp delete mode 100644 source/modules/asura-utils/math/curve.h delete mode 100644 source/modules/asura-utils/math/functions.cpp delete mode 100644 source/modules/asura-utils/math/functions.h delete mode 100644 source/modules/asura-utils/math/matrix44.cpp delete mode 100644 source/modules/asura-utils/math/matrix44.h delete mode 100644 source/modules/asura-utils/math/quaternion.cpp delete mode 100644 source/modules/asura-utils/math/quaternion.h delete mode 100644 source/modules/asura-utils/math/rect.hpp delete mode 100644 source/modules/asura-utils/math/transform.cpp delete mode 100644 source/modules/asura-utils/math/transform.h delete mode 100644 source/modules/asura-utils/math/vector2.hpp delete mode 100644 source/modules/asura-utils/math/vector3.hpp delete mode 100644 source/modules/asura-utils/math/vector4.h (limited to 'source/modules/asura-utils/math') 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 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 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 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 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 // memcpy -#include - -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 - -#include "../Scripting/Portable.hpp" - -namespace_begin(AsuraEngine) -namespace_begin(Math) - -/// 不需要转置的OpenGL矩阵,类似glm::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 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 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 - 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& src1, const Rect& src2, Rect& 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 Recti; - typedef Rect Rectu; - typedef Rect Rectf; - typedef Rect 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 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 - -namespace_begin(AsuraEngine) -namespace_begin(Math) - -template -class Vector2 -{ -public: - Vector2(); - Vector2(T X, T Y); - - template - explicit Vector2(const Vector2& vector); - - void Set(T X, T Y); - - T x; ///< X coordinate of the vector - T y; ///< Y coordinate of the vector -}; - -template -Vector2 operator -(const Vector2& right); - -template -Vector2& operator +=(Vector2& left, const Vector2& right); - -template -Vector2& operator -=(Vector2& left, const Vector2& right); - -template -Vector2 operator +(const Vector2& left, const Vector2& right); - -template -Vector2 operator -(const Vector2& left, const Vector2& right); - -template -Vector2 operator *(const Vector2& left, T right); - -template -Vector2 operator *(T left, const Vector2& right); - -template -Vector2& operator *=(Vector2& left, T right); - -template -Vector2 operator /(const Vector2& left, T right); - -template -Vector2& operator /=(Vector2& left, T right); - -template -bool operator ==(const Vector2& left, const Vector2& right); - -template -bool operator !=(const Vector2& left, const Vector2& right); - -#include "Vector2.inc" - -typedef Vector2 Vector2i; -typedef Vector2 Vector2u; -typedef Vector2 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 - 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 - explicit Vector3(const Vector3& 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 - Vector3 operator -(const Vector3& 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 - Vector3& operator +=(Vector3& left, const Vector3& 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 - Vector3& operator -=(Vector3& left, const Vector3& 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 - Vector3 operator +(const Vector3& left, const Vector3& 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 - Vector3 operator -(const Vector3& left, const Vector3& 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 - Vector3 operator *(const Vector3& 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 - Vector3 operator *(T left, const Vector3& 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 - Vector3& operator *=(Vector3& 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 - Vector3 operator /(const Vector3& 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 - Vector3& operator /=(Vector3& 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 - bool operator ==(const Vector3& left, const Vector3& 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 - bool operator !=(const Vector3& left, const Vector3& right); - -#include "Vector3.inc" - - // Define the most common types - typedef Vector3 Vector3i; - typedef Vector3 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 - 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 - explicit Vector4(const Vector4& 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 - Vector4 operator -(const Vector4& 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 - Vector4& operator +=(Vector4& left, const Vector4& 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 - Vector4& operator -=(Vector4& left, const Vector4& 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 - Vector4 operator +(const Vector4& left, const Vector4& 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 - Vector4 operator -(const Vector4& left, const Vector4& 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 - Vector4 operator *(const Vector4& 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 - Vector4 operator *(T left, const Vector4& 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 - Vector4& operator *=(Vector4& 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 - Vector4 operator /(const Vector4& 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 - Vector4& operator /=(Vector4& 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 - bool operator ==(const Vector4& left, const Vector4& 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 - bool operator !=(const Vector4& left, const Vector4& right); - -#include "Vector4.inc" - - // Define the most common types - typedef Vector4 Vector4i; - typedef Vector4 Vector4f; - - } -} - -#endif \ No newline at end of file -- cgit v1.1-26-g67d0