Changed README.md to update rendering settings and build instructions. Changed BSDF.h to add functions for normal unpacking and tangent transformation. Changed RayIntersection.h to include tangent vector in hit_result_t. Changed Common.h to include vec2.h for 2D vector handling. Changed String.h to add string_copy function and improve is_absolute_path. Changed GeometryUtilities.h to enhance quad creation with tangent calculations. Changed Mesh.h to include tangents in the vertex structure. Changed Triangle.h to add tangents in the vertex structure for better normal mapping. Changed Light.h to include tangents in the light shading context. Changed SkyLight.h to introduce a new structure for sky lights. Changed Material.h to include tangents in the shading context. Changed SimpleLit.h to add normal and tangent textures for detailed shading. Changed Texture.h to introduce a new structure for texture assets. Changed BSDF.c to add functions for unpacking normals and transforming tangents. Changed PathTracing.c to include tangents in the shading context. Changed RayIntersection.c to calculate normals and tangents in ray-triangle intersections. Changed Mesh.c to improve material texture loading and handle tangents. Changed Material.c to enhance material collection initialization and resizing. Changed SimpleLit.c to incorporate normal mapping with normal textures. Changed Texture.c to improve management of texture assets and resources.
27 lines
1.2 KiB
C
27 lines
1.2 KiB
C
#ifndef MESH_H
|
|
#define MESH_H
|
|
|
|
#include "Material/Material.h"
|
|
#include "Geometry/Triangle.h"
|
|
#include "Rendering/Scene.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 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
|