Remove primitive support types constructor

This commit is contained in:
2023-10-03 09:52:04 +02:00
parent f852c564cd
commit af5855804f
7 changed files with 20 additions and 18 deletions

View File

@@ -15,7 +15,7 @@ namespace JabyEngine {
static constexpr auto SingleLine = !PolyLine;
static constexpr LineCode create() {
return LineCode(CmdValue);
return CodeBase<LineCode>::create(CmdValue);
}
};

View File

@@ -15,7 +15,7 @@ namespace JabyEngine {
static constexpr auto TriVertics = !QuadVertics;
static constexpr PolyCode create() {
return PolyCode(CmdValue);
return CodeBase<PolyCode>::create(CmdValue);
}
};

View File

@@ -23,7 +23,7 @@ namespace JabyEngine {
static constexpr auto Size = BitRange::from_to(27 - BitCorrection, 28 - BitCorrection);
static constexpr RectCode create() {
return RectCode(CmdValue);
return CodeBase<RectCode>::create(CmdValue);
}
};

View File

@@ -23,10 +23,12 @@ namespace JabyEngine {
static constexpr auto NoBlendTexture = Bit(24 - BitCorrection);
static constexpr auto BlendTexture = !NoBlendTexture;
constexpr CodeBase() = default;
constexpr CodeBase(uint8_t value) : value(bit::value::set_normalized(0u, CmdID.with(value))) {
static constexpr T create(uint8_t value) {
return T{bit::value::set_normalized<uint8_t>(0u, CmdID.with(value))};
}
constexpr CodeBase(const T& code) : value(code.value) {
static constexpr T create(const T& code) {
return CodeBase::create(code.value);
}
constexpr T& set(Bit bit) {
@@ -67,10 +69,10 @@ namespace JabyEngine {
}
struct PageClut {
uint16_t value = 0;
uint16_t value;
constexpr PageClut() = default;
constexpr PageClut(uint16_t x, uint16_t y) : value((y << 6) | ((x >> 4) & 0x3f)) {
static constexpr PageClut create(uint16_t x, uint16_t y) {
return PageClut{static_cast<uint16_t>((y << 6) | ((x >> 4) & 0x3f))};
}
};
@@ -80,10 +82,10 @@ namespace JabyEngine {
static constexpr auto SemiTransparency = BitRange::from_to(5, 6);
static constexpr auto TextureClut = BitRange::from_to(7, 8);
uint16_t value = 0;
uint16_t value;
constexpr TPage() = default;
constexpr TPage(uint16_t x, uint16_t y, ::JabyEngine::GPU::SemiTransparency transparency, TexturePageColor clut_color) : value(TexturePageX.as_value(x >> 6) | TexturePageY.as_value(y >> 8) | SemiTransparency.as_value(static_cast<uint16_t>(transparency)) | TextureClut.as_value(static_cast<uint16_t>(clut_color))) {
static constexpr TPage create(uint16_t x, uint16_t y, ::JabyEngine::GPU::SemiTransparency transparency, TexturePageColor clut_color) {
return TPage{static_cast<uint16_t>(TexturePageX.as_value(x >> 6) | TexturePageY.as_value(y >> 8) | SemiTransparency.as_value(static_cast<uint16_t>(transparency)) | TextureClut.as_value(static_cast<uint16_t>(clut_color)))};
}
};
}