Update project structure and improve performance
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.
This commit is contained in:
@@ -25,8 +25,8 @@ inline void quad_create(vec3s center, vec3s forward, vec3s up, float size, uint8
|
||||
|
||||
inline void sphere_create(vec3s center, float radius, uint8_t material_id, triangle_collection_t* collection)
|
||||
{
|
||||
int segments = 8;
|
||||
int rings = 8;
|
||||
int segments = 16;
|
||||
int rings = 16;
|
||||
|
||||
for (int i = 0; i < rings; i++)
|
||||
{
|
||||
@@ -59,13 +59,15 @@ inline void sphere_create(vec3s center, float radius, uint8_t material_id, trian
|
||||
center.z + radius * sinf(theta1) * sinf(phi2)
|
||||
};
|
||||
|
||||
vec3s n1 = glms_vec3_normalize(glms_vec3_sub(p1, center));
|
||||
vec3s n2 = glms_vec3_normalize(glms_vec3_sub(p2, center));
|
||||
vec3s n3 = glms_vec3_normalize(glms_vec3_sub(p3, center));
|
||||
vec3s n4 = glms_vec3_normalize(glms_vec3_sub(p4, center));
|
||||
// vec3s n1 = glms_vec3_normalize(glms_vec3_sub(p1, center));
|
||||
// vec3s n2 = glms_vec3_normalize(glms_vec3_sub(p2, center));
|
||||
// vec3s n3 = glms_vec3_normalize(glms_vec3_sub(p3, center));
|
||||
// vec3s n4 = glms_vec3_normalize(glms_vec3_sub(p4, center));
|
||||
|
||||
triangle_create_with_normals(p3, p2, p1, n3, n2, n1, material_id, collection);
|
||||
triangle_create_with_normals(p3, p1, p4, n3, n1, n4, material_id, collection);
|
||||
// triangle_create_with_normals(p3, p2, p1, n3, n2, n1, material_id, collection);
|
||||
// triangle_create_with_normals(p3, p1, p4, n3, n1, n4, material_id, collection);
|
||||
triangle_create(p3, p2, p1, material_id, collection);
|
||||
triangle_create(p3, p1, p4, material_id, collection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user