Added new files for BVH, AABB, and Debug functionalities. Added new utility functions in Common.h. Added gamma correction function in PostProcessing.h. Changed the return type of path_trace to vec4s for alpha blending. Changed BSDF function signatures to include sample index and bounce. Changed the BSDF.h to replace inline functions with declarations. Changed the Light and SkyLight evaluation functions to include throughput and sample index. Changed the sphere creation function in GeometryUtilities.h for better quality. Changed the scene structure to include a BVH tree for improved ray intersection. Changed the scene initialization parameters for better performance. Created new Debug functions for ray intersection counting. Created new functions for triangle collection management in Triangle.c. Improved pixel updating logic in Window.c. Improved ray intersection performance with new BVH implementation. Removed unused includes from Common.h. Removed old library linking methods in CMakeLists.txt.
31 lines
845 B
C
31 lines
845 B
C
#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
|