DEBOGAGE
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
[submodule "libft"]
|
||||
path = libft
|
||||
url = git@github.com:H3XploR/libft.git
|
||||
[submodule "minilibx-linux"]
|
||||
path = minilibx-linux
|
||||
url = https://github.com/42Paris/minilibx-linux.git
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_arraylen.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/17 21:10:10 by yantoine #+# #+# */
|
||||
/* Updated: 2025/02/17 21:21:30 by yantoine ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "miniRT.h"
|
||||
|
||||
int ft_arraylen(char **array)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while (array[i])
|
||||
i++;
|
||||
return (i);
|
||||
}
|
||||
|
||||
void ft_free_array(char **array)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while (array[i])
|
||||
{
|
||||
free(array[i]);
|
||||
i++;
|
||||
}
|
||||
free(array);
|
||||
}
|
||||
@@ -6,24 +6,24 @@
|
||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/14 18:28:42 by yantoine #+# #+# */
|
||||
/* Updated: 2025/02/14 20:15:29 by yantoine ### ########.fr */
|
||||
/* Updated: 2025/02/17 21:07:31 by yantoine ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "miniRT.h"
|
||||
|
||||
inline int check_tokens(char **tokens, int expected)
|
||||
int check_tokens(char **tokens, int expected)
|
||||
{
|
||||
return (tokens && ft_arraylen(tokens) == expected);
|
||||
}
|
||||
|
||||
inline 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)
|
||||
{
|
||||
if (to_test >= max)
|
||||
{
|
||||
printf("error:\n");
|
||||
close(scene.fd_if_exit);
|
||||
free(scene->line_if_exit);
|
||||
free(scene.line_if_exit);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,56 +6,56 @@
|
||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/14 01:41:17 by yantoine #+# #+# */
|
||||
/* Updated: 2025/02/15 19:56:05 by yantoine ### ########.fr */
|
||||
/* Updated: 2025/02/17 21:52:57 by yantoine ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "miniRT.h"
|
||||
|
||||
static inline t_scene parsing_line(const char *line, t_scene scene)
|
||||
static inline t_scene parsing_line(char *line, t_scene scene)
|
||||
{
|
||||
scene->line_if_exit = line;
|
||||
scene.line_if_exit = line;
|
||||
if (line[0] == '#')
|
||||
return ;
|
||||
return (scene);
|
||||
else if (line[0] == 'A')
|
||||
parsing_ambiant(line, scene);
|
||||
scene = parsing_ambiant(scene);
|
||||
else if (line[0] == 'C')
|
||||
parsing_camera(line, scene);
|
||||
scene = parsing_camera(scene);
|
||||
else if (line[0] == 'L')
|
||||
parsing_light(line, scene);
|
||||
scene = parsing_light(scene);
|
||||
else if (ft_strncmp(line, "sp", 2) == 0)
|
||||
parsing_sphere(line, scene);
|
||||
scene = parsing_sphere(scene);
|
||||
else if (ft_strncmp(line, "pl", 2) == 0)
|
||||
parsing_plane(line, scene);
|
||||
scene = parsing_plane(scene);
|
||||
else if (ft_strncmp(line, "cy", 2) == 0)
|
||||
parsing_cylindre(line, scene);
|
||||
scene = parsing_cylindre(scene);
|
||||
else
|
||||
printf("Erreur : ligne non reconnue\n");
|
||||
return (scene);
|
||||
}
|
||||
|
||||
// ----- Parsing du fichier de configuration -----
|
||||
t_scene load_config(const char *filename)
|
||||
{
|
||||
int fd;
|
||||
char line[256];
|
||||
const char *line;
|
||||
char *line;
|
||||
t_scene scene;
|
||||
|
||||
scene = create_scene(void);
|
||||
fd = open(filename, "r");
|
||||
scene = create_scene();
|
||||
fd = open(filename, O_RDONLY);
|
||||
if (!fd)
|
||||
{
|
||||
printf("Erreur : impossible d'ouvrir %s\n", filename);
|
||||
return ;
|
||||
return (scene);
|
||||
}
|
||||
scene.fd_if_exit = fd;
|
||||
while (1)
|
||||
{
|
||||
line = (const char *)get_next_line(fd);
|
||||
line = get_next_line(fd);
|
||||
if (!line)
|
||||
break ;
|
||||
free(line);
|
||||
parsing_line(line, scene);
|
||||
free(line);
|
||||
}
|
||||
return (scene);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
# **************************************************************************** #
|
||||
# #
|
||||
# ::: :::::::: #
|
||||
# config.rt :+: :+: :+: #
|
||||
# +:+ +:+ +:+ #
|
||||
# By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2025/02/13 19:27:37 by yantoine #+# #+# #
|
||||
# Updated: 2025/02/13 19:37:39 by yantoine ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
# Ambient lighting (ratio et couleur)
|
||||
A 0 255,255,255
|
||||
|
||||
# Camera : position à (0,0,20) et orientée vers (0,0,-1) avec un FOV de 70°
|
||||
C 10,20,20 0,0,-1 70
|
||||
|
||||
# Light : source lumineuse forte placée au-dessus de la scène
|
||||
L 11,40,-30 1 255,255,255
|
||||
|
||||
# Sphere : une sphère rouge centrée à (0,0,0) avec un diamètre de 10
|
||||
sp 0,0,0 10 255,0,0
|
||||
sp 10,10,10 10 0,0,100
|
||||
|
||||
# Plane : un plan vert servant de sol, passant par (0,-5,0) et avec une normale vers le haut
|
||||
pl 0,-5,0 0,1,0 100,55,0
|
||||
|
||||
# Cylinder : un cylindre bleu placé à (10,0,0), avec un axe vertical (0,1,0),
|
||||
# un diamètre de 8 et une hauteur de 20
|
||||
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
|
||||
|
||||
@@ -6,16 +6,16 @@
|
||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/17 19:30:45 by yantoine #+# #+# */
|
||||
/* Updated: 2025/02/17 19:30:59 by yantoine ### ########.fr */
|
||||
/* Updated: 2025/02/17 21:55:36 by yantoine ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "miniRT.h"
|
||||
|
||||
int update_frame(t_app *app)
|
||||
int update_frame(t_app *app, t_scene scene)
|
||||
{
|
||||
update_camera(app);
|
||||
render_scene(app);
|
||||
render_scene(app, scene);
|
||||
mlx_put_image_to_window(app->mlx, app->win, app->img, 0, 0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_atof.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/17 21:19:17 by yantoine #+# #+# */
|
||||
/* Updated: 2025/02/17 21:20:13 by yantoine ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "miniRT.h"
|
||||
|
||||
float ft_atof(char *str)
|
||||
{
|
||||
float res;
|
||||
float dec;
|
||||
int sign;
|
||||
|
||||
res = 0;
|
||||
dec = 0;
|
||||
sign = 1;
|
||||
if (*str == '-')
|
||||
{
|
||||
sign = -1;
|
||||
str++;
|
||||
}
|
||||
while (*str >= '0' && *str <= '9')
|
||||
{
|
||||
res = res * 10 + *str - '0';
|
||||
str++;
|
||||
}
|
||||
if (*str == '.')
|
||||
{
|
||||
str++;
|
||||
while (*str >= '0' && *str <= '9')
|
||||
{
|
||||
dec = dec * 10 + *str - '0';
|
||||
str++;
|
||||
}
|
||||
}
|
||||
return (sign * (res + dec / pow(10, ft_strlen(str))));
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/17 19:54:03 by yantoine #+# #+# */
|
||||
/* Updated: 2025/02/17 19:58:12 by yantoine ### ########.fr */
|
||||
/* Updated: 2025/02/17 22:09:13 by yantoine ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -75,6 +75,7 @@ int main(int argc, char **argv)
|
||||
{
|
||||
t_app app;
|
||||
|
||||
ft_bzero(&app, sizeof(t_app));
|
||||
init_app_config(&app, argc, argv);
|
||||
if (init_mlx_and_image(&app))
|
||||
return (1);
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
NAME = miniRT
|
||||
|
||||
MINILIBX = minilibx-linux/libmlx.a
|
||||
LIBFT = libft/libft.a
|
||||
|
||||
SRC = $(wildcard *.c)
|
||||
DIR_OBJ = obj
|
||||
OBJ = $(addprefix $(DIR_OBJ)/, $(notdir $(SRC:.c=.o)))
|
||||
|
||||
CC = cc
|
||||
CFLAGS = -fsanitize=address -g3 -Wall -Wextra -Werror
|
||||
INCLUDES = -I. -Ilibft -Iminilibx-linux
|
||||
LDFLAGS = -Llibft -Lminilibx-linux
|
||||
LDLIBS = -lft -lmlx -lXext -lX11 -lm -lbsd
|
||||
|
||||
$(NAME): $(OBJ) $(LIBFT) $(MINILIBX)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $(NAME) $(OBJ) $(LDLIBS)
|
||||
|
||||
$(DIR_OBJ)/%.o: %.c | $(DIR_OBJ)
|
||||
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
|
||||
|
||||
$(DIR_OBJ):
|
||||
mkdir -p $(DIR_OBJ)
|
||||
|
||||
$(LIBFT):
|
||||
@make -C libft all
|
||||
|
||||
$(MINILIBX):
|
||||
@make -C minilibx-linux
|
||||
|
||||
all: $(NAME)
|
||||
|
||||
clean:
|
||||
@make -C libft clean
|
||||
@rm -rf $(DIR_OBJ)
|
||||
|
||||
fclean: clean
|
||||
@rm -rf $(NAME)
|
||||
@make -C libft fclean
|
||||
@make -C minilibx-linux clean
|
||||
|
||||
re: fclean all
|
||||
|
||||
.PHONY: all clean fclean re
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/13 20:02:36 by yantoine #+# #+# */
|
||||
/* Updated: 2025/02/17 19:53:54 by yantoine ### ########.fr */
|
||||
/* Updated: 2025/02/17 21:55:55 by yantoine ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -14,13 +14,15 @@
|
||||
# define MINIRT_H
|
||||
|
||||
# include <math.h>
|
||||
#include "mlx.h"
|
||||
# include <stdbool.h>
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include <fcntl.h>
|
||||
# include "get_next_line.h"
|
||||
# include "libft.h"
|
||||
# include "float.h"
|
||||
# include "mlx.h"
|
||||
|
||||
// ----- Taille ecran ----
|
||||
# define WIDTH 320
|
||||
@@ -34,83 +36,6 @@
|
||||
# define MAX_AMBIENT 1
|
||||
# define MAX_CAMERA 1
|
||||
|
||||
// ----- Minilibx
|
||||
typedef struct s_app
|
||||
{
|
||||
void *mlx;
|
||||
void *win;
|
||||
void *img;
|
||||
int *pixels;
|
||||
int bpp;
|
||||
int size_line;
|
||||
int endian;
|
||||
int win_width;
|
||||
int win_height;
|
||||
int key_w;
|
||||
int key_s;
|
||||
int key_a;
|
||||
int key_d;
|
||||
int key_left;
|
||||
int key_right;
|
||||
int key_up;
|
||||
int key_down;
|
||||
float move_speed;
|
||||
float rot_speed;
|
||||
float mouse_sens;
|
||||
t_vec3 cam_pos;
|
||||
t_vec3 cam_dir;
|
||||
t_vec3 right;
|
||||
t_vec3 cam_up;
|
||||
float fov;
|
||||
float yaw;
|
||||
float pitch;
|
||||
} t_app;
|
||||
|
||||
|
||||
// ----- Calcul
|
||||
|
||||
typedef struct s_calc
|
||||
{
|
||||
t_vec3 oc;
|
||||
float a;
|
||||
float b;
|
||||
float c;
|
||||
float disc;
|
||||
float sqrtDisc;
|
||||
float t0;
|
||||
float t1;
|
||||
float t;
|
||||
t_vec3 hitPoint;
|
||||
t_vec3 d;
|
||||
t_vec3 v;
|
||||
float d_dot_v;
|
||||
float oc_dot_v;
|
||||
t_vec3 d_perp;
|
||||
t_vec3 oc_perp;
|
||||
float t_side;
|
||||
float y;
|
||||
float t_cap;
|
||||
float t_bot;
|
||||
float t_top;
|
||||
t_vec3 p;
|
||||
t_vec3 cp;
|
||||
float dist;
|
||||
float t_final;
|
||||
float proj;
|
||||
t_vec3 n;
|
||||
float ndc_x;
|
||||
float ndc_y;
|
||||
float aspect;
|
||||
float scale;
|
||||
float screen_x;
|
||||
float screen_y;
|
||||
t_vec3 ray_dir;
|
||||
t_vec3 color;
|
||||
unsigned char r;
|
||||
unsigned char g;
|
||||
unsigned char b;
|
||||
} t_calc;
|
||||
|
||||
// ----- Espace 3d
|
||||
typedef struct s_vec3
|
||||
{
|
||||
@@ -159,8 +84,8 @@ typedef struct s_light
|
||||
|
||||
typedef struct s_ambient
|
||||
{
|
||||
float ambient_ratio;
|
||||
t_vec3 ambient_color;
|
||||
float ratio;
|
||||
t_vec3 color;
|
||||
} t_ambient;
|
||||
|
||||
typedef struct s_camera
|
||||
@@ -183,13 +108,88 @@ typedef struct s_scene
|
||||
int numSpheres;
|
||||
int numPlanes;
|
||||
int numCylinders;
|
||||
int numCamera;
|
||||
int numLights;
|
||||
int numAmbient;
|
||||
const char *line_if_exit;
|
||||
const int fd_if_exit;
|
||||
const char **token_if_exit;
|
||||
char *line_if_exit;
|
||||
char **token_if_exit;
|
||||
int fd_if_exit;
|
||||
} t_scene;
|
||||
|
||||
// ----- Minilibx
|
||||
typedef struct s_app
|
||||
{
|
||||
void *mlx;
|
||||
void *win;
|
||||
void *img;
|
||||
int *pixels;
|
||||
int bpp;
|
||||
int size_line;
|
||||
int endian;
|
||||
int win_width;
|
||||
int win_height;
|
||||
int key_w;
|
||||
int key_s;
|
||||
int key_a;
|
||||
int key_d;
|
||||
int key_left;
|
||||
int key_right;
|
||||
int key_up;
|
||||
int key_down;
|
||||
float move_speed;
|
||||
float rot_speed;
|
||||
float mouse_sens;
|
||||
t_vec3 cam_pos;
|
||||
t_vec3 cam_dir;
|
||||
t_vec3 right;
|
||||
t_vec3 cam_up;
|
||||
float fov;
|
||||
float yaw;
|
||||
float pitch;
|
||||
} t_app;
|
||||
|
||||
|
||||
// ----- Calcul
|
||||
typedef struct s_calc
|
||||
{
|
||||
t_vec3 oc;
|
||||
float a;
|
||||
float b;
|
||||
float c;
|
||||
float disc;
|
||||
float sqrtDisc;
|
||||
float t0;
|
||||
float t1;
|
||||
float t;
|
||||
t_vec3 hitPoint;
|
||||
t_vec3 d;
|
||||
t_vec3 v;
|
||||
float d_dot_v;
|
||||
float oc_dot_v;
|
||||
t_vec3 d_perp;
|
||||
t_vec3 oc_perp;
|
||||
float t_side;
|
||||
float y;
|
||||
float t_cap;
|
||||
float t_bot;
|
||||
float t_top;
|
||||
t_vec3 p;
|
||||
t_vec3 cp;
|
||||
float dist;
|
||||
float t_final;
|
||||
float proj;
|
||||
t_vec3 n;
|
||||
float ndc_x;
|
||||
float ndc_y;
|
||||
float aspect;
|
||||
float scale;
|
||||
float screen_x;
|
||||
float screen_y;
|
||||
t_ray ray;
|
||||
t_vec3 ray_dir;
|
||||
t_vec3 color;
|
||||
} t_calc;
|
||||
|
||||
// Calcul de vecteur
|
||||
t_vec3 vec3_add(t_vec3 a, t_vec3 b);
|
||||
t_vec3 vec3_sub(t_vec3 a, t_vec3 b);
|
||||
@@ -203,29 +203,32 @@ t_vec3 vec3_mul(t_vec3 a, t_vec3 b);
|
||||
// Config de scene
|
||||
t_scene create_scene(void);
|
||||
t_scene load_config(const char *filename);
|
||||
t_scene parsing_ambiant(const char *line, t_scene scene);
|
||||
t_scene parsing_camera(const char *line, t_scene scene);
|
||||
t_scene parsing_light(const char *line, t_scene scene);
|
||||
t_scene parsing_sphere(const char *line, t_scene scene);
|
||||
t_scene parsing_plane(const char *line, t_scene scene);
|
||||
t_scene parsing_cylindre(const char *line, t_scene scene);
|
||||
t_scene parsing_ambiant(t_scene scene);
|
||||
t_scene parsing_camera(t_scene scene);
|
||||
t_scene parsing_light(t_scene scene);
|
||||
t_scene parsing_sphere(t_scene scene);
|
||||
t_scene parsing_plane(t_scene scene);
|
||||
t_scene parsing_cylindre(t_scene scene);
|
||||
t_vec3 parse_color(const char *token, t_scene scene);
|
||||
t_vec3 parse_vector(const char *token, t_scene scene);
|
||||
t_vec3 parse_vector_normalize(const char *token, t_scene scene);
|
||||
|
||||
|
||||
// Parsing utils
|
||||
inline char **get_tokens_secure(t_scene scene, const int numObject, const int numObjectMax, const int supposed_nb_token);
|
||||
char **get_tokens_secure(t_scene scene, const int numObject, const int numObjectMax, const int supposed_nb_token);
|
||||
|
||||
// Check
|
||||
inline int check_tokens(char **tokens, const int to_test, int expected);
|
||||
inline void check_if_max(t_scene scene, const int to_test, const int max);
|
||||
int check_tokens(char **tokens, int expected);
|
||||
void check_if_max(t_scene scene, const int to_test, const int max);
|
||||
|
||||
// Intersection
|
||||
float intersectCylinder(Ray ray, Cylinder cy, t_vec3 *hitNormal);
|
||||
float intersectPlane(Ray ray, Plane p, t_vec3 *hitNormal);
|
||||
float intersectSphere(Ray ray, Sphere s, t_vec3 *hitNormal);
|
||||
bool isInShadow(t_vec3 hitPoint, t_vec3 lightPos);
|
||||
float intersectCylinder(t_ray ray, t_cylinder cy, t_vec3 *hitNormal);
|
||||
float intersectPlane(t_ray ray, t_plane p, t_vec3 *hitNormal);
|
||||
float intersectSphere(t_ray ray, t_sphere s, t_vec3 *hitNormal);
|
||||
bool isInShadow(t_vec3 hitPoint, t_vec3 lightPos, t_scene scene);
|
||||
bool intersectObjects(t_ray ray, float *tMin, t_vec3 *hitNormal, t_vec3 *objColor, t_scene scene);
|
||||
t_vec3 calcLighting(t_vec3 hitPoint, t_vec3 hitNormal, t_vec3 objColor, t_scene scene);
|
||||
t_vec3 trace(t_ray ray, t_scene scene);
|
||||
|
||||
// Peripherique
|
||||
int key_press(int keycode, t_app *app);
|
||||
@@ -234,6 +237,12 @@ int mouse_move(int x, int y, t_app *app);
|
||||
|
||||
// Render
|
||||
void update_camera(t_app *app);
|
||||
void render_scene(t_app *app);
|
||||
int update_frame(t_app *app);
|
||||
void render_scene(t_app *app, t_scene scene);
|
||||
int update_frame(t_app *app, t_scene scene);
|
||||
|
||||
// Array
|
||||
int ft_arraylen(char **array);
|
||||
void ft_free_array(char **array);
|
||||
// Conversion
|
||||
float ft_atof(char *str);
|
||||
#endif
|
||||
|
||||
Submodule
+1
Submodule minilibx-linux added at 7dc53a411a
+7
-5
@@ -6,19 +6,21 @@
|
||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/14 18:04:39 by yantoine #+# #+# */
|
||||
/* Updated: 2025/02/14 20:52:08 by yantoine ### ########.fr */
|
||||
/* Updated: 2025/02/17 21:53:34 by yantoine ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "miniRT.h"
|
||||
|
||||
|
||||
t_scene parsing_ambiant(const char *line, t_scene scene)
|
||||
t_scene parsing_ambiant(t_scene scene)
|
||||
{
|
||||
const char **tokens = get_tokens_secure(scene, scene.numAmbient, MAX_AMBIENT, 3);
|
||||
char **tokens;
|
||||
|
||||
tokens = get_tokens_secure(scene, scene.numAmbient, MAX_AMBIENT, 3);
|
||||
scene.token_if_exit = tokens;
|
||||
scene.ambient.ambient_ratio = ft_atof(tokens[1]);
|
||||
scene.ambient.ambient_color = parse_color(tokens[2], scene);
|
||||
scene.ambient.ratio = ft_atof(tokens[1]);
|
||||
scene.ambient.color = parse_color(tokens[2], scene);
|
||||
ft_free_array(tokens);
|
||||
scene.numAmbient++;
|
||||
return (scene);
|
||||
|
||||
+7
-5
@@ -6,21 +6,23 @@
|
||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/14 20:02:29 by yantoine #+# #+# */
|
||||
/* Updated: 2025/02/15 19:43:52 by yantoine ### ########.fr */
|
||||
/* Updated: 2025/02/17 21:24:12 by yantoine ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "miniRT.h"
|
||||
|
||||
t_scene parsing_camera(const char *line, t_scene scene)
|
||||
t_scene parsing_camera(t_scene scene)
|
||||
{
|
||||
const char **tokens = get_tokens_secure(scene, scene.numCamera, MAX_CAMERA, 4);
|
||||
char **tokens;
|
||||
|
||||
tokens = get_tokens_secure(scene, scene.numCamera, MAX_CAMERA, 4);
|
||||
scene.token_if_exit = tokens;
|
||||
scene.camera.camPos = parse_vector(tokens[1], scene);
|
||||
scene.camera.camDir = parse_vector_normalize(tokens[2], scene);
|
||||
scene.camera.fov = ft_atof(tokens[3]);
|
||||
scene.camera.yaw = atan2f(camDir.x, -camDir.z);
|
||||
scene.camera.pitch = asinf(camDir.y);
|
||||
scene.camera.yaw = atan2f(scene.camera.camDir.x, -scene.camera.camDir.z);
|
||||
scene.camera.pitch = asinf(scene.camera.camDir.y);
|
||||
ft_free_array(tokens);
|
||||
scene.numCamera++;
|
||||
return (scene);
|
||||
|
||||
+6
-5
@@ -6,7 +6,7 @@
|
||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/14 20:05:49 by yantoine #+# #+# */
|
||||
/* Updated: 2025/02/15 19:23:20 by yantoine ### ########.fr */
|
||||
/* Updated: 2025/02/17 21:25:34 by yantoine ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -28,21 +28,22 @@ static inline int range_is_ok(char **token_color)
|
||||
|
||||
t_vec3 parse_color(const char *token, t_scene scene)
|
||||
{
|
||||
const char **token_color = ft_split(token, ',');
|
||||
char **token_color;
|
||||
t_vec3 color;
|
||||
|
||||
token_color = ft_split(token, ',');
|
||||
if (!check_tokens(token_color, 3) || !range_is_ok(token_color))
|
||||
{
|
||||
ft_free_array(tokens_color);
|
||||
ft_free_array(token_color);
|
||||
ft_free_array(scene.token_if_exit);
|
||||
ft_putendl_fd("error", 2);
|
||||
free(scene.line_if_exit);
|
||||
close(scene.fd);
|
||||
close(scene.fd_if_exit);
|
||||
exit(1);
|
||||
}
|
||||
color.x = ft_atof(token_color[0]) / 255;
|
||||
color.y = ft_atof(token_color[1]) / 255;
|
||||
color.z = ft_atof(token_color[2]) / 255;
|
||||
ft_free_array(tokens_color);
|
||||
ft_free_array(token_color);
|
||||
return (color);
|
||||
}
|
||||
|
||||
+7
-5
@@ -6,7 +6,7 @@
|
||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/15 19:54:13 by yantoine #+# #+# */
|
||||
/* Updated: 2025/02/17 18:55:52 by yantoine ### ########.fr */
|
||||
/* Updated: 2025/02/17 22:02:43 by yantoine ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -92,14 +92,16 @@ float intersectCylinder(Ray ray, Cylinder cy, t_vec3 *hitNormal)
|
||||
return calc.t_final;
|
||||
}*/
|
||||
|
||||
t_scene parsing_cylinder(const char *line, t_scene scene)
|
||||
t_scene parsing_cylindre(t_scene scene)
|
||||
{
|
||||
const char **tokens = get_tokens_secure(scene, scene.numCylinders, MAX_CYLINDERS, 6);
|
||||
char **tokens;
|
||||
|
||||
tokens = get_tokens_secure(scene, scene.numCylinders, MAX_CYLINDERS, 6);
|
||||
scene.token_if_exit = tokens;
|
||||
scene.cylinders[scene.numCylinders].center = parse_vector(tokens[1], scene);
|
||||
scene.cylinders[scene.numCylinders].axis = parse_vector_normalize(tokens[2], scene);
|
||||
scene.cylinders[scene.numCylinders].radius = parse_float(tokens[3], scene);
|
||||
scene.cylinders[scene.numCylinders].height = parse_float(tokens[4], scene);
|
||||
scene.cylinders[scene.numCylinders].radius = ft_atof(tokens[3]);
|
||||
scene.cylinders[scene.numCylinders].height = ft_atof(tokens[4]);
|
||||
scene.cylinders[scene.numCylinders].color = parse_color(tokens[5], scene);
|
||||
ft_free_array(tokens);
|
||||
scene.numCylinders++;
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/17 18:54:45 by yantoine #+# #+# */
|
||||
/* Updated: 2025/02/17 18:54:46 by yantoine ### ########.fr */
|
||||
/* Updated: 2025/02/17 21:28:56 by yantoine ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "miniRT.h"
|
||||
|
||||
// Initialise les variables de calcul et les coefficients du polynôme d'intersection
|
||||
static int init_intersection(Ray ray, Cylinder cy, t_calc *calc) {
|
||||
static int init_intersection(t_ray ray, t_cylinder cy, t_calc *calc) {
|
||||
calc->d = ray.dir;
|
||||
calc->oc = vec3_sub(ray.origin, cy.center);
|
||||
calc->v = cy.axis;
|
||||
@@ -34,7 +34,7 @@ static int init_intersection(Ray ray, Cylinder cy, t_calc *calc) {
|
||||
}
|
||||
|
||||
// Calcule l'intersection sur la surface latérale du cylindre
|
||||
static void compute_side_intersection(Ray ray, Cylinder cy, t_calc *calc) {
|
||||
static void compute_side_intersection(t_cylinder cy, t_calc *calc) {
|
||||
calc->t_side = -1;
|
||||
if (calc->t0 > 1e-3f) {
|
||||
calc->y = calc->oc_dot_v + calc->t0 * calc->d_dot_v;
|
||||
@@ -49,7 +49,7 @@ static void compute_side_intersection(Ray ray, Cylinder cy, t_calc *calc) {
|
||||
}
|
||||
|
||||
// Calcule l'intersection sur les capuchons supérieur et inférieur
|
||||
static void compute_cap_intersection(Ray ray, Cylinder cy, t_calc *calc) {
|
||||
static void compute_cap_intersection(t_ray ray, t_cylinder cy, t_calc *calc) {
|
||||
calc->t_cap = -1;
|
||||
if (fabs(calc->d_dot_v) > 1e-6f) {
|
||||
calc->t_bot = ((-cy.height / 2.0f) - calc->oc_dot_v) / calc->d_dot_v;
|
||||
@@ -83,7 +83,7 @@ static float select_final_intersection(t_calc *calc) {
|
||||
}
|
||||
|
||||
// Calcule la normale au point d'intersection
|
||||
static void compute_hit_normal(Ray ray, Cylinder cy, t_calc *calc, t_vec3 *hitNormal) {
|
||||
static void compute_hit_normal(t_ray ray, t_cylinder cy, t_calc *calc, t_vec3 *hitNormal) {
|
||||
calc->hitPoint = vec3_add(ray.origin, vec3_scale(calc->d, calc->t_final));
|
||||
calc->cp = vec3_sub(calc->hitPoint, cy.center);
|
||||
calc->proj = vec3_dot(calc->cp, calc->v);
|
||||
@@ -96,11 +96,11 @@ static void compute_hit_normal(Ray ray, Cylinder cy, t_calc *calc, t_vec3 *hitNo
|
||||
}
|
||||
|
||||
// Fonction principale d'intersection du cylindre
|
||||
float intersectCylinder(Ray ray, Cylinder cy, t_vec3 *hitNormal) {
|
||||
float intersectCylinder(t_ray ray, t_cylinder cy, t_vec3 *hitNormal) {
|
||||
t_calc calc;
|
||||
if (init_intersection(ray, cy, &calc) < 0)
|
||||
return -1;
|
||||
compute_side_intersection(ray, cy, &calc);
|
||||
compute_side_intersection(cy, &calc);
|
||||
compute_cap_intersection(ray, cy, &calc);
|
||||
if (select_final_intersection(&calc) < 0)
|
||||
return -1;
|
||||
|
||||
+7
-5
@@ -6,18 +6,20 @@
|
||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/15 19:39:08 by yantoine #+# #+# */
|
||||
/* Updated: 2025/02/15 19:44:19 by yantoine ### ########.fr */
|
||||
/* Updated: 2025/02/17 21:29:55 by yantoine ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "minRT.h"
|
||||
#include "miniRT.h"
|
||||
|
||||
t_scene parsing_light(const char *line, t_scene scene)
|
||||
t_scene parsing_light(t_scene scene)
|
||||
{
|
||||
const char **tokens = get_tokens_secure(scene, scene.numLights, MAX_LIGHTS, 4);
|
||||
char **tokens;
|
||||
|
||||
tokens = get_tokens_secure(scene, scene.numLights, MAX_LIGHTS, 4);
|
||||
scene.token_if_exit = tokens;
|
||||
scene.lights[scene.numLights].pos = parse_vector(tokens[1], scene);
|
||||
scene.lights[scene.numLights].brightness = ft_atof(tokens[2], scene);
|
||||
scene.lights[scene.numLights].brightness = ft_atof(tokens[2]);
|
||||
scene.lights[scene.numLights].color = parse_color(tokens[3], scene);
|
||||
ft_free_array(tokens);
|
||||
scene.numLights++;
|
||||
|
||||
+6
-4
@@ -6,15 +6,17 @@
|
||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/15 19:49:41 by yantoine #+# #+# */
|
||||
/* Updated: 2025/02/17 17:49:28 by yantoine ### ########.fr */
|
||||
/* Updated: 2025/02/17 21:30:47 by yantoine ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "miniRT.h"
|
||||
|
||||
t_scene parsing_plane(const char *line, t_scene scene)
|
||||
t_scene parsing_plane(t_scene scene)
|
||||
{
|
||||
const char **tokens = get_tokens_secure(scene, scene.numPlanes, MAX_PLANES, 4);
|
||||
char **tokens;
|
||||
|
||||
tokens = get_tokens_secure(scene, scene.numPlanes, MAX_PLANES, 4);
|
||||
scene.token_if_exit = tokens;
|
||||
scene.planes[scene.numPlanes].point = parse_vector(tokens[1], scene);
|
||||
scene.planes[scene.numPlanes].normal = parse_vector_normalize(tokens[2], scene);
|
||||
@@ -24,7 +26,7 @@ t_scene parsing_plane(const char *line, t_scene scene)
|
||||
return (scene);
|
||||
}
|
||||
|
||||
float intersectPlane(Ray ray, Plane p, t_vec3 *hitNormal)
|
||||
float intersectPlane(t_ray ray, t_plane p, t_vec3 *hitNormal)
|
||||
{
|
||||
float denom;
|
||||
float t;
|
||||
|
||||
+9
-7
@@ -6,33 +6,35 @@
|
||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/15 19:46:16 by yantoine #+# #+# */
|
||||
/* Updated: 2025/02/17 17:31:42 by yantoine ### ########.fr */
|
||||
/* Updated: 2025/02/17 21:31:36 by yantoine ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "miniRT.h"
|
||||
|
||||
t_scene parsing_sphere(const char *line, t_scene scene)
|
||||
t_scene parsing_sphere(t_scene scene)
|
||||
{
|
||||
const char **tokens = get_tokens_secure(scene, scene.numSpheres, MAX_SPHERES, 4);
|
||||
char **tokens;
|
||||
|
||||
tokens = get_tokens_secure(scene, scene.numSpheres, MAX_SPHERES, 4);
|
||||
scene.token_if_exit = tokens;
|
||||
scene.spheres[scene.numSpheres].center = parse_vector(tokens[1], scene);
|
||||
scene.spheres[scene.numSpheres].radius = ft_atof(tokens[2], scene) / 2.0f;
|
||||
scene.spheres[scene.numSpheres].radius = ft_atof(tokens[2]) / 2.0f;
|
||||
scene.spheres[scene.numSpheres].color = parse_color(tokens[3], scene);
|
||||
ft_free_array(tokens);
|
||||
scene.numSpheres++;
|
||||
return (scene);
|
||||
}
|
||||
|
||||
float intersectSphere(Ray ray, Sphere s, t_vec3 *hitNormal)
|
||||
float intersectSphere(t_ray ray, t_sphere s, t_vec3 *hitNormal)
|
||||
{
|
||||
t_calc calc;
|
||||
|
||||
calc.oc = vec3_sub(ray.origin, s.center);
|
||||
calc.a = vec3_dot(ray.dir, ray.dir);
|
||||
calc.b = 2.0f * vec3_dot(calc.oc, ray.dir);
|
||||
c = vec3_dot(calc.oc, calc.oc) - s.radius * s.radius;
|
||||
calc.disc = calc.b * calc.b - 4 * calc.a * c;
|
||||
calc.c = vec3_dot(calc.oc, calc.oc) - s.radius * s.radius;
|
||||
calc.disc = calc.b * calc.b - 4 * calc.a * calc.c;
|
||||
if (calc.disc < 0)
|
||||
return (-1);
|
||||
calc.sqrtDisc = sqrtf(calc.disc);
|
||||
|
||||
+6
-6
@@ -6,24 +6,24 @@
|
||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/14 20:23:21 by yantoine #+# #+# */
|
||||
/* Updated: 2025/02/14 20:48:49 by yantoine ### ########.fr */
|
||||
/* Updated: 2025/02/17 21:34:12 by yantoine ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "miniRT.h"
|
||||
|
||||
|
||||
inline char **get_tokens_secure(t_scene scene, const int numObject, const int numObjectMax, const int supposed_nb_token)
|
||||
char **get_tokens_secure(t_scene scene, const int numObject, const int numObjectMax, const int supposed_nb_token)
|
||||
{
|
||||
const int result_if_max = check_if_max(scene, numObject, numObjectMax);
|
||||
const char **tokens = ft_split(scene.line_if_exit, ' ');
|
||||
char **tokens;
|
||||
|
||||
check_if_max(scene, numObject, numObjectMax);
|
||||
tokens = ft_split(scene.line_if_exit, ' ');
|
||||
if (!check_tokens(tokens, supposed_nb_token))
|
||||
{
|
||||
ft_free_array(tokens);
|
||||
ft_putendl_fd("error", 2);
|
||||
free(scene.line_if_exit);
|
||||
close(scene.fd);
|
||||
close(scene.fd_if_exit);
|
||||
exit(1);
|
||||
}
|
||||
return (tokens);
|
||||
|
||||
+4
-3
@@ -6,7 +6,7 @@
|
||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/15 19:16:01 by yantoine #+# #+# */
|
||||
/* Updated: 2025/02/15 19:36:24 by yantoine ### ########.fr */
|
||||
/* Updated: 2025/02/17 21:35:12 by yantoine ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -28,9 +28,10 @@ static inline int range_is_ok(char **token_vector)
|
||||
|
||||
t_vec3 parse_vector(const char *token, t_scene scene)
|
||||
{
|
||||
const char **token_vector = ft_split(token, ',');
|
||||
char **token_vector;
|
||||
t_vec3 vector;
|
||||
|
||||
token_vector = ft_split(token, ',');
|
||||
if (!check_tokens(token_vector, 3) || !range_is_ok(token_vector))
|
||||
{
|
||||
ft_free_array(token_vector);
|
||||
@@ -43,7 +44,7 @@ t_vec3 parse_vector(const char *token, t_scene scene)
|
||||
vector.x = ft_atof(token_vector[0]);
|
||||
vector.y = ft_atof(token_vector[1]);
|
||||
vector.z = ft_atof(token_vector[2]);
|
||||
ft_free_array(tokens_vector);
|
||||
ft_free_array(token_vector);
|
||||
return (vector);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,681 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* raytracer_formatted.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/13 19:56:17 by yantoine #+# #+# */
|
||||
/* Updated: 2025/02/17 17:18:17 by yantoine ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
/*
|
||||
*Raytracer interactif en un seul fichier C avec lecture d'un fichier de configuration (.rt)
|
||||
*
|
||||
*Compilation (exemple sous Linux) :
|
||||
* gcc raytracer.c -lSDL2 -lm -O2 -o raytracer
|
||||
*
|
||||
*Utilisation :
|
||||
* ./raytracer config.rt
|
||||
*Si aucun fichier n'est passé en argument, une scène par défaut est utilisée.
|
||||
*/
|
||||
|
||||
|
||||
// Ambient et caméra (JE GARDE POUR FAIRE LA FONCTION UN EXEMPLE)
|
||||
|
||||
float ambient_ratio = 0.1f;
|
||||
t_vec3 ambient_color = {0.1f, 0.1f, 0.1f};
|
||||
t_vec3 camPos = {0.0f, 0.0f, 0.0f};
|
||||
t_vec3 camDir = {0.0f, 0.0f, -1.0f};
|
||||
float fov = 90.0f;
|
||||
float yaw = 0.0f;// vue de gauche a droite
|
||||
float pitch = 0.0f; // vue de haut en bas en radians
|
||||
|
||||
// ----- Parsing du fichier de configuration -----
|
||||
void load_config(const char *filename)
|
||||
{
|
||||
//---- Jlaisse pour contextualiser -----
|
||||
while (fgets(line, sizeof(line), fp))
|
||||
{
|
||||
// Ignore les lignes vides ou commençant par #
|
||||
if (line[0] == '\n' || line[0] == '#')
|
||||
continue ;
|
||||
// Ambient lighting: A ratio R,G,B
|
||||
if (line[0] == 'A')
|
||||
{
|
||||
int r, g, b;
|
||||
if (sscanf(line, "A %f %d,%d,%d", &ratio, &r, &g, &b) == 4)
|
||||
{
|
||||
ambient_ratio = ratio;
|
||||
ambient_color = (t_vec3){r / 255.0f, g / 255.0f, b / 255.0f};
|
||||
printf("Ambiance : ratio=%.2f, color=(%d,%d,%d)\n", ratio, r, g,
|
||||
b);
|
||||
}
|
||||
}
|
||||
// Camera: C pos_x,pos_y,pos_z norm_x,norm_y,norm_z FOV
|
||||
else if (line[0] == 'C')
|
||||
{
|
||||
float px, py, pz, nx, ny, nz, f;
|
||||
if (sscanf(line, "C %f,%f,%f %f,%f,%f %f", &px, &py, &pz, &nx, &ny,
|
||||
&nz, &f) == 7)
|
||||
{
|
||||
camPos = (t_vec3){px, py, pz};
|
||||
camDir = vec3_normalize((t_vec3){nx, ny, nz});
|
||||
fov = f;
|
||||
yaw = atan2f(camDir.x, -camDir.z);
|
||||
pitch = asinf(camDir.y);
|
||||
printf("Camera : pos=(%.2f,%.2f,%.2f), dir=(%.2f,%.2f,%.2f),
|
||||
fov=%.2f\n", px, py, pz, nx, ny, nz, f);
|
||||
}
|
||||
}
|
||||
// Light: L pos_x,pos_y,pos_z brightness R,G,B
|
||||
else if (line[0] == 'L')
|
||||
{
|
||||
float lx, ly, lz, bright;
|
||||
int r, g, b;
|
||||
if (sscanf(line, "L %f,%f,%f %f %d,%d,%d", &lx, &ly, &lz, &bright,
|
||||
&r, &g, &b) == 7)
|
||||
{
|
||||
if (numLights < MAX_LIGHTS)
|
||||
{
|
||||
lights[numLights].pos = (t_vec3){lx, ly, lz};
|
||||
lights[numLights].brightness = bright;
|
||||
lights[numLights].color = (t_vec3){r / 255.0f, g / 255.0f, b
|
||||
/ 255.0f};
|
||||
numLights++;
|
||||
printf("Light : pos=(%.2f,%.2f,%.2f), bright=%.2f,
|
||||
color=(%d,%d,%d)\n", lx, ly, lz, bright, r, g, b);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Sphere: sp pos_x,pos_y,pos_z diameter R,G,B
|
||||
else if (strncmp(line, "sp", 2) == 0)
|
||||
{
|
||||
float cx, cy, cz, diam;
|
||||
int r, g, b;
|
||||
if (sscanf(line, "sp %f,%f,%f %f %d,%d,%d", &cx, &cy, &cz, &diam,
|
||||
&r, &g, &b) == 7)
|
||||
{
|
||||
if (numSpheres < MAX_SPHERES)
|
||||
{
|
||||
spheres[numSpheres].center = (t_vec3){cx, cy, cz};
|
||||
spheres[numSpheres].radius = diam / 2.0f;
|
||||
spheres[numSpheres].color = (t_vec3){r / 255.0f, g / 255.0f,
|
||||
b / 255.0f};
|
||||
numSpheres++;
|
||||
printf("Sphere : center=(%.2f,%.2f,%.2f), diam=%.2f,
|
||||
color=(%d,%d,%d)\n", cx, cy, cz, diam, r, g, b);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Plane: pl pos_x,pos_y,pos_z norm_x,norm_y,norm_z R,G,B
|
||||
else if (strncmp(line, "pl", 2) == 0)
|
||||
{
|
||||
float px, py, pz, nx, ny, nz;
|
||||
int r, g, b;
|
||||
// Correction : nous attendons 9 éléments (3 + 3 + 3)
|
||||
if (sscanf(line, "pl %f,%f,%f %f,%f,%f %d,%d,%d", &px, &py, &pz,
|
||||
&nx, &ny, &nz, &r, &g, &b) == 9)
|
||||
{
|
||||
if (numPlanes < MAX_PLANES)
|
||||
{
|
||||
planes[numPlanes].point = (t_vec3){px, py, pz};
|
||||
planes[numPlanes].normal = vec3_normalize((t_vec3){nx, ny,
|
||||
nz});
|
||||
planes[numPlanes].color = (t_vec3){r / 255.0f, g / 255.0f, b
|
||||
/ 255.0f};
|
||||
numPlanes++;
|
||||
printf("Plane : point=(%.2f,%.2f,%.2f),
|
||||
normal=(%.2f,%.2f,%.2f), color=(%d,%d,%d)\n", px, py,
|
||||
pz, nx, ny, nz, r, g, b);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Cylinder: cy pos_x,pos_y,pos_z axis_x,axis_y,axis_z diameter height R,G,B
|
||||
else if (strncmp(line, "cy", 2) == 0)
|
||||
{
|
||||
float cx, cy, cz, ax, ay, az, diam, height;
|
||||
int r, g, b;
|
||||
// Correction : nous attendons 11 éléments (3 + 3 + 1 + 1 + 3)
|
||||
if (sscanf(line, "cy %f,%f,%f %f,%f,%f %f %f %d,%d,%d", &cx, &cy,
|
||||
&cz, &ax, &ay, &az, &diam, &height, &r, &g, &b) == 11)
|
||||
{
|
||||
if (numCylinders < MAX_CYLINDERS)
|
||||
{
|
||||
cylinders[numCylinders].center = (t_vec3){cx, cy, cz};
|
||||
cylinders[numCylinders].axis = vec3_normalize((t_vec3){ax,
|
||||
ay, az});
|
||||
cylinders[numCylinders].radius = diam / 2.0f;
|
||||
cylinders[numCylinders].height = height;
|
||||
cylinders[numCylinders].color = (t_vec3){r / 255.0f, g
|
||||
/ 255.0f, b / 255.0f};
|
||||
numCylinders++;
|
||||
printf("Cylinder : center=(%.2f,%.2f,%.2f),
|
||||
axis=(%.2f,%.2f,%.2f), diam=%.2f, height=%.2f,
|
||||
color=(%d,%d,%d)\n", cx, cy, cz, ax, ay, az, diam,
|
||||
height, r, g, b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
// ----- Fonctions d'intersection -----
|
||||
float intersectSphere(Ray ray, Sphere s, t_vec3 *hitNormal)
|
||||
{
|
||||
|
||||
oc = vec3_sub(ray.origin, s.center);
|
||||
a = vec3_dot(ray.dir, ray.dir);
|
||||
b = 2.0f * vec3_dot(oc, ray.dir);
|
||||
c = vec3_dot(oc, oc) - s.radius * s.radius;
|
||||
disc = b * b - 4 * a * c;
|
||||
if (disc < 0)
|
||||
return (-1);
|
||||
sqrtDisc = sqrtf(disc);
|
||||
t0 = (-b - sqrtDisc) / (2 * a);
|
||||
t1 = (-b + sqrtDisc) / (2 * a);
|
||||
t = (t0 > 1e-3f) ? t0 : t1;
|
||||
if (t < 1e-3f)
|
||||
return (-1);
|
||||
hitPoint = vec3_add(ray.origin, vec3_scale(ray.dir, t));
|
||||
*hitNormal = vec3_normalize(vec3_sub(hitPoint, s.center));
|
||||
return (t);
|
||||
}
|
||||
|
||||
float intersectPlane(Ray ray, Plane p, t_vec3 *hitNormal)
|
||||
{
|
||||
float denom;
|
||||
float t;
|
||||
|
||||
denom = vec3_dot(p.normal, ray.dir);
|
||||
if (fabs(denom) < 1e-6f)
|
||||
return (-1);
|
||||
t = vec3_dot(vec3_sub(p.point, ray.origin), p.normal) / denom;
|
||||
if (t < 1e-3f)
|
||||
return (-1);
|
||||
*hitNormal = p.normal;
|
||||
return (t);
|
||||
}
|
||||
|
||||
// Intersection d'un cylindre orienté arbitrairement (version simplifiée)
|
||||
float intersectCylinder(Ray ray, Cylinder cy, t_vec3 *hitNormal)
|
||||
{
|
||||
t_vec3 d;
|
||||
t_vec3 oc;
|
||||
t_vec3 v;
|
||||
float d_dot_v;
|
||||
float oc_dot_v;
|
||||
t_vec3 d_perp;
|
||||
t_vec3 oc_perp;
|
||||
float a;
|
||||
float b;
|
||||
float c;
|
||||
float disc;
|
||||
float sqrtDisc;
|
||||
float t0;
|
||||
float t1;
|
||||
float t_side;
|
||||
float y;
|
||||
float y;
|
||||
float t_cap;
|
||||
float t_bot;
|
||||
t_vec3 p;
|
||||
t_vec3 cp;
|
||||
float dist;
|
||||
float t_top;
|
||||
t_vec3 p;
|
||||
t_vec3 cp;
|
||||
float dist;
|
||||
float t_final;
|
||||
t_vec3 hitPoint;
|
||||
t_vec3 cp;
|
||||
float proj;
|
||||
t_vec3 n;
|
||||
|
||||
d = ray.dir;
|
||||
oc = vec3_sub(ray.origin, cy.center);
|
||||
v = cy.axis;
|
||||
d_dot_v = vec3_dot(d, v);
|
||||
oc_dot_v = vec3_dot(oc, v);
|
||||
d_perp = vec3_sub(d, vec3_scale(v, d_dot_v));
|
||||
oc_perp = vec3_sub(oc, vec3_scale(v, oc_dot_v));
|
||||
a = vec3_dot(d_perp, d_perp);
|
||||
b = 2 * vec3_dot(d_perp, oc_perp);
|
||||
c = vec3_dot(oc_perp, oc_perp) - cy.radius * cy.radius;
|
||||
disc = b * b - 4 * a * c;
|
||||
if (disc < 0)
|
||||
return (-1);
|
||||
sqrtDisc = sqrtf(disc);
|
||||
t0 = (-b - sqrtDisc) / (2 * a);
|
||||
t1 = (-b + sqrtDisc) / (2 * a);
|
||||
t_side = -1;
|
||||
if (t0 > 1e-3f)
|
||||
{
|
||||
y = oc_dot_v + t0 * d_dot_v;
|
||||
if (fabs(y) <= cy.height / 2.0f)
|
||||
t_side = t0;
|
||||
}
|
||||
if (t_side < 0 && t1 > 1e-3f)
|
||||
{
|
||||
y = oc_dot_v + t1 * d_dot_v;
|
||||
if (fabs(y) <= cy.height / 2.0f)
|
||||
t_side = t1;
|
||||
}
|
||||
t_cap = -1;
|
||||
if (fabs(d_dot_v) > 1e-6f)
|
||||
{
|
||||
t_bot = ((-cy.height / 2.0f) - oc_dot_v) / d_dot_v;
|
||||
if (t_bot > 1e-3f)
|
||||
{
|
||||
p = vec3_add(ray.origin, vec3_scale(d, t_bot));
|
||||
cp = vec3_sub(p, cy.center);
|
||||
dist = vec3_length(vec3_sub(cp, vec3_scale(v, vec3_dot(cp, v))));
|
||||
if (dist <= cy.radius)
|
||||
t_cap = t_bot;
|
||||
}
|
||||
t_top = ((cy.height / 2.0f) - oc_dot_v) / d_dot_v;
|
||||
if (t_top > 1e-3f)
|
||||
{
|
||||
p = vec3_add(ray.origin, vec3_scale(d, t_top));
|
||||
cp = vec3_sub(p, cy.center);
|
||||
dist = vec3_length(vec3_sub(cp, vec3_scale(v, vec3_dot(cp, v))));
|
||||
if (dist <= cy.radius && (t_cap < 0 || t_top < t_cap))
|
||||
t_cap = t_top;
|
||||
}
|
||||
}
|
||||
t_final = -1;
|
||||
if (t_side > 1e-3f && t_cap > 1e-3f)
|
||||
t_final = (t_side < t_cap) ? t_side : t_cap;
|
||||
else if (t_side > 1e-3f)
|
||||
t_final = t_side;
|
||||
else
|
||||
t_final = t_cap;
|
||||
if (t_final < 1e-3f)
|
||||
return (-1);
|
||||
hitPoint = vec3_add(ray.origin, vec3_scale(d, t_final));
|
||||
cp = vec3_sub(hitPoint, cy.center);
|
||||
proj = vec3_dot(cp, v);
|
||||
if (fabs(proj) < cy.height / 2.0f - 1e-3f)
|
||||
{
|
||||
n = vec3_sub(cp, vec3_scale(v, proj));
|
||||
*hitNormal = vec3_normalize(n);
|
||||
}
|
||||
else
|
||||
{
|
||||
*hitNormal = (proj > 0) ? v : vec3_scale(v, -1);
|
||||
}
|
||||
return t_final;
|
||||
}
|
||||
|
||||
// ----- Test d'ombre -----
|
||||
bool isInShadow(t_vec3 hitPoint, t_vec3 lightPos)
|
||||
{
|
||||
t_vec3 toLight;
|
||||
float maxT;
|
||||
t_vec3 L;
|
||||
const float epsilon = 1e-3f;
|
||||
Ray shadowRay;
|
||||
t_vec3 dummy;
|
||||
float t;
|
||||
|
||||
toLight = vec3_sub(lightPos, hitPoint);
|
||||
maxT = vec3_length(toLight);
|
||||
L = vec3_normalize(toLight);
|
||||
shadowRay = {vec3_add(hitPoint, vec3_scale(L, epsilon)), L};
|
||||
for (int i = 0; i < numSpheres; i++)
|
||||
{
|
||||
t = intersectSphere(shadowRay, spheres[i], &dummy);
|
||||
if (t > epsilon && t < maxT)
|
||||
return true;
|
||||
}
|
||||
for (int i = 0; i < numPlanes; i++)
|
||||
{
|
||||
t = intersectPlane(shadowRay, planes[i], &dummy);
|
||||
if (t > epsilon && t < maxT)
|
||||
return true;
|
||||
}
|
||||
for (int i = 0; i < numCylinders; i++)
|
||||
{
|
||||
t = intersectCylinder(shadowRay, cylinders[i], &dummy);
|
||||
if (t > epsilon && t < maxT)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ----- Lancer de rayon (ray tracing) -----
|
||||
t_vec3 trace(Ray ray)
|
||||
{
|
||||
float tMin;
|
||||
t_vec3 hitNormal;
|
||||
t_vec3 objColor;
|
||||
bool hitSomething;
|
||||
float t;
|
||||
t_vec3 n;
|
||||
t_vec3 n;
|
||||
t_vec3 n;
|
||||
t_vec3 hitPoint;
|
||||
t_vec3 finalColor;
|
||||
Light light;
|
||||
t_vec3 L;
|
||||
float diff;
|
||||
t_vec3 viewDir;
|
||||
t_vec3 halfDir;
|
||||
float spec;
|
||||
|
||||
tMin = 1e9;
|
||||
hitNormal = {0, 0, 0};
|
||||
objColor = {0, 0, 0};
|
||||
hitSomething = false;
|
||||
for (int i = 0; i < numSpheres; i++)
|
||||
{
|
||||
t = intersectSphere(ray, spheres[i], &n);
|
||||
if (t > 1e-3f && t < tMin)
|
||||
{
|
||||
tMin = t;
|
||||
hitNormal = n;
|
||||
objColor = spheres[i].color;
|
||||
hitSomething = true;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < numPlanes; i++)
|
||||
{
|
||||
t = intersectPlane(ray, planes[i], &n);
|
||||
if (t > 1e-3f && t < tMin)
|
||||
{
|
||||
tMin = t;
|
||||
hitNormal = n;
|
||||
objColor = planes[i].color;
|
||||
hitSomething = true;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < numCylinders; i++)
|
||||
{
|
||||
t = intersectCylinder(ray, cylinders[i], &n);
|
||||
if (t > 1e-3f && t < tMin)
|
||||
{
|
||||
tMin = t;
|
||||
hitNormal = n;
|
||||
objColor = cylinders[i].color;
|
||||
hitSomething = true;
|
||||
}
|
||||
}
|
||||
if (hitSomething)
|
||||
{
|
||||
hitPoint = vec3_add(ray.origin, vec3_scale(ray.dir, tMin));
|
||||
finalColor = vec3_scale(objColor, ambient_ratio);
|
||||
for (int i = 0; i < numLights; i++)
|
||||
{
|
||||
light = lights[i];
|
||||
L = vec3_normalize(vec3_sub(light.pos, hitPoint));
|
||||
if (isInShadow(hitPoint, light.pos))
|
||||
continue ;
|
||||
diff = fmaxf(0.0f, vec3_dot(hitNormal, L));
|
||||
viewDir = vec3_normalize(vec3_sub(camPos, hitPoint));
|
||||
halfDir = vec3_normalize(vec3_add(L, viewDir));
|
||||
spec = powf(fmaxf(0.0f, vec3_dot(hitNormal, halfDir)), 32.0f);
|
||||
finalColor = vec3_add(finalColor, vec3_scale(vec3_mul(objColor,
|
||||
light.color), diff * light.brightness));
|
||||
finalColor = vec3_add(finalColor, vec3_scale((t_vec3){1, 1, 1}, spec
|
||||
* light.brightness));
|
||||
}
|
||||
if (finalColor.x > 1.0f)
|
||||
finalColor.x = 1.0f;
|
||||
if (finalColor.y > 1.0f)
|
||||
finalColor.y = 1.0f;
|
||||
if (finalColor.z > 1.0f)
|
||||
finalColor.z = 1.0f;
|
||||
return finalColor;
|
||||
}
|
||||
return (t_vec3){0.2f, 0.7f, 1.0f}; // Fond (ciel)
|
||||
}
|
||||
|
||||
// ----- Main -----
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SDL_Window *window;
|
||||
SDL_Renderer *renderer;
|
||||
SDL_Texture *texture;
|
||||
Uint32 *pixels;
|
||||
bool running;
|
||||
SDL_Event event;
|
||||
const float moveSpeed = 0.5f;
|
||||
const float rotSpeed = 0.03f;
|
||||
const float mouseSensitivity = 0.002f;
|
||||
bool key_w = false, key_s = false, key_a = false, key_d;
|
||||
bool key_left = false, key_right = false, key_up = false,
|
||||
key_down;
|
||||
t_vec3 right;
|
||||
t_vec3 camUp;
|
||||
float ndc_x;
|
||||
float ndc_y;
|
||||
float aspect;
|
||||
float scale;
|
||||
float screen_x;
|
||||
float screen_y;
|
||||
t_vec3 rayDir;
|
||||
Ray ray;
|
||||
t_vec3 color;
|
||||
Uint8 r;
|
||||
Uint8 g;
|
||||
Uint8 b;
|
||||
|
||||
// Chargement de la config si un fichier est passé en argument
|
||||
if (argc > 1)
|
||||
load_config(argv[1]);
|
||||
// Scène par défaut si aucune config n'a été chargée
|
||||
if (numSpheres == 0 && numPlanes == 0 && numCylinders == 0
|
||||
&& numLights == 0)
|
||||
{
|
||||
spheres[0].center = (t_vec3){0, 0, 0};
|
||||
spheres[0].radius = 1.0f;
|
||||
spheres[0].color = (t_vec3){1, 0, 0};
|
||||
numSpheres = 1;
|
||||
planes[0].point = (t_vec3){0, -5, 0};
|
||||
planes[0].normal = (t_vec3){0, 1, 0};
|
||||
planes[0].color = (t_vec3){0, 1, 0};
|
||||
numPlanes = 1;
|
||||
cylinders[0].center = (t_vec3){10, 0, 0};
|
||||
cylinders[0].axis = (t_vec3){0, 1, 0};
|
||||
cylinders[0].radius = 4.0f;
|
||||
cylinders[0].height = 20.0f;
|
||||
cylinders[0].color = (t_vec3){0, 0, 1};
|
||||
numCylinders = 1;
|
||||
lights[0].pos = (t_vec3){0, 50, 20};
|
||||
lights[0].brightness = 1.0f;
|
||||
lights[0].color = (t_vec3){1, 1, 1};
|
||||
numLights = 1;
|
||||
ambient_ratio = 0.3f;
|
||||
ambient_color = (t_vec3){1, 1, 1};
|
||||
camPos = (t_vec3){0, 0, 20};
|
||||
camDir = vec3_normalize((t_vec3){0, 0, -1});
|
||||
fov = 70.0f;
|
||||
yaw = atan2f(camDir.x, -camDir.z);
|
||||
pitch = asinf(camDir.y);
|
||||
}
|
||||
if (SDL_Init(SDL_INIT_VIDEO) < 0)
|
||||
{
|
||||
fprintf(stderr, "Erreur SDL_Init: %s\n", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
window = SDL_CreateWindow("Raytracer interactif", SDL_WINDOWPOS_CENTERED,
|
||||
SDL_WINDOWPOS_CENTERED, WIDTH * 2, HEIGHT * 2, SDL_WINDOW_SHOWN);
|
||||
if (!window)
|
||||
{
|
||||
fprintf(stderr, "Erreur SDL_CreateWindow: %s\n", SDL_GetError());
|
||||
SDL_Quit();
|
||||
return 1;
|
||||
}
|
||||
SDL_SetRelativeMouseMode(SDL_TRUE);
|
||||
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
|
||||
if (!renderer)
|
||||
{
|
||||
fprintf(stderr, "Erreur SDL_CreateRenderer: %s\n", SDL_GetError());
|
||||
SDL_DestroyWindow(window);
|
||||
SDL_Quit();
|
||||
return 1;
|
||||
}
|
||||
texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888,
|
||||
SDL_TEXTUREACCESS_STREAMING, WIDTH, HEIGHT);
|
||||
if (!texture)
|
||||
{
|
||||
fprintf(stderr, "Erreur SDL_CreateTexture: %s\n", SDL_GetError());
|
||||
SDL_DestroyRenderer(renderer);
|
||||
SDL_DestroyWindow(window);
|
||||
SDL_Quit();
|
||||
return 1;
|
||||
}
|
||||
pixels = malloc(WIDTH * HEIGHT * sizeof(Uint32));
|
||||
if (!pixels)
|
||||
{
|
||||
fprintf(stderr, "Erreur d'allocation mémoire.\n");
|
||||
SDL_DestroyTexture(texture);
|
||||
SDL_DestroyRenderer(renderer);
|
||||
SDL_DestroyWindow(window);
|
||||
SDL_Quit();
|
||||
return 1;
|
||||
}
|
||||
running = true;
|
||||
key_w = false, key_s = false, key_a = false, key_d = false;
|
||||
key_left = false, key_right = false, key_up = false, key_down = false;
|
||||
while (running)
|
||||
{
|
||||
while (SDL_PollEvent(&event))
|
||||
{
|
||||
if (event.type == SDL_QUIT)
|
||||
running = false;
|
||||
else if (event.type == SDL_KEYDOWN)
|
||||
{
|
||||
switch (event.key.keysym.sym)
|
||||
{
|
||||
case SDLK_ESCAPE:
|
||||
running = false;
|
||||
break ;
|
||||
case SDLK_w:
|
||||
key_w = true;
|
||||
break ;
|
||||
case SDLK_s:
|
||||
key_s = true;
|
||||
break ;
|
||||
case SDLK_a:
|
||||
key_a = true;
|
||||
break ;
|
||||
case SDLK_d:
|
||||
key_d = true;
|
||||
break ;
|
||||
case SDLK_LEFT:
|
||||
key_left = true;
|
||||
break ;
|
||||
case SDLK_RIGHT:
|
||||
key_right = true;
|
||||
break ;
|
||||
case SDLK_UP:
|
||||
key_up = true;
|
||||
break ;
|
||||
case SDLK_DOWN:
|
||||
key_down = true;
|
||||
break ;
|
||||
default:
|
||||
break ;
|
||||
}
|
||||
}
|
||||
else if (event.type == SDL_KEYUP)
|
||||
{
|
||||
switch (event.key.keysym.sym)
|
||||
{
|
||||
case SDLK_w:
|
||||
key_w = false;
|
||||
break ;
|
||||
case SDLK_s:
|
||||
key_s = false;
|
||||
break ;
|
||||
case SDLK_a:
|
||||
key_a = false;
|
||||
break ;
|
||||
case SDLK_d:
|
||||
key_d = false;
|
||||
break ;
|
||||
case SDLK_LEFT:
|
||||
key_left = false;
|
||||
break ;
|
||||
case SDLK_RIGHT:
|
||||
key_right = false;
|
||||
break ;
|
||||
case SDLK_UP:
|
||||
key_up = false;
|
||||
break ;
|
||||
case SDLK_DOWN:
|
||||
key_down = false;
|
||||
break ;
|
||||
default:
|
||||
break ;
|
||||
}
|
||||
}
|
||||
else if (event.type == SDL_MOUSEMOTION)
|
||||
{
|
||||
yaw += event.motion.xrel * mouseSensitivity;
|
||||
pitch -= event.motion.yrel * mouseSensitivity;
|
||||
}
|
||||
}
|
||||
if (key_left)
|
||||
yaw -= rotSpeed;
|
||||
if (key_right)
|
||||
yaw += rotSpeed;
|
||||
if (key_up)
|
||||
pitch += rotSpeed;
|
||||
if (key_down)
|
||||
pitch -= rotSpeed;
|
||||
if (pitch > 1.57f - 0.01f)
|
||||
pitch = 1.57f - 0.01f;
|
||||
if (pitch < -1.57f + 0.01f)
|
||||
pitch = -1.57f + 0.01f;
|
||||
camDir.x = cosf(pitch) * sinf(yaw);
|
||||
camDir.y = sinf(pitch);
|
||||
camDir.z = -cosf(pitch) * cosf(yaw);
|
||||
camDir = vec3_normalize(camDir);
|
||||
right = {cosf(yaw), 0, sinf(yaw)};
|
||||
right = vec3_normalize(right);
|
||||
camUp = vec3_normalize(vec3_cross(right, camDir));
|
||||
if (key_w)
|
||||
camPos = vec3_add(camPos, vec3_scale(camDir, moveSpeed));
|
||||
if (key_s)
|
||||
camPos = vec3_sub(camPos, vec3_scale(camDir, moveSpeed));
|
||||
if (key_a)
|
||||
camPos = vec3_sub(camPos, vec3_scale(right, moveSpeed));
|
||||
if (key_d)
|
||||
camPos = vec3_add(camPos, vec3_scale(right, moveSpeed));
|
||||
for (int y = 0; y < HEIGHT; y++)
|
||||
{
|
||||
for (int x = 0; x < WIDTH; x++)
|
||||
{
|
||||
ndc_x = (x + 0.5f) / WIDTH;
|
||||
ndc_y = (y + 0.5f) / HEIGHT;
|
||||
aspect = (float)WIDTH / HEIGHT;
|
||||
scale = tanf((fov * 0.5f) * (M_PI / 180.0f));
|
||||
screen_x = (2 * ndc_x - 1) * aspect * scale;
|
||||
screen_y = (1 - 2 * ndc_y) * scale;
|
||||
rayDir = vec3_add(camDir, vec3_add(vec3_scale(right, screen_x),
|
||||
vec3_scale(camUp, screen_y)));
|
||||
rayDir = vec3_normalize(rayDir);
|
||||
ray = {camPos, rayDir};
|
||||
color = trace(ray);
|
||||
r = (Uint8)(fminf(color.x, 1.0f) * 255);
|
||||
g = (Uint8)(fminf(color.y, 1.0f) * 255);
|
||||
b = (Uint8)(fminf(color.z, 1.0f) * 255);
|
||||
pixels[y * WIDTH + x] = (255 << 24) | (r << 16) | (g << 8) | b;
|
||||
}
|
||||
}
|
||||
SDL_UpdateTexture(texture, NULL, pixels, WIDTH * sizeof(Uint32));
|
||||
SDL_RenderClear(renderer);
|
||||
SDL_RenderCopy(renderer, texture, NULL, NULL);
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
free(pixels);
|
||||
SDL_DestroyTexture(texture);
|
||||
SDL_DestroyRenderer(renderer);
|
||||
SDL_DestroyWindow(window);
|
||||
SDL_Quit();
|
||||
return 0;
|
||||
}
|
||||
@@ -6,15 +6,18 @@
|
||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/17 19:24:30 by yantoine #+# #+# */
|
||||
/* Updated: 2025/02/17 19:52:46 by yantoine ### ########.fr */
|
||||
/* Updated: 2025/02/17 21:54:39 by yantoine ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "miniRT.h"
|
||||
|
||||
static void render_pixel(t_app *app, int x, int y)
|
||||
static void render_pixel(t_app *app, int x, int y, t_scene scene)
|
||||
{
|
||||
t_calc calc;
|
||||
unsigned char r;
|
||||
unsigned char g;
|
||||
unsigned char b;
|
||||
|
||||
calc.ndc_x = (x + 0.5f) / app->win_width;
|
||||
calc.ndc_y = (y + 0.5f) / app->win_height;
|
||||
@@ -28,14 +31,14 @@ static void render_pixel(t_app *app, int x, int y)
|
||||
calc.ray_dir = vec3_normalize(calc.ray_dir);
|
||||
calc.ray.origin = app->cam_pos;
|
||||
calc.ray.dir = calc.ray_dir;
|
||||
calc.color = trace(calc.ray);
|
||||
calc.r = (unsigned char)(fminf(calc.color.x, 1.0f) * 255);
|
||||
calc.g = (unsigned char)(fminf(calc.color.y, 1.0f) * 255);
|
||||
calc.b = (unsigned char)(fminf(calc.color.z, 1.0f) * 255);
|
||||
app->pixels[y * app->win_width + x] = (255 << 24) | (calc.r << 16) | (calc.g << 8) | calc.b;
|
||||
calc.color = trace(calc.ray, scene);
|
||||
r = (unsigned char)(fminf(calc.color.x, 1.0f) * 255);
|
||||
g = (unsigned char)(fminf(calc.color.y, 1.0f) * 255);
|
||||
b = (unsigned char)(fminf(calc.color.z, 1.0f) * 255);
|
||||
app->pixels[y * app->win_width + x] = (255 << 24) | (r << 16) | (g << 8) | b;
|
||||
}
|
||||
|
||||
void render_scene(t_app *app)
|
||||
void render_scene(t_app *app, t_scene scene)
|
||||
{
|
||||
int y;
|
||||
int x;
|
||||
@@ -46,7 +49,7 @@ void render_scene(t_app *app)
|
||||
x = 0;
|
||||
while (x < app->win_width)
|
||||
{
|
||||
render_pixel(app, x, y);
|
||||
render_pixel(app, x, y, scene);
|
||||
x++;
|
||||
}
|
||||
y++;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/13 21:23:32 by yantoine #+# #+# */
|
||||
/* Updated: 2025/02/13 21:26:52 by yantoine ### ########.fr */
|
||||
/* Updated: 2025/02/17 21:39:27 by yantoine ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -16,6 +16,6 @@ t_scene create_scene(void)
|
||||
{
|
||||
t_scene scene;
|
||||
|
||||
scene = ft_bzero(sizeof(t_scene));
|
||||
ft_bzero(&scene, sizeof(t_scene));
|
||||
return (scene);
|
||||
}
|
||||
|
||||
@@ -6,19 +6,19 @@
|
||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/17 18:58:42 by yantoine #+# #+# */
|
||||
/* Updated: 2025/02/17 19:03:01 by yantoine ### ########.fr */
|
||||
/* Updated: 2025/02/17 21:44:07 by yantoine ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "miniRT.h"
|
||||
|
||||
// Vérifie les intersections avec les sphères
|
||||
static bool checkShadowSphere(const Ray shadowRay, float maxT, float epsilon) {
|
||||
static bool checkShadowSphere(const t_ray shadowRay, float maxT, float epsilon, t_scene scene) {
|
||||
int i = 0;
|
||||
t_vec3 dummy;
|
||||
float t;
|
||||
while (i < numSpheres) {
|
||||
t = intersectSphere(shadowRay, spheres[i], &dummy);
|
||||
while (i < scene.numSpheres) {
|
||||
t = intersectSphere(shadowRay, scene.spheres[i], &dummy);
|
||||
if (t > epsilon && t < maxT)
|
||||
return true;
|
||||
i++;
|
||||
@@ -27,12 +27,12 @@ static bool checkShadowSphere(const Ray shadowRay, float maxT, float epsilon) {
|
||||
}
|
||||
|
||||
// Vérifie les intersections avec les plans
|
||||
static bool checkShadowPlane(const Ray shadowRay, float maxT, float epsilon) {
|
||||
static bool checkShadowPlane(const t_ray shadowRay, float maxT, float epsilon, t_scene scene) {
|
||||
int i = 0;
|
||||
t_vec3 dummy;
|
||||
float t;
|
||||
while (i < numPlanes) {
|
||||
t = intersectPlane(shadowRay, planes[i], &dummy);
|
||||
while (i < scene.numPlanes) {
|
||||
t = intersectPlane(shadowRay, scene.planes[i], &dummy);
|
||||
if (t > epsilon && t < maxT)
|
||||
return true;
|
||||
i++;
|
||||
@@ -41,12 +41,12 @@ static bool checkShadowPlane(const Ray shadowRay, float maxT, float epsilon) {
|
||||
}
|
||||
|
||||
// Vérifie les intersections avec les cylindres
|
||||
static bool checkShadowCylinder(const Ray shadowRay, float maxT, float epsilon) {
|
||||
static bool checkShadowCylinder(const t_ray shadowRay, float maxT, float epsilon, t_scene scene) {
|
||||
int i = 0;
|
||||
t_vec3 dummy;
|
||||
float t;
|
||||
while (i < numCylinders) {
|
||||
t = intersectCylinder(shadowRay, cylinders[i], &dummy);
|
||||
while (i < scene.numCylinders) {
|
||||
t = intersectCylinder(shadowRay, scene.cylinders[i], &dummy);
|
||||
if (t > epsilon && t < maxT)
|
||||
return true;
|
||||
i++;
|
||||
@@ -55,20 +55,20 @@ static bool checkShadowCylinder(const Ray shadowRay, float maxT, float epsilon)
|
||||
}
|
||||
|
||||
// Fonction principale qui détermine si le point est dans l'ombre
|
||||
bool isInShadow(t_vec3 hitPoint, t_vec3 lightPos) {
|
||||
bool isInShadow(t_vec3 hitPoint, t_vec3 lightPos, t_scene scene) {
|
||||
const float epsilon = 1e-3f;
|
||||
t_vec3 toLight = vec3_sub(lightPos, hitPoint);
|
||||
float maxT = vec3_length(toLight);
|
||||
t_vec3 L = vec3_normalize(toLight);
|
||||
Ray shadowRay;
|
||||
t_ray shadowRay;
|
||||
shadowRay.origin = vec3_add(hitPoint, vec3_scale(L, epsilon));
|
||||
shadowRay.direction = L;
|
||||
shadowRay.dir = L;
|
||||
|
||||
if (checkShadowSphere(shadowRay, maxT, epsilon))
|
||||
if (checkShadowSphere(shadowRay, maxT, epsilon, scene))
|
||||
return true;
|
||||
if (checkShadowPlane(shadowRay, maxT, epsilon))
|
||||
if (checkShadowPlane(shadowRay, maxT, epsilon, scene))
|
||||
return true;
|
||||
if (checkShadowCylinder(shadowRay, maxT, epsilon))
|
||||
if (checkShadowCylinder(shadowRay, maxT, epsilon, scene))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
@@ -35,6 +35,12 @@
|
||||
!_TAG_KIND_DESCRIPTION!C++ t,typedef /typedefs/
|
||||
!_TAG_KIND_DESCRIPTION!C++ u,union /union names/
|
||||
!_TAG_KIND_DESCRIPTION!C++ v,variable /variable definitions/
|
||||
!_TAG_KIND_DESCRIPTION!Make I,makefile /makefiles/
|
||||
!_TAG_KIND_DESCRIPTION!Make m,macro /macros/
|
||||
!_TAG_KIND_DESCRIPTION!Make t,target /targets/
|
||||
!_TAG_KIND_DESCRIPTION!Man S,subsection /sub sections/
|
||||
!_TAG_KIND_DESCRIPTION!Man s,section /sections/
|
||||
!_TAG_KIND_DESCRIPTION!Man t,title /titles/
|
||||
!_TAG_KIND_DESCRIPTION!Markdown S,subsection /level 2 sections/
|
||||
!_TAG_KIND_DESCRIPTION!Markdown T,l4subsection /level 4 sections/
|
||||
!_TAG_KIND_DESCRIPTION!Markdown c,chapter /chapters/
|
||||
@@ -43,13 +49,28 @@
|
||||
!_TAG_KIND_DESCRIPTION!Markdown s,section /sections/
|
||||
!_TAG_KIND_DESCRIPTION!Markdown t,subsubsection /level 3 sections/
|
||||
!_TAG_KIND_DESCRIPTION!Markdown u,l5subsection /level 5 sections/
|
||||
!_TAG_KIND_DESCRIPTION!Perl c,constant /constants/
|
||||
!_TAG_KIND_DESCRIPTION!Perl f,format /formats/
|
||||
!_TAG_KIND_DESCRIPTION!Perl l,label /labels/
|
||||
!_TAG_KIND_DESCRIPTION!Perl p,package /packages/
|
||||
!_TAG_KIND_DESCRIPTION!Perl s,subroutine /subroutines/
|
||||
!_TAG_KIND_DESCRIPTION!Sh a,alias /aliases/
|
||||
!_TAG_KIND_DESCRIPTION!Sh f,function /functions/
|
||||
!_TAG_KIND_DESCRIPTION!Sh h,heredoc /label for here document/
|
||||
!_TAG_KIND_DESCRIPTION!Sh s,script /script files/
|
||||
!_TAG_KIND_DESCRIPTION!Yaml a,anchor /anchors/
|
||||
!_TAG_OUTPUT_EXCMD mixed /number, pattern, mixed, or combineV2/
|
||||
!_TAG_OUTPUT_FILESEP slash /slash or backslash/
|
||||
!_TAG_OUTPUT_MODE u-ctags /u-ctags or e-ctags/
|
||||
!_TAG_OUTPUT_VERSION 0.0 /current.age/
|
||||
!_TAG_PARSER_VERSION!C 1.1 /current.age/
|
||||
!_TAG_PARSER_VERSION!C++ 1.1 /current.age/
|
||||
!_TAG_PARSER_VERSION!Make 0.0 /current.age/
|
||||
!_TAG_PARSER_VERSION!Man 0.0 /current.age/
|
||||
!_TAG_PARSER_VERSION!Markdown 1.1 /current.age/
|
||||
!_TAG_PARSER_VERSION!Perl 0.0 /current.age/
|
||||
!_TAG_PARSER_VERSION!Sh 0.0 /current.age/
|
||||
!_TAG_PARSER_VERSION!Yaml 0.0 /current.age/
|
||||
!_TAG_PATTERN_LENGTH_LIMIT 96 /0 for no limit/
|
||||
!_TAG_PROC_CWD /home/null/Documents/better_ray_tracer/ //
|
||||
!_TAG_PROGRAM_AUTHOR Universal Ctags Team //
|
||||
@@ -69,109 +90,480 @@
|
||||
!_TAG_ROLE_DESCRIPTION!C++!module imported /imported with "imported ..."/
|
||||
!_TAG_ROLE_DESCRIPTION!C++!module partOwner /used for specifying a partition/
|
||||
!_TAG_ROLE_DESCRIPTION!C++!partition imported /imported with "imported ..."/
|
||||
!_TAG_ROLE_DESCRIPTION!Make!makefile included /included/
|
||||
!_TAG_ROLE_DESCRIPTION!Make!makefile optional /optionally included/
|
||||
!_TAG_ROLE_DESCRIPTION!Sh!heredoc endmarker /end marker/
|
||||
!_TAG_ROLE_DESCRIPTION!Sh!script loaded /loaded/
|
||||
!_TAG_ROLE_DESCRIPTION!Yaml!anchor alias /alias/
|
||||
$(DIR_OBJ) makefile /^$(DIR_OBJ):$/;" t
|
||||
$(DIR_OBJ)/%.o makefile /^$(DIR_OBJ)\/%.o: %.c | $(DIR_OBJ)$/;" t
|
||||
$(LIBFT) makefile /^$(LIBFT):$/;" t
|
||||
$(MINILIBX) makefile /^$(MINILIBX):$/;" t
|
||||
$(NAME) libft/Makefile /^$(NAME): $(OBJS)$/;" t
|
||||
$(NAME) makefile /^$(NAME): $(OBJ) $(LIBFT) $(MINILIBX)$/;" t
|
||||
$(NAME) minilibx-linux/Makefile.mk /^$(NAME) : $(OBJ)$/;" t
|
||||
$(NAME) minilibx-linux/test/Makefile.mk /^$(NAME): $(OBJ)$/;" t
|
||||
$(OBJ_DIR)/%.o minilibx-linux/Makefile.mk /^$(OBJ_DIR)\/%.o: %.c$/;" t
|
||||
%.o libft/Makefile /^%.o: %.c$/;" t
|
||||
AR libft/Makefile /^AR = ar rcs$/;" m
|
||||
AUTHOR minilibx-linux/man/man1/mlx.1 /^.SH AUTHOR$/;" s title:MiniLibX
|
||||
AUTHOR minilibx-linux/man/man1/mlx_loop.1 /^.SH AUTHOR$/;" s title:MiniLibX
|
||||
AUTHOR minilibx-linux/man/man1/mlx_new_image.1 /^.SH AUTHOR$/;" s title:MiniLibX
|
||||
AUTHOR minilibx-linux/man/man1/mlx_new_window.1 /^.SH AUTHOR$/;" s title:MiniLibX
|
||||
AUTHOR minilibx-linux/man/man1/mlx_pixel_put.1 /^.SH AUTHOR$/;" s title:MiniLibX
|
||||
AUTHOR minilibx-linux/man/man3/mlx.3 /^.SH AUTHOR$/;" s title:MiniLibX
|
||||
AUTHOR minilibx-linux/man/man3/mlx_loop.3 /^.SH AUTHOR$/;" s title:MiniLibX
|
||||
AUTHOR minilibx-linux/man/man3/mlx_new_image.3 /^.SH AUTHOR$/;" s title:MiniLibX
|
||||
AUTHOR minilibx-linux/man/man3/mlx_new_window.3 /^.SH AUTHOR$/;" s title:MiniLibX
|
||||
AUTHOR minilibx-linux/man/man3/mlx_pixel_put.3 /^.SH AUTHOR$/;" s title:MiniLibX
|
||||
BUFFER_SIZE libft/get_next_line.h /^# define BUFFER_SIZE /;" d
|
||||
CC libft/Makefile /^CC = cc$/;" m
|
||||
CC makefile /^CC = cc$/;" m
|
||||
CC minilibx-linux/Makefile.mk /^ CC = clang$/;" m
|
||||
CC minilibx-linux/Makefile.mk /^CC = gcc$/;" m
|
||||
CC minilibx-linux/test/Makefile.mk /^ CC = gcc$/;" m
|
||||
CC minilibx-linux/test/Makefile.mk /^ CC = clang$/;" m
|
||||
CFLAGS libft/Makefile /^CFLAGS = -Wall -Wextra -Werror -g3$/;" m
|
||||
CFLAGS makefile /^CFLAGS = -fsanitize=address -g3 -Wall -Wextra -Werror$/;" m
|
||||
CFLAGS minilibx-linux/Makefile.mk /^CFLAGS = -O3 -I$(INC)$/;" m
|
||||
CFLAGS minilibx-linux/test/Makefile.mk /^CFLAGS= -I$(INC) -O3 -I.. -g$/;" m
|
||||
CHAR libft/libft.h /^# define CHAR /;" d
|
||||
COLOR MANAGEMENT minilibx-linux/man/man1/mlx_pixel_put.1 /^.SH COLOR MANAGEMENT$/;" s title:MiniLibX
|
||||
COLOR MANAGEMENT minilibx-linux/man/man3/mlx_pixel_put.3 /^.SH COLOR MANAGEMENT$/;" s title:MiniLibX
|
||||
DEC libft/libft.h /^# define DEC /;" d
|
||||
DESCRIPTION minilibx-linux/man/man1/mlx.1 /^.SH DESCRIPTION$/;" s title:MiniLibX
|
||||
DESCRIPTION minilibx-linux/man/man1/mlx_loop.1 /^.SH DESCRIPTION$/;" s title:MiniLibX
|
||||
DESCRIPTION minilibx-linux/man/man1/mlx_new_image.1 /^.SH DESCRIPTION$/;" s title:MiniLibX
|
||||
DESCRIPTION minilibx-linux/man/man1/mlx_new_window.1 /^.SH DESCRIPTION$/;" s title:MiniLibX
|
||||
DESCRIPTION minilibx-linux/man/man1/mlx_pixel_put.1 /^.SH DESCRIPTION$/;" s title:MiniLibX
|
||||
DESCRIPTION minilibx-linux/man/man3/mlx.3 /^.SH DESCRIPTION$/;" s title:MiniLibX
|
||||
DESCRIPTION minilibx-linux/man/man3/mlx_loop.3 /^.SH DESCRIPTION$/;" s title:MiniLibX
|
||||
DESCRIPTION minilibx-linux/man/man3/mlx_new_image.3 /^.SH DESCRIPTION$/;" s title:MiniLibX
|
||||
DESCRIPTION minilibx-linux/man/man3/mlx_new_window.3 /^.SH DESCRIPTION$/;" s title:MiniLibX
|
||||
DESCRIPTION minilibx-linux/man/man3/mlx_pixel_put.3 /^.SH DESCRIPTION$/;" s title:MiniLibX
|
||||
DIR_OBJ makefile /^DIR_OBJ = obj$/;" m
|
||||
ENV_DISPLAY minilibx-linux/mlx_int.h /^# define ENV_DISPLAY /;" d
|
||||
EOF minilibx-linux/configure /^cat <<EOF$/;" h
|
||||
ERR_NO_TRUECOLOR minilibx-linux/mlx_int.h /^# define ERR_NO_TRUECOLOR /;" d
|
||||
GET_NEXT_LINE_H libft/get_next_line.h /^# define GET_NEXT_LINE_H$/;" d
|
||||
GOING FURTHER WITH EVENTS minilibx-linux/man/man1/mlx_loop.1 /^.SH GOING FURTHER WITH EVENTS$/;" s title:MiniLibX
|
||||
GOING FURTHER WITH EVENTS minilibx-linux/man/man3/mlx_loop.3 /^.SH GOING FURTHER WITH EVENTS$/;" s title:MiniLibX
|
||||
HEIGHT miniRT.h /^# define HEIGHT /;" d
|
||||
HEXLO libft/libft.h /^# define HEXLO /;" d
|
||||
HEXUP libft/libft.h /^# define HEXUP /;" d
|
||||
IM1_SX minilibx-linux/test/main.c /^#define IM1_SX /;" d file:
|
||||
IM1_SY minilibx-linux/test/main.c /^#define IM1_SY /;" d file:
|
||||
IM3_SX minilibx-linux/test/main.c /^#define IM3_SX /;" d file:
|
||||
IM3_SY minilibx-linux/test/main.c /^#define IM3_SY /;" d file:
|
||||
INC minilibx-linux/Makefile.mk /^INC =%%%%$/;" m
|
||||
INC minilibx-linux/test/Makefile.mk /^INC=%%%%$/;" m
|
||||
INCLIB minilibx-linux/test/Makefile.mk /^INCLIB=$(INC)\/..\/lib$/;" m
|
||||
INCLUDE FILE minilibx-linux/man/man1/mlx.1 /^.SH INCLUDE FILE$/;" s title:MiniLibX
|
||||
INCLUDE FILE minilibx-linux/man/man3/mlx.3 /^.SH INCLUDE FILE$/;" s title:MiniLibX
|
||||
INCLUDES makefile /^INCLUDES = -I. -Ilibft -Iminilibx-linux$/;" m
|
||||
LDFLAGS makefile /^LDFLAGS = -Llibft -Lminilibx-linux$/;" m
|
||||
LDLIBS makefile /^LDLIBS = -lft -lmlx -lXext -lX11 -lm -lbsd$/;" m
|
||||
LFLAGS minilibx-linux/test/Makefile.mk /^LFLAGS = -L.. -lmlx -L$(INCLIB) -lXext -lX11 -lm$/;" m
|
||||
LIBFT makefile /^LIBFT = libft\/libft.a$/;" m
|
||||
LIBFT_H libft/libft.h /^# define LIBFT_H$/;" d
|
||||
LIBRARY FUNCTIONS minilibx-linux/man/man1/mlx.1 /^.SH LIBRARY FUNCTIONS$/;" s title:MiniLibX
|
||||
LIBRARY FUNCTIONS minilibx-linux/man/man3/mlx.3 /^.SH LIBRARY FUNCTIONS$/;" s title:MiniLibX
|
||||
LINKING MiniLibX minilibx-linux/man/man1/mlx.1 /^.SH LINKING MiniLibX$/;" s title:MiniLibX
|
||||
LINKING MiniLibX minilibx-linux/man/man3/mlx.3 /^.SH LINKING MiniLibX$/;" s title:MiniLibX
|
||||
LOCALHOST minilibx-linux/mlx_int.h /^# define LOCALHOST /;" d
|
||||
MAX_AMBIENT miniRT.h /^# define MAX_AMBIENT /;" d
|
||||
MAX_CAMERA miniRT.h /^# define MAX_CAMERA /;" d
|
||||
MAX_CYLINDERS miniRT.h /^# define MAX_CYLINDERS /;" d
|
||||
MAX_LIGHTS miniRT.h /^# define MAX_LIGHTS /;" d
|
||||
MAX_PLANES miniRT.h /^# define MAX_PLANES /;" d
|
||||
MAX_SPHERES miniRT.h /^# define MAX_SPHERES /;" d
|
||||
MINILIBX makefile /^MINILIBX = minilibx-linux\/libmlx.a$/;" m
|
||||
MINIRT_H miniRT.h /^# define MINIRT_H$/;" d
|
||||
MLX_H minilibx-linux/mlx.h /^#define MLX_H$/;" d
|
||||
MLX_INT_H minilibx-linux/mlx_int.h /^# define MLX_INT_H$/;" d
|
||||
MLX_MAX_EVENT minilibx-linux/mlx_int.h /^# define MLX_MAX_EVENT /;" d
|
||||
MLX_TYPE_SHM minilibx-linux/mlx_int.h /^# define MLX_TYPE_SHM /;" d
|
||||
MLX_TYPE_SHM_PIXMAP minilibx-linux/mlx_int.h /^# define MLX_TYPE_SHM_PIXMAP /;" d
|
||||
MLX_TYPE_XIMAGE minilibx-linux/mlx_int.h /^# define MLX_TYPE_XIMAGE /;" d
|
||||
MiniLibX minilibx-linux/man/man1/mlx.1 /^.TH MiniLibX 3 "September 19, 2002"$/;" t
|
||||
MiniLibX minilibx-linux/man/man1/mlx_loop.1 /^.TH MiniLibX 3 "September 19, 2002"$/;" t
|
||||
MiniLibX minilibx-linux/man/man1/mlx_new_image.1 /^.TH MiniLibX 3 "September 19, 2002"$/;" t
|
||||
MiniLibX minilibx-linux/man/man1/mlx_new_window.1 /^.TH MiniLibX 3 "September 19, 2002"$/;" t
|
||||
MiniLibX minilibx-linux/man/man1/mlx_pixel_put.1 /^.TH MiniLibX 3 "September 19, 2002"$/;" t
|
||||
MiniLibX minilibx-linux/man/man3/mlx.3 /^.TH MiniLibX 3 "September 19, 2002"$/;" t
|
||||
MiniLibX minilibx-linux/man/man3/mlx_loop.3 /^.TH MiniLibX 3 "September 19, 2002"$/;" t
|
||||
MiniLibX minilibx-linux/man/man3/mlx_new_image.3 /^.TH MiniLibX 3 "September 19, 2002"$/;" t
|
||||
MiniLibX minilibx-linux/man/man3/mlx_new_window.3 /^.TH MiniLibX 3 "September 19, 2002"$/;" t
|
||||
MiniLibX minilibx-linux/man/man3/mlx_pixel_put.3 /^.TH MiniLibX 3 "September 19, 2002"$/;" t
|
||||
NAME libft/Makefile /^NAME = libft.a$/;" m
|
||||
NAME makefile /^NAME = miniRT$/;" m
|
||||
NAME minilibx-linux/Makefile.mk /^NAME = libmlx.a$/;" m
|
||||
NAME minilibx-linux/man/man1/mlx.1 /^.SH NAME$/;" s title:MiniLibX
|
||||
NAME minilibx-linux/man/man1/mlx_loop.1 /^.SH NAME$/;" s title:MiniLibX
|
||||
NAME minilibx-linux/man/man1/mlx_new_image.1 /^.SH NAME$/;" s title:MiniLibX
|
||||
NAME minilibx-linux/man/man1/mlx_new_window.1 /^.SH NAME$/;" s title:MiniLibX
|
||||
NAME minilibx-linux/man/man1/mlx_pixel_put.1 /^.SH NAME$/;" s title:MiniLibX
|
||||
NAME minilibx-linux/man/man3/mlx.3 /^.SH NAME$/;" s title:MiniLibX
|
||||
NAME minilibx-linux/man/man3/mlx_loop.3 /^.SH NAME$/;" s title:MiniLibX
|
||||
NAME minilibx-linux/man/man3/mlx_new_image.3 /^.SH NAME$/;" s title:MiniLibX
|
||||
NAME minilibx-linux/man/man3/mlx_new_window.3 /^.SH NAME$/;" s title:MiniLibX
|
||||
NAME minilibx-linux/man/man3/mlx_pixel_put.3 /^.SH NAME$/;" s title:MiniLibX
|
||||
NAME minilibx-linux/test/Makefile.mk /^NAME= mlx-test$/;" m
|
||||
NAME_UNAME minilibx-linux/Makefile.mk /^NAME_UNAME = libmlx_$(UNAME).a$/;" m
|
||||
OBJ makefile /^OBJ = $(addprefix $(DIR_OBJ)\/, $(notdir $(SRC:.c=.o)))$/;" m
|
||||
OBJ minilibx-linux/Makefile.mk /^OBJ = $(addprefix $(OBJ_DIR)\/,$(SRC:%.c=%.o))$/;" m
|
||||
OBJ minilibx-linux/test/Makefile.mk /^OBJ = $(SRC:%.c=%.o)$/;" m
|
||||
OBJS libft/Makefile /^OBJS = ft_calloc.o ft_isascii.o ft_itoa.o ft_memcpy.o ft_putchar_fd.o ft_putstr_fd.o f/;" m
|
||||
OBJ_DIR minilibx-linux/Makefile.mk /^OBJ_DIR = obj$/;" m
|
||||
RETURN minilibx-linux/mlx_xpm.c /^#define RETURN /;" d file:
|
||||
RETURN VALUES minilibx-linux/man/man1/mlx.1 /^.SH RETURN VALUES$/;" s title:MiniLibX
|
||||
RETURN VALUES minilibx-linux/man/man1/mlx_new_image.1 /^.SH RETURN VALUES$/;" s title:MiniLibX
|
||||
RETURN VALUES minilibx-linux/man/man1/mlx_new_window.1 /^.SH RETURN VALUES$/;" s title:MiniLibX
|
||||
RETURN VALUES minilibx-linux/man/man3/mlx.3 /^.SH RETURN VALUES$/;" s title:MiniLibX
|
||||
RETURN VALUES minilibx-linux/man/man3/mlx_new_image.3 /^.SH RETURN VALUES$/;" s title:MiniLibX
|
||||
RETURN VALUES minilibx-linux/man/man3/mlx_new_window.3 /^.SH RETURN VALUES$/;" s title:MiniLibX
|
||||
RM libft/Makefile /^RM = rm -f$/;" m
|
||||
SEE ALSO minilibx-linux/man/man1/mlx.1 /^.SH SEE ALSO$/;" s title:MiniLibX
|
||||
SEE ALSO minilibx-linux/man/man1/mlx_loop.1 /^.SH SEE ALSO$/;" s title:MiniLibX
|
||||
SEE ALSO minilibx-linux/man/man1/mlx_new_image.1 /^.SH SEE ALSO$/;" s title:MiniLibX
|
||||
SEE ALSO minilibx-linux/man/man1/mlx_new_window.1 /^.SH SEE ALSO$/;" s title:MiniLibX
|
||||
SEE ALSO minilibx-linux/man/man1/mlx_pixel_put.1 /^.SH SEE ALSO$/;" s title:MiniLibX
|
||||
SEE ALSO minilibx-linux/man/man3/mlx.3 /^.SH SEE ALSO$/;" s title:MiniLibX
|
||||
SEE ALSO minilibx-linux/man/man3/mlx_loop.3 /^.SH SEE ALSO$/;" s title:MiniLibX
|
||||
SEE ALSO minilibx-linux/man/man3/mlx_new_image.3 /^.SH SEE ALSO$/;" s title:MiniLibX
|
||||
SEE ALSO minilibx-linux/man/man3/mlx_new_window.3 /^.SH SEE ALSO$/;" s title:MiniLibX
|
||||
SEE ALSO minilibx-linux/man/man3/mlx_pixel_put.3 /^.SH SEE ALSO$/;" s title:MiniLibX
|
||||
SRC makefile /^SRC = $(wildcard *.c)$/;" m
|
||||
SRC minilibx-linux/Makefile.mk /^SRC = mlx_init.c mlx_new_window.c mlx_pixel_put.c mlx_loop.c \\$/;" m
|
||||
SRC minilibx-linux/test/Makefile.mk /^SRC = main.c$/;" m
|
||||
SRCS libft/Makefile /^SRCS = ft_calloc.c ft_isascii.c ft_itoa.c ft_memcpy.c ft_putchar_fd.c ft_putstr_fd.c f/;" m
|
||||
STORING COLOR INSIDE IMAGES minilibx-linux/man/man1/mlx_new_image.1 /^.SH STORING COLOR INSIDE IMAGES$/;" s title:MiniLibX
|
||||
STORING COLOR INSIDE IMAGES minilibx-linux/man/man3/mlx_new_image.3 /^.SH STORING COLOR INSIDE IMAGES$/;" s title:MiniLibX
|
||||
STR libft/libft.h /^# define STR /;" d
|
||||
SYNOPSYS minilibx-linux/man/man1/mlx.1 /^.SH SYNOPSYS$/;" s title:MiniLibX
|
||||
SYNOPSYS minilibx-linux/man/man1/mlx_loop.1 /^.SH SYNOPSYS$/;" s title:MiniLibX
|
||||
SYNOPSYS minilibx-linux/man/man1/mlx_new_image.1 /^.SH SYNOPSYS$/;" s title:MiniLibX
|
||||
SYNOPSYS minilibx-linux/man/man1/mlx_new_window.1 /^.SH SYNOPSYS$/;" s title:MiniLibX
|
||||
SYNOPSYS minilibx-linux/man/man1/mlx_pixel_put.1 /^.SH SYNOPSYS$/;" s title:MiniLibX
|
||||
SYNOPSYS minilibx-linux/man/man3/mlx.3 /^.SH SYNOPSYS$/;" s title:MiniLibX
|
||||
SYNOPSYS minilibx-linux/man/man3/mlx_loop.3 /^.SH SYNOPSYS$/;" s title:MiniLibX
|
||||
SYNOPSYS minilibx-linux/man/man3/mlx_new_image.3 /^.SH SYNOPSYS$/;" s title:MiniLibX
|
||||
SYNOPSYS minilibx-linux/man/man3/mlx_new_window.3 /^.SH SYNOPSYS$/;" s title:MiniLibX
|
||||
SYNOPSYS minilibx-linux/man/man3/mlx_pixel_put.3 /^.SH SYNOPSYS$/;" s title:MiniLibX
|
||||
UNAME minilibx-linux/Makefile.mk /^UNAME = $(shell uname)$/;" m
|
||||
UNAME minilibx-linux/test/Makefile.mk /^UNAME := $(shell uname)$/;" m
|
||||
WARN_SHM_ATTACH minilibx-linux/mlx_int.h /^# define WARN_SHM_ATTACH /;" d
|
||||
WIDTH miniRT.h /^# define WIDTH /;" d
|
||||
WIN1_SX minilibx-linux/test/main.c /^#define WIN1_SX /;" d file:
|
||||
WIN1_SY minilibx-linux/test/main.c /^#define WIN1_SY /;" d file:
|
||||
X-WINDOW CONCEPT minilibx-linux/man/man1/mlx.1 /^.SH X-WINDOW CONCEPT$/;" s title:MiniLibX
|
||||
X-WINDOW CONCEPT minilibx-linux/man/man3/mlx.3 /^.SH X-WINDOW CONCEPT$/;" s title:MiniLibX
|
||||
X-WINDOW EVENTS minilibx-linux/man/man1/mlx_loop.1 /^.SH X-WINDOW EVENTS$/;" s title:MiniLibX
|
||||
X-WINDOW EVENTS minilibx-linux/man/man3/mlx_loop.3 /^.SH X-WINDOW EVENTS$/;" s title:MiniLibX
|
||||
XPM IMAGES minilibx-linux/man/man1/mlx_new_image.1 /^.SH XPM IMAGES$/;" s title:MiniLibX
|
||||
XPM IMAGES minilibx-linux/man/man3/mlx_new_image.3 /^.SH XPM IMAGES$/;" s title:MiniLibX
|
||||
X_ShmAttach minilibx-linux/mlx_new_image.c /^#define X_ShmAttach /;" d file:
|
||||
a miniRT.h /^ float a;$/;" m struct:s_calc typeref:typename:float
|
||||
all libft/Makefile /^all: $(NAME)$/;" t
|
||||
all makefile /^all: $(NAME)$/;" t
|
||||
all minilibx-linux/Makefile /^all : do_configure$/;" t
|
||||
all minilibx-linux/Makefile.mk /^all : $(NAME)$/;" t
|
||||
all minilibx-linux/test/Makefile.mk /^all: $(NAME)$/;" t
|
||||
ambient miniRT.h /^ t_ambient ambient;$/;" m struct:s_scene typeref:typename:t_ambient
|
||||
ambient_color miniRT.h /^ t_vec3 ambient_color;$/;" m struct:s_ambient typeref:typename:t_vec3
|
||||
ambient_color raytracer_formatted.c /^t_vec3 ambient_color = {0.1f, 0.1f, 0.1f};$/;" v typeref:typename:t_vec3
|
||||
ambient_ratio miniRT.h /^ float ambient_ratio;$/;" m struct:s_ambient typeref:typename:float
|
||||
ambient_ratio raytracer_formatted.c /^float ambient_ratio = 0.1f;$/;" v typeref:typename:float
|
||||
aspect miniRT.h /^ float aspect;$/;" m struct:s_calc typeref:typename:float
|
||||
at_exit minilibx-linux/test/run_tests.sh /^at_exit() {$/;" f
|
||||
axis miniRT.h /^ t_vec3 axis; \/\/ Axe normalisé$/;" m struct:s_cylinder typeref:typename:t_vec3
|
||||
b miniRT.h /^ float b;$/;" m struct:s_calc typeref:typename:float
|
||||
b miniRT.h /^ unsigned char b;$/;" m struct:s_calc typeref:typename:unsigned char
|
||||
base libft/libft.h /^ int base;$/;" m struct:s_info typeref:typename:int
|
||||
better_ray_tracer README.md /^# better_ray_tracer/;" c
|
||||
bpp miniRT.h /^ int bpp;$/;" m struct:s_app typeref:typename:int
|
||||
bpp minilibx-linux/mlx_int.h /^ int bpp;$/;" m struct:s_img typeref:typename:int
|
||||
bpp1 minilibx-linux/test/main.c /^int bpp1;$/;" v typeref:typename:int
|
||||
bpp2 minilibx-linux/test/main.c /^int bpp2;$/;" v typeref:typename:int
|
||||
bpp3 minilibx-linux/test/main.c /^int bpp3;$/;" v typeref:typename:int
|
||||
bpp4 minilibx-linux/test/main.c /^int bpp4;$/;" v typeref:typename:int
|
||||
brightness miniRT.h /^ float brightness;$/;" m struct:s_light typeref:typename:float
|
||||
c miniRT.h /^ float c;$/;" m struct:s_calc typeref:typename:float
|
||||
calcLighting trace.c /^t_vec3 calcLighting(t_vec3 hitPoint, t_vec3 hitNormal, t_vec3 objColor) {$/;" f typeref:typename:t_vec3
|
||||
calcLighting trace.c /^t_vec3 calcLighting(t_vec3 hitPoint, t_vec3 hitNormal, t_vec3 objColor, t_scene scene) {$/;" f typeref:typename:t_vec3
|
||||
camDir miniRT.h /^ t_vec3 camDir;$/;" m struct:s_camera typeref:typename:t_vec3
|
||||
camDir raytracer_formatted.c /^t_vec3 camDir = {0.0f, 0.0f, -1.0f};$/;" v typeref:typename:t_vec3
|
||||
camPos miniRT.h /^ t_vec3 camPos;$/;" m struct:s_camera typeref:typename:t_vec3
|
||||
camPos raytracer_formatted.c /^t_vec3 camPos = {0.0f, 0.0f, 0.0f};$/;" v typeref:typename:t_vec3
|
||||
cam_dir miniRT.h /^ t_vec3 cam_dir;$/;" m struct:s_app typeref:typename:t_vec3
|
||||
cam_pos miniRT.h /^ t_vec3 cam_pos;$/;" m struct:s_app typeref:typename:t_vec3
|
||||
cam_up miniRT.h /^ t_vec3 cam_up;$/;" m struct:s_app typeref:typename:t_vec3
|
||||
camera miniRT.h /^ t_camera camera;$/;" m struct:s_scene typeref:typename:t_camera
|
||||
center miniRT.h /^ t_vec3 center;$/;" m struct:s_cylinder typeref:typename:t_vec3
|
||||
center miniRT.h /^ t_vec3 center;$/;" m struct:s_sphere typeref:typename:t_vec3
|
||||
checkShadowCylinder shadows.c /^static bool checkShadowCylinder(const Ray shadowRay, float maxT, float epsilon) {$/;" f typeref:typename:bool file:
|
||||
checkShadowPlane shadows.c /^static bool checkShadowPlane(const Ray shadowRay, float maxT, float epsilon) {$/;" f typeref:typename:bool file:
|
||||
checkShadowSphere shadows.c /^static bool checkShadowSphere(const Ray shadowRay, float maxT, float epsilon) {$/;" f typeref:typename:bool file:
|
||||
check_if_max check.c /^inline void check_if_max(t_scene scene, const int to_test, const int max)$/;" f typeref:typename:void
|
||||
check_tokens check.c /^inline int check_tokens(char **tokens, int expected)$/;" f typeref:typename:int
|
||||
check minilibx-linux/Makefile.mk /^check: all$/;" t
|
||||
checkShadowCylinder shadows.c /^static bool checkShadowCylinder(const t_ray shadowRay, float maxT, float epsilon, t_scene scene)/;" f typeref:typename:bool file:
|
||||
checkShadowPlane shadows.c /^static bool checkShadowPlane(const t_ray shadowRay, float maxT, float epsilon, t_scene scene) {$/;" f typeref:typename:bool file:
|
||||
checkShadowSphere shadows.c /^static bool checkShadowSphere(const t_ray shadowRay, float maxT, float epsilon, t_scene scene) {$/;" f typeref:typename:bool file:
|
||||
check_if_max check.c /^void check_if_max(t_scene scene, const int to_test, const int max)$/;" f typeref:typename:void
|
||||
check_tokens check.c /^int check_tokens(char **tokens, int expected)$/;" f typeref:typename:int
|
||||
clean libft/Makefile /^clean:$/;" t
|
||||
clean makefile /^clean:$/;" t
|
||||
clean minilibx-linux/Makefile /^clean :$/;" t
|
||||
clean minilibx-linux/Makefile.mk /^clean :$/;" t
|
||||
clean minilibx-linux/configure /^clean(){$/;" f
|
||||
clean minilibx-linux/test/Makefile.mk /^clean:$/;" t
|
||||
cmap minilibx-linux/mlx_int.h /^ Colormap cmap;$/;" m struct:s_xvar typeref:typename:Colormap
|
||||
col minilibx-linux/mlx_int.h /^ int col;$/;" m struct:s_xpm_col typeref:typename:int
|
||||
color miniRT.h /^ t_vec3 color;$/;" m struct:s_ambient typeref:typename:t_vec3
|
||||
color miniRT.h /^ t_vec3 color;$/;" m struct:s_cylinder typeref:typename:t_vec3
|
||||
color miniRT.h /^ t_vec3 color;$/;" m struct:s_light typeref:typename:t_vec3
|
||||
color miniRT.h /^ t_vec3 color;$/;" m struct:s_plane typeref:typename:t_vec3
|
||||
color miniRT.h /^ t_vec3 color;$/;" m struct:s_sphere typeref:typename:t_vec3
|
||||
color miniRT.h /^ t_vec3 color;$/;" m struct:s_calc typeref:typename:t_vec3
|
||||
compute_cap_intersection parsing_cylinder_utils.c /^static void compute_cap_intersection(Ray ray, Cylinder cy, t_calc *calc) {$/;" f typeref:typename:void file:
|
||||
compute_hit_normal parsing_cylinder_utils.c /^static void compute_hit_normal(Ray ray, Cylinder cy, t_calc *calc, t_vec3 *hitNormal) {$/;" f typeref:typename:void file:
|
||||
compute_side_intersection parsing_cylinder_utils.c /^static void compute_side_intersection(Ray ray, Cylinder cy, t_calc *calc) {$/;" f typeref:typename:void file:
|
||||
color minilibx-linux/mlx_int.h /^ int color;$/;" m struct:s_col_name typeref:typename:int
|
||||
color_map_1 minilibx-linux/test/main.c /^int color_map_1(void *win,int w,int h)$/;" f typeref:typename:int
|
||||
color_map_2 minilibx-linux/test/main.c /^int color_map_2(unsigned char *data,int bpp,int sl,int w,int h,int endian, int type)$/;" f typeref:typename:int
|
||||
compute_cap_intersection parsing_cylinder_utils.c /^static void compute_cap_intersection(t_ray ray, t_cylinder cy, t_calc *calc) {$/;" f typeref:typename:void file:
|
||||
compute_hit_normal parsing_cylinder_utils.c /^static void compute_hit_normal(t_ray ray, t_cylinder cy, t_calc *calc, t_vec3 *hitNormal) {$/;" f typeref:typename:void file:
|
||||
compute_side_intersection parsing_cylinder_utils.c /^static void compute_side_intersection(t_cylinder cy, t_calc *calc) {$/;" f typeref:typename:void file:
|
||||
count_word libft/ft_split.c /^static size_t count_word(char *str, char c)$/;" f typeref:typename:size_t file:
|
||||
counter libft/libft.h /^ size_t counter;$/;" m struct:s_info typeref:typename:size_t
|
||||
cp miniRT.h /^ t_vec3 cp;$/;" m struct:s_calc typeref:typename:t_vec3
|
||||
create_scene scene.c /^t_scene create_scene(void)$/;" f typeref:typename:t_scene
|
||||
cylinders miniRT.h /^ t_cylinder cylinders[MAX_CYLINDERS];$/;" m struct:s_scene typeref:typename:t_cylinder[]
|
||||
d miniRT.h /^ t_vec3 d;$/;" m struct:s_calc typeref:typename:t_vec3
|
||||
d_dot_v miniRT.h /^ float d_dot_v;$/;" m struct:s_calc typeref:typename:float
|
||||
d_perp miniRT.h /^ t_vec3 d_perp;$/;" m struct:s_calc typeref:typename:t_vec3
|
||||
data minilibx-linux/mlx_int.h /^ char *data;$/;" m struct:s_img typeref:typename:char *
|
||||
data1 minilibx-linux/test/main.c /^char *data1;$/;" v typeref:typename:char *
|
||||
data2 minilibx-linux/test/main.c /^char *data2;$/;" v typeref:typename:char *
|
||||
data3 minilibx-linux/test/main.c /^char *data3;$/;" v typeref:typename:char *
|
||||
data4 minilibx-linux/test/main.c /^char *data4;$/;" v typeref:typename:char *
|
||||
decrgb minilibx-linux/mlx_int.h /^ int decrgb[6];$/;" m struct:s_xvar typeref:typename:int[6]
|
||||
depth minilibx-linux/mlx_int.h /^ int depth;$/;" m struct:s_xvar typeref:typename:int
|
||||
dir miniRT.h /^ t_vec3 dir;$/;" m struct:s_ray typeref:typename:t_vec3
|
||||
disc miniRT.h /^ float disc;$/;" m struct:s_calc typeref:typename:float
|
||||
display minilibx-linux/mlx_int.h /^ Display *display;$/;" m struct:s_xvar typeref:typename:Display *
|
||||
dist miniRT.h /^ float dist;$/;" m struct:s_calc typeref:typename:float
|
||||
divisor libft/ft_split.c /^static char **divisor(char *str1, char c, char **array, size_t len)$/;" f typeref:typename:char ** file:
|
||||
do_configure minilibx-linux/Makefile /^do_configure :$/;" t
|
||||
do_flush minilibx-linux/mlx_int.h /^ int do_flush;$/;" m struct:s_xvar typeref:typename:int
|
||||
end_loop minilibx-linux/mlx_int.h /^ int end_loop;$/;" m struct:s_xvar typeref:typename:int
|
||||
endian miniRT.h /^ int endian;$/;" m struct:s_app typeref:typename:int
|
||||
fd_if_exit miniRT.h /^ const int fd_if_exit;$/;" m struct:s_scene typeref:typename:const int
|
||||
endian1 minilibx-linux/test/main.c /^int endian1;$/;" v typeref:typename:int
|
||||
endian2 minilibx-linux/test/main.c /^int endian2;$/;" v typeref:typename:int
|
||||
endian3 minilibx-linux/test/main.c /^int endian3;$/;" v typeref:typename:int
|
||||
endian4 minilibx-linux/test/main.c /^int endian4;$/;" v typeref:typename:int
|
||||
expose_hook minilibx-linux/mlx_int.h /^ int (*expose_hook)();$/;" m struct:s_win_list typeref:typename:int (*)()
|
||||
expose_param minilibx-linux/mlx_int.h /^ void *expose_param;$/;" m struct:s_win_list typeref:typename:void *
|
||||
expose_win1 minilibx-linux/test/main.c /^int expose_win1(void *p)$/;" f typeref:typename:int
|
||||
expose_win2 minilibx-linux/test/main.c /^int expose_win2(void *p)$/;" f typeref:typename:int
|
||||
fclean libft/Makefile /^fclean: clean$/;" t
|
||||
fclean makefile /^fclean: clean$/;" t
|
||||
fd libft/libft.h /^ int fd;$/;" m struct:s_info typeref:typename:int
|
||||
fd_if_exit miniRT.h /^ int fd_if_exit;$/;" m struct:s_scene typeref:typename:int
|
||||
format libft/printf_fd.c /^static int format(const char *str, t_info *info, va_list *args)$/;" f typeref:typename:int file:
|
||||
format minilibx-linux/mlx_int.h /^ int format;$/;" m struct:s_img typeref:typename:int
|
||||
fov miniRT.h /^ float fov;$/;" m struct:s_camera typeref:typename:float
|
||||
fov miniRT.h /^ float fov;$/;" m struct:s_app typeref:typename:float
|
||||
fov raytracer_formatted.c /^float fov = 90.0f;$/;" v typeref:typename:float
|
||||
g miniRT.h /^ unsigned char g;$/;" m struct:s_calc typeref:typename:unsigned char
|
||||
get_tokens_secure parsing_utils.c /^inline char **get_tokens_secure(t_scene scene, const int numObject, const int numObjectMax, cons/;" f typeref:typename:char **
|
||||
free_array libft/ft_split.c /^static void free_array(char **s1)$/;" f typeref:typename:void file:
|
||||
ft_arraylen array.c /^int ft_arraylen(char **array)$/;" f typeref:typename:int
|
||||
ft_atof ft_atof.c /^float ft_atof(char *str)$/;" f typeref:typename:float
|
||||
ft_atoi libft/ft_atoi.c /^int ft_atoi(const char *text)$/;" f typeref:typename:int
|
||||
ft_bzero libft/ft_bzero.c /^void ft_bzero(void *s, size_t n)$/;" f typeref:typename:void
|
||||
ft_calloc libft/ft_calloc.c /^void *ft_calloc(size_t n, size_t size)$/;" f typeref:typename:void *
|
||||
ft_free_array array.c /^void ft_free_array(char **array)$/;" f typeref:typename:void
|
||||
ft_fsign libft/ft_atoi.c /^static int ft_fsign(char c)$/;" f typeref:typename:int file:
|
||||
ft_is_space libft/ft_is_space.c /^int ft_is_space(char c)$/;" f typeref:typename:int
|
||||
ft_isalnum libft/ft_isalnum.c /^int ft_isalnum(int c)$/;" f typeref:typename:int
|
||||
ft_isalpha libft/ft_isalpha.c /^int ft_isalpha(int c)$/;" f typeref:typename:int
|
||||
ft_isascii libft/ft_isascii.c /^int ft_isascii(int c)$/;" f typeref:typename:int
|
||||
ft_isdigit libft/ft_isdigit.c /^int ft_isdigit(int c)$/;" f typeref:typename:int
|
||||
ft_isprint libft/ft_isprint.c /^int ft_isprint(int c)$/;" f typeref:typename:int
|
||||
ft_isspace libft/ft_atoi.c /^static int ft_isspace(char c)$/;" f typeref:typename:int file:
|
||||
ft_itoa libft/ft_itoa.c /^char *ft_itoa(int n)$/;" f typeref:typename:char *
|
||||
ft_memchr libft/ft_memchr.c /^void *ft_memchr(const void *s, int c, size_t n)$/;" f typeref:typename:void *
|
||||
ft_memcmp libft/ft_memcmp.c /^int ft_memcmp(const void *s1, const void *s2, size_t n)$/;" f typeref:typename:int
|
||||
ft_memcpy libft/ft_memcpy.c /^void *ft_memcpy(void *dest, const void *src, size_t n)$/;" f typeref:typename:void *
|
||||
ft_memmove libft/ft_memmove.c /^void *ft_memmove(void *dest, const void *src, size_t n)$/;" f typeref:typename:void *
|
||||
ft_memset libft/ft_memset.c /^void *ft_memset(void *s, int c, size_t n)$/;" f typeref:typename:void *
|
||||
ft_n_digit libft/ft_itoa.c /^static int ft_n_digit(int n)$/;" f typeref:typename:int file:
|
||||
ft_n_digit libft/ft_putnbr_fd.c /^static int ft_n_digit(int n)$/;" f typeref:typename:int file:
|
||||
ft_pow libft/ft_itoa.c /^static int ft_pow(int n)$/;" f typeref:typename:int file:
|
||||
ft_pow libft/ft_putnbr_fd.c /^static int ft_pow(int n)$/;" f typeref:typename:int file:
|
||||
ft_putchar_fd libft/ft_putchar_fd.c /^void ft_putchar_fd(char c, int fd)$/;" f typeref:typename:void
|
||||
ft_putendl_fd libft/ft_putendl_fd.c /^void ft_putendl_fd(char *s, int fd)$/;" f typeref:typename:void
|
||||
ft_putnbr_fd libft/ft_putnbr_fd.c /^void ft_putnbr_fd(int n, int fd)$/;" f typeref:typename:void
|
||||
ft_putstr_fd libft/ft_putstr_fd.c /^void ft_putstr_fd(char *s, int fd)$/;" f typeref:typename:void
|
||||
ft_realloc libft/ft_realloc.c /^void *ft_realloc(void *ptr, size_t new_size)$/;" f typeref:typename:void *
|
||||
ft_set_digit libft/ft_itoa.c /^static void ft_set_digit(long nbr_digit, long index, char *nbr, long n)$/;" f typeref:typename:void file:
|
||||
ft_set_digit libft/ft_putnbr_fd.c /^static void ft_set_digit(long nbr_digit, long n, int fd)$/;" f typeref:typename:void file:
|
||||
ft_set_number libft/ft_itoa.c /^static void ft_set_number(char *tab)$/;" f typeref:typename:void file:
|
||||
ft_set_number libft/ft_putnbr_fd.c /^static void ft_set_number(char *tab)$/;" f typeref:typename:void file:
|
||||
ft_split libft/ft_split.c /^char **ft_split(char const *s, char c)$/;" f typeref:typename:char **
|
||||
ft_strchr libft/ft_strchr.c /^char *ft_strchr(const char *s, int c)$/;" f typeref:typename:char *
|
||||
ft_strdup libft/ft_strdup.c /^char *ft_strdup(const char *s1)$/;" f typeref:typename:char *
|
||||
ft_striteri libft/ft_striteri.c /^void ft_striteri(char *s, void (*f)(unsigned int, char *))$/;" f typeref:typename:void
|
||||
ft_strjoin libft/ft_strjoin.c /^char *ft_strjoin(char const *s1, char const *s2)$/;" f typeref:typename:char *
|
||||
ft_strlcat libft/ft_strlcat.c /^size_t ft_strlcat(char *dest, const char *src, size_t size)$/;" f typeref:typename:size_t
|
||||
ft_strlcpy libft/ft_strlcpy.c /^size_t ft_strlcpy(char *dest, const char *src, size_t size)$/;" f typeref:typename:size_t
|
||||
ft_strlen libft/ft_strlen.c /^size_t ft_strlen(const char *c)$/;" f typeref:typename:size_t
|
||||
ft_strmapi libft/ft_strmapi.c /^char *ft_strmapi(char const *s, char (*f)(unsigned int, char))$/;" f typeref:typename:char *
|
||||
ft_strncmp libft/ft_strncmp.c /^int ft_strncmp(const char *s1, const char *s2, size_t n)$/;" f typeref:typename:int
|
||||
ft_strnstr libft/ft_strnstr.c /^char *ft_strnstr(const char *big, const char *little, size_t len)$/;" f typeref:typename:char *
|
||||
ft_strrchr libft/ft_strrchr.c /^char *ft_strrchr(const char *s, int c)$/;" f typeref:typename:char *
|
||||
ft_strtod libft/ft_strtod.c /^double ft_strtod(char *string)$/;" f typeref:typename:double
|
||||
ft_strtrim libft/ft_strtrim.c /^char *ft_strtrim(char const *s1, char const *set)$/;" f typeref:typename:char *
|
||||
ft_substr libft/ft_substr.c /^char *ft_substr(char const *s, unsigned int start, size_t len)$/;" f typeref:typename:char *
|
||||
ft_tolower libft/ft_tolower.c /^int ft_tolower(int c)$/;" f typeref:typename:int
|
||||
ft_toupper libft/ft_toupper.c /^int ft_toupper(int c)$/;" f typeref:typename:int
|
||||
gc minilibx-linux/mlx_int.h /^ GC gc;$/;" m struct:s_win_list typeref:typename:GC
|
||||
gc minilibx-linux/mlx_int.h /^ GC gc;$/;" m struct:s_img typeref:typename:GC
|
||||
gere_mouse minilibx-linux/test/new_win.c /^int gere_mouse(int x,int y,int button,void*toto)$/;" f typeref:typename:int
|
||||
get_next_line libft/gnl.c /^char *get_next_line(int fd)$/;" f typeref:typename:char *
|
||||
get_tokens_secure parsing_utils.c /^char **get_tokens_secure(t_scene scene, const int numObject, const int numObjectMax, const int s/;" f typeref:typename:char **
|
||||
get_xlib_include_path minilibx-linux/configure /^get_xlib_include_path(){$/;" f
|
||||
gnl_ft_getline libft/gnl.c /^char *gnl_ft_getline(char *static_str)$/;" f typeref:typename:char *
|
||||
gnl_ft_remove_bn libft/gnl.c /^char *gnl_ft_remove_bn(char *static_str)$/;" f typeref:typename:char *
|
||||
gnl_ft_strchr libft/gnl_utils.c /^char *gnl_ft_strchr(char *s, int c)$/;" f typeref:typename:char *
|
||||
gnl_ft_strjoin libft/gnl_utils.c /^char *gnl_ft_strjoin(char *s1, char *s2)$/;" f typeref:typename:char *
|
||||
gnl_ft_strlen libft/gnl_utils.c /^size_t gnl_ft_strlen(char *s)$/;" f typeref:typename:size_t
|
||||
gnl_read_fd libft/gnl.c /^char *gnl_read_fd(int fd, char *str)$/;" f typeref:typename:char *
|
||||
height miniRT.h /^ float height;$/;" m struct:s_cylinder typeref:typename:float
|
||||
height minilibx-linux/mlx_int.h /^ int height;$/;" m struct:s_img typeref:typename:int
|
||||
hitPoint miniRT.h /^ t_vec3 hitPoint;$/;" m struct:s_calc typeref:typename:t_vec3
|
||||
hook minilibx-linux/mlx_int.h /^ int (*hook)();$/;" m struct:s_event_list typeref:typename:int (*)()
|
||||
hooks minilibx-linux/mlx_int.h /^ t_event_list hooks[MLX_MAX_EVENT];$/;" m struct:s_win_list typeref:typename:t_event_list[]
|
||||
i libft/libft.h /^ size_t i;$/;" m struct:s_info typeref:typename:size_t
|
||||
im1 minilibx-linux/test/main.c /^void *im1;$/;" v typeref:typename:void *
|
||||
im2 minilibx-linux/test/main.c /^void *im2;$/;" v typeref:typename:void *
|
||||
im3 minilibx-linux/test/main.c /^void *im3;$/;" v typeref:typename:void *
|
||||
im4 minilibx-linux/test/main.c /^void *im4;$/;" v typeref:typename:void *
|
||||
image minilibx-linux/mlx_int.h /^ XImage *image;$/;" m struct:s_img typeref:typename:XImage *
|
||||
img miniRT.h /^ void *img;$/;" m struct:s_app typeref:typename:void *
|
||||
init_app_config main.c /^static int init_app_config(t_app *app, int argc, char **argv)$/;" f typeref:typename:int file:
|
||||
init_intersection parsing_cylinder_utils.c /^static int init_intersection(Ray ray, Cylinder cy, t_calc *calc) {$/;" f typeref:typename:int file:
|
||||
init_intersection parsing_cylinder_utils.c /^static int init_intersection(t_ray ray, t_cylinder cy, t_calc *calc) {$/;" f typeref:typename:int file:
|
||||
init_mlx_and_image main.c /^static int init_mlx_and_image(t_app *app)$/;" f typeref:typename:int file:
|
||||
intersectCylinder parsing_cylinder_utils.c /^float intersectCylinder(Ray ray, Cylinder cy, t_vec3 *hitNormal) {$/;" f typeref:typename:float
|
||||
intersectCylinder raytracer_formatted.c /^float intersectCylinder(Ray ray, Cylinder cy, t_vec3 *hitNormal)$/;" f typeref:typename:float
|
||||
intersectObjects trace.c /^bool intersectObjects(Ray ray, float *tMin, t_vec3 *hitNormal, t_vec3 *objColor) {$/;" f typeref:typename:bool
|
||||
intersectPlane parsing_plane.c /^float intersectPlane(Ray ray, Plane p, t_vec3 *hitNormal)$/;" f typeref:typename:float
|
||||
intersectPlane raytracer_formatted.c /^float intersectPlane(Ray ray, Plane p, t_vec3 *hitNormal)$/;" f typeref:typename:float
|
||||
intersectSphere parsing_sphere.c /^float intersectSphere(Ray ray, Sphere s, t_vec3 *hitNormal)$/;" f typeref:typename:float
|
||||
intersectSphere raytracer_formatted.c /^float intersectSphere(Ray ray, Sphere s, t_vec3 *hitNormal)$/;" f typeref:typename:float
|
||||
isInShadow raytracer_formatted.c /^bool isInShadow(t_vec3 hitPoint, t_vec3 lightPos)$/;" f typeref:typename:bool
|
||||
isInShadow shadows.c /^bool isInShadow(t_vec3 hitPoint, t_vec3 lightPos) {$/;" f typeref:typename:bool
|
||||
intersectCylinder parsing_cylinder_utils.c /^float intersectCylinder(t_ray ray, t_cylinder cy, t_vec3 *hitNormal) {$/;" f typeref:typename:float
|
||||
intersectObjects trace.c /^bool intersectObjects(t_ray ray, float *tMin, t_vec3 *hitNormal, t_vec3 *objColor, t_scene scene/;" f typeref:typename:bool
|
||||
intersectPlane parsing_plane.c /^float intersectPlane(t_ray ray, t_plane p, t_vec3 *hitNormal)$/;" f typeref:typename:float
|
||||
intersectSphere parsing_sphere.c /^float intersectSphere(t_ray ray, t_sphere s, t_vec3 *hitNormal)$/;" f typeref:typename:float
|
||||
isInShadow shadows.c /^bool isInShadow(t_vec3 hitPoint, t_vec3 lightPos, t_scene scene) {$/;" f typeref:typename:bool
|
||||
key_a miniRT.h /^ int key_a;$/;" m struct:s_app typeref:typename:int
|
||||
key_d miniRT.h /^ int key_d;$/;" m struct:s_app typeref:typename:int
|
||||
key_down miniRT.h /^ int key_down;$/;" m struct:s_app typeref:typename:int
|
||||
key_hook minilibx-linux/mlx_int.h /^ int (*key_hook)();$/;" m struct:s_win_list typeref:typename:int (*)()
|
||||
key_left miniRT.h /^ int key_left;$/;" m struct:s_app typeref:typename:int
|
||||
key_param minilibx-linux/mlx_int.h /^ void *key_param;$/;" m struct:s_win_list typeref:typename:void *
|
||||
key_press peripherique.c /^int key_press(int keycode, t_app *app)$/;" f typeref:typename:int
|
||||
key_release peripherique.c /^int key_release(int keycode, t_app *app)$/;" f typeref:typename:int
|
||||
key_right miniRT.h /^ int key_right;$/;" m struct:s_app typeref:typename:int
|
||||
key_s miniRT.h /^ int key_s;$/;" m struct:s_app typeref:typename:int
|
||||
key_up miniRT.h /^ int key_up;$/;" m struct:s_app typeref:typename:int
|
||||
key_w miniRT.h /^ int key_w;$/;" m struct:s_app typeref:typename:int
|
||||
key_win1 minilibx-linux/test/main.c /^int key_win1(int key,void *p)$/;" f typeref:typename:int
|
||||
key_win2 minilibx-linux/test/main.c /^int key_win2(int key,void *p)$/;" f typeref:typename:int
|
||||
key_win3 minilibx-linux/test/main.c /^int key_win3(int key,void *p)$/;" f typeref:typename:int
|
||||
len_word libft/ft_split.c /^static size_t len_word(char *s, char c, size_t start)$/;" f typeref:typename:size_t file:
|
||||
lights miniRT.h /^ t_light lights[MAX_LIGHTS];$/;" m struct:s_scene typeref:typename:t_light[]
|
||||
line_if_exit miniRT.h /^ const char *line_if_exit;$/;" m struct:s_scene typeref:typename:const char *
|
||||
line_if_exit miniRT.h /^ char *line_if_exit;$/;" m struct:s_scene typeref:typename:char *
|
||||
load_config config.c /^t_scene load_config(const char *filename)$/;" f typeref:typename:t_scene
|
||||
load_config raytracer_formatted.c /^void load_config(const char *filename)$/;" f typeref:typename:void
|
||||
local_endian minilibx-linux/test/main.c /^int local_endian;$/;" v typeref:typename:int
|
||||
log_error minilibx-linux/configure /^log_error(){$/;" f
|
||||
log_error minilibx-linux/test/run_tests.sh /^log_error(){$/;" f
|
||||
log_info minilibx-linux/configure /^log_info(){$/;" f
|
||||
log_info minilibx-linux/test/run_tests.sh /^log_info(){$/;" f
|
||||
logging minilibx-linux/configure /^logging(){$/;" f
|
||||
logging minilibx-linux/test/run_tests.sh /^logging(){$/;" f
|
||||
loop_hook minilibx-linux/mlx_int.h /^ int (*loop_hook)();$/;" m struct:s_xvar typeref:typename:int (*)()
|
||||
loop_param minilibx-linux/mlx_int.h /^ void *loop_param;$/;" m struct:s_xvar typeref:typename:void *
|
||||
main main.c /^int main(int argc, char **argv)$/;" f typeref:typename:int
|
||||
main raytracer_formatted.c /^int main(int argc, char *argv[])$/;" f typeref:typename:int
|
||||
main minilibx-linux/configure /^main(){$/;" f
|
||||
main minilibx-linux/test/main.c /^int main()$/;" f typeref:typename:int
|
||||
main minilibx-linux/test/new_win.c /^int main()$/;" f typeref:typename:int
|
||||
main minilibx-linux/test/run_tests.sh /^main(){$/;" f
|
||||
mask minilibx-linux/mlx_int.h /^ int mask;$/;" m struct:s_event_list typeref:typename:int
|
||||
mlx miniRT.h /^ void *mlx;$/;" m struct:s_app typeref:typename:void *
|
||||
mlx minilibx-linux/test/main.c /^void *mlx;$/;" v typeref:typename:void *
|
||||
mlx minilibx-linux/test/new_win.c /^void *mlx;$/;" v typeref:typename:void *
|
||||
mlx_X_error minilibx-linux/mlx_new_image.c /^int mlx_X_error;$/;" v typeref:typename:int
|
||||
mlx_clear_window minilibx-linux/mlx_clear_window.c /^int mlx_clear_window(t_xvar *xvar,t_win_list *win)$/;" f typeref:typename:int
|
||||
mlx_col_name minilibx-linux/mlx_rgb.c /^struct s_col_name mlx_col_name[] =$/;" v typeref:struct:s_col_name[]
|
||||
mlx_destroy_display minilibx-linux/mlx_destroy_display.c /^int mlx_destroy_display(t_xvar *xvar)$/;" f typeref:typename:int
|
||||
mlx_destroy_image minilibx-linux/mlx_destroy_image.c /^int mlx_destroy_image(t_xvar *xvar, t_img *img)$/;" f typeref:typename:int
|
||||
mlx_destroy_window minilibx-linux/mlx_destroy_window.c /^int mlx_destroy_window(t_xvar *xvar,t_win_list *win)$/;" f typeref:typename:int
|
||||
mlx_do_key_autorepeatoff minilibx-linux/mlx_hook.c /^int mlx_do_key_autorepeatoff(t_xvar *xvar)$/;" f typeref:typename:int
|
||||
mlx_do_key_autorepeaton minilibx-linux/mlx_hook.c /^int mlx_do_key_autorepeaton(t_xvar *xvar)$/;" f typeref:typename:int
|
||||
mlx_do_sync minilibx-linux/mlx_hook.c /^int mlx_do_sync(t_xvar *xvar)$/;" f typeref:typename:int
|
||||
mlx_expose_hook minilibx-linux/mlx_expose_hook.c /^int mlx_expose_hook(t_win_list *win,int (*funct)(),void *param)$/;" f typeref:typename:int
|
||||
mlx_ext_fullscreen minilibx-linux/mlx_ext_randr.c /^int mlx_ext_fullscreen(t_xvar *xvar, t_win_list *win, int fullscreen)$/;" f typeref:typename:int
|
||||
mlx_flush_event minilibx-linux/mlx_flush_event.c /^int mlx_flush_event(t_xvar *xvar)$/;" f typeref:typename:int
|
||||
mlx_get_color_value minilibx-linux/mlx_get_color_value.c /^int mlx_get_color_value(t_xvar *xvar,int color)$/;" f typeref:typename:int
|
||||
mlx_get_data_addr minilibx-linux/mlx_get_data_addr.c /^char *mlx_get_data_addr(t_img *img,int *bits_per_pixel,$/;" f typeref:typename:char *
|
||||
mlx_get_screen_size minilibx-linux/mlx_screen_size.c /^int mlx_get_screen_size(void *mlx_ptr, int *sizex, int *sizey)$/;" f typeref:typename:int
|
||||
mlx_hook minilibx-linux/mlx_hook.c /^int mlx_hook(t_win_list *win, int x_event, int x_mask, $/;" f typeref:typename:int
|
||||
mlx_init minilibx-linux/mlx_init.c /^void *mlx_init()$/;" f typeref:typename:void *
|
||||
mlx_int_anti_resize_win minilibx-linux/mlx_int_anti_resize_win.c /^int mlx_int_anti_resize_win(t_xvar *xvar,Window win,int w,int h)$/;" f typeref:typename:int
|
||||
mlx_int_deal_shm minilibx-linux/mlx_init.c /^int mlx_int_deal_shm(t_xvar *xvar)$/;" f typeref:typename:int
|
||||
mlx_int_do_nothing minilibx-linux/mlx_int_do_nothing.c /^int mlx_int_do_nothing(void *param)$/;" f typeref:typename:int
|
||||
mlx_int_egal_img minilibx-linux/mlx_lib_xpm.c /^int mlx_int_egal_img(XImage *img1,XImage *img2)$/;" f typeref:typename:int
|
||||
mlx_int_file_get_rid_comment minilibx-linux/mlx_xpm.c /^int mlx_int_file_get_rid_comment(char *ptr, int size)$/;" f typeref:typename:int
|
||||
mlx_int_get_col_name minilibx-linux/mlx_xpm.c /^int mlx_int_get_col_name(char *str,int size)$/;" f typeref:typename:int
|
||||
mlx_int_get_good_color minilibx-linux/mlx_get_color_value.c /^int mlx_int_get_good_color(t_xvar *xvar,int color)$/;" f typeref:typename:int
|
||||
mlx_int_get_line minilibx-linux/mlx_xpm.c /^char *mlx_int_get_line(char *ptr,int *pos,int size)$/;" f typeref:typename:char *
|
||||
mlx_int_get_text_rgb minilibx-linux/mlx_xpm.c /^int mlx_int_get_text_rgb(char *name, char *end)$/;" f typeref:typename:int
|
||||
mlx_int_get_visual minilibx-linux/mlx_int_get_visual.c /^int mlx_int_get_visual(t_xvar *xvar)$/;" f typeref:typename:int
|
||||
mlx_int_new_image minilibx-linux/mlx_new_image.c /^void *mlx_int_new_image(t_xvar *xvar,int width, int height,int format)$/;" f typeref:typename:void *
|
||||
mlx_int_new_xshm_image minilibx-linux/mlx_new_image.c /^void *mlx_int_new_xshm_image(t_xvar *xvar,int width,int height,int format)$/;" f typeref:typename:void *
|
||||
mlx_int_param_ButtonPress minilibx-linux/mlx_int_param_event.c /^int mlx_int_param_ButtonPress(t_xvar *xvar, XEvent *ev, t_win_list *win)$/;" f typeref:typename:int
|
||||
mlx_int_param_ButtonRelease minilibx-linux/mlx_int_param_event.c /^int mlx_int_param_ButtonRelease(t_xvar *xvar, XEvent *ev, t_win_list *win)$/;" f typeref:typename:int
|
||||
mlx_int_param_Expose minilibx-linux/mlx_int_param_event.c /^int mlx_int_param_Expose(t_xvar *xvar, XEvent *ev, t_win_list *win)$/;" f typeref:typename:int
|
||||
mlx_int_param_KeyPress minilibx-linux/mlx_int_param_event.c /^int mlx_int_param_KeyPress(t_xvar *xvar, XEvent *ev, t_win_list *win)$/;" f typeref:typename:int
|
||||
mlx_int_param_KeyRelease minilibx-linux/mlx_int_param_event.c /^int mlx_int_param_KeyRelease(t_xvar *xvar, XEvent *ev, t_win_list *win)$/;" f typeref:typename:int
|
||||
mlx_int_param_MotionNotify minilibx-linux/mlx_int_param_event.c /^int mlx_int_param_MotionNotify(t_xvar *xvar, XEvent *ev, t_win_list *win)$/;" f typeref:typename:int
|
||||
mlx_int_param_event minilibx-linux/mlx_int_param_event.c /^int (*(mlx_int_param_event[]))() =$/;" v typeref:typename:int (* ([]))()
|
||||
mlx_int_param_generic minilibx-linux/mlx_int_param_event.c /^int mlx_int_param_generic(t_xvar *xvar, XEvent *ev, t_win_list *win)$/;" f typeref:typename:int
|
||||
mlx_int_param_undef minilibx-linux/mlx_int_param_event.c /^int mlx_int_param_undef()$/;" f typeref:typename:int
|
||||
mlx_int_parse_xpm minilibx-linux/mlx_xpm.c /^void *mlx_int_parse_xpm(t_xvar *xvar,void *info,int info_size,char *(*f)())$/;" f typeref:typename:void *
|
||||
mlx_int_rgb_conversion minilibx-linux/mlx_init.c /^int mlx_int_rgb_conversion(t_xvar *xvar)$/;" f typeref:typename:int
|
||||
mlx_int_set_win_event_mask minilibx-linux/mlx_int_set_win_event_mask.c /^int mlx_int_set_win_event_mask(t_xvar *xvar)$/;" f typeref:typename:int
|
||||
mlx_int_static_line minilibx-linux/mlx_xpm.c /^char *mlx_int_static_line(char **xpm_data,int *pos,int size)$/;" f typeref:typename:char *
|
||||
mlx_int_str_str minilibx-linux/mlx_int_str_to_wordtab.c /^int mlx_int_str_str(char *str,char *find,int len)$/;" f typeref:typename:int
|
||||
mlx_int_str_str_cote minilibx-linux/mlx_int_str_to_wordtab.c /^int mlx_int_str_str_cote(char *str,char *find,int len)$/;" f typeref:typename:int
|
||||
mlx_int_str_to_wordtab minilibx-linux/mlx_int_str_to_wordtab.c /^char **mlx_int_str_to_wordtab(char *str)$/;" f typeref:typename:char **
|
||||
mlx_int_wait_first_expose minilibx-linux/mlx_int_wait_first_expose.c /^int mlx_int_wait_first_expose(t_xvar *xvar,Window win)$/;" f typeref:typename:int
|
||||
mlx_int_xpm_f_image minilibx-linux/mlx_lib_xpm.c /^void *mlx_int_xpm_f_image(t_xvar *xvar,int *width,int *height,$/;" f typeref:typename:void *
|
||||
mlx_int_xpm_set_pixel minilibx-linux/mlx_xpm.c /^int mlx_int_xpm_set_pixel(t_img *img, char *data, int opp, int col, int x)$/;" f typeref:typename:int
|
||||
mlx_key_hook minilibx-linux/mlx_key_hook.c /^int mlx_key_hook(t_win_list *win,int (*funct)(),void *param)$/;" f typeref:typename:int
|
||||
mlx_loop minilibx-linux/mlx_loop.c /^int mlx_loop(t_xvar *xvar)$/;" f typeref:typename:int
|
||||
mlx_loop_end minilibx-linux/mlx_loop.c /^int mlx_loop_end(t_xvar *xvar)$/;" f typeref:typename:int
|
||||
mlx_loop_hook minilibx-linux/mlx_loop_hook.c /^int mlx_loop_hook(t_xvar *xvar,int (*funct)(),void *param)$/;" f typeref:typename:int
|
||||
mlx_mouse_get_pos minilibx-linux/mlx_mouse.c /^int mlx_mouse_get_pos(t_xvar *xvar, t_win_list *win, \\$/;" f typeref:typename:int
|
||||
mlx_mouse_hide minilibx-linux/mlx_mouse.c /^int mlx_mouse_hide(t_xvar *xvar, t_win_list *win)$/;" f typeref:typename:int
|
||||
mlx_mouse_hook minilibx-linux/mlx_mouse_hook.c /^int mlx_mouse_hook(t_win_list *win,int (*funct)(),void *param)$/;" f typeref:typename:int
|
||||
mlx_mouse_move minilibx-linux/mlx_mouse.c /^int mlx_mouse_move(t_xvar *xvar, t_win_list *win, int x, int y)$/;" f typeref:typename:int
|
||||
mlx_mouse_show minilibx-linux/mlx_mouse.c /^int mlx_mouse_show(t_xvar *xvar, t_win_list *win)$/;" f typeref:typename:int
|
||||
mlx_new_image minilibx-linux/mlx_new_image.c /^void *mlx_new_image(t_xvar *xvar,int width, int height)$/;" f typeref:typename:void *
|
||||
mlx_new_image2 minilibx-linux/mlx_new_image.c /^void *mlx_new_image2(t_xvar *xvar,int width, int height)$/;" f typeref:typename:void *
|
||||
mlx_new_window minilibx-linux/mlx_new_window.c /^void *mlx_new_window(t_xvar *xvar,int size_x,int size_y,char *title)$/;" f typeref:typename:void *
|
||||
mlx_pixel_put minilibx-linux/mlx_pixel_put.c /^int mlx_pixel_put(t_xvar *xvar,t_win_list *win,$/;" f typeref:typename:int
|
||||
mlx_put_image_to_window minilibx-linux/mlx_put_image_to_window.c /^int mlx_put_image_to_window(t_xvar *xvar,t_win_list *win,t_img *img,$/;" f typeref:typename:int
|
||||
mlx_set_font minilibx-linux/mlx_set_font.c /^void mlx_set_font(t_xvar *xvar, t_win_list *win, char *name)$/;" f typeref:typename:void
|
||||
mlx_string_put minilibx-linux/mlx_string_put.c /^int mlx_string_put(t_xvar *xvar,t_win_list *win,$/;" f typeref:typename:int
|
||||
mlx_xpm_file_to_image minilibx-linux/mlx_lib_xpm.c /^void *mlx_xpm_file_to_image(t_xvar *xvar,char *filename,$/;" f typeref:typename:void *
|
||||
mlx_xpm_file_to_image minilibx-linux/mlx_xpm.c /^void *mlx_xpm_file_to_image(t_xvar *xvar,char *file,int *width,int *height)$/;" f typeref:typename:void *
|
||||
mlx_xpm_to_image minilibx-linux/mlx_lib_xpm.c /^void *mlx_xpm_to_image(t_xvar *xvar,char **data,int *width,int *height)$/;" f typeref:typename:void *
|
||||
mlx_xpm_to_image minilibx-linux/mlx_xpm.c /^void *mlx_xpm_to_image(t_xvar *xvar,char **xpm_data,int *width,int *height)$/;" f typeref:typename:void *
|
||||
mouse_hook minilibx-linux/mlx_int.h /^ int (*mouse_hook)();$/;" m struct:s_win_list typeref:typename:int (*)()
|
||||
mouse_move peripherique.c /^int mouse_move(int x, int y, t_app *app)$/;" f typeref:typename:int
|
||||
mouse_param minilibx-linux/mlx_int.h /^ void *mouse_param;$/;" m struct:s_win_list typeref:typename:void *
|
||||
mouse_sens miniRT.h /^ float mouse_sens;$/;" m struct:s_app typeref:typename:float
|
||||
mouse_win1 minilibx-linux/test/main.c /^int mouse_win1(int button,int x,int y, void *p)$/;" f typeref:typename:int
|
||||
mouse_win2 minilibx-linux/test/main.c /^int mouse_win2(int button,int x,int y, void *p)$/;" f typeref:typename:int
|
||||
mouse_win3 minilibx-linux/test/main.c /^int mouse_win3(int x,int y, void *p)$/;" f typeref:typename:int
|
||||
move_speed miniRT.h /^ float move_speed;$/;" m struct:s_app typeref:typename:float
|
||||
n miniRT.h /^ t_vec3 n;$/;" m struct:s_calc typeref:typename:t_vec3
|
||||
name minilibx-linux/mlx_int.h /^ char *name;$/;" m struct:s_col_name typeref:typename:char *
|
||||
name minilibx-linux/mlx_int.h /^ int name;$/;" m struct:s_xpm_col typeref:typename:int
|
||||
ndc_x miniRT.h /^ float ndc_x;$/;" m struct:s_calc typeref:typename:float
|
||||
ndc_y miniRT.h /^ float ndc_y;$/;" m struct:s_calc typeref:typename:float
|
||||
next minilibx-linux/mlx_int.h /^ struct s_win_list *next;$/;" m struct:s_win_list typeref:struct:s_win_list *
|
||||
normal miniRT.h /^ t_vec3 normal;$/;" m struct:s_plane typeref:typename:t_vec3
|
||||
numAmbient miniRT.h /^ int numAmbient;$/;" m struct:s_scene typeref:typename:int
|
||||
numCamera miniRT.h /^ int numCamera;$/;" m struct:s_scene typeref:typename:int
|
||||
numCylinders miniRT.h /^ int numCylinders;$/;" m struct:s_scene typeref:typename:int
|
||||
numLights miniRT.h /^ int numLights;$/;" m struct:s_scene typeref:typename:int
|
||||
numPlanes miniRT.h /^ int numPlanes;$/;" m struct:s_scene typeref:typename:int
|
||||
@@ -181,53 +573,88 @@ oc_dot_v miniRT.h /^ float oc_dot_v;$/;" m struct:s_calc typeref:typename:float
|
||||
oc_perp miniRT.h /^ t_vec3 oc_perp;$/;" m struct:s_calc typeref:typename:t_vec3
|
||||
origin miniRT.h /^ t_vec3 origin;$/;" m struct:s_ray typeref:typename:t_vec3
|
||||
p miniRT.h /^ t_vec3 p;$/;" m struct:s_calc typeref:typename:t_vec3
|
||||
param minilibx-linux/mlx_int.h /^ void *param;$/;" m struct:s_event_list typeref:typename:void *
|
||||
parse_args minilibx-linux/configure /^parse_args(){$/;" f
|
||||
parse_color parsing_color.c /^t_vec3 parse_color(const char *token, t_scene scene)$/;" f typeref:typename:t_vec3
|
||||
parse_vector parsing_vector.c /^t_vec3 parse_vector(const char *token, t_scene scene)$/;" f typeref:typename:t_vec3
|
||||
parse_vector_normalize parsing_vector.c /^t_vec3 parse_vector_normalize(const char *token, t_scene scene)$/;" f typeref:typename:t_vec3
|
||||
parsing_ambiant parsing_ambiant.c /^t_scene parsing_ambiant(const char *line, t_scene scene)$/;" f typeref:typename:t_scene
|
||||
parsing_camera parsing_camera.c /^t_scene parsing_camera(const char *line, t_scene scene)$/;" f typeref:typename:t_scene
|
||||
parsing_cylinder parsing_cylinder.c /^t_scene parsing_cylinder(const char *line, t_scene scene)$/;" f typeref:typename:t_scene
|
||||
parsing_light parsing_light.c /^t_scene parsing_light(const char *line, t_scene scene)$/;" f typeref:typename:t_scene
|
||||
parsing_line config.c /^static inline t_scene parsing_line(const char *line, t_scene scene)$/;" f typeref:typename:t_scene file:
|
||||
parsing_plane parsing_plane.c /^t_scene parsing_plane(const char *line, t_scene scene)$/;" f typeref:typename:t_scene
|
||||
parsing_sphere parsing_sphere.c /^t_scene parsing_sphere(const char *line, t_scene scene)$/;" f typeref:typename:t_scene
|
||||
parsing_ambiant parsing_ambiant.c /^t_scene parsing_ambiant(t_scene scene)$/;" f typeref:typename:t_scene
|
||||
parsing_camera parsing_camera.c /^t_scene parsing_camera(t_scene scene)$/;" f typeref:typename:t_scene
|
||||
parsing_cylindre parsing_cylinder.c /^t_scene parsing_cylindre(t_scene scene)$/;" f typeref:typename:t_scene
|
||||
parsing_light parsing_light.c /^t_scene parsing_light(t_scene scene)$/;" f typeref:typename:t_scene
|
||||
parsing_line config.c /^static inline t_scene parsing_line(char *line, t_scene scene)$/;" f typeref:typename:t_scene file:
|
||||
parsing_plane parsing_plane.c /^t_scene parsing_plane(t_scene scene)$/;" f typeref:typename:t_scene
|
||||
parsing_sphere parsing_sphere.c /^t_scene parsing_sphere(t_scene scene)$/;" f typeref:typename:t_scene
|
||||
partie_entiere libft/ft_strtod.c /^static int partie_entiere(double *entier, char *string, int i, double *sign)$/;" f typeref:typename:int file:
|
||||
pitch miniRT.h /^ float pitch; \/\/ vue de haut en bas en radians$/;" m struct:s_camera typeref:typename:float
|
||||
pitch miniRT.h /^ float pitch;$/;" m struct:s_app typeref:typename:float
|
||||
pitch raytracer_formatted.c /^float pitch = 0.0f; \/\/ vue de haut en bas en radians$/;" v typeref:typename:float
|
||||
pix minilibx-linux/mlx_int.h /^ Pixmap pix;$/;" m struct:s_img typeref:typename:Pixmap
|
||||
pixels miniRT.h /^ int *pixels;$/;" m struct:s_app typeref:typename:int *
|
||||
planes miniRT.h /^ t_plane planes[MAX_PLANES];$/;" m struct:s_scene typeref:typename:t_plane[]
|
||||
point miniRT.h /^ t_vec3 point;$/;" m struct:s_plane typeref:typename:t_vec3
|
||||
pos miniRT.h /^ t_vec3 pos;$/;" m struct:s_light typeref:typename:t_vec3
|
||||
printf_fd libft/printf_fd.c /^int printf_fd(int fd, const char *str, ...)$/;" f typeref:typename:int
|
||||
private_cmap minilibx-linux/mlx_int.h /^ int private_cmap;$/;" m struct:s_xvar typeref:typename:int
|
||||
proj miniRT.h /^ float proj;$/;" m struct:s_calc typeref:typename:float
|
||||
r miniRT.h /^ unsigned char r;$/;" m struct:s_calc typeref:typename:unsigned char
|
||||
pshm_format minilibx-linux/mlx_int.h /^ int pshm_format;$/;" m struct:s_xvar typeref:typename:int
|
||||
putnbr_b libft/printf_fd.c /^static int putnbr_b(t_lu n, char *str, int numdig, t_info *info)$/;" f typeref:typename:int file:
|
||||
putstr libft/printf_fd.c /^static int putstr(char *str, char c, int is_char, t_info *info)$/;" f typeref:typename:int file:
|
||||
radius miniRT.h /^ float radius;$/;" m struct:s_sphere typeref:typename:float
|
||||
radius miniRT.h /^ float radius; \/\/ Demi-diamètre$/;" m struct:s_cylinder typeref:typename:float
|
||||
range_is_ok parsing_color.c /^static inline int range_is_ok(char **token_color)$/;" f typeref:typename:int file:
|
||||
range_is_ok parsing_vector.c /^static inline int range_is_ok(char **token_vector)$/;" f typeref:typename:int file:
|
||||
ratio miniRT.h /^ float ratio;$/;" m struct:s_ambient typeref:typename:float
|
||||
ray miniRT.h /^ t_ray ray;$/;" m struct:s_calc typeref:typename:t_ray
|
||||
ray_dir miniRT.h /^ t_vec3 ray_dir;$/;" m struct:s_calc typeref:typename:t_vec3
|
||||
render_pixel render.c /^static void render_pixel(t_app *app, int x, int y)$/;" f typeref:typename:void file:
|
||||
render_scene render.c /^void render_scene(t_app *app)$/;" f typeref:typename:void
|
||||
re libft/Makefile /^re: fclean all$/;" t
|
||||
re makefile /^re: fclean all$/;" t
|
||||
re minilibx-linux/Makefile /^re : clean all$/;" t
|
||||
re minilibx-linux/test/Makefile.mk /^re: clean all$/;" t
|
||||
render_pixel render.c /^static void render_pixel(t_app *app, int x, int y, t_scene scene)$/;" f typeref:typename:void file:
|
||||
render_scene render.c /^void render_scene(t_app *app, t_scene scene)$/;" f typeref:typename:void
|
||||
right miniRT.h /^ t_vec3 right;$/;" m struct:s_app typeref:typename:t_vec3
|
||||
root minilibx-linux/mlx_int.h /^ Window root;$/;" m struct:s_xvar typeref:typename:Window
|
||||
rot_speed miniRT.h /^ float rot_speed;$/;" m struct:s_app typeref:typename:float
|
||||
s_ambient miniRT.h /^typedef struct s_ambient$/;" s
|
||||
s_app miniRT.h /^typedef struct s_app$/;" s
|
||||
s_calc miniRT.h /^typedef struct s_calc$/;" s
|
||||
s_camera miniRT.h /^typedef struct s_camera$/;" s
|
||||
s_col_name minilibx-linux/mlx_int.h /^struct s_col_name$/;" s
|
||||
s_cylinder miniRT.h /^typedef struct s_cylinder$/;" s
|
||||
s_event_list minilibx-linux/mlx_int.h /^typedef struct s_event_list$/;" s
|
||||
s_img minilibx-linux/mlx_int.h /^typedef struct s_img$/;" s
|
||||
s_info libft/libft.h /^struct s_info$/;" s
|
||||
s_light miniRT.h /^typedef struct s_light$/;" s
|
||||
s_plane miniRT.h /^typedef struct s_plane$/;" s
|
||||
s_ray miniRT.h /^typedef struct s_ray$/;" s
|
||||
s_scene miniRT.h /^typedef struct s_scene$/;" s
|
||||
s_sphere miniRT.h /^typedef struct s_sphere$/;" s
|
||||
s_vec3 miniRT.h /^typedef struct s_vec3$/;" s
|
||||
s_win_list minilibx-linux/mlx_int.h /^typedef struct s_win_list$/;" s
|
||||
s_xpm_col minilibx-linux/mlx_int.h /^typedef struct s_xpm_col$/;" s
|
||||
s_xvar minilibx-linux/mlx_int.h /^typedef struct s_xvar$/;" s
|
||||
saved_mode minilibx-linux/mlx_ext_randr.c /^RRMode saved_mode = 0;$/;" v typeref:typename:RRMode
|
||||
scale miniRT.h /^ float scale;$/;" m struct:s_calc typeref:typename:float
|
||||
screen minilibx-linux/mlx_int.h /^ int screen;$/;" m struct:s_xvar typeref:typename:int
|
||||
screen_x miniRT.h /^ float screen_x;$/;" m struct:s_calc typeref:typename:float
|
||||
screen_y miniRT.h /^ float screen_y;$/;" m struct:s_calc typeref:typename:float
|
||||
select_final_intersection parsing_cylinder_utils.c /^static float select_final_intersection(t_calc *calc) {$/;" f typeref:typename:float file:
|
||||
setup_hooks main.c /^static void setup_hooks(t_app *app)$/;" f typeref:typename:void file:
|
||||
shm minilibx-linux/mlx_int.h /^ XShmSegmentInfo shm;$/;" m struct:s_img typeref:typename:XShmSegmentInfo
|
||||
shm_att_pb minilibx-linux/mlx_new_image.c /^int shm_att_pb(Display *d,XErrorEvent *ev)$/;" f typeref:typename:int
|
||||
show minilibx-linux/Makefile.mk /^show:$/;" t
|
||||
show minilibx-linux/test/Makefile.mk /^show:$/;" t
|
||||
show_help minilibx-linux/configure /^show_help(){$/;" f
|
||||
sigint_handler minilibx-linux/test/run_tests.sh /^sigint_handler(){$/;" f
|
||||
size_line miniRT.h /^ int size_line;$/;" m struct:s_app typeref:typename:int
|
||||
size_line minilibx-linux/mlx_int.h /^ int size_line;$/;" m struct:s_img typeref:typename:int
|
||||
sl1 minilibx-linux/test/main.c /^int sl1;$/;" v typeref:typename:int
|
||||
sl2 minilibx-linux/test/main.c /^int sl2;$/;" v typeref:typename:int
|
||||
sl3 minilibx-linux/test/main.c /^int sl3;$/;" v typeref:typename:int
|
||||
sl4 minilibx-linux/test/main.c /^int sl4;$/;" v typeref:typename:int
|
||||
spheres miniRT.h /^ t_sphere spheres[MAX_SPHERES];$/;" m struct:s_scene typeref:typename:t_sphere[]
|
||||
sqrtDisc miniRT.h /^ float sqrtDisc;$/;" m struct:s_calc typeref:typename:float
|
||||
strlcpy_is_not_posix minilibx-linux/mlx_xpm.c /^unsigned int strlcpy_is_not_posix(char *dest, char *src, unsigned int size)$/;" f typeref:typename:unsigned int
|
||||
t miniRT.h /^ float t;$/;" m struct:s_calc typeref:typename:float
|
||||
t0 miniRT.h /^ float t0;$/;" m struct:s_calc typeref:typename:float
|
||||
t1 miniRT.h /^ float t1;$/;" m struct:s_calc typeref:typename:float
|
||||
@@ -238,22 +665,33 @@ t_calc miniRT.h /^} t_calc;$/;" t typeref:struct:s_calc
|
||||
t_camera miniRT.h /^} t_camera;$/;" t typeref:struct:s_camera
|
||||
t_cap miniRT.h /^ float t_cap;$/;" m struct:s_calc typeref:typename:float
|
||||
t_cylinder miniRT.h /^} t_cylinder;$/;" t typeref:struct:s_cylinder
|
||||
t_event_list minilibx-linux/mlx_int.h /^} t_event_list;$/;" t typeref:struct:s_event_list
|
||||
t_final miniRT.h /^ float t_final;$/;" m struct:s_calc typeref:typename:float
|
||||
t_img minilibx-linux/mlx_int.h /^} t_img;$/;" t typeref:struct:s_img
|
||||
t_info libft/libft.h /^typedef struct s_info t_info;$/;" t typeref:struct:s_info
|
||||
t_light miniRT.h /^} t_light;$/;" t typeref:struct:s_light
|
||||
t_lu libft/libft.h /^typedef unsigned long t_lu;$/;" t typeref:typename:unsigned long
|
||||
t_plane miniRT.h /^} t_plane;$/;" t typeref:struct:s_plane
|
||||
t_ray miniRT.h /^} t_ray;$/;" t typeref:struct:s_ray
|
||||
t_scene miniRT.h /^} t_scene;$/;" t typeref:struct:s_scene
|
||||
t_side miniRT.h /^ float t_side;$/;" m struct:s_calc typeref:typename:float
|
||||
t_sphere miniRT.h /^} t_sphere;$/;" t typeref:struct:s_sphere
|
||||
t_top miniRT.h /^ float t_top;$/;" m struct:s_calc typeref:typename:float
|
||||
t_ui libft/libft.h /^typedef unsigned int t_ui;$/;" t typeref:typename:unsigned int
|
||||
t_vec3 miniRT.h /^} t_vec3;$/;" t typeref:struct:s_vec3
|
||||
token_if_exit miniRT.h /^ const char **token_if_exit;$/;" m struct:s_scene typeref:typename:const char **
|
||||
trace raytracer_formatted.c /^t_vec3 trace(Ray ray)$/;" f typeref:typename:t_vec3
|
||||
trace trace.c /^t_vec3 trace(Ray ray) {$/;" f typeref:typename:t_vec3
|
||||
t_win_list minilibx-linux/mlx_int.h /^} t_win_list;$/;" t typeref:struct:s_win_list
|
||||
t_xpm_col minilibx-linux/mlx_int.h /^} t_xpm_col;$/;" t typeref:struct:s_xpm_col
|
||||
t_xvar minilibx-linux/mlx_int.h /^} t_xvar;$/;" t typeref:struct:s_xvar
|
||||
test_default_main minilibx-linux/test/run_tests.sh /^test_default_main(){$/;" f
|
||||
token_if_exit miniRT.h /^ char **token_if_exit;$/;" m struct:s_scene typeref:typename:char **
|
||||
trace trace.c /^t_vec3 trace(t_ray ray, t_scene scene) {$/;" f typeref:typename:t_vec3
|
||||
treat_int libft/printf_fd.c /^static int treat_int(int n, char *str, int numdig, t_info *info)$/;" f typeref:typename:int file:
|
||||
type minilibx-linux/mlx_int.h /^ int type;$/;" m struct:s_img typeref:typename:int
|
||||
update_camera update_camera.c /^void update_camera(t_app *app)$/;" f typeref:typename:void
|
||||
update_camera_movement update_camera.c /^static void update_camera_movement(t_app *app)$/;" f typeref:typename:void file:
|
||||
update_camera_rotation update_camera.c /^static void update_camera_rotation(t_app *app)$/;" f typeref:typename:void file:
|
||||
update_frame frame.c /^int update_frame(t_app *app)$/;" f typeref:typename:int
|
||||
update_frame frame.c /^int update_frame(t_app *app, t_scene scene)$/;" f typeref:typename:int
|
||||
use_xshm minilibx-linux/mlx_int.h /^ int use_xshm;$/;" m struct:s_xvar typeref:typename:int
|
||||
v miniRT.h /^ t_vec3 v;$/;" m struct:s_calc typeref:typename:t_vec3
|
||||
vec3_add calcul_de_vecteur.c /^t_vec3 vec3_add(t_vec3 a, t_vec3 b)$/;" f typeref:typename:t_vec3
|
||||
vec3_cross calcul_de_vecteur.c /^t_vec3 vec3_cross(t_vec3 a, t_vec3 b)$/;" f typeref:typename:t_vec3
|
||||
@@ -263,13 +701,26 @@ vec3_mul calcul_de_vecteur2.c /^t_vec3 vec3_mul(t_vec3 a, t_vec3 b)$/;" f typere
|
||||
vec3_normalize calcul_de_vecteur2.c /^t_vec3 vec3_normalize(t_vec3 a)$/;" f typeref:typename:t_vec3
|
||||
vec3_scale calcul_de_vecteur.c /^t_vec3 vec3_scale(t_vec3 a, float s)$/;" f typeref:typename:t_vec3
|
||||
vec3_sub calcul_de_vecteur.c /^t_vec3 vec3_sub(t_vec3 a, t_vec3 b)$/;" f typeref:typename:t_vec3
|
||||
visual minilibx-linux/mlx_int.h /^ Visual *visual;$/;" m struct:s_xvar typeref:typename:Visual *
|
||||
width minilibx-linux/mlx_int.h /^ int width;$/;" m struct:s_img typeref:typename:int
|
||||
win miniRT.h /^ void *win;$/;" m struct:s_app typeref:typename:void *
|
||||
win1 minilibx-linux/test/main.c /^void *win1;$/;" v typeref:typename:void *
|
||||
win1 minilibx-linux/test/new_win.c /^void *win1;$/;" v typeref:typename:void *
|
||||
win2 minilibx-linux/test/main.c /^void *win2;$/;" v typeref:typename:void *
|
||||
win2 minilibx-linux/test/new_win.c /^void *win2;$/;" v typeref:typename:void *
|
||||
win3 minilibx-linux/test/main.c /^void *win3;$/;" v typeref:typename:void *
|
||||
win_count minilibx-linux/mlx_loop.c /^static int win_count(t_xvar *xvar)$/;" f typeref:typename:int file:
|
||||
win_height miniRT.h /^ int win_height;$/;" m struct:s_app typeref:typename:int
|
||||
win_list minilibx-linux/mlx_int.h /^ t_win_list *win_list;$/;" m struct:s_xvar typeref:typename:t_win_list *
|
||||
win_width miniRT.h /^ int win_width;$/;" m struct:s_app typeref:typename:int
|
||||
window minilibx-linux/mlx_int.h /^ Window window;$/;" m struct:s_win_list typeref:typename:Window
|
||||
wm_delete_window minilibx-linux/mlx_int.h /^ Atom wm_delete_window;$/;" m struct:s_xvar typeref:typename:Atom
|
||||
wm_protocols minilibx-linux/mlx_int.h /^ Atom wm_protocols;$/;" m struct:s_xvar typeref:typename:Atom
|
||||
x miniRT.h /^ float x;$/;" m struct:s_vec3 typeref:typename:float
|
||||
xpm1_x minilibx-linux/test/main.c /^int xpm1_x;$/;" v typeref:typename:int
|
||||
xpm1_y minilibx-linux/test/main.c /^int xpm1_y;$/;" v typeref:typename:int
|
||||
y miniRT.h /^ float y;$/;" m struct:s_vec3 typeref:typename:float
|
||||
y miniRT.h /^ float y;$/;" m struct:s_calc typeref:typename:float
|
||||
yaw miniRT.h /^ float yaw;\/\/ vue de gauche a droite$/;" m struct:s_camera typeref:typename:float
|
||||
yaw miniRT.h /^ float yaw;$/;" m struct:s_app typeref:typename:float
|
||||
yaw raytracer_formatted.c /^float yaw = 0.0f;\/\/ vue de gauche a droite$/;" v typeref:typename:float
|
||||
z miniRT.h /^ float z;$/;" m struct:s_vec3 typeref:typename:float
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/17 19:07:07 by yantoine #+# #+# */
|
||||
/* Updated: 2025/02/17 19:10:35 by yantoine ### ########.fr */
|
||||
/* Updated: 2025/02/17 21:51:30 by yantoine ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -15,41 +15,41 @@
|
||||
#include "miniRT.h"
|
||||
|
||||
// Renvoie true si le rayon intersecte un objet, et met à jour tMin, hitNormal et objColor
|
||||
bool intersectObjects(Ray ray, float *tMin, t_vec3 *hitNormal, t_vec3 *objColor) {
|
||||
bool intersectObjects(t_ray ray, float *tMin, t_vec3 *hitNormal, t_vec3 *objColor, t_scene scene) {
|
||||
bool hit = false;
|
||||
float t;
|
||||
t_vec3 n;
|
||||
int i = 0;
|
||||
while (i < numSpheres) {
|
||||
t = intersectSphere(ray, spheres[i], &n);
|
||||
if (t > 1e-3f && t < *tMin) { *tMin = t; *hitNormal = n; *objColor = spheres[i].color; hit = true; }
|
||||
while (i < scene.numSpheres) {
|
||||
t = intersectSphere(ray, scene.spheres[i], &n);
|
||||
if (t > 1e-3f && t < *tMin) { *tMin = t; *hitNormal = n; *objColor = scene.spheres[i].color; hit = true; }
|
||||
i++;
|
||||
}
|
||||
i = 0;
|
||||
while (i < numPlanes) {
|
||||
t = intersectPlane(ray, planes[i], &n);
|
||||
if (t > 1e-3f && t < *tMin) { *tMin = t; *hitNormal = n; *objColor = planes[i].color; hit = true; }
|
||||
while (i < scene.numPlanes) {
|
||||
t = intersectPlane(ray, scene.planes[i], &n);
|
||||
if (t > 1e-3f && t < *tMin) { *tMin = t; *hitNormal = n; *objColor = scene.planes[i].color; hit = true; }
|
||||
i++;
|
||||
}
|
||||
i = 0;
|
||||
while (i < numCylinders) {
|
||||
t = intersectCylinder(ray, cylinders[i], &n);
|
||||
if (t > 1e-3f && t < *tMin) { *tMin = t; *hitNormal = n; *objColor = cylinders[i].color; hit = true; }
|
||||
while (i < scene.numCylinders) {
|
||||
t = intersectCylinder(ray, scene.cylinders[i], &n);
|
||||
if (t > 1e-3f && t < *tMin) { *tMin = t; *hitNormal = n; *objColor = scene.cylinders[i].color; hit = true; }
|
||||
i++;
|
||||
}
|
||||
return hit;
|
||||
}
|
||||
|
||||
// Calcule l'éclairage (ambiant, diffus et spéculaire) sur un point d'impact
|
||||
t_vec3 calcLighting(t_vec3 hitPoint, t_vec3 hitNormal, t_vec3 objColor) {
|
||||
t_vec3 color = vec3_scale(objColor, ambient_ratio);
|
||||
t_vec3 calcLighting(t_vec3 hitPoint, t_vec3 hitNormal, t_vec3 objColor, t_scene scene) {
|
||||
t_vec3 color = vec3_scale(objColor, scene.ambient.ratio);
|
||||
int i = 0;
|
||||
while (i < numLights) {
|
||||
Light light = lights[i];
|
||||
while (i < scene.numLights) {
|
||||
t_light light = scene.lights[i];
|
||||
t_vec3 L = vec3_normalize(vec3_sub(light.pos, hitPoint));
|
||||
if (!isInShadow(hitPoint, light.pos)) {
|
||||
if (!isInShadow(hitPoint, light.pos, scene)) {
|
||||
float diff = fmaxf(0.0f, vec3_dot(hitNormal, L));
|
||||
t_vec3 viewDir = vec3_normalize(vec3_sub(camPos, hitPoint));
|
||||
t_vec3 viewDir = vec3_normalize(vec3_sub(scene.camera.camPos, hitPoint));
|
||||
t_vec3 halfDir = vec3_normalize(vec3_add(L, viewDir));
|
||||
float spec = powf(fmaxf(0.0f, vec3_dot(hitNormal, halfDir)), 32.0f);
|
||||
color = vec3_add(color, vec3_scale(vec3_mul(objColor, light.color),
|
||||
@@ -66,13 +66,13 @@ t_vec3 calcLighting(t_vec3 hitPoint, t_vec3 hitNormal, t_vec3 objColor) {
|
||||
}
|
||||
|
||||
// Fonction principale de lancer de rayon (trace)
|
||||
t_vec3 trace(Ray ray) {
|
||||
t_vec3 trace(t_ray ray, t_scene scene) {
|
||||
float tMin = 1e9;
|
||||
t_vec3 hitNormal = {0, 0, 0};
|
||||
t_vec3 objColor = {0, 0, 0};
|
||||
if (intersectObjects(ray, &tMin, &hitNormal, &objColor)) {
|
||||
if (intersectObjects(ray, &tMin, &hitNormal, &objColor, scene)) {
|
||||
t_vec3 hitPoint = vec3_add(ray.origin, vec3_scale(ray.dir, tMin));
|
||||
return calcLighting(hitPoint, hitNormal, objColor);
|
||||
return calcLighting(hitPoint, hitNormal, objColor, scene);
|
||||
}
|
||||
return (t_vec3){0.2f, 0.7f, 1.0f}; // Couleur de fond (ciel)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user