2022-02-21 09:04:16 +00:00
|
|
|
#pragma once
|
|
|
|
|
2022-07-29 20:16:55 +00:00
|
|
|
#include <dolphin/gx.h>
|
2022-05-10 08:20:09 +00:00
|
|
|
|
2022-03-12 15:47:20 +00:00
|
|
|
#include <bitset>
|
|
|
|
|
|
|
|
#include <zeus/CColor.hpp>
|
2022-07-29 20:16:55 +00:00
|
|
|
#include <zeus/CVector3f.hpp>
|
2022-02-21 09:04:16 +00:00
|
|
|
|
|
|
|
namespace GX {
|
2022-06-13 07:55:50 +00:00
|
|
|
constexpr u8 MaxLights = 8;
|
2022-03-12 15:47:20 +00:00
|
|
|
using LightMask = std::bitset<MaxLights>;
|
2022-02-21 09:04:16 +00:00
|
|
|
} // namespace GX
|
2022-03-12 15:47:20 +00:00
|
|
|
|
2022-07-29 20:16:55 +00:00
|
|
|
constexpr GXColor GX_BLACK{0, 0, 0, 255};
|
|
|
|
constexpr GXColor GX_WHITE{255, 255, 255, 255};
|
|
|
|
constexpr GXColor GX_CLEAR{0, 0, 0, 0};
|
2022-05-13 23:40:19 +00:00
|
|
|
|
2022-07-29 20:16:55 +00:00
|
|
|
inline bool operator==(const GXColor& lhs, const GXColor& rhs) noexcept {
|
|
|
|
return lhs.r == rhs.r && lhs.g == rhs.g && lhs.b == rhs.b && lhs.a == rhs.a;
|
2022-05-13 23:40:19 +00:00
|
|
|
}
|
2022-05-10 08:20:09 +00:00
|
|
|
|
2022-07-29 20:16:55 +00:00
|
|
|
static inline void GXPosition3f32(const zeus::CVector3f& v) { GXPosition3f32(v.x(), v.y(), v.z()); }
|
|
|
|
static inline void GXNormal3f32(const zeus::CVector3f& v) { GXNormal3f32(v.x(), v.y(), v.z()); }
|
|
|
|
static inline void GXTexCoord2f32(const zeus::CVector2f& v) { GXTexCoord2f32(v.x(), v.y()); }
|
|
|
|
static inline void GXColor4f32(const zeus::CColor& v) { GXColor4f32(v.r(), v.g(), v.b(), v.a()); }
|
2022-05-13 23:40:19 +00:00
|
|
|
|
2022-07-29 20:16:55 +00:00
|
|
|
static inline GXColor to_gx_color(const zeus::CColor& color) {
|
|
|
|
return {
|
|
|
|
static_cast<u8>(color.r() * 255.f),
|
|
|
|
static_cast<u8>(color.g() * 255.f),
|
|
|
|
static_cast<u8>(color.b() * 255.f),
|
|
|
|
static_cast<u8>(color.a() * 255.f),
|
|
|
|
};
|
2022-05-10 08:20:09 +00:00
|
|
|
}
|
2022-07-29 20:16:55 +00:00
|
|
|
static inline zeus::CColor from_gx_color(GXColor color) {
|
|
|
|
return {
|
|
|
|
static_cast<float>(color.r) / 255.f,
|
|
|
|
static_cast<float>(color.g) / 255.f,
|
|
|
|
static_cast<float>(color.b) / 255.f,
|
|
|
|
static_cast<float>(color.a) / 255.f,
|
|
|
|
};
|
2022-05-10 08:20:09 +00:00
|
|
|
}
|