Support apply_matrix on Vertex type

This commit is contained in:
2024-04-03 17:30:37 -05:00
parent 1bf91b2d75
commit 605162a55d
6 changed files with 57 additions and 39 deletions

View File

@@ -18,22 +18,19 @@ namespace GTETest {
}
void apply(const GTE::MATRIX& matrix) {
static const auto apply_to = [](const GTE::MATRIX& matrix, GTE::SVECTOR vector) -> GPU::Vertex {
static const auto apply_to = [](const GTE::MATRIX& matrix, GPU::Vertex vertex) -> GPU::Vertex {
GTE::MATRIX move_back = GTE::MATRIX{
GTE::ROTMATRIX::identity(), GTE::TRANSFERVECTOR::translated(-matrix.transfer.x, -matrix.transfer.y, -matrix.transfer.z)
};
GTE::SVECTOR output;
int32_t flag;
GTE::comp_matrix(matrix, move_back, move_back);
return GTE::apply_matrix(move_back, vector, output).to<GPU::Vertex>();
return GTE::apply_matrix(move_back, vertex, vertex);
};
const auto& area = this->area;
this->display.vertex0 = apply_to(matrix, GTE::SVECTOR::from(area.get_top_left()));
this->display.vertex1 = apply_to(matrix, GTE::SVECTOR::from(area.get_top_right()));
this->display.vertex2 = apply_to(matrix, GTE::SVECTOR::from(area.get_bottom_left()));
this->display.vertex3 = apply_to(matrix, GTE::SVECTOR::from(area.get_bottom_right()));
this->display.vertex0 = apply_to(matrix, area.get_top_left());
this->display.vertex1 = apply_to(matrix, area.get_top_right());
this->display.vertex2 = apply_to(matrix, area.get_bottom_left());
this->display.vertex3 = apply_to(matrix, area.get_bottom_right());
}
void render() {