Support ApplyMatrix

This commit is contained in:
2024-04-02 16:08:24 -05:00
parent 87f71a6c61
commit 57e1a17dd2
5 changed files with 52 additions and 11 deletions

View File

@@ -34,7 +34,7 @@ namespace GTETest {
GTE::set_trans_matrix(matrix);
GTE::set_rot_matrix(matrix);
doener_fish.apply();
doener_fish.apply(matrix);
rotation += 5_DEG;
return false;
}

View File

@@ -17,20 +17,19 @@ namespace GTETest {
};
}
void apply() {
static const auto apply_to = [](GTE::SVECTOR vector) -> GPU::Vertex {
GTE::VECTOR output;
void apply(const GTE::MATRIX& matrix) {
static const auto apply_to = [](const GTE::MATRIX& matrix, GTE::SVECTOR vector) -> GPU::Vertex {
GTE::SVECTOR output;
int32_t flag;
GTE::rot_trans(vector, output, flag);
return output.to<GPU::Vertex>();
return GTE::apply_matrix(matrix, vector, output).to<GPU::Vertex>();
};
const auto& area = this->area;
this->display.vertex0 = apply_to(GTE::SVECTOR::from(area.get_top_left()));
this->display.vertex1 = apply_to(GTE::SVECTOR::from(area.get_top_right()));
this->display.vertex2 = apply_to(GTE::SVECTOR::from(area.get_bottom_left()));
this->display.vertex3 = apply_to(GTE::SVECTOR::from(area.get_bottom_right()));
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()));
}
void render() {