This commit is contained in:
H3XploR
2025-02-17 22:09:31 +01:00
parent 557de2b0a7
commit e36cfb5fde
27 changed files with 912 additions and 953 deletions
+6 -5
View File
@@ -6,7 +6,7 @@
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/14 20:05:49 by yantoine #+# #+# */
/* Updated: 2025/02/15 19:23:20 by yantoine ### ########.fr */
/* Updated: 2025/02/17 21:25:34 by yantoine ### ########.fr */
/* */
/* ************************************************************************** */
@@ -28,21 +28,22 @@ static inline int range_is_ok(char **token_color)
t_vec3 parse_color(const char *token, t_scene scene)
{
const char **token_color = ft_split(token, ',');
char **token_color;
t_vec3 color;
token_color = ft_split(token, ',');
if (!check_tokens(token_color, 3) || !range_is_ok(token_color))
{
ft_free_array(tokens_color);
ft_free_array(token_color);
ft_free_array(scene.token_if_exit);
ft_putendl_fd("error", 2);
free(scene.line_if_exit);
close(scene.fd);
close(scene.fd_if_exit);
exit(1);
}
color.x = ft_atof(token_color[0]) / 255;
color.y = ft_atof(token_color[1]) / 255;
color.z = ft_atof(token_color[2]) / 255;
ft_free_array(tokens_color);
ft_free_array(token_color);
return (color);
}