update parsing ambient

This commit is contained in:
H3XploR
2025-02-14 20:53:18 +01:00
parent 1ecb24da74
commit 7cd536501d
7 changed files with 82 additions and 19 deletions
+3 -12
View File
@@ -6,7 +6,7 @@
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/14 18:04:39 by yantoine #+# #+# */
/* Updated: 2025/02/14 18:56:00 by yantoine ### ########.fr */
/* Updated: 2025/02/14 20:52:08 by yantoine ### ########.fr */
/* */
/* ************************************************************************** */
@@ -15,19 +15,10 @@
t_scene parsing_ambiant(const char *line, t_scene scene)
{
const int result_if_max = check_if_max(scene, MAX_AMBIENT);
const char **tokens = ft_split(line, ' ');
const int result_check_tokens = check_tokens(tokens, 3);
if (!result_check_tokens)
{
ft_free_array(tokens);
ft_putendl_fd("error", 2);
close(scene.fd);
exit(1);
}
const char **tokens = get_tokens_secure(scene, scene.numAmbient, MAX_AMBIENT, 3);
scene.ambient.ambient_ratio = ft_atof(tokens[1]);
scene.ambient.ambient_color = parse_color(tokens[2], scene);
ft_free_array(tokens);
scene.numAmbient++;
return (scene);
}