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.
25 lines
1.2 KiB
C
25 lines
1.2 KiB
C
#ifndef MESH_H
|
|
#define MESH_H
|
|
|
|
#include "Material/Material.h"
|
|
#include "Geometry/Triangle.h"
|
|
|
|
#include <stdint.h>
|
|
|
|
// TODO: Currently transformation does not work because we store every triangle in to the same buffer and when bulding the bvh, we only consider that triangle buffer.
|
|
// One solution for this is we can have two levels of bvh, one for scene and one for each mesh. The mesh level bvh will apply the transformation to the triangles.
|
|
// The scene level bvh onlt tells the ray which mesh to check and the mesh level bvh will tell the ray which triangle to check.
|
|
// For instancing, we may need another mesh_model_t struct to store the actual bvh and triangle data(like id and size), and each mesh_entity_t will have a transformation matrix and the id to that mesh_model_t.
|
|
// This way we can share the same triangle and bvh for multiple instances of the same mesh, and we can also apply different transformations to each instance.
|
|
typedef struct
|
|
{
|
|
mat4s local_to_world;
|
|
uint64_t id;
|
|
uint64_t size;
|
|
} mesh_entity_t;
|
|
|
|
//HACK: We should handle the material from mesh, not user input.
|
|
mesh_entity_t mesh_load(const char* filename, uint8_t material_id, triangle_collection_t* triangles, material_collection_t* materials);
|
|
|
|
#endif // MESH_H
|