#ifndef MESH_H #define MESH_H #include "Material/Material.h" #include "Geometry/Triangle.h" #include "Rendering/Scene.h" #include // 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 only 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 triangle_id; uint64_t triangle_count; uint16_t material_id; uint16_t material_count; } mesh_entity_t; mesh_entity_t mesh_load(const char* filename, scene_t* scene); #endif // MESH_H