Fix issues with translation
authorLukáš Jiřiště <jiriste@icpf.cas.cz>
Wed, 27 Nov 2024 09:39:12 +0000 (10:39 +0100)
committerLukáš Jiřiště <jiriste@icpf.cas.cz>
Wed, 27 Nov 2024 09:39:12 +0000 (10:39 +0100)
This was the same issue as was fixed in a2872aa. Ray was expected to
have normalized direction, but did not.

src/main.c

index 6f8eec61aaa27d2f78e5c4017a8dd4b953e628b7..68f1aa498d32f19b4b981efef5abfbf411909a6a 100644 (file)
@@ -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);
 }