Add front/back face detection
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
typedef struct {
|
||||
vec3_t point, normal;
|
||||
double t;
|
||||
bool front;
|
||||
} hit_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -25,11 +26,17 @@ typedef union {
|
||||
sphere_params_t sphere;
|
||||
} obj_params_t;
|
||||
|
||||
typedef bool intersect_fn_t(
|
||||
obj_params_t params, ray_t ray, hit_t *hit_out, double t_min,
|
||||
double t_max);
|
||||
|
||||
typedef struct {
|
||||
bool (*intersect)(obj_params_t params, ray_t ray, hit_t *hit_out);
|
||||
intersect_fn_t *intersect;
|
||||
obj_params_t params;
|
||||
} obj_t;
|
||||
|
||||
bool intersect_sphere(obj_params_t params, ray_t ray, hit_t *hit_out);
|
||||
bool intersect_sphere(
|
||||
obj_params_t params, ray_t ray, hit_t *hit_out, double t_min,
|
||||
double t_max);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user