update .rt et norme

This commit is contained in:
H3XploR
2025-02-18 17:20:28 +01:00
parent c6c13573cb
commit 6e963545c9
9 changed files with 172 additions and 166 deletions
+2 -9
View File
@@ -6,28 +6,21 @@
# By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2025/02/13 19:27:37 by yantoine #+# #+# #
# Updated: 2025/02/17 23:45:52 by yantoine ### ########.fr #
# Updated: 2025/02/18 17:19:31 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 0,0,0 0,0,1 70
C 10,20,-60 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
+12 -6
View File
@@ -6,12 +6,22 @@
/* 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 */
/* Updated: 2025/02/18 17:14:00 by yantoine ### ########.fr */
/* */
/* ************************************************************************** */
#include "miniRT.h"
inline static char *check_sign(char *str, int *sign)
{
if (*str == '-')
{
*sign = -1;
str++;
}
return (str);
}
float ft_atof(char *str)
{
float res;
@@ -21,11 +31,7 @@ float ft_atof(char *str)
res = 0;
dec = 0;
sign = 1;
if (*str == '-')
{
sign = -1;
str++;
}
str = check_sign(str, &sign);
while (*str >= '0' && *str <= '9')
{
res = res * 10 + *str - '0';
Executable
BIN
View File
Binary file not shown.
+2 -6
View File
@@ -6,22 +6,18 @@
# By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2025/02/13 19:27:37 by yantoine #+# #+# #
# Updated: 2025/02/17 23:48:57 by yantoine ### ########.fr #
# Updated: 2025/02/18 17:17:07 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 0,0,0 0,0,0 70
C 0,0,0 0,0,-1 70
# Light : source lumineuse forte placée au-dessus de la scène
L 11,40,50 1 255,255,255
sp 0,0,-20 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
+3 -1
View File
@@ -6,7 +6,7 @@
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/15 19:54:13 by yantoine #+# #+# */
/* Updated: 2025/02/17 22:02:43 by yantoine ### ########.fr */
/* Updated: 2025/02/18 17:14:45 by yantoine ### ########.fr */
/* */
/* ************************************************************************** */
@@ -97,6 +97,8 @@ float intersectCylinder(Ray ray, Cylinder cy, t_vec3 *hitNormal)
}*/
t_scene parsing_cylindre(t_scene scene)
{
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);
+1 -55
View File
@@ -6,60 +6,12 @@
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/17 23:16:21 by yantoine #+# #+# */
/* Updated: 2025/02/17 23:35:54 by yantoine ### ########.fr */
/* Updated: 2025/02/18 17:03:05 by yantoine ### ########.fr */
/* */
/* ************************************************************************** */
#include "miniRT.h"
void print_vec3(t_vec3 vec)
{
printf("(x: %.2f, y: %.2f, z: %.2f)", vec.x, vec.y, vec.z);
}
void print_ray(t_ray ray)
{
printf("Rayon d'origine : ");
print_vec3(ray.origin);
printf("\nDirection : ");
print_vec3(ray.dir);
printf("\n");
}
void print_sphere(t_sphere sphere)
{
printf("Centre : ");
print_vec3(sphere.center);
printf("\nRayon : %.2f", sphere.radius);
printf("\nCouleur : ");
print_vec3(sphere.color);
printf("\n");
}
void print_plane(t_plane plane)
{
printf("Point : ");
print_vec3(plane.point);
printf("\nNormale : ");
print_vec3(plane.normal);
printf("\nCouleur : ");
print_vec3(plane.color);
printf("\n");
}
void print_cylinder(t_cylinder cyl)
{
printf("Centre : ");
print_vec3(cyl.center);
printf("\nAxe : ");
print_vec3(cyl.axis);
printf("\nRayon : %.2f", cyl.radius);
printf("\nHauteur : %.2f", cyl.height);
printf("\nCouleur : ");
print_vec3(cyl.color);
printf("\n");
}
void print_light(t_light light)
{
printf("Position : ");
@@ -100,16 +52,13 @@ void print_scene(t_scene scene)
i = 0;
printf("=== SCENE ===\n");
// Ambiance
printf("\n--- Ambiance ---\n");
print_ambient(scene.ambient);
// Caméra
if (scene.numCamera > 0)
{
printf("\n--- Caméra ---\n");
print_camera(scene.camera);
}
// Sphères
printf("\n--- Sphères (%d) ---\n", scene.numSpheres);
i = 0;
while (i < scene.numSpheres)
@@ -118,7 +67,6 @@ void print_scene(t_scene scene)
print_sphere(scene.spheres[i]);
i++;
}
// Plans
printf("\n--- Plans (%d) ---\n", scene.numPlanes);
i = 0;
while (i < scene.numPlanes)
@@ -127,7 +75,6 @@ void print_scene(t_scene scene)
print_plane(scene.planes[i]);
i++;
}
// Cylindres
printf("\n--- Cylindres (%d) ---\n", scene.numCylinders);
i = 0;
while (i < scene.numCylinders)
@@ -136,7 +83,6 @@ void print_scene(t_scene scene)
print_cylinder(scene.cylinders[i]);
i++;
}
// Lumières
printf("\n--- Lumières (%d) ---\n", scene.numLights);
i = 0;
while (i < scene.numLights)
+62
View File
@@ -0,0 +1,62 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print_next.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/18 17:02:32 by yantoine #+# #+# */
/* Updated: 2025/02/18 17:02:42 by yantoine ### ########.fr */
/* */
/* ************************************************************************** */
#include "miniRT.h"
void print_vec3(t_vec3 vec)
{
printf("(x: %.2f, y: %.2f, z: %.2f)", vec.x, vec.y, vec.z);
}
void print_ray(t_ray ray)
{
printf("Rayon d'origine : ");
print_vec3(ray.origin);
printf("\nDirection : ");
print_vec3(ray.dir);
printf("\n");
}
void print_sphere(t_sphere sphere)
{
printf("Centre : ");
print_vec3(sphere.center);
printf("\nRayon : %.2f", sphere.radius);
printf("\nCouleur : ");
print_vec3(sphere.color);
printf("\n");
}
void print_plane(t_plane plane)
{
printf("Point : ");
print_vec3(plane.point);
printf("\nNormale : ");
print_vec3(plane.normal);
printf("\nCouleur : ");
print_vec3(plane.color);
printf("\n");
}
void print_cylinder(t_cylinder cyl)
{
printf("Centre : ");
print_vec3(cyl.center);
printf("\nAxe : ");
print_vec3(cyl.axis);
printf("\nRayon : %.2f", cyl.radius);
printf("\nHauteur : %.2f", cyl.height);
printf("\nCouleur : ");
print_vec3(cyl.color);
printf("\n");
}
+27 -26
View File
@@ -284,17 +284,18 @@ 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, t_scene scene) {$/;" f typeref:typename:t_vec3
calcLighting trace.c /^t_vec3 calcLighting(t_vec3 hitPoint, t_vec3 hitNormal, t_vec3 objColor,$/;" f typeref:typename:t_vec3
camDir miniRT.h /^ t_vec3 camDir;$/;" m struct:s_camera typeref:typename:t_vec3
camPos miniRT.h /^ t_vec3 camPos;$/;" m struct:s_camera 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
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:
checkShadowCylinder shadows.c /^static bool checkShadowCylinder(const t_ray shadowRay, float maxT,$/;" f typeref:typename:bool file:
checkShadowPlane shadows.c /^static bool checkShadowPlane(const t_ray shadowRay, float maxT, float epsilon,$/;" f typeref:typename:bool file:
checkShadowSphere shadows.c /^static bool checkShadowSphere(const t_ray shadowRay, float maxT, float epsilon,$/;" 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_sign ft_atof.c /^inline static char *check_sign(char *str, int *sign)$/;" f typeref:typename:char * file:
check_tokens check.c /^int check_tokens(char **tokens, int expected)$/;" f typeref:typename:int
clean libft/Makefile /^clean:$/;" t
clean makefile /^clean:$/;" t
@@ -305,17 +306,17 @@ 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_calc 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
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:
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,$/;" 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
@@ -410,7 +411,7 @@ gc minilibx-linux/mlx_int.h /^ GC gc;$/;" m struct:s_win_list typeref:typena
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_tokens_secure parsing_utils.c /^char **get_tokens_secure(t_scene scene, const int numObject,$/;" 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 *
@@ -431,13 +432,13 @@ 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(t_ray ray, t_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(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
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,$/;" 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
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
@@ -588,15 +589,15 @@ 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
print_ambient print.c /^void print_ambient(t_ambient amb) {$/;" f typeref:typename:void
print_camera print.c /^void print_camera(t_camera cam) {$/;" f typeref:typename:void
print_cylinder print.c /^void print_cylinder(t_cylinder cyl) {$/;" f typeref:typename:void
print_light print.c /^void print_light(t_light light) {$/;" f typeref:typename:void
print_plane print.c /^void print_plane(t_plane plane) {$/;" f typeref:typename:void
print_ray print.c /^void print_ray(t_ray ray) {$/;" f typeref:typename:void
print_scene print.c /^void print_scene(t_scene scene) {$/;" f typeref:typename:void
print_sphere print.c /^void print_sphere(t_sphere sphere) {$/;" f typeref:typename:void
print_vec3 print.c /^void print_vec3(t_vec3 vec) {$/;" f typeref:typename:void
print_ambient print.c /^void print_ambient(t_ambient amb)$/;" f typeref:typename:void
print_camera print.c /^void print_camera(t_camera cam)$/;" f typeref:typename:void
print_cylinder print_next.c /^void print_cylinder(t_cylinder cyl)$/;" f typeref:typename:void
print_light print.c /^void print_light(t_light light)$/;" f typeref:typename:void
print_plane print_next.c /^void print_plane(t_plane plane)$/;" f typeref:typename:void
print_ray print_next.c /^void print_ray(t_ray ray)$/;" f typeref:typename:void
print_scene print.c /^void print_scene(t_scene scene)$/;" f typeref:typename:void
print_sphere print_next.c /^void print_sphere(t_sphere sphere)$/;" f typeref:typename:void
print_vec3 print_next.c /^void print_vec3(t_vec3 vec)$/;" f typeref:typename:void
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
@@ -643,7 +644,7 @@ scene miniRT.h /^ t_scene scene;$/;" m struct:s_app typeref:typename:t_scene
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:
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
@@ -689,7 +690,7 @@ t_xpm_col minilibx-linux/mlx_int.h /^} t_xpm_col;$/;" t typeref:struct:s_xpm_
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
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
up miniRT.h /^ t_vec3 up;$/;" m struct:s_camera typeref:typename:t_vec3
@@ -725,7 +726,7 @@ wm_protocols minilibx-linux/mlx_int.h /^ Atom wm_protocols;$/;" m struct:s_xvar
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
y miniRT.h /^ float y;$/;" m struct:s_vec3 typeref:typename:float
yaw miniRT.h /^ float yaw; \/\/ vue de gauche a droite$/;" m struct:s_camera typeref:typename:float
z miniRT.h /^ float z;$/;" m struct:s_vec3 typeref:typename:float
+4 -4
View File
@@ -6,14 +6,14 @@
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/17 19:07:07 by yantoine #+# #+# */
/* Updated: 2025/02/17 21:51:30 by yantoine ### ########.fr */
/* Updated: 2025/02/18 17:15:32 by yantoine ### ########.fr */
/* */
/* ************************************************************************** */
#include "miniRT.h"
// Renvoie true si le rayon intersecte un objet, et met à jour tMin,
hitNormal et objColor
//hitNormal et objColor
bool intersectObjects(t_ray ray, float *tMin, t_vec3 *hitNormal,
t_vec3 *objColor, t_scene scene)
{
@@ -115,8 +115,8 @@ t_vec3 trace(t_ray ray, t_scene scene)
t_vec3 hitPoint;
tMin = 1e9;
hitNormal = {0, 0, 0};
objColor = {0, 0, 0};
hitNormal = (t_vec3){0, 0, 0};
objColor = (t_vec3){0, 0, 0};
if (intersectObjects(ray, &tMin, &hitNormal, &objColor, scene))
{
hitPoint = vec3_add(ray.origin, vec3_scale(ray.dir, tMin));