Define custom EPSILON
This commit is contained in:
parent
56959990e4
commit
4914f8eb71
@ -2,13 +2,14 @@
|
|||||||
#include "vector/vec.h"
|
#include "vector/vec.h"
|
||||||
#include "window/window.h"
|
#include "window/window.h"
|
||||||
#include <SDL2/SDL_events.h>
|
#include <SDL2/SDL_events.h>
|
||||||
#include <float.h>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#define EPSILON 0.001f
|
||||||
|
|
||||||
#define ARR_LEN(ARR) sizeof(ARR) / sizeof(ARR[0])
|
#define ARR_LEN(ARR) sizeof(ARR) / sizeof(ARR[0])
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -283,7 +284,7 @@ f32 compute_lighting(vec3f_t position, vec3f_t surface_normal,
|
|||||||
I += light.intensity;
|
I += light.intensity;
|
||||||
} else {
|
} else {
|
||||||
vec3f_t light_direction = {0};
|
vec3f_t light_direction = {0};
|
||||||
f32 t_max = FLT_EPSILON;
|
f32 t_max = EPSILON;
|
||||||
|
|
||||||
switch (light.type) {
|
switch (light.type) {
|
||||||
case LIGHT_TYPE_POINT:
|
case LIGHT_TYPE_POINT:
|
||||||
@ -299,7 +300,7 @@ f32 compute_lighting(vec3f_t position, vec3f_t surface_normal,
|
|||||||
}
|
}
|
||||||
|
|
||||||
intersection_t shadow = find_closest_intersection(
|
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) {
|
if (shadow.closest_sphere != NULL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user