checker erreur limite de config

This commit is contained in:
YANNIS
2025-02-22 18:19:02 +01:00
parent 660d18d859
commit fe4bc4b980
15 changed files with 89 additions and 50 deletions
-26
View File
@@ -1,26 +0,0 @@
# **************************************************************************** #
# #
# ::: :::::::: #
# config.rt :+: :+: :+: #
# +:+ +:+ +:+ #
# By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2025/02/13 19:27:37 by yantoine #+# #+# #
# Updated: 2025/02/18 17:19:31 by yantoine ### ########.fr #
# #
# **************************************************************************** #
A 0 255,255,255
C 10,20,-60 0,0,1 70
L 11,40,-30 1 255,255,255
sp 0,0,0 10 255,0,0
sp 10,10,10 10 0,0,100
pl 0,-5,0 0,1,0 100,55,0
cy 10,0,0 0.5,0,0 8 20 0,0,255
cy 10,0,0 0,1,0 8 20 0,0,255
+23
View File
@@ -0,0 +1,23 @@
#include "miniRT.h"
int isdigit_token(char **tokens)
{
int i;
int j;
i = -1;
while (tokens[++i])
{
j = -1;
while (tokens[i][++j])
{
if (!ft_isdigit(tokens[i][j]) && tokens[i][j] != '\n' && tokens[i][j] != '-' && tokens[i][j] != ',')
{
printf("%c\n", tokens[i][j]);
printf("%p\n", tokens[i]);
return (0);
}
}
}
return (1);
}
+1 -1
Submodule libft updated: 060e991b6f...2b3e413e15
+1 -1
View File
@@ -57,7 +57,7 @@ int main(int argc, char **argv)
ft_bzero(&app, sizeof(t_app)); ft_bzero(&app, sizeof(t_app));
init_app_config(&app, argc, argv); init_app_config(&app, argc, argv);
if (init_mlx_and_image(&app)) if (app.scene.num_camera == 0 || init_mlx_and_image(&app))
return (1); return (1);
setup_hooks(&app); setup_hooks(&app);
mlx_loop(app.mlx); mlx_loop(app.mlx);
BIN
View File
Binary file not shown.
+1
View File
@@ -237,6 +237,7 @@ char **get_tokens_secure(t_scene scene, const int numObject,
// Check // Check
int check_tokens(char **tokens, int expected); int check_tokens(char **tokens, int expected);
void check_if_max(t_scene scene, const int to_test, const int max); void check_if_max(t_scene scene, const int to_test, const int max);
int isdigit_token(char **tokens);
// Intersection // Intersection
float intersect_cylinder(t_ray ray, t_cylinder cy, t_vec3 *hitNormal); float intersect_cylinder(t_ray ray, t_cylinder cy, t_vec3 *hitNormal);
-21
View File
@@ -1,21 +0,0 @@
# **************************************************************************** #
# #
# ::: :::::::: #
# one_sphere_plane.rt :+: :+: :+: #
# +:+ +:+ +:+ #
# By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2025/02/13 19:27:37 by yantoine #+# #+# #
# Updated: 2025/02/18 17:17:07 by yantoine ### ########.fr #
# #
# **************************************************************************** #
A 0 255,255,255
C 0,0,0 0,0,-1 70
L 11,40,50 1 255,255,255
sp 0,0,-20 10 0,0,100
pl 0,-5,0 0,1,0 100,55,0
+1 -1
View File
@@ -19,7 +19,7 @@ char **get_tokens_secure(t_scene scene, const int numObject,
check_if_max(scene, numObject, numObjectMax); check_if_max(scene, numObject, numObjectMax);
tokens = ft_split(scene.line_if_exit, ' '); tokens = ft_split(scene.line_if_exit, ' ');
if (!check_tokens(tokens, supposed_nb_token)) if (!check_tokens(tokens, supposed_nb_token) || !isdigit_token(tokens + 1))
{ {
ft_free_array(tokens); ft_free_array(tokens);
ft_putendl_fd("error", 2); ft_putendl_fd("error", 2);
@@ -0,0 +1,14 @@
A 0 255,255,255
C 10,20,-60 0,0,1 70
L 11,40,-30 1 255,255,255
sp 0,0,0 10 255,0,0
sp 10,10,10 10 0,0,100
pl 0,-5,0 0,1,0 100,55,0
cy 10,0,0 0.5,0,0 8 20 0,0,255
cy 10,0,0 0,1,0 8 20 0,0,255
+9
View File
@@ -0,0 +1,9 @@
A 0 255,255,255
C 0,0,0 0,0,-1 70
L 11,40,50 1 255,255,255
sp 0,0,-20 10 0,0,100
pl 0,-5,0 0,1,0 100,55,0
+9
View File
@@ -0,0 +1,9 @@
A 0 255,255,255
C 0,0,0 0,0,-1 70
L 11,40,50 1 2e5,255,255
sp 0,0,-20 10 0,0,100
pl 0,-5,0 0,1,0 100,55,0
+9
View File
@@ -0,0 +1,9 @@
A e 255,255,255
C 0,0,0 0,0,-1 70
L 11,40,50 1 255,255,255
sp 0,0,-20 10 0,0,100
pl 0,-5,0 0,1,0 100,55,0
+9
View File
@@ -0,0 +1,9 @@
A 0 255,255,255 1
C 0,0,0 0,0,-1 70
L 11,40,50 1 255,255,255
sp 0,0,-20 10 0,0,100
pl 0,-5,0 0,1,0 100,55,0
+12
View File
@@ -0,0 +1,12 @@
A 0 255,255,255
L 11,40,-30 1 255,255,255
sp 0,0,0 10 255,0,0
sp 10,10,10 10 0,0,100
pl 0,-5,0 0,1,0 100,55,0
cy 10,0,0 0.5,0,0 8 20 0,0,255
cy 10,0,0 0,1,0 8 20 0,0,255