Fixed camera rotation
This commit is contained in:
parent
201f222083
commit
511ec18e6f
|
@ -109,11 +109,14 @@ void render()
|
|||
glClearBufferfv(GL_DEPTH, 0, &depth);
|
||||
|
||||
mat4x4_perspective(projection_matrix, 120, 1200 / 800, 0.0001f, 1000.0f);
|
||||
mat4x4_translate(view_matrix, -tc_camera_position.x, -tc_camera_position.y, tc_camera_position.z);
|
||||
|
||||
mat4x4_identity(view_matrix);
|
||||
mat4x4_rotate_X(view_matrix, view_matrix, tc_camera_rotation.x);
|
||||
mat4x4_rotate_Y(view_matrix, view_matrix, tc_camera_rotation.y);
|
||||
mat4x4_rotate_Z(view_matrix, view_matrix, tc_camera_rotation.z);
|
||||
|
||||
mat4x4_translate_in_place(view_matrix, -tc_camera_position.x, -tc_camera_position.y, tc_camera_position.z);
|
||||
|
||||
glUseProgram(tc_game_state_g.renderer.draw_shader.program_id);
|
||||
|
||||
int projection_uniform_location = glGetUniformLocation(tc_game_state_g.renderer.draw_shader.program_id, "projection_matrix");
|
||||
|
@ -280,12 +283,12 @@ bool update()
|
|||
|
||||
if(rotate_left)
|
||||
{
|
||||
tc_camera_rotation.y += 1.0f / (3.1415 * 2);
|
||||
tc_camera_rotation.y -= 0.1f / (3.1415 * 2);
|
||||
}
|
||||
|
||||
if(rotate_right)
|
||||
{
|
||||
tc_camera_rotation.y -= 1.0f / (3.1415 * 2);
|
||||
tc_camera_rotation.y += 0.1f / (3.1415 * 2);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue