#ifndef RAY_INTERSECTION_H #define RAY_INTERSECTION_H #include "Common.h" #include "Geometry/Triangle.h" #include "Rendering/Scene.h" typedef struct { vec3s origin; vec3s direction; } ray_t; typedef struct { vec3s point; vec3s normal; uint64_t triangle_id; float distance; bool hit; } hit_result_t; hit_result_t ray_intersect_triangle(ray_t ray, triangle_t triangle); bool ray_intersect_aabb(ray_t ray, aabb_t aabb, float* enter_out, float* exit_out); void ray_intersect_bvh(const ray_t ray, const bvh_node_t* bvh_nodes, const uint64_t* primitive_indices, const triangle_collection_t* all_triangles, uint64_t node_index, float* closest_out, hit_result_t* best_hit_out); hit_result_t ray_intersect_scene(ray_t ray, const scene_t* scene); #endif // RAY_INTERSECTION_H