From 8f0dda5eab181b0f14f2652b4e984aaaae3f258c Mon Sep 17 00:00:00 2001 From: rtk0c Date: Mon, 27 Jun 2022 18:27:13 -0700 Subject: Start from a clean slate --- core/src/Utils/Vector.hpp | 144 ---------------------------------------------- 1 file changed, 144 deletions(-) delete mode 100644 core/src/Utils/Vector.hpp (limited to 'core/src/Utils/Vector.hpp') diff --git a/core/src/Utils/Vector.hpp b/core/src/Utils/Vector.hpp deleted file mode 100644 index 4d3f3b3..0000000 --- a/core/src/Utils/Vector.hpp +++ /dev/null @@ -1,144 +0,0 @@ -#pragma once - -#include "Utils/IO/DataStream.hpp" - -template -struct Vec2 -{ - T x = 0; - T y = 0; - - template - Vec2 Cast() const - { - return { - static_cast(x), - static_cast(y), - }; - } - - void ReadFromDataStream(InputDataStream& stream) - { - stream.Value(x); - stream.Value(y); - } - - void WriteToDataStream(OutputDataStream& stream) const - { - stream.Value(x); - stream.Value(y); - } - - friend constexpr bool operator==(const Vec2& a, const Vec2& b) = default; - - friend constexpr Vec2 operator+(const Vec2& a, const Vec2& b) { return { a.x + b.x, a.y + b.y }; } - friend constexpr Vec2 operator-(const Vec2& a, const Vec2& b) { return { a.x - b.x, a.y - b.y }; } - friend constexpr Vec2 operator*(const Vec2& a, const Vec2& b) { return { a.x * b.x, a.y * b.y }; } - friend constexpr Vec2 operator/(const Vec2& a, const Vec2& b) { return { a.x / b.x, a.y / b.y }; } - - friend constexpr Vec2 operator+(const Vec2& a, T n) { return { a.x + n, a.y + n }; } - friend constexpr Vec2 operator-(const Vec2& a, T n) { return { a.x - n, a.y - n }; } - friend constexpr Vec2 operator*(const Vec2& a, T n) { return { a.x * n, a.y * n }; } - friend constexpr Vec2 operator/(const Vec2& a, T n) { return { a.x / n, a.y / n }; } -}; - -using Vec2i = Vec2; -using Vec2f = Vec2; - -template -struct Vec3 -{ - T x = 0; - T y = 0; - T z = 0; - - template - Vec3 Cast() const - { - return { - static_cast(x), - static_cast(y), - static_cast(z), - }; - } - - void ReadFromDataStream(InputDataStream& stream) - { - stream.Value(x); - stream.Value(y); - stream.Value(z); - } - - void WriteToDataStream(OutputDataStream& stream) const - { - stream.Value(x); - stream.Value(y); - stream.Value(z); - } - - friend constexpr bool operator==(const Vec3& a, const Vec3& b) = default; - - friend constexpr Vec3 operator+(const Vec3& a, const Vec3& b) { return { a.x + b.x, a.y + b.y, a.z + b.z }; } - friend constexpr Vec3 operator-(const Vec3& a, const Vec3& b) { return { a.x - b.x, a.y - b.y, a.z - b.z }; } - friend constexpr Vec3 operator*(const Vec3& a, const Vec3& b) { return { a.x * b.x, a.y * b.y, a.z * b.z }; } - friend constexpr Vec3 operator/(const Vec3& a, const Vec3& b) { return { a.x / b.x, a.y / b.y, a.z / b.z }; } - - friend constexpr Vec3 operator+(const Vec3& a, T n) { return { a.x + n, a.y + n, a.z + n }; } - friend constexpr Vec3 operator-(const Vec3& a, T n) { return { a.x - n, a.y - n, a.z - n }; } - friend constexpr Vec3 operator*(const Vec3& a, T n) { return { a.x * n, a.y * n, a.z * n }; } - friend constexpr Vec3 operator/(const Vec3& a, T n) { return { a.x / n, a.y / n, a.z / n }; } -}; - -using Vec3i = Vec3; -using Vec3f = Vec3; - -template -struct Vec4 -{ - T x = 0; - T y = 0; - T z = 0; - T w = 0; - - template - Vec4 Cast() const - { - return { - static_cast(x), - static_cast(y), - static_cast(z), - static_cast(w), - }; - } - - void ReadFromDataStream(InputDataStream& stream) - { - stream.Value(x); - stream.Value(y); - stream.Value(z); - stream.Value(w); - } - - void WriteToDataStream(OutputDataStream& stream) const - { - stream.Value(x); - stream.Value(y); - stream.Value(z); - stream.Value(w); - } - - friend constexpr bool operator==(const Vec4& a, const Vec4& b) = default; - - friend constexpr Vec4 operator+(const Vec4& a, const Vec4& b) { return { a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w }; } - friend constexpr Vec4 operator-(const Vec4& a, const Vec4& b) { return { a.x - b.x, a.y - b.y, a.z - b.z, a.w - b.w }; } - friend constexpr Vec4 operator*(const Vec4& a, const Vec4& b) { return { a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w }; } - friend constexpr Vec4 operator/(const Vec4& a, const Vec4& b) { return { a.x / b.x, a.y / b.y, a.z / b.z, a.w / b.w }; } - - friend constexpr Vec4 operator+(const Vec4& a, T n) { return { a.x + n, a.y + n, a.z + n, a.w + n }; } - friend constexpr Vec4 operator-(const Vec4& a, T n) { return { a.x - n, a.y - n, a.z - n, a.w - n }; } - friend constexpr Vec4 operator*(const Vec4& a, T n) { return { a.x * n, a.y * n, a.z * n, a.w * n }; } - friend constexpr Vec4 operator/(const Vec4& a, T n) { return { a.x / n, a.y / n, a.z / n, a.w / n }; } -}; - -using Vec4i = Vec4; -using Vec4f = Vec4; -- cgit v1.2.3-70-g09d2