Define custom EPSILON

This commit is contained in:
Abdelrahman Said 2024-02-04 00:20:54 +00:00
parent 56959990e4
commit 4914f8eb71

View File

@ -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;
}