#pragma once namespace td { template struct Vec2 { union { T x; T r; }; union { T y; T g; }; constexpr Vec2(T X = 0, T Y = 0) : x(X), y(Y) {} }; template inline bool operator==(const Vec2& vec2, const Vec2& other) { return vec2.x == other.x && vec2.y == other.y; } template struct Vec3 { union { T x; T r; }; union { T y; T g; }; union { T z; T b; }; constexpr Vec3(T X = 0, T Y = 0, T Z = 0) : x(X), y(Y), z(Z) {} }; template inline bool operator==(const Vec3& vec3, const Vec3& other) { return vec3.x == other.x && vec3.y == other.y && vec3.z == other.z; } template struct Vec4 { union { T x; T r; }; union { T y; T g; }; union { T z; T b; }; union { T w; T a; }; constexpr Vec4(Vec3 vec, T W = 1) : x(vec.x), y(vec.y), z(vec.z), w(W) {} constexpr Vec4(T X = 0, T Y = 0, T Z = 0, T W = 0) : x(X), y(Y), z(Z), w(W) {} }; template inline bool operator==(const Vec4& vec4, const Vec4& other) { return vec4.x == other.x && vec4.y == other.y && vec4.z == other.z && vec4.w = other.w; } using Vec2i = Vec2; using Vec2u = Vec2; using Vec2f = Vec2; using Vec2d = Vec2; using Vec3i = Vec3; using Vec3u = Vec3; using Vec3f = Vec3; using Vec3d = Vec3; using Vec4i = Vec4; using Vec4u = Vec4; using Vec4f = Vec4; using Vec4d = Vec4; using Color = Vec3; } // namespace td