moved Color to Defines.h

This commit is contained in:
2023-01-02 12:21:27 +01:00
parent 386ea5b6ad
commit 7d30017742
6 changed files with 27 additions and 20 deletions

View File

@@ -14,11 +14,15 @@ struct Vec2 {
T g;
};
Vec2(T X = 0, T Y = 0) : x(X), y(Y) {}
constexpr Vec2(T X = 0, T Y = 0) : x(X), y(Y) {}
friend bool operator==(const Vec2& vec2, const Vec2& other) { return vec2.x == other.x && vec2.y == other.y; }
};
template<typename T>
inline bool operator==(const Vec2<T>& vec2, const Vec2<T>& other) {
return vec2.x == other.x && vec2.y == other.y;
}
template<typename T>
struct Vec3 {
union {
@@ -36,9 +40,14 @@ struct Vec3 {
T b;
};
Vec3(T X = 0, T Y = 0, T Z = 0) : x(X), y(Y), z(Z) {}
constexpr Vec3(T X = 0, T Y = 0, T Z = 0) : x(X), y(Y), z(Z) {}
};
template<typename T>
inline bool operator==(const Vec3<T>& vec3, const Vec3<T>& other) {
return vec3.x == other.x && vec3.y == other.y && vec3.z == other.z;
}
using Vec2i = Vec2<int>;
using Vec2u = Vec2<unsigned int>;
using Vec2f = Vec2<float>;
@@ -48,5 +57,7 @@ using Vec3i = Vec3<int>;
using Vec3u = Vec3<unsigned int>;
using Vec3f = Vec3<float>;
using Vec3d = Vec3<double>;
using Color = Vec3<unsigned char>;
} // namespace td