From: Lukas Jiriste Date: Thu, 28 Nov 2024 22:30:48 +0000 (+0100) Subject: Convert camera FOV to radians when parsing X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=f499243f7d3e86354d1867538793d6d1c0407906;p=42%2FminiRT.git Convert camera FOV to radians when parsing --- diff --git a/src/parsing.c b/src/parsing.c index 131ec51..ad87967 100644 --- a/src/parsing.c +++ b/src/parsing.c @@ -6,7 +6,7 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/11/28 12:34:20 by ljiriste #+# #+# */ -/* Updated: 2024/11/28 20:36:19 by ljiriste ### ########.fr */ +/* Updated: 2024/11/28 23:29:35 by ljiriste ### ########.fr */ /* */ /* ************************************************************************** */ @@ -17,6 +17,10 @@ #include #include +#ifndef M_PI +# define M_PI 3.14159265358979323846 +#endif // M_PI + const char *extract_keyword(const char *line, size_t *i) { if (line[*i + 1] == '\0' || ft_isspace(line[*i + 1])) @@ -226,7 +230,7 @@ int add_camera(const t_parse_tree_node *camera_node, t_vec *cameras) camera.up_direction = (t_vec3){.x = 0, .y = 1, .z = 0}; camera.up_direction = vec_vec_mul(camera.up_direction, camera.orientation); camera.up_direction = vec_normalize(camera.up_direction); - camera.field_of_view = node_to_double(ft_cget_node_child(ft_cget_node_child(camera_node, 3), 0)); + camera.field_of_view = node_to_double(ft_cget_node_child(ft_cget_node_child(camera_node, 3), 0)) * M_PI / 180; return (ft_vec_append(cameras, &camera) != success); }