Finish GTE test
This commit is contained in:
@@ -38,6 +38,22 @@ namespace JabyEngine {
|
||||
|
||||
template<typename T>
|
||||
struct Poly4Interface {
|
||||
static constexpr Vertex vertex0_from(const AreaI16& area) {
|
||||
return area.get_top_left();
|
||||
}
|
||||
|
||||
static constexpr Vertex vertex1_from(const AreaI16& area) {
|
||||
return area.get_top_right();
|
||||
}
|
||||
|
||||
static constexpr Vertex vertex2_from(const AreaI16& area) {
|
||||
return area.get_bottom_left();
|
||||
}
|
||||
|
||||
static constexpr Vertex vertex3_from(const AreaI16& area) {
|
||||
return area.get_bottom_right();
|
||||
}
|
||||
|
||||
constexpr T& set_rect_size(const SizeI16& size) {
|
||||
static_cast<T*>(this)->vertex1 = static_cast<const T*>(this)->vertex0.add(size.width, 0);
|
||||
static_cast<T*>(this)->vertex2 = static_cast<const T*>(this)->vertex0.add(0, size.height);
|
||||
@@ -228,10 +244,10 @@ namespace JabyEngine {
|
||||
|
||||
static constexpr POLY_F4 create(const AreaI16& area, Color24 color) {
|
||||
return POLY_F4::create({
|
||||
area.position,
|
||||
area.position.move(area.size.width, 0),
|
||||
area.position.move(0, area.size.height),
|
||||
area.position.move(area.size.width, area.size.height)
|
||||
POLY_F4::vertex0_from(area),
|
||||
POLY_F4::vertex1_from(area),
|
||||
POLY_F4::vertex2_from(area),
|
||||
POLY_F4::vertex3_from(area)
|
||||
}, color);
|
||||
}
|
||||
};
|
||||
@@ -276,10 +292,10 @@ namespace JabyEngine {
|
||||
|
||||
static constexpr POLY_FT4 create(const AreaI16& area, const PageOffset& tex_offset, TPage tpage, PageClut clut, Color24 color = Color24::Grey()) {
|
||||
return POLY_FT4::create({
|
||||
{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)}
|
||||
{POLY_FT4::vertex0_from(area), tex_offset},
|
||||
{POLY_FT4::vertex1_from(area), tex_offset.move(area.size.width, 0)},
|
||||
{POLY_FT4::vertex2_from(area), tex_offset.move(0, area.size.height)},
|
||||
{POLY_FT4::vertex3_from(area), tex_offset.move(area.size.width, area.size.height)}
|
||||
}, tpage, clut, color);
|
||||
}
|
||||
};
|
||||
@@ -320,10 +336,10 @@ namespace JabyEngine {
|
||||
|
||||
static constexpr POLY_G4 create(const AreaI16& area, const Color24 (&color)[4]) {
|
||||
return POLY_G4::create({
|
||||
{area.position, color[0]},
|
||||
{area.position.move(area.size.width, 0), color[1]},
|
||||
{area.position.move(0, area.size.height), color[2]},
|
||||
{area.position.move(area.size.width, area.size.height), color[3]}
|
||||
{POLY_FT4::vertex0_from(area), color[0]},
|
||||
{POLY_FT4::vertex1_from(area), color[1]},
|
||||
{POLY_FT4::vertex2_from(area), color[2]},
|
||||
{POLY_FT4::vertex3_from(area), color[3]}
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -373,10 +389,10 @@ namespace JabyEngine {
|
||||
|
||||
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, 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]}
|
||||
{POLY_FT4::vertex0_from(area), tex_offset, color[0]},
|
||||
{POLY_FT4::vertex1_from(area), tex_offset.move(area.size.width, 0), color[1]},
|
||||
{POLY_FT4::vertex2_from(area), tex_offset.move(0, area.size.height), color[2]},
|
||||
{POLY_FT4::vertex3_from(area), tex_offset.move(area.size.width, area.size.height), color[3]}
|
||||
}, tpage, clut);
|
||||
}
|
||||
};
|
||||
|
@@ -125,14 +125,23 @@ namespace JabyEngine {
|
||||
GPU::Vertex& apply_to(GPU::Vertex& vertex) const;
|
||||
GPU::Vertex apply_to(const GPU::Vertex& vertex) const;
|
||||
|
||||
GPU::POLY_FT4& apply_to(GPU::POLY_FT4& poly) const {
|
||||
template<typename T>
|
||||
T& apply_to_area(T& poly, const GPU::AreaI16& area) const {
|
||||
poly.vertex0 = MATRIX::apply_to(GPU::POLY_G4::vertex0_from(area));
|
||||
poly.vertex1 = MATRIX::apply_to(GPU::POLY_G4::vertex1_from(area));
|
||||
poly.vertex2 = MATRIX::apply_to(GPU::POLY_G4::vertex2_from(area));
|
||||
poly.vertex3 = MATRIX::apply_to(GPU::POLY_G4::vertex3_from(area));
|
||||
return poly;
|
||||
}
|
||||
|
||||
/*GPU::POLY_FT4& apply_to(GPU::POLY_FT4& poly) const {
|
||||
MATRIX::apply_to(poly.vertex0);
|
||||
MATRIX::apply_to(poly.vertex1);
|
||||
MATRIX::apply_to(poly.vertex2);
|
||||
MATRIX::apply_to(poly.vertex3);
|
||||
|
||||
return poly;
|
||||
}
|
||||
}*/
|
||||
};
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user