From b46a0d9369fbaa1938f0968ab216bc2d564a9c37 Mon Sep 17 00:00:00 2001 From: fschildt Date: Mon, 21 Jul 2025 16:07:28 +0200 Subject: first commit --- src/basic/math.hpp | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 src/basic/math.hpp (limited to 'src/basic/math.hpp') diff --git a/src/basic/math.hpp b/src/basic/math.hpp new file mode 100644 index 0000000..0f21181 --- /dev/null +++ b/src/basic/math.hpp @@ -0,0 +1,59 @@ +#pragma once + +#include + +struct V2ST { + size_t x; + size_t y; + + V2ST() = default; + V2ST(size_t x, size_t y); + V2ST(int32_t x, int32_t y); + bool operator==(V2ST &b); + bool operator==(const V2ST& other) const { + return x == other.x && y == other.y; + } +}; + +struct V2F32 { + float x; + float y; + + V2F32() = default; + V2F32(float x, float y); + V2F32 operator/(float scalar); + V2F32 operator*(float scalar); + V2F32 operator+(V2F32 other); +}; + +struct V3F32 { + float x; + float y; + float z; + + V3F32() = default; + V3F32(float x, float y, float z); + V3F32 operator/(float scalar); + V3F32 operator*(float scalar); +}; + +struct V4F32 { + float x; + float y; + float z; + float w; + + V4F32() = default; + V4F32 (float x, float y, float z, float w); + V4F32 operator/(float scalar); + V4F32 operator*(float scalar); +}; + +struct V2I32 { + int32_t x; + int32_t y; + + V2I32() = default; + V2I32 (int32_t x, int32_t y); + bool operator==(V2I32 other); +}; -- cgit v1.2.3