diff options
author | vimene <vincent.menegaux@gmail.com> | 2023-11-26 08:43:14 +0100 |
---|---|---|
committer | vimene <vincent.menegaux@gmail.com> | 2023-11-26 08:43:14 +0100 |
commit | 5a1d67d1797a3db874e44500e13237d676843185 (patch) | |
tree | 17d0f1c2db6cc32fe40fdde4a081b96e8ad0ae13 /src/math/math_vector.cpp | |
parent | f63febed2a769d0c55192e192a20b8e39f162932 (diff) | |
download | engine-5a1d67d1797a3db874e44500e13237d676843185.tar.gz |
added namespaces, made every function in engine.cpp static and added warnings' flags
Diffstat (limited to 'src/math/math_vector.cpp')
-rw-r--r-- | src/math/math_vector.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/math/math_vector.cpp b/src/math/math_vector.cpp index baa2448..aacff86 100644 --- a/src/math/math_vector.cpp +++ b/src/math/math_vector.cpp @@ -1,6 +1,8 @@ #include "math/math_vector.h" #include <cmath> +using namespace engine::math; + MathVector2::MathVector2() { } @@ -39,15 +41,15 @@ MathVector2 MathVector2::round() const { return { std::round(x), std::round(y) }; } -MathVector2 operator*(float n, MathVector2 other) { +MathVector2 engine::math::operator*(float n, MathVector2 other) { return { n * other.x, n * other.y }; } -MathVector2 operator*(MathVector2 other, float n) { +MathVector2 engine::math::operator*(MathVector2 other, float n) { return n * other; } -MathVector2 operator/(MathVector2 other, float n) { +MathVector2 engine::math::operator/(MathVector2 other, float n) { return { other.x / n, other.y / n }; } @@ -97,15 +99,15 @@ MathVector3 MathVector3::cross(MathVector3 other) const { }; } -MathVector3 operator*(float n, MathVector3 other) { +MathVector3 engine::math::operator*(float n, MathVector3 other) { return { n * other.x, n * other.y, n * other.z }; } -MathVector3 operator*(MathVector3 other, float n) { +MathVector3 engine::math::operator*(MathVector3 other, float n) { return n * other; } -MathVector3 operator/(MathVector3 other, float n) { +MathVector3 engine::math::operator/(MathVector3 other, float n) { return { other.x / n, other.y / n, other.z / n }; } @@ -160,14 +162,14 @@ MathVector3 MathVector4::div_by_w() const { return xyz() / w; } -MathVector4 operator*(float n, MathVector4 other) { +MathVector4 engine::math::operator*(float n, MathVector4 other) { return { n * other.x, n * other.y, n * other.z, n * other.w }; } -MathVector4 operator*(MathVector4 other, float n) { +MathVector4 engine::math::operator*(MathVector4 other, float n) { return n * other; } -MathVector4 operator/(MathVector4 other, float n) { +MathVector4 engine::math::operator/(MathVector4 other, float n) { return { other.x / n, other.y / n, other.z / n, other.w / n }; } |