I'm using shaders for the drawing actually so i dont know how to actually show the animations properly by reducing the codes. I need to reduce the codes so that i only need to call the function on the main block and flags are only in the rotate function of Cube. The code is too long for rotation and the Booleans are too many for a rotation function. Here, x_Cubes is a class that has a vector for storing data of class Cube. Mat = transformX * transformY * transformZ * mat Void _Rotate(glm::mat4& mat, float ang_x, float ang_y, float ang_z) On function cubes.Rotate(): void x_Cubes::Rotate(int axis) The places where I kept are codes unrelated to my question.
Where rSpeed and cubes.Rot_speed refers to angles for rotation speeds. Here's my code to optimize: //Code for creating cubes The only problem(or something like that) is that i need to optimize my code for easier understanding and more flexibility. I've been trying to make a rubik's cube project and it succeeds nicely.