I have a rotation 4x4 matrix to generate a model matrix, but I would like to be able to control it like cinema4D or 3ds Max with three separate angles that are always perpendicular to each other, and so far I've had no luck...
Currently, every time I change one of the angles, I call a function containing the following code:
self->rot_matrix = mat4();
self->rot_matrix = mat4_rotate(self->rot_matrix, 1, 0, 0,
rot.x);
self->rot_matrix = mat4_rotate(self->rot_matrix, 0, 0, 1,
rot.z);
self->rot_matrix = mat4_rotate(self->rot_matrix, 0, 1, 0,
rot.y);
This doesn't work though, because when I rotate around z or x, the y axis should change, but not the y angle... I'm terrible at this sort of mathematics, and would appreciate a simple explanation of what to do.
One idea I've had would be to have two vectors define the rotation system, and then use rodrigues rotation to update them, this I can do with ease, but I have no idea how to transform those two vectors back to a rotation matrix.
Thanks in advance!