MAJ parsing_color et config_ambient
This commit is contained in:
@@ -14,4 +14,19 @@
|
||||
|
||||
t_color parse_color(const char *token, t_scene scene)
|
||||
{
|
||||
const char **token_color = ft_split(token, ',');
|
||||
t_color color;
|
||||
|
||||
if (!check_tokens(token_color, 3))
|
||||
{
|
||||
ft_free_array(tokens_color);
|
||||
ft_free_array(scene.token_if_exit);
|
||||
ft_putendl_fd("error", 2);
|
||||
free(scene.line_if_exit);
|
||||
close(scene.fd);
|
||||
exit(1);
|
||||
}
|
||||
color.r = ft_atoi(token_color[0]) / 255;
|
||||
color.g = ft_atoi(token_color[1]) / 255;
|
||||
color.b = ft_atoi(token_color[2]) / 255;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user