From: Lukáš Jiřiště Date: Wed, 27 Nov 2024 09:39:12 +0000 (+0100) Subject: Fix issues with translation X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=ff9284e6b9bdbd8e4be9ce661eb668eb2b8b07f0;p=42%2FminiRT.git Fix issues with translation This was the same issue as was fixed in a2872aa. Ray was expected to have normalized direction, but did not. --- diff --git a/src/main.c b/src/main.c index 6f8eec6..68f1aa4 100644 --- a/src/main.c +++ b/src/main.c @@ -101,6 +101,7 @@ t_ray get_camera_ray(int x, int y, const t_session *s) vec_vec_mul(camera->orientation, camera->up_direction), (x_max - 1 - 2 * x) / (x_max - 1))), tan(camera->field_of_view / 2))); + res.direction = vec_real_mul(res.direction, 1 / vec_norm(res.direction)); return (res); }