checker erreur limite de config
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
@@ -57,7 +57,7 @@ int main(int argc, char **argv)
|
||||
|
||||
ft_bzero(&app, sizeof(t_app));
|
||||
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);
|
||||
setup_hooks(&app);
|
||||
mlx_loop(app.mlx);
|
||||
|
||||
@@ -237,6 +237,7 @@ char **get_tokens_secure(t_scene scene, const int numObject,
|
||||
// Check
|
||||
int check_tokens(char **tokens, int expected);
|
||||
void check_if_max(t_scene scene, const int to_test, const int max);
|
||||
int isdigit_token(char **tokens);
|
||||
|
||||
// Intersection
|
||||
float intersect_cylinder(t_ray ray, t_cylinder cy, t_vec3 *hitNormal);
|
||||
|
||||
@@ -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
@@ -19,7 +19,7 @@ char **get_tokens_secure(t_scene scene, const int numObject,
|
||||
|
||||
check_if_max(scene, numObject, numObjectMax);
|
||||
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_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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user