Improve naming
This commit is contained in:
parent
21649c4fe8
commit
30057d9687
|
@ -1,4 +1,5 @@
|
|||
#include <PSX/GPU/gpu.hpp>
|
||||
#include <PSX/GPU/gpu_primitives.hpp>
|
||||
#include <FontWriter/font_writer.hpp>
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -17,19 +18,19 @@ namespace JabyEngine {
|
|||
}
|
||||
|
||||
void setup(const FontBufferInfo& buffer_info, const SimpleTIM& vram_dst, const GPU::SizeI16& font_size) {
|
||||
this->tex_page = GPU::TexPage::create(vram_dst.get_texture_position(), GPU::TexturePageColor::$4bit).linked();
|
||||
this->tex_page = Make::TexPage(vram_dst.get_texture_position(), GPU::TexturePageColor::$4bit).linked();
|
||||
this->prim_buffer = buffer_info;
|
||||
|
||||
this->planschi = GPU::SPRT_16::create(
|
||||
GPU::PositionI16::create(0, 0),
|
||||
GPU::PagePositionClut::create(GPU::PagePosition::create(0, 0), GPU::PageClut::create(vram_dst.get_clut_position()))
|
||||
this->planschi = Make::SPRT_16(
|
||||
Make::PositionI16(0, 0),
|
||||
Make::OffsetPageWithClut(Make::PageOffset(0, 0), Make::PageClut(vram_dst.get_clut_position()))
|
||||
).linked();
|
||||
|
||||
for(size_t buffer_id = 0; buffer_id < 2; buffer_id++) {
|
||||
for(size_t buffer_element_id = 0; buffer_element_id < buffer_info.single_buffer_length; buffer_element_id++) {
|
||||
this->prim_buffer.double_buffer[buffer_id][buffer_element_id] = GPU::SPRT::create(
|
||||
GPU::AreaI16::create(GPU::PositionI16::create(0, 0), font_size),
|
||||
GPU::PagePositionClut::create(GPU::PagePosition::create(0, 0), GPU::PageClut::create(vram_dst.get_clut_position()))
|
||||
this->prim_buffer.double_buffer[buffer_id][buffer_element_id] = Make::SPRT(
|
||||
Make::AreaI16(Make::PositionI16(0, 0), font_size),
|
||||
Make::OffsetPageWithClut(Make::PageOffset(0, 0), Make::PageClut(vram_dst.get_clut_position()))
|
||||
).linked();
|
||||
|
||||
this->prim_buffer.double_buffer[buffer_id][buffer_element_id]->set_identitiy();
|
||||
|
@ -42,7 +43,7 @@ namespace JabyEngine {
|
|||
|
||||
void FontWriter :: setup(const FontBufferInfo& buffer_info, const SimpleTIM& vram_dst, const FontInfo& font_info) {
|
||||
printf("Hello Planschi c: @0x%p @0x%p\n", buffer_info.double_buffer[0], buffer_info.double_buffer[1]);
|
||||
double_buffer.setup(buffer_info, vram_dst, GPU::SizeI16::create(font_info.FontSize.width, font_info.FontSize.height));
|
||||
double_buffer.setup(buffer_info, vram_dst, Make::SizeI16(font_info.FontSize.width, font_info.FontSize.height));
|
||||
|
||||
//TMP
|
||||
double_buffer.prim_buffer.double_buffer[0][0].terminate();
|
||||
|
|
|
@ -82,8 +82,8 @@ namespace FontWriter {
|
|||
}
|
||||
|
||||
const uint8_t char_id = cur_char - '!';
|
||||
(*Pool::text_ptr)->page = GPU::PagePosition::create(((char_id & 0xF) << 4), ((char_id >> 4) << 4));
|
||||
(*Pool::text_ptr)->color = font_color;
|
||||
(*Pool::text_ptr)->tex_offset = GPU::PageOffset::create(((char_id & 0xF) << 4), ((char_id >> 4) << 4));
|
||||
(*Pool::text_ptr)->color = font_color;
|
||||
|
||||
Pool::last_link = &Pool::last_link->concat(*Pool::text_ptr);
|
||||
Pool::text_ptr++;
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace object {
|
|||
GPU::TexturePageColor::$4bit).linked()),
|
||||
sprite(GPU::SPRT::create(
|
||||
GPU::AreaI16::create(GPU::PositionI16::create(0, 100), GPU::SizeI16::create(120, 128)),
|
||||
GPU::PagePositionClut(GPU::PagePosition::create(0, 0), GPU::PageClut::create(TIM.get_clut_x(), TIM.get_clut_y())),
|
||||
GPU::OffsetPageWithClut(GPU::PageOffset::create(0, 0), GPU::PageClut::create(TIM.get_clut_x(), TIM.get_clut_y())),
|
||||
GPU::Color24::Blue()).linked()),
|
||||
timer(),
|
||||
color_idx(0) {}
|
||||
|
|
|
@ -38,9 +38,9 @@ static constexpr const auto triangle2 = Make::POLY_FT3({
|
|||
Make::Vertex(TriangleArea.size.width, TriangleArea.size.height)
|
||||
},{
|
||||
// Texture
|
||||
Make::PagePosition(TriangleArea.position.x, TriangleArea.position.y),
|
||||
Make::PagePosition(TriangleArea.size.width, TriangleArea.position.y),
|
||||
Make::PagePosition(TriangleArea.size.width, TriangleArea.size.height)
|
||||
Make::PageOffset(TriangleArea.position.x, TriangleArea.position.y),
|
||||
Make::PageOffset(TriangleArea.size.width, TriangleArea.position.y),
|
||||
Make::PageOffset(TriangleArea.size.width, TriangleArea.size.height)
|
||||
}, TriangleTPage, TriangleClut, GPU::Color24::Grey()
|
||||
);
|
||||
static constexpr const auto triangle3 = Make::POLY_G3({
|
||||
|
@ -49,16 +49,16 @@ static constexpr const auto triangle3 = Make::POLY_G3({
|
|||
{triangle1.vertex2.move(TriangleArea.size.width, 0), GPU::Color24::Blue()}}
|
||||
);
|
||||
static constexpr const auto triangle4 = Make::POLY_GT3({
|
||||
{triangle2.vertex0.move(TriangleArea.size.width, 0), triangle2.page0, GPU::Color24::Red()},
|
||||
{triangle2.vertex1.move(TriangleArea.size.width, 0), triangle2.page1, GPU::Color24::Blue()},
|
||||
{triangle2.vertex2.move(TriangleArea.size.width, 0), triangle2.page2, GPU::Color24::Green()}},
|
||||
{triangle2.vertex0.move(TriangleArea.size.width, 0), triangle2.tex_offset0, GPU::Color24::Red()},
|
||||
{triangle2.vertex1.move(TriangleArea.size.width, 0), triangle2.tex_offset1, GPU::Color24::Blue()},
|
||||
{triangle2.vertex2.move(TriangleArea.size.width, 0), triangle2.tex_offset2, GPU::Color24::Green()}},
|
||||
TriangleTPage,
|
||||
TriangleClut
|
||||
);
|
||||
|
||||
static constexpr const auto rectangle1 = Make::POLY_F4(RectangleArea, RectangleColor);
|
||||
static constexpr const auto rectangle2 = Make::POLY_FT4(Make::AreaI16(
|
||||
RectangleArea.position.move(RectangleArea.size.width, 0), RectangleArea.size), Make::PagePosition(0, 0),
|
||||
RectangleArea.position.move(RectangleArea.size.width, 0), RectangleArea.size), Make::PageOffset(0, 0),
|
||||
RectangleTPage,
|
||||
RectangleClut,
|
||||
GPU::Color24::Grey()
|
||||
|
@ -70,7 +70,7 @@ static constexpr const auto rectangle3 = Make::POLY_G4(
|
|||
GPU::Color24::Green(),
|
||||
GPU::Color24::White()});
|
||||
static constexpr const auto rectangle4 = Make::POLY_GT4(Make::AreaI16(
|
||||
RectangleArea.position.move(RectangleArea.size.width*3, 0), RectangleArea.size), Make::PagePosition(0, 0),
|
||||
RectangleArea.position.move(RectangleArea.size.width*3, 0), RectangleArea.size), Make::PageOffset(0, 0),
|
||||
RectangleTPage,
|
||||
RectangleClut, {
|
||||
GPU::Color24::Red(),
|
||||
|
@ -79,7 +79,7 @@ static constexpr const auto rectangle4 = Make::POLY_GT4(Make::AreaI16(
|
|||
GPU::Color24::White()}
|
||||
);
|
||||
static constexpr const auto rectangle5 = Make::POLY_GT4(Make::AreaI16(
|
||||
RectangleArea.position.move(0, RectangleArea.size.height), RectangleArea.size), Make::PagePosition(0, 0),
|
||||
RectangleArea.position.move(0, RectangleArea.size.height), RectangleArea.size), Make::PageOffset(0, 0),
|
||||
RectangleTPage,
|
||||
RectangleClut, {
|
||||
GPU::Color24::Red(),
|
||||
|
@ -115,13 +115,13 @@ static constexpr const auto rect3 = Make::TILE_8(Make::PositionI16(GPU::Display:
|
|||
static constexpr const auto rect4 = Make::TILE_1(Make::PositionI16(GPU::Display::Width - 1, GPU::Display::Height - 1), GPU::Color24::Red());
|
||||
|
||||
static constexpr const auto texpage = Make::TexPage(Make::PositionU16(320, 0), GPU::TexturePageColor::$4bit);
|
||||
static constexpr const auto rect5 = Make::SPRT(Make::AreaI16(Make::PositionI16(0, GPU::Display::Height - 32), Make::SizeI16(32, 32)), {Make::PagePosition(0, 0), TriangleClut}, GPU::Color24::Green());
|
||||
static constexpr const auto rect6 = Make::SPRT_16(Make::Vertex(0, GPU::Display::Height - 16), Make::PagePositionClut(Make::PagePosition(0, 0), TriangleClut), GPU::Color24::Blue());
|
||||
static constexpr const auto rect7 = Make::SPRT_8(Make::Vertex(0, GPU::Display::Height - 8), Make::PagePositionClut(Make::PagePosition(0, 0), TriangleClut), GPU::Color24::Yellow());
|
||||
static constexpr const auto rect8 = Make::SPRT_1(Make::Vertex(0, GPU::Display::Height - 1), Make::PagePositionClut(Make::PagePosition(0, 0), TriangleClut), GPU::Color24::Red());
|
||||
static constexpr const auto rect5 = Make::SPRT(Make::AreaI16(Make::PositionI16(0, GPU::Display::Height - 32), Make::SizeI16(32, 32)), {Make::PageOffset(0, 0), TriangleClut}, GPU::Color24::Green());
|
||||
static constexpr const auto rect6 = Make::SPRT_16(Make::Vertex(0, GPU::Display::Height - 16), Make::OffsetPageWithClut(Make::PageOffset(0, 0), TriangleClut), GPU::Color24::Blue());
|
||||
static constexpr const auto rect7 = Make::SPRT_8(Make::Vertex(0, GPU::Display::Height - 8), Make::OffsetPageWithClut(Make::PageOffset(0, 0), TriangleClut), GPU::Color24::Yellow());
|
||||
static constexpr const auto rect8 = Make::SPRT_1(Make::Vertex(0, GPU::Display::Height - 1), Make::OffsetPageWithClut(Make::PageOffset(0, 0), TriangleClut), GPU::Color24::Red());
|
||||
|
||||
static auto rect9 = Make::SPRT(Make::AreaI16(Make::PositionI16(GPU::Display::Width/2, GPU::Display::Height/2), Make::SizeI16(32, 32)).centered(), Make::PagePositionClut(Make::PagePosition(0, 0), TriangleClut), GPU::Color24::Grey()).linked();
|
||||
static auto rect10 = Make::SPRT(Make::AreaI16(Make::PositionI16(GPU::Display::Width/2, GPU::Display::Height/2 - 32), Make::SizeI16(32, 32)).centered(), Make::PagePositionClut(Make::PagePosition(0, 0), TriangleClut), GPU::Color24::Grey()).linked();
|
||||
static auto rect9 = Make::SPRT(Make::AreaI16(Make::PositionI16(GPU::Display::Width/2, GPU::Display::Height/2), Make::SizeI16(32, 32)).centered(), Make::OffsetPageWithClut(Make::PageOffset(0, 0), TriangleClut), GPU::Color24::Grey()).linked();
|
||||
static auto rect10 = Make::SPRT(Make::AreaI16(Make::PositionI16(GPU::Display::Width/2, GPU::Display::Height/2 - 32), Make::SizeI16(32, 32)).centered(), Make::OffsetPageWithClut(Make::PageOffset(0, 0), TriangleClut), GPU::Color24::Grey()).linked();
|
||||
|
||||
static void load_assets() {
|
||||
static const CDFile Assets[] = {
|
||||
|
|
|
@ -60,37 +60,37 @@ namespace JabyEngine {
|
|||
|
||||
struct POLY_FT3 : public internal::RenderPrimitive<POLY_FT3>, public internal::PolyCodeInterface<POLY_FT3>, public internal::LinkedElementCreator<POLY_FT3> {
|
||||
struct VertexEx {
|
||||
Vertex position;
|
||||
PagePosition page;
|
||||
Vertex position;
|
||||
PageOffset tex_offset;
|
||||
};
|
||||
static constexpr auto IdentityCode = Code(POLY_F3::IdentityCode).set(Code::Textured);
|
||||
|
||||
Color24 color; // a
|
||||
Code code; // a
|
||||
Vertex vertex0; // b
|
||||
PagePosition page0; // c
|
||||
PageClut page_clut; // c
|
||||
Vertex vertex1; // d
|
||||
PagePosition page1; // e
|
||||
TPage tpage; // e
|
||||
Vertex vertex2; // f
|
||||
PagePosition page2; // g
|
||||
uint16_t padded2; // g
|
||||
Color24 color; // a
|
||||
Code code; // a
|
||||
Vertex vertex0; // b
|
||||
PageOffset tex_offset0; // c
|
||||
PageClut page_clut; // c
|
||||
Vertex vertex1; // d
|
||||
PageOffset tex_offset1; // e
|
||||
TPage tpage; // e
|
||||
Vertex vertex2; // f
|
||||
PageOffset tex_offset2; // g
|
||||
uint16_t padded2; // g
|
||||
|
||||
static constexpr POLY_FT3 create(const Vertex (&verticies)[3], const PagePosition (&page_pos)[3], TPage tpage, PageClut clut, Color24 color = Color24::Grey()) {
|
||||
return POLY_FT3::create(
|
||||
{{verticies[0], page_pos[0]},
|
||||
{verticies[1], page_pos[1]},
|
||||
{verticies[2], page_pos[2]}
|
||||
static constexpr POLY_FT3 create(const Vertex (&verticies)[3], const PageOffset (&tex_offsets)[3], TPage tpage, PageClut clut, Color24 color = Color24::Grey()) {
|
||||
return POLY_FT3::create({
|
||||
{verticies[0], tex_offsets[0]},
|
||||
{verticies[1], tex_offsets[1]},
|
||||
{verticies[2], tex_offsets[2]}
|
||||
}, tpage, clut, color);
|
||||
}
|
||||
|
||||
static constexpr POLY_FT3 create(const VertexEx (&vertices_ex)[3], TPage tpage, PageClut clut, Color24 color) {
|
||||
return POLY_FT3 {
|
||||
.color = color, .code = IdentityCode,
|
||||
.vertex0 = vertices_ex[0].position, .page0 = vertices_ex[0].page, .page_clut = clut,
|
||||
.vertex1 = vertices_ex[1].position, .page1 = vertices_ex[1].page, .tpage = tpage,
|
||||
.vertex2 = vertices_ex[2].position, .page2 = vertices_ex[2].page};
|
||||
.vertex0 = vertices_ex[0].position, .tex_offset0 = vertices_ex[0].tex_offset, .page_clut = clut,
|
||||
.vertex1 = vertices_ex[1].position, .tex_offset1 = vertices_ex[1].tex_offset, .tpage = tpage,
|
||||
.vertex2 = vertices_ex[2].position, .tex_offset2 = vertices_ex[2].tex_offset};
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -126,41 +126,41 @@ namespace JabyEngine {
|
|||
|
||||
struct POLY_GT3 : public internal::RenderPrimitive<POLY_GT3>, public internal::PolyCodeInterface<POLY_GT3>, public internal::LinkedElementCreator<POLY_GT3> {
|
||||
struct VertexEx {
|
||||
Vertex position;
|
||||
PagePosition page;
|
||||
Color24 color;
|
||||
Vertex position;
|
||||
PageOffset tex_offset;
|
||||
Color24 color;
|
||||
};
|
||||
static constexpr auto IdentityCode = Code(POLY_G3::IdentityCode).set(Code::Textured);
|
||||
|
||||
Color24 color0; // a
|
||||
Code code; // a
|
||||
Vertex vertex0; // b
|
||||
PagePosition page0; // c
|
||||
PageClut page_clut; // c
|
||||
Color24 color1; // d
|
||||
uint8_t pad1; // d
|
||||
Vertex vertex1; // e
|
||||
PagePosition page1; // f
|
||||
TPage tpage; // f
|
||||
Color24 color2; // g
|
||||
uint8_t pad2; // g
|
||||
Vertex vertex2; // h
|
||||
PagePosition page2; // i
|
||||
uint16_t pad3; // i
|
||||
Color24 color0; // a
|
||||
Code code; // a
|
||||
Vertex vertex0; // b
|
||||
PageOffset tex_offset0; // c
|
||||
PageClut page_clut; // c
|
||||
Color24 color1; // d
|
||||
uint8_t pad1; // d
|
||||
Vertex vertex1; // e
|
||||
PageOffset tex_offset1; // f
|
||||
TPage tpage; // f
|
||||
Color24 color2; // g
|
||||
uint8_t pad2; // g
|
||||
Vertex vertex2; // h
|
||||
PageOffset tex_offset2; // i
|
||||
uint16_t pad3; // i
|
||||
|
||||
static constexpr POLY_GT3 create(const Vertex (&verticies)[3], const PagePosition (&page_pos)[3], const Color24 (&color)[3], TPage tpage, PageClut clut) {
|
||||
static constexpr POLY_GT3 create(const Vertex (&verticies)[3], const PageOffset (&tex_offsets)[3], const Color24 (&color)[3], TPage tpage, PageClut clut) {
|
||||
return POLY_GT3::create({
|
||||
{verticies[0], page_pos[0], color[0]},
|
||||
{verticies[1], page_pos[1], color[1]},
|
||||
{verticies[2], page_pos[2], color[2]}
|
||||
{verticies[0], tex_offsets[0], color[0]},
|
||||
{verticies[1], tex_offsets[1], color[1]},
|
||||
{verticies[2], tex_offsets[2], color[2]}
|
||||
}, tpage, clut);
|
||||
}
|
||||
|
||||
static constexpr POLY_GT3 create(const VertexEx (&verticies_ex)[3], TPage tpage, PageClut clut) {
|
||||
return POLY_GT3 {
|
||||
.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, .pad1 = 0, .vertex1 = verticies_ex[1].position, .page1 = verticies_ex[1].page, .tpage = tpage,
|
||||
.color2 = verticies_ex[2].color, .pad2 = 0, .vertex2 = verticies_ex[2].position, .page2 = verticies_ex[2].page, .pad3 = 0
|
||||
.color0 = verticies_ex[0].color, .code = IdentityCode, .vertex0 = verticies_ex[0].position, .tex_offset0 = verticies_ex[0].tex_offset, .page_clut = clut,
|
||||
.color1 = verticies_ex[1].color, .pad1 = 0, .vertex1 = verticies_ex[1].position, .tex_offset1 = verticies_ex[1].tex_offset, .tpage = tpage,
|
||||
.color2 = verticies_ex[2].color, .pad2 = 0, .vertex2 = verticies_ex[2].position, .tex_offset2 = verticies_ex[2].tex_offset, .pad3 = 0
|
||||
};
|
||||
}
|
||||
};
|
||||
|
@ -204,46 +204,46 @@ namespace JabyEngine {
|
|||
typedef POLY_FT3::VertexEx VertexEx;
|
||||
static constexpr auto IdentityCode = Code(POLY_FT3::IdentityCode).set(Code::QuadVertics);
|
||||
|
||||
Color24 color; // a
|
||||
Code code; // a
|
||||
Vertex vertex0; // b
|
||||
PagePosition page0; // c
|
||||
PageClut page_clut; // c
|
||||
Vertex vertex1; // d
|
||||
PagePosition page1; // e
|
||||
TPage tpage; // e
|
||||
Vertex vertex2; // f
|
||||
PagePosition page2; // g
|
||||
uint16_t pad2; // g
|
||||
Vertex vertex3; // h
|
||||
PagePosition page3; // i
|
||||
uint16_t pad3; // i
|
||||
Color24 color; // a
|
||||
Code code; // a
|
||||
Vertex vertex0; // b
|
||||
PageOffset tex_offset0; // c
|
||||
PageClut page_clut; // c
|
||||
Vertex vertex1; // d
|
||||
PageOffset tex_offset1; // e
|
||||
TPage tpage; // e
|
||||
Vertex vertex2; // f
|
||||
PageOffset tex_offset2; // g
|
||||
uint16_t pad2; // g
|
||||
Vertex vertex3; // h
|
||||
PageOffset tex_offset3; // i
|
||||
uint16_t pad3; // i
|
||||
|
||||
static constexpr POLY_FT4 create(const Vertex (&verticies)[4], const PagePosition (&page_pos)[4], TPage tpage, PageClut clut, Color24 color) {
|
||||
static constexpr POLY_FT4 create(const Vertex (&verticies)[4], const PageOffset (&tex_offsets)[4], TPage tpage, PageClut clut, Color24 color) {
|
||||
return POLY_FT4::create({
|
||||
{verticies[0], page_pos[0]},
|
||||
{verticies[1], page_pos[1]},
|
||||
{verticies[2], page_pos[2]},
|
||||
{verticies[3], page_pos[3]}
|
||||
{verticies[0], tex_offsets[0]},
|
||||
{verticies[1], tex_offsets[1]},
|
||||
{verticies[2], tex_offsets[2]},
|
||||
{verticies[3], tex_offsets[3]}
|
||||
}, tpage, clut, color);
|
||||
}
|
||||
|
||||
static constexpr POLY_FT4 create(const VertexEx (&vertices_ex)[4], TPage tpage, PageClut clut, Color24 color = Color24::Grey()) {
|
||||
return POLY_FT4 {
|
||||
.color = color, .code = IdentityCode,
|
||||
.vertex0 = vertices_ex[0].position, .page0 = vertices_ex[0].page, .page_clut = clut,
|
||||
.vertex1 = vertices_ex[1].position, .page1 = vertices_ex[1].page, .tpage = tpage,
|
||||
.vertex2 = vertices_ex[2].position, .page2 = vertices_ex[2].page, .pad2 = 0,
|
||||
.vertex3 = vertices_ex[3].position, .page3 = vertices_ex[3].page, .pad3 = 0
|
||||
.vertex0 = vertices_ex[0].position, .tex_offset0 = vertices_ex[0].tex_offset, .page_clut = clut,
|
||||
.vertex1 = vertices_ex[1].position, .tex_offset1 = vertices_ex[1].tex_offset, .tpage = tpage,
|
||||
.vertex2 = vertices_ex[2].position, .tex_offset2 = vertices_ex[2].tex_offset, .pad2 = 0,
|
||||
.vertex3 = vertices_ex[3].position, .tex_offset3 = vertices_ex[3].tex_offset, .pad3 = 0
|
||||
};
|
||||
}
|
||||
|
||||
static constexpr POLY_FT4 create(const AreaI16& area, const PagePosition& texture_pos, TPage tpage, PageClut clut, Color24 color) {
|
||||
static constexpr POLY_FT4 create(const AreaI16& area, const PageOffset& tex_offset, TPage tpage, PageClut clut, Color24 color) {
|
||||
return POLY_FT4::create({
|
||||
{area.position, texture_pos},
|
||||
{area.position.move(area.size.width, 0), texture_pos.move(area.size.width, 0)},
|
||||
{area.position.move(0, area.size.height), texture_pos.move(0, area.size.height)},
|
||||
{area.position.move(area.size.width, area.size.height), texture_pos.move(area.size.width, area.size.height)}
|
||||
{area.position, tex_offset},
|
||||
{area.position.move(area.size.width, 0), tex_offset.move(area.size.width, 0)},
|
||||
{area.position.move(0, area.size.height), tex_offset.move(0, area.size.height)},
|
||||
{area.position.move(area.size.width, area.size.height), tex_offset.move(area.size.width, area.size.height)}
|
||||
}, tpage, clut, color);
|
||||
}
|
||||
};
|
||||
|
@ -296,51 +296,51 @@ namespace JabyEngine {
|
|||
typedef POLY_GT3::VertexEx VertexEx;
|
||||
static constexpr auto IdentityCode = Code(POLY_GT3::IdentityCode).set(Code::QuadVertics);
|
||||
|
||||
Color24 color0; // a
|
||||
Code code; // a
|
||||
Vertex vertex0; // b
|
||||
PagePosition page0; // c
|
||||
PageClut page_clut; // c
|
||||
Color24 color1; // d
|
||||
uint8_t pad1; // d
|
||||
Vertex vertex1; // e
|
||||
PagePosition page1; // f
|
||||
TPage tpage; // f
|
||||
Color24 color2; // g
|
||||
uint8_t pad2; // g
|
||||
Vertex vertex2; // h
|
||||
PagePosition page2; // i
|
||||
uint16_t pad3; // i
|
||||
Color24 color3; // j
|
||||
uint8_t pad4; // j
|
||||
Vertex vertex3; // k
|
||||
PagePosition page3; // l
|
||||
uint16_t pad5; // l
|
||||
Color24 color0; // a
|
||||
Code code; // a
|
||||
Vertex vertex0; // b
|
||||
PageOffset tex_offset0; // c
|
||||
PageClut page_clut; // c
|
||||
Color24 color1; // d
|
||||
uint8_t pad1; // d
|
||||
Vertex vertex1; // e
|
||||
PageOffset tex_offset1; // f
|
||||
TPage tpage; // f
|
||||
Color24 color2; // g
|
||||
uint8_t pad2; // g
|
||||
Vertex vertex2; // h
|
||||
PageOffset tex_offset2; // i
|
||||
uint16_t pad3; // i
|
||||
Color24 color3; // j
|
||||
uint8_t pad4; // j
|
||||
Vertex vertex3; // k
|
||||
PageOffset tex_offset3; // l
|
||||
uint16_t pad5; // l
|
||||
|
||||
static constexpr POLY_GT4 create(const Vertex (&verticies)[4], const PagePosition (&page_pos)[4], const Color24 (&color)[4], TPage tpage, PageClut clut) {
|
||||
static constexpr POLY_GT4 create(const Vertex (&verticies)[4], const PageOffset (&tex_offsets)[4], const Color24 (&color)[4], TPage tpage, PageClut clut) {
|
||||
return POLY_GT4::create({
|
||||
{verticies[0], page_pos[0], color[0]},
|
||||
{verticies[1], page_pos[1], color[1]},
|
||||
{verticies[2], page_pos[2], color[2]},
|
||||
{verticies[3], page_pos[3], color[3]},
|
||||
{verticies[0], tex_offsets[0], color[0]},
|
||||
{verticies[1], tex_offsets[1], color[1]},
|
||||
{verticies[2], tex_offsets[2], color[2]},
|
||||
{verticies[3], tex_offsets[3], color[3]},
|
||||
}, tpage, clut);
|
||||
}
|
||||
|
||||
static constexpr POLY_GT4 create(const VertexEx (&verticies_ex)[4], TPage tpage, PageClut clut) {
|
||||
return POLY_GT4 {
|
||||
.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, .pad1 = 0, .vertex1 = verticies_ex[1].position, .page1 = verticies_ex[1].page, .tpage = tpage,
|
||||
.color2 = verticies_ex[2].color, .pad2 = 0, .vertex2 = verticies_ex[2].position, .page2 = verticies_ex[2].page, .pad3 = 0,
|
||||
.color3 = verticies_ex[3].color, .pad4 = 0, .vertex3 = verticies_ex[3].position, .page3 = verticies_ex[3].page, .pad5 = 0
|
||||
.color0 = verticies_ex[0].color, .code = IdentityCode, .vertex0 = verticies_ex[0].position, .tex_offset0 = verticies_ex[0].tex_offset, .page_clut = clut,
|
||||
.color1 = verticies_ex[1].color, .pad1 = 0, .vertex1 = verticies_ex[1].position, .tex_offset1 = verticies_ex[1].tex_offset, .tpage = tpage,
|
||||
.color2 = verticies_ex[2].color, .pad2 = 0, .vertex2 = verticies_ex[2].position, .tex_offset2 = verticies_ex[2].tex_offset, .pad3 = 0,
|
||||
.color3 = verticies_ex[3].color, .pad4 = 0, .vertex3 = verticies_ex[3].position, .tex_offset3 = verticies_ex[3].tex_offset, .pad5 = 0
|
||||
};
|
||||
}
|
||||
|
||||
static constexpr POLY_GT4 create(const AreaI16& area, const PagePosition& texture_pos, TPage tpage, PageClut clut, const Color24 (&color)[4]) {
|
||||
static constexpr POLY_GT4 create(const AreaI16& area, const PageOffset& tex_offset, TPage tpage, PageClut clut, const Color24 (&color)[4]) {
|
||||
return POLY_GT4::create({
|
||||
{area.position, texture_pos, color[0]},
|
||||
{area.position.move(area.size.width, 0), texture_pos.move(area.size.width, 0), color[1]},
|
||||
{area.position.move(0, area.size.height), texture_pos.move(0, area.size.height), color[2]},
|
||||
{area.position.move(area.size.width, area.size.height), texture_pos.move(area.size.width, area.size.height), color[3]}
|
||||
{area.position, tex_offset, color[0]},
|
||||
{area.position.move(area.size.width, 0), tex_offset.move(area.size.width, 0), color[1]},
|
||||
{area.position.move(0, area.size.height), tex_offset.move(0, area.size.height), color[2]},
|
||||
{area.position.move(area.size.width, area.size.height), tex_offset.move(area.size.width, area.size.height), color[3]}
|
||||
}, tpage, clut);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
|
||||
namespace JabyEngine {
|
||||
namespace GPU {
|
||||
struct PagePositionClut {
|
||||
PagePosition page;
|
||||
PageClut clut;
|
||||
struct OffsetPageWithClut {
|
||||
PageOffset tex_offset;
|
||||
PageClut clut;
|
||||
|
||||
static constexpr PagePositionClut create(PagePosition page, PageClut clut) {
|
||||
return PagePositionClut{page, clut};
|
||||
static constexpr OffsetPageWithClut create(PageOffset tex_offset, PageClut clut) {
|
||||
return OffsetPageWithClut{tex_offset, clut};
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -61,15 +61,15 @@ namespace JabyEngine {
|
|||
typedef RectCodeInterface<RECT_BASE_T<Size>>::Code Code;
|
||||
static constexpr auto IdentityCode = Code(RECT_BASE_F<Size>::IdentityCode).set(Code::Textured);
|
||||
|
||||
Color24 color;
|
||||
Code code;
|
||||
Vertex position;
|
||||
PagePosition page;
|
||||
PageClut clut;
|
||||
Color24 color;
|
||||
Code code;
|
||||
Vertex position;
|
||||
PageOffset tex_offset;
|
||||
PageClut clut;
|
||||
|
||||
static constexpr RECT_BASE_T create(const Vertex& position, const PagePositionClut& page, const Color24& color = Color24::Grey()) {
|
||||
static constexpr RECT_BASE_T create(const Vertex& position, const OffsetPageWithClut& tex_offset_w_clut, const Color24& color = Color24::Grey()) {
|
||||
return RECT_BASE_T {
|
||||
.color = color, .code = IdentityCode, .position = position, .page = page.page, .clut = page.clut
|
||||
.color = color, .code = IdentityCode, .position = position, .tex_offset = tex_offset_w_clut.tex_offset, .clut = tex_offset_w_clut.clut
|
||||
};
|
||||
}
|
||||
};
|
||||
|
@ -86,10 +86,10 @@ namespace JabyEngine {
|
|||
|
||||
template<typename RectCode::SizeType Size>
|
||||
struct RECT_T : public RECT_BASE_T<Size>, public internal::RenderPrimitive<RECT_T<Size>>, public internal::LinkedElementCreator<RECT_T<Size>> {
|
||||
static constexpr RECT_T create(const Vertex& position, const PagePositionClut& page, const Color24& color = Color24::Grey()) {
|
||||
static constexpr RECT_T create(const Vertex& position, const OffsetPageWithClut& tex_offset_w_clut, const Color24& color = Color24::Grey()) {
|
||||
RECT_T rect;
|
||||
|
||||
static_cast<RECT_BASE_T<Size>&>(rect) = RECT_BASE_T<Size>::create(position, page, color);
|
||||
static_cast<RECT_BASE_T<Size>&>(rect) = RECT_BASE_T<Size>::create(position, tex_offset_w_clut, color);
|
||||
return rect;
|
||||
}
|
||||
};
|
||||
|
@ -116,7 +116,7 @@ namespace JabyEngine {
|
|||
struct SPRT : public internal::RECT_BASE_T<internal::RectCode::SizeType::Variable>, public internal::RenderPrimitive<SPRT>, public internal::LinkedElementCreator<SPRT> {
|
||||
SizeI16 size;
|
||||
|
||||
static constexpr SPRT create(const AreaI16& area, const PagePositionClut& page, const Color24& color = Color24::Grey()) {
|
||||
static constexpr SPRT create(const AreaI16& area, const OffsetPageWithClut& page, const Color24& color = Color24::Grey()) {
|
||||
SPRT sprt;
|
||||
|
||||
static_cast<RECT_BASE_T&>(sprt) = RECT_BASE_T::create(area.position, page, color);
|
||||
|
|
|
@ -86,11 +86,11 @@ namespace JabyEngine {
|
|||
|
||||
// ###################################################################
|
||||
|
||||
static constexpr GPU::PagePosition PagePosition() {
|
||||
return creator_template<GPU::PagePosition>(0_u8, 0_u8);
|
||||
static constexpr GPU::PageOffset PageOffset() {
|
||||
return creator_template<GPU::PageOffset>(0_u8, 0_u8);
|
||||
}
|
||||
static constexpr GPU::PagePosition PagePosition(uint8_t u, uint8_t v) {
|
||||
return creator_template<GPU::PagePosition>(u, v);
|
||||
static constexpr GPU::PageOffset PageOffset(uint8_t u, uint8_t v) {
|
||||
return creator_template<GPU::PageOffset>(u, v);
|
||||
}
|
||||
|
||||
// ###################################################################
|
||||
|
@ -101,6 +101,9 @@ namespace JabyEngine {
|
|||
static constexpr GPU::PageClut PageClut(uint16_t x, uint16_t y) {
|
||||
return creator_template<GPU::PageClut>(x, y);
|
||||
}
|
||||
static constexpr GPU::PageClut PageClut(const GPU::PositionU16& clut_pos) {
|
||||
return creator_template<GPU::PageClut>(clut_pos);
|
||||
}
|
||||
|
||||
// ###################################################################
|
||||
|
||||
|
@ -122,11 +125,11 @@ namespace JabyEngine {
|
|||
|
||||
// ###################################################################
|
||||
|
||||
static constexpr GPU::PagePositionClut PagePositionClut() {
|
||||
return creator_template<GPU::PagePositionClut>(PagePosition(), PageClut());
|
||||
static constexpr GPU::OffsetPageWithClut OffsetPageWithClut() {
|
||||
return creator_template<GPU::OffsetPageWithClut>(PageOffset(), PageClut());
|
||||
}
|
||||
static constexpr GPU::PagePositionClut PagePositionClut(GPU::PagePosition page, GPU::PageClut clut) {
|
||||
return creator_template<GPU::PagePositionClut>(page, clut);
|
||||
static constexpr GPU::OffsetPageWithClut OffsetPageWithClut(GPU::PageOffset tex_offset, GPU::PageClut clut) {
|
||||
return creator_template<GPU::OffsetPageWithClut>(tex_offset, clut);
|
||||
}
|
||||
|
||||
// ###################################################################
|
||||
|
@ -175,8 +178,8 @@ namespace JabyEngine {
|
|||
return creator_template<GPU::POLY_F3>(verticies, color);
|
||||
}
|
||||
|
||||
static constexpr GPU::POLY_FT3 POLY_FT3(const GPU::Vertex (&verticies)[3], const GPU::PagePosition (&page_pos)[3], GPU::TPage tpage, GPU::PageClut clut, GPU::Color24 color = GPU::Color24::Grey()) {
|
||||
return creator_template<GPU::POLY_FT3>(verticies, page_pos, tpage, clut, color);
|
||||
static constexpr GPU::POLY_FT3 POLY_FT3(const GPU::Vertex (&verticies)[3], const GPU::PageOffset (&tex_offset)[3], GPU::TPage tpage, GPU::PageClut clut, GPU::Color24 color = GPU::Color24::Grey()) {
|
||||
return creator_template<GPU::POLY_FT3>(verticies, tex_offset, tpage, clut, color);
|
||||
}
|
||||
|
||||
static constexpr GPU::POLY_FT3 POLY_FT3(const GPU::POLY_FT3::VertexEx (&vertices_ex)[3], GPU::TPage tpage, GPU::PageClut clut, GPU::Color24 color) {
|
||||
|
@ -191,8 +194,8 @@ namespace JabyEngine {
|
|||
return creator_template<GPU::POLY_G3>(verticies_ex);
|
||||
}
|
||||
|
||||
static constexpr GPU::POLY_GT3 POLY_GT3(const GPU::Vertex (&verticies)[3], const GPU::PagePosition (&page_pos)[3], const GPU::Color24 (&color)[3], GPU::TPage tpage, GPU::PageClut clut) {
|
||||
return creator_template<GPU::POLY_GT3>(verticies, page_pos, color, tpage, clut);
|
||||
static constexpr GPU::POLY_GT3 POLY_GT3(const GPU::Vertex (&verticies)[3], const GPU::PageOffset (&tex_offset)[3], const GPU::Color24 (&color)[3], GPU::TPage tpage, GPU::PageClut clut) {
|
||||
return creator_template<GPU::POLY_GT3>(verticies, tex_offset, color, tpage, clut);
|
||||
}
|
||||
|
||||
static constexpr GPU::POLY_GT3 POLY_GT3(const GPU::POLY_GT3::VertexEx (&verticies_ex)[3], GPU::TPage tpage, GPU::PageClut clut) {
|
||||
|
@ -207,16 +210,16 @@ namespace JabyEngine {
|
|||
return creator_template<GPU::POLY_F4>(area, color);
|
||||
}
|
||||
|
||||
static constexpr GPU::POLY_FT4 POLY_FT4(const GPU::Vertex (&verticies)[4], const GPU::PagePosition (&page_pos)[4], GPU::TPage tpage, GPU::PageClut clut, GPU::Color24 color) {
|
||||
return creator_template<GPU::POLY_FT4>(verticies, page_pos, tpage, clut, color);
|
||||
static constexpr GPU::POLY_FT4 POLY_FT4(const GPU::Vertex (&verticies)[4], const GPU::PageOffset (&tex_offset)[4], GPU::TPage tpage, GPU::PageClut clut, GPU::Color24 color) {
|
||||
return creator_template<GPU::POLY_FT4>(verticies, tex_offset, tpage, clut, color);
|
||||
}
|
||||
|
||||
static constexpr GPU::POLY_FT4 POLY_FT4(const GPU::POLY_FT4::VertexEx (&vertices_ex)[4], GPU::TPage tpage, GPU::PageClut clut, GPU::Color24 color = GPU::Color24::Grey()) {
|
||||
return creator_template<GPU::POLY_FT4>(vertices_ex, tpage, clut, color);
|
||||
}
|
||||
|
||||
static constexpr GPU::POLY_FT4 POLY_FT4(const GPU::AreaI16& area, const GPU::PagePosition& texture_pos, GPU::TPage tpage, GPU::PageClut clut, GPU::Color24 color) {
|
||||
return creator_template<GPU::POLY_FT4>(area, texture_pos, tpage, clut, color);
|
||||
static constexpr GPU::POLY_FT4 POLY_FT4(const GPU::AreaI16& area, const GPU::PageOffset& tex_offset, GPU::TPage tpage, GPU::PageClut clut, GPU::Color24 color) {
|
||||
return creator_template<GPU::POLY_FT4>(area, tex_offset, tpage, clut, color);
|
||||
}
|
||||
|
||||
static constexpr GPU::POLY_G4 POLY_G4(const GPU::Vertex (&verticies)[4], const GPU::Color24 (&color)[4]) {
|
||||
|
@ -231,16 +234,16 @@ namespace JabyEngine {
|
|||
return creator_template<GPU::POLY_G4>(area, color);
|
||||
}
|
||||
|
||||
static constexpr GPU::POLY_GT4 POLY_GT4(const GPU::Vertex (&verticies)[4], const GPU::PagePosition (&page_pos)[4], const GPU::Color24 (&color)[4], GPU::TPage tpage, GPU::PageClut clut) {
|
||||
return creator_template<GPU::POLY_GT4>(verticies, page_pos, color, tpage, clut);
|
||||
static constexpr GPU::POLY_GT4 POLY_GT4(const GPU::Vertex (&verticies)[4], const GPU::PageOffset (&tex_offset)[4], const GPU::Color24 (&color)[4], GPU::TPage tpage, GPU::PageClut clut) {
|
||||
return creator_template<GPU::POLY_GT4>(verticies, tex_offset, color, tpage, clut);
|
||||
}
|
||||
|
||||
static constexpr GPU::POLY_GT4 POLY_GT4(const GPU::POLY_GT4::VertexEx (&verticies_ex)[4], GPU::TPage tpage, GPU::PageClut clut) {
|
||||
return creator_template<GPU::POLY_GT4>(verticies_ex, tpage, clut);
|
||||
}
|
||||
|
||||
static constexpr GPU::POLY_GT4 POLY_GT4(const GPU::AreaI16& area, const GPU::PagePosition& texture_pos, GPU::TPage tpage, GPU::PageClut clut, const GPU::Color24 (&color)[4]) {
|
||||
return creator_template<GPU::POLY_GT4>(area, texture_pos, tpage, clut, color);
|
||||
static constexpr GPU::POLY_GT4 POLY_GT4(const GPU::AreaI16& area, const GPU::PageOffset& tex_offset, GPU::TPage tpage, GPU::PageClut clut, const GPU::Color24 (&color)[4]) {
|
||||
return creator_template<GPU::POLY_GT4>(area, tex_offset, tpage, clut, color);
|
||||
}
|
||||
|
||||
// ###################################################################
|
||||
|
@ -280,35 +283,35 @@ namespace JabyEngine {
|
|||
// ###################################################################
|
||||
|
||||
static constexpr GPU::SPRT_1 SPRT_1() {
|
||||
return creator_template<GPU::SPRT_1>(Vertex(), PagePositionClut(), GPU::Color24::Black());
|
||||
return creator_template<GPU::SPRT_1>(Vertex(), OffsetPageWithClut(), GPU::Color24::Black());
|
||||
}
|
||||
|
||||
static constexpr GPU::SPRT_1 SPRT_1(const GPU::Vertex& position, const GPU::PagePositionClut& page, const GPU::Color24& color = GPU::Color24::Grey()) {
|
||||
return creator_template<GPU::SPRT_1>(position, page, color);
|
||||
static constexpr GPU::SPRT_1 SPRT_1(const GPU::Vertex& position, const GPU::OffsetPageWithClut& tex_offset_w_clut, const GPU::Color24& color = GPU::Color24::Grey()) {
|
||||
return creator_template<GPU::SPRT_1>(position, tex_offset_w_clut, color);
|
||||
}
|
||||
|
||||
static constexpr GPU::SPRT_8 SPRT_8() {
|
||||
return creator_template<GPU::SPRT_8>(Vertex(), PagePositionClut(), GPU::Color24::Black());
|
||||
return creator_template<GPU::SPRT_8>(Vertex(), OffsetPageWithClut(), GPU::Color24::Black());
|
||||
}
|
||||
|
||||
static constexpr GPU::SPRT_8 SPRT_8(const GPU::Vertex& position, const GPU::PagePositionClut& page, const GPU::Color24& color = GPU::Color24::Grey()) {
|
||||
return creator_template<GPU::SPRT_8>(position, page, color);
|
||||
static constexpr GPU::SPRT_8 SPRT_8(const GPU::Vertex& position, const GPU::OffsetPageWithClut& tex_offset_w_clut, const GPU::Color24& color = GPU::Color24::Grey()) {
|
||||
return creator_template<GPU::SPRT_8>(position, tex_offset_w_clut, color);
|
||||
}
|
||||
|
||||
static constexpr GPU::SPRT_16 SPRT_16() {
|
||||
return creator_template<GPU::SPRT_16>(Vertex(), PagePositionClut(), GPU::Color24::Black());
|
||||
return creator_template<GPU::SPRT_16>(Vertex(), OffsetPageWithClut(), GPU::Color24::Black());
|
||||
}
|
||||
|
||||
static constexpr GPU::SPRT_16 SPRT_16(const GPU::Vertex& position, const GPU::PagePositionClut& page, const GPU::Color24& color = GPU::Color24::Grey()) {
|
||||
return creator_template<GPU::SPRT_16>(position, page, color);
|
||||
static constexpr GPU::SPRT_16 SPRT_16(const GPU::Vertex& position, const GPU::OffsetPageWithClut& tex_offset_w_clut, const GPU::Color24& color = GPU::Color24::Grey()) {
|
||||
return creator_template<GPU::SPRT_16>(position, tex_offset_w_clut, color);
|
||||
}
|
||||
|
||||
static constexpr GPU::SPRT SPRT() {
|
||||
return creator_template<GPU::SPRT>(AreaI16(), PagePositionClut(), GPU::Color24::Black());
|
||||
return creator_template<GPU::SPRT>(AreaI16(), OffsetPageWithClut(), GPU::Color24::Black());
|
||||
}
|
||||
|
||||
static constexpr GPU::SPRT SPRT(const GPU::AreaI16& area, const GPU::PagePositionClut& page, const GPU::Color24& color = GPU::Color24::Grey()) {
|
||||
return creator_template<GPU::SPRT>(area, page, color);
|
||||
static constexpr GPU::SPRT SPRT(const GPU::AreaI16& area, const GPU::OffsetPageWithClut& tex_offset_w_clut, const GPU::Color24& color = GPU::Color24::Grey()) {
|
||||
return creator_template<GPU::SPRT>(area, tex_offset_w_clut, color);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -175,7 +175,7 @@ namespace JabyEngine {
|
|||
};
|
||||
|
||||
// Type used for primitives
|
||||
struct PagePosition : public internal::XYMovement<PagePosition, uint8_t> {
|
||||
struct PageOffset : public internal::XYMovement<PageOffset, uint8_t> {
|
||||
union {
|
||||
uint8_t x;
|
||||
uint8_t u;
|
||||
|
@ -186,8 +186,8 @@ namespace JabyEngine {
|
|||
uint8_t v;
|
||||
};
|
||||
|
||||
static constexpr PagePosition create(uint8_t u, uint8_t v) {
|
||||
return PagePosition{.x = u, .y = v}; //< Activate x and y to use XYMovement during constexpr
|
||||
static constexpr PageOffset create(uint8_t u, uint8_t v) {
|
||||
return PageOffset{.x = u, .y = v}; //< Activate x and y to use XYMovement during constexpr
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue