From da1891aa0a053297e1b17bc34c23c362f9ac0c6b Mon Sep 17 00:00:00 2001 From: Connor Thomson Date: Wed, 9 Sep 2026 20:31:31 -0700 Subject: Add mouse movement --- src/obj_model.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/obj_model.c') diff --git a/src/obj_model.c b/src/obj_model.c index ffbfcf3..6b11583 100644 --- a/src/obj_model.c +++ b/src/obj_model.c @@ -157,12 +157,14 @@ void ta_obj_model_render(const ta_obj_model *model, SDL_GPUCommandBuffer *comman uniforms.model[14] = model->position[2]; float aspect = (float)window_width / (float)window_height; float focal_length = 1.0f / tanf(22.5f * 0.01745329252f); + float near_plane = 0.1f; + float far_plane = 100.0f; ta_camera_get_view_matrix(view); projection[0] = focal_length / aspect; projection[5] = focal_length; - projection[10] = -101.0f / 99.0f; + projection[10] = far_plane / (near_plane - far_plane); projection[11] = -1.0f; - projection[14] = -200.0f / 99.0f; + projection[14] = near_plane * far_plane / (near_plane - far_plane); ta_obj_multiply(view_model, view, uniforms.model); ta_obj_multiply(uniforms.mvp, projection, view_model); SDL_PushGPUVertexUniformData(command_buffer, 0, &uniforms, sizeof(uniforms)); -- cgit v1.2.3