From 4914f8eb717f2883478b6f3d43a3f04e7db0c8a0 Mon Sep 17 00:00:00 2001 From: Abdelrahman Date: Sun, 4 Feb 2024 00:20:54 +0000 Subject: [PATCH] Define custom EPSILON --- src/raytracer/main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/raytracer/main.c b/src/raytracer/main.c index 2f2a4ad..1d4b455 100644 --- a/src/raytracer/main.c +++ b/src/raytracer/main.c @@ -2,13 +2,14 @@ #include "vector/vec.h" #include "window/window.h" #include -#include #include #include #include #include #include +#define EPSILON 0.001f + #define ARR_LEN(ARR) sizeof(ARR) / sizeof(ARR[0]) typedef struct { @@ -283,7 +284,7 @@ f32 compute_lighting(vec3f_t position, vec3f_t surface_normal, I += light.intensity; } else { vec3f_t light_direction = {0}; - f32 t_max = FLT_EPSILON; + f32 t_max = EPSILON; switch (light.type) { case LIGHT_TYPE_POINT: @@ -299,7 +300,7 @@ f32 compute_lighting(vec3f_t position, vec3f_t surface_normal, } intersection_t shadow = find_closest_intersection( - position, light_direction, 0.001f, t_max, scene); + position, light_direction, EPSILON, t_max, scene); if (shadow.closest_sphere != NULL) { continue; }