From 5a1d67d1797a3db874e44500e13237d676843185 Mon Sep 17 00:00:00 2001 From: vimene Date: Sun, 26 Nov 2023 08:43:14 +0100 Subject: added namespaces, made every function in engine.cpp static and added warnings' flags --- src/math/math_vector.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/math/math_vector.cpp') 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 +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 }; } -- cgit v1.2.3