Support getting and setting of matrix
This commit is contained in:
@@ -104,10 +104,45 @@ namespace JabyEngine {
|
||||
printf("Cos of %i = %i (%i)\n", angle, cos_value, wanna_be_float(cos_value));
|
||||
};
|
||||
|
||||
static const auto print_matrix = [](const GTE::MATRIX& matrix) {
|
||||
printf("{%i, %i, %i}\n", matrix.rot[0][0], matrix.rot[0][1], matrix.rot[0][2]);
|
||||
printf("{%i, %i, %i}\n", matrix.rot[1][0], matrix.rot[1][1], matrix.rot[1][2]);
|
||||
printf("{%i, %i, %i}\n", matrix.rot[2][0], matrix.rot[2][1], matrix.rot[2][2]);
|
||||
printf("{%i, %i, %i}\n", matrix.trans[0], matrix.trans[1], matrix.trans[2]);
|
||||
};
|
||||
|
||||
display_stuff(25);
|
||||
display_stuff(45);
|
||||
display_stuff(75);
|
||||
display_stuff(90);
|
||||
|
||||
auto rot_mat = []() -> GTE::MATRIX {
|
||||
auto rot = GTE::MATRIX::identity();
|
||||
|
||||
rot.rot[0][0] = 123;
|
||||
rot.rot[0][1] = 456;
|
||||
rot.rot[0][2] = 789;
|
||||
|
||||
rot.rot[1][0] = 1123;
|
||||
rot.rot[1][1] = 1456;
|
||||
rot.rot[1][2] = 1789;
|
||||
|
||||
rot.rot[2][0] = 2123;
|
||||
rot.rot[2][1] = 2456;
|
||||
rot.rot[2][2] = 2789;
|
||||
|
||||
rot.trans[0] = 9;
|
||||
rot.trans[1] = 8;
|
||||
rot.trans[2] = 7;
|
||||
return rot;
|
||||
}();
|
||||
|
||||
print_matrix(rot_mat);
|
||||
printf("---\n");
|
||||
GTE::set_matrix(rot_mat);
|
||||
rot_mat = GTE::get_matrix();
|
||||
print_matrix(rot_mat);
|
||||
printf("---\n");
|
||||
}
|
||||
|
||||
void start() {
|
||||
|
@@ -43,5 +43,31 @@ namespace JabyEngine {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void set_matrix(const MATRIX& matrix) {
|
||||
set_rot_matrix(matrix);
|
||||
set_trans_matrix(matrix);
|
||||
}
|
||||
|
||||
MATRIX get_matrix() {
|
||||
MATRIX matrix;
|
||||
|
||||
get_rot_matrix(matrix);
|
||||
get_trans_matrix(matrix);
|
||||
return matrix;
|
||||
}
|
||||
|
||||
void push_matrix() {
|
||||
// FIXME: Implement this
|
||||
}
|
||||
|
||||
void push_matrix(const MATRIX& matrix) {
|
||||
push_matrix();
|
||||
set_matrix(matrix);
|
||||
}
|
||||
|
||||
void pop_matrix() {
|
||||
// FIXME: Implement this
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user