diff --git a/miniRT b/miniRT index 315364e..efc7ba5 100755 Binary files a/miniRT and b/miniRT differ diff --git a/miniRT.h b/miniRT.h index bdd499e..ba002c7 100644 --- a/miniRT.h +++ b/miniRT.h @@ -6,7 +6,7 @@ /* By: yantoine +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/02/13 20:02:36 by yantoine #+# #+# */ -/* Updated: 2025/02/18 17:39:45 by yantoine ### ########.fr */ +/* Updated: 2025/02/18 17:50:11 by yantoine ### ########.fr */ /* */ /* ************************************************************************** */ @@ -221,7 +221,7 @@ 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 is_in_shadow(t_vec3 hitPoint, t_vec3 lightPos, t_scene scene); -bool intersectObjects(t_ray ray, float *tMin, t_vec3 *hitNormal, +bool intersect_objects(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); diff --git a/shadows.c b/shadows.c index 51751f6..ee61115 100644 --- a/shadows.c +++ b/shadows.c @@ -13,13 +13,13 @@ #include "miniRT.h" // Vérifie les intersections avec les sphères -static bool check_shadow_sphere(const t_ray shadow_ray, \ - float max_t, t_scene scene) +static bool check_shadow_sphere(const t_ray shadow_ray, float max_t, + t_scene scene) { const float epsilon = 1e-3f; - int i; - t_vec3 dummy; - float t; + int i; + t_vec3 dummy; + float t; i = 0; while (i < scene.numSpheres) @@ -33,13 +33,13 @@ static bool check_shadow_sphere(const t_ray shadow_ray, \ } // Vérifie les intersections avec les plans -static bool check_shadow_plane(const t_ray shadow_ray, \ - float max_t, t_scene scene) +static bool check_shadow_plane(const t_ray shadow_ray, float max_t, + t_scene scene) { const float epsilon = 1e-3f; - int i; - t_vec3 dummy; - float t; + int i; + t_vec3 dummy; + float t; i = 0; while (i < scene.numPlanes) @@ -53,13 +53,13 @@ static bool check_shadow_plane(const t_ray shadow_ray, \ } // Vérifie les intersections avec les cylindres -static bool check_shadow_cylinder(const t_ray shadow_ray, \ - float max_t, t_scene scene) +static bool check_shadow_cylinder(const t_ray shadow_ray, float max_t, + t_scene scene) { const float epsilon = 1e-3f; - int i; - t_vec3 dummy; - float t; + int i; + t_vec3 dummy; + float t; i = 0; while (i < scene.numCylinders) diff --git a/tags b/tags index 89f06b8..99e747b 100644 --- a/tags +++ b/tags @@ -292,9 +292,9 @@ center miniRT.h /^ t_vec3 center;$/;" m struct:s_cylinder typeref:typename:t_ve center miniRT.h /^ t_vec3 center;$/;" m struct:s_sphere typeref:typename:t_vec3 check minilibx-linux/Makefile.mk /^check: all$/;" t check_if_max check.c /^void check_if_max(t_scene scene, const int to_test, const int max)$/;" f typeref:typename:void -check_shadow_cylinder shadows.c /^static bool check_shadow_cylinder(const t_ray shadow_ray, \\$/;" f typeref:typename:bool file: -check_shadow_plane shadows.c /^static bool check_shadow_plane(const t_ray shadow_ray, \\$/;" f typeref:typename:bool file: -check_shadow_sphere shadows.c /^static bool check_shadow_sphere(const t_ray shadow_ray, \\$/;" f typeref:typename:bool file: +check_shadow_cylinder shadows.c /^static bool check_shadow_cylinder(const t_ray shadow_ray, float max_t,$/;" f typeref:typename:bool file: +check_shadow_plane shadows.c /^static bool check_shadow_plane(const t_ray shadow_ray, float max_t,$/;" f typeref:typename:bool file: +check_shadow_sphere shadows.c /^static bool check_shadow_sphere(const t_ray shadow_ray, float max_t,$/;" f typeref:typename:bool file: 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 @@ -434,8 +434,8 @@ 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_mlx_and_image main.c /^static int init_mlx_and_image(t_app *app)$/;" f typeref:typename:int file: +interesct_objects trace.c /^bool interesct_objects(t_ray ray, float *tMin, t_vec3 *hitNormal,$/;" 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 is_in_shadow shadows.c /^bool is_in_shadow(t_vec3 hitPoint, t_vec3 lightPos, t_scene scene)$/;" f typeref:typename:bool diff --git a/trace.c b/trace.c index 02e9753..8cea09c 100644 --- a/trace.c +++ b/trace.c @@ -6,7 +6,7 @@ /* By: yantoine +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/02/17 19:07:07 by yantoine #+# #+# */ -/* Updated: 2025/02/18 17:40:17 by yantoine ### ########.fr */ +/* Updated: 2025/02/18 18:04:11 by yantoine ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,7 +14,7 @@ // Renvoie true si le rayon intersecte un objet, et met à jour tMin, //hitNormal et objColor -bool intersectObjects(t_ray ray, float *tMin, t_vec3 *hitNormal, +bool interesct_objects(t_ray ray, float *tMin, t_vec3 *hitNormal, t_vec3 *objColor, t_scene scene) { bool hit; @@ -117,7 +117,7 @@ t_vec3 trace(t_ray ray, t_scene scene) tMin = 1e9; hitNormal = (t_vec3){0, 0, 0}; objColor = (t_vec3){0, 0, 0}; - if (intersectObjects(ray, &tMin, &hitNormal, &objColor, scene)) + if (interesct_objects(ray, &tMin, &hitNormal, &objColor, scene)) { hitPoint = vec3_add(ray.origin, vec3_scale(ray.dir, tMin)); return (calcLighting(hitPoint, hitNormal, objColor, scene));