From: Lukas Jiriste Date: Fri, 10 Jan 2025 14:38:10 +0000 (+0100) Subject: Switch parsing order X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=c54a52734b3d307b90c0dc869468c18c72e38ba3;p=42%2FminiRT.git Switch parsing order This is done so cycling through lights and cameras starts with the topmost element one (instead of the bottommost one). --- diff --git a/src/parsing.c b/src/parsing.c index 38c2a88..70645f3 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: 2025/01/08 14:53:13 by ljiriste ### ########.fr */ +/* Updated: 2025/01/10 15:36:56 by ljiriste ### ########.fr */ /* */ /* ************************************************************************** */ @@ -325,10 +325,10 @@ int parse_tree_to_scene(const t_parse_tree_node *tree, t_scene *scene) { if (tree->children.size == 2) { - if (add_element_to_scene(ft_cget_node_child(tree, 1), scene)) - return (1); if (parse_tree_to_scene(ft_cget_node_child(tree, 0), scene)) return (1); + if (add_element_to_scene(ft_cget_node_child(tree, 1), scene)) + return (1); } return (0); } diff --git a/test_scene.rt b/test_scene.rt index 3ade7e9..fccc072 100644 --- a/test_scene.rt +++ b/test_scene.rt @@ -1,7 +1,7 @@ L 3,0,0 0.4 255,0,0 L 3,1,0 0.4 0,0,255 -C 2,0,0 1,0,-1 70 C 0,0,0 1,0,0 90 +C 2,0,0 1,0,-1 70 sp 3,0.5,-0.7 0.6 255,255,255 L 3,0.5,-0.5 0.01 0,255,0 L 3,0.5,-0.9 0.01 255,0,0