+#include "vec3.h"
#include "miniRT.h"
#include <mlx.h>
#include <X11/X.h>
return ;
}
+t_ray get_camera_ray(int x, int y, const t_session *s)
+{
+ t_ray res;
+ const float x_max = s->img.width;
+ const float y_max = s->img.height;
+ const t_camera *const camera = s->scene.current_camera;
+
+ res.direction = camera->orientation;
+ res.direction =
+ vec_add(
+ res.direction,
+ vec_real_mul(
+ vec_add(
+ vec_real_mul(
+ camera->up_direction,
+ y_max / x_max * (y_max - 1 - 2 * y) / (y_max - 1)),
+ vec_real_mul(
+ vec_vec_mul(camera->orientation, camera->up_direction),
+ (x_max - 1 - 2 * x) / (x_max - 1))),
+ tan(camera->field_of_view / 2)));
+ return (res);
+}
+
void draw(t_session *s)
{
int x;