The problem is, I multiply the modelview matrix by the translation matrix first, and then by the rotation matrix. This works except that by rotating the scene 90 degrees, it throws the translation coordinates off by 90 degrees! In other words, translation occurs under the assumption that the scene has not been rotated.
I only need to rotate the scene on the Y axis, Wolfenstein/Doom style. Here is my code so far:
mat4x4 mat_model,mat_tran,mat_rot,mat_temp; mat4x4_identity(mat_model); mat4x4_identity(mat_tran); mat4x4_identity(mat_rot); mat4x4_identity(mat_temp); //create translation matrix mat4x4_translate(mat_tran, strafe, 0.0, dolly); //create rotation matrix mat4x4_rotate_Y(mat_rot,mat_temp,-rot_y); //apply the matrices to the modelview matrix mat4x4_mul(mat_temp,mat_tran,mat_rot); mat4x4_dup(mat_model,mat_temp);
What am I missing?







