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 <SDL2/SDL_events.h> -#include <float.h> #include <math.h> #include <stdbool.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> +#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; }