update norme
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/02/13 20:02:36 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 intersectPlane(t_ray ray, t_plane p, t_vec3 *hitNormal);
|
||||||
float intersectSphere(t_ray ray, t_sphere s, 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 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 *objColor, t_scene scene);
|
||||||
t_vec3 calcLighting(t_vec3 hitPoint, t_vec3 hitNormal, t_vec3 objColor,
|
t_vec3 calcLighting(t_vec3 hitPoint, t_vec3 hitNormal, t_vec3 objColor,
|
||||||
t_scene scene);
|
t_scene scene);
|
||||||
|
|||||||
@@ -13,13 +13,13 @@
|
|||||||
#include "miniRT.h"
|
#include "miniRT.h"
|
||||||
|
|
||||||
// Vérifie les intersections avec les sphères
|
// Vérifie les intersections avec les sphères
|
||||||
static bool check_shadow_sphere(const t_ray shadow_ray, \
|
static bool check_shadow_sphere(const t_ray shadow_ray, float max_t,
|
||||||
float max_t, t_scene scene)
|
t_scene scene)
|
||||||
{
|
{
|
||||||
const float epsilon = 1e-3f;
|
const float epsilon = 1e-3f;
|
||||||
int i;
|
int i;
|
||||||
t_vec3 dummy;
|
t_vec3 dummy;
|
||||||
float t;
|
float t;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < scene.numSpheres)
|
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
|
// Vérifie les intersections avec les plans
|
||||||
static bool check_shadow_plane(const t_ray shadow_ray, \
|
static bool check_shadow_plane(const t_ray shadow_ray, float max_t,
|
||||||
float max_t, t_scene scene)
|
t_scene scene)
|
||||||
{
|
{
|
||||||
const float epsilon = 1e-3f;
|
const float epsilon = 1e-3f;
|
||||||
int i;
|
int i;
|
||||||
t_vec3 dummy;
|
t_vec3 dummy;
|
||||||
float t;
|
float t;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < scene.numPlanes)
|
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
|
// Vérifie les intersections avec les cylindres
|
||||||
static bool check_shadow_cylinder(const t_ray shadow_ray, \
|
static bool check_shadow_cylinder(const t_ray shadow_ray, float max_t,
|
||||||
float max_t, t_scene scene)
|
t_scene scene)
|
||||||
{
|
{
|
||||||
const float epsilon = 1e-3f;
|
const float epsilon = 1e-3f;
|
||||||
int i;
|
int i;
|
||||||
t_vec3 dummy;
|
t_vec3 dummy;
|
||||||
float t;
|
float t;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < scene.numCylinders)
|
while (i < scene.numCylinders)
|
||||||
|
|||||||
@@ -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
|
center miniRT.h /^ t_vec3 center;$/;" m struct:s_sphere typeref:typename:t_vec3
|
||||||
check minilibx-linux/Makefile.mk /^check: all$/;" t
|
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_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_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, \\$/;" 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, \\$/;" 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_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
|
check_tokens check.c /^int check_tokens(char **tokens, int expected)$/;" f typeref:typename:int
|
||||||
clean libft/Makefile /^clean:$/;" t
|
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_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:
|
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
|
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
|
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
|
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
|
is_in_shadow shadows.c /^bool is_in_shadow(t_vec3 hitPoint, t_vec3 lightPos, t_scene scene)$/;" f typeref:typename:bool
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/02/17 19:07:07 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,
|
// 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,
|
bool interesct_objects(t_ray ray, float *tMin, t_vec3 *hitNormal,
|
||||||
t_vec3 *objColor, t_scene scene)
|
t_vec3 *objColor, t_scene scene)
|
||||||
{
|
{
|
||||||
bool hit;
|
bool hit;
|
||||||
@@ -117,7 +117,7 @@ t_vec3 trace(t_ray ray, t_scene scene)
|
|||||||
tMin = 1e9;
|
tMin = 1e9;
|
||||||
hitNormal = (t_vec3){0, 0, 0};
|
hitNormal = (t_vec3){0, 0, 0};
|
||||||
objColor = (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));
|
hitPoint = vec3_add(ray.origin, vec3_scale(ray.dir, tMin));
|
||||||
return (calcLighting(hitPoint, hitNormal, objColor, scene));
|
return (calcLighting(hitPoint, hitNormal, objColor, scene));
|
||||||
|
|||||||
Reference in New Issue
Block a user