Support more primitives
This commit is contained in:
parent
04c6f7fb77
commit
530a7cff72
|
@ -50,6 +50,12 @@ void main() {
|
|||
{{0 + FirstOffsetX, 0}, {0xFF, 0x0, 0x0}},
|
||||
{{64 + FirstOffsetX, 64}, {0x0, 0xFF, 0x0}},
|
||||
{{0 + FirstOffsetX, 64}, {0x0, 0x0, 0xFF}}});
|
||||
const JabyEngine::GPU::POLY_GT3 triangle4({
|
||||
{{0 + FirstOffsetX, 0}, {0, 0}, {0xFF, 0x0, 0x0}},
|
||||
{{64 + FirstOffsetX, 64}, {64, 64}, {0x0, 0x0, 0xFF}},
|
||||
{{64 + FirstOffsetX, 0}, {64, 0}, {0x0, 0xFF, 0x0}}},
|
||||
JabyEngine::GPU::TPage(320, 0, JabyEngine::GPU::SemiTransparency::B_Half_add_F_Half, JabyEngine::GPU::TexturePageColor::$4bit),
|
||||
JabyEngine::GPU::PageClut(320, 256));
|
||||
|
||||
load_assets();
|
||||
|
||||
|
@ -57,6 +63,7 @@ void main() {
|
|||
JabyEngine::GPU::render(triangle);
|
||||
JabyEngine::GPU::render(triangle2);
|
||||
JabyEngine::GPU::render(triangle3);
|
||||
JabyEngine::GPU::render(triangle4);
|
||||
|
||||
JabyEngine::GPU::swap_buffers_vsync(2);
|
||||
}
|
||||
|
|
|
@ -181,12 +181,50 @@ namespace JabyEngine {
|
|||
color2(verticies_ex[2].color), vertex2(verticies_ex[2].position) {}
|
||||
};
|
||||
|
||||
struct POLY_GT3 : public internal::IsPrimitive, public internal::CodeInterface<POLY_GT3> {
|
||||
struct VertexEx {
|
||||
Vertex position;
|
||||
PagePosition page;
|
||||
Color24 color;
|
||||
};
|
||||
static constexpr auto IdentityCode = Code(POLY_G3::IdentityCode).set(Code::Textured);
|
||||
|
||||
Color24 color0; // a
|
||||
Code code = IdentityCode; // a
|
||||
Vertex vertex0; // b
|
||||
PagePosition page0; // c
|
||||
PageClut page_clut; // c
|
||||
Color24 color1; // d
|
||||
uint8_t padded1; // d
|
||||
Vertex vertex1; // e
|
||||
PagePosition page1; // f
|
||||
TPage tpage; // f
|
||||
Color24 color2; // g
|
||||
uint8_t padded2; // g
|
||||
Vertex vertex2; // h
|
||||
PagePosition page2; // i
|
||||
uint16_t padded3; // i
|
||||
|
||||
constexpr POLY_GT3() = default;
|
||||
constexpr POLY_GT3(const Vertex (&verticies)[3], const PagePosition (&page_pos)[3], const Color24 (&color)[3], TPage tpage, PageClut clut) :
|
||||
color0(color[0]), code(IdentityCode), vertex0(verticies[0]), page0(page_pos[0]), page_clut(clut),
|
||||
color1(color[1]), vertex1(verticies[1]), page1(page_pos[1]), tpage(tpage),
|
||||
color2(color[2]), vertex2(verticies[2]), page2(page_pos[2]) {}
|
||||
constexpr POLY_GT3(const VertexEx (&verticies_ex)[3], TPage tpage, PageClut clut) :
|
||||
color0(verticies_ex[0].color), code(IdentityCode), vertex0(verticies_ex[0].position), page0(verticies_ex[0].page), page_clut(clut),
|
||||
color1(verticies_ex[1].color), vertex1(verticies_ex[1].position), page1(verticies_ex[1].page), tpage(tpage),
|
||||
color2(verticies_ex[2].color), vertex2(verticies_ex[2].position), page2(verticies_ex[2].page) {}
|
||||
};
|
||||
|
||||
typedef POLY_F3 FlatTriangle;
|
||||
typedef POLY_FT3 FlatTexturedTriangle;
|
||||
typedef POLY_G3 GouraudTriangle;
|
||||
typedef POLY_GT3 GouraudTexturedTriangle;
|
||||
|
||||
static_assert(sizeof(POLY_F3) == 16);
|
||||
static_assert(sizeof(POLY_FT3) == 28);
|
||||
static_assert(sizeof(POLY_G3) == 24);
|
||||
static_assert(sizeof(POLY_GT3) == 36);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue