Set C standard to C11 and add new assets

Changed CMakeLists.txt to set the C standard to C11.
Added multiple binary image files for new visual assets.
Added several new image files to enhance rendering capabilities.
Changed stb_image.h to improve support for various image formats.
Changed ray tracing engine to enhance ray creation and intersection.
Changed triangle structure to use a vertex array for better attribute handling.
Changed scene initialization to accommodate new texture management.
This commit is contained in:
2025-04-29 01:43:52 +09:00
parent 4db14ffdb0
commit 3de6b83d32
53 changed files with 8939 additions and 162671 deletions

View File

@@ -12,7 +12,7 @@ static void ray_intersect_bvh_count(ray_t ray, bvh_tree_t bvh_tree, uint64_t nod
const bvh_node_t* node = &bvh_tree.nodes[node_index];
float enter, exit;
if (!ray_intersect_aabb(ray, node->bounds, &enter, &exit))
if (!ray_intersect_aabb(&ray, node->bounds, &enter, &exit))
{
return;
}
@@ -33,11 +33,9 @@ static void ray_intersect_bvh_count(ray_t ray, bvh_tree_t bvh_tree, uint64_t nod
vec4s render_debug(scene_t* scene, ray_t ray, uint16_t sample_index, int flag)
{
vec4s result = glms_vec4_zero();
if (scene == NULL)
{
return result;
return glms_vec4_zero();
}
switch (flag & 0xFF)
@@ -46,20 +44,23 @@ vec4s render_debug(scene_t* scene, ray_t ray, uint16_t sample_index, int flag)
uint32_t count = 0;
ray_intersect_bvh_count(ray, scene->bvh_tree, 0, &count);
vec4s result = glms_vec4_zero();
for (uint32_t i = 0; i < count; i++)
{
result = glms_vec4_add(result, DEBUG_COLOR_BVH);
}
return result;
break;
case DEBUG_SOBOL:
uint16_t i = sample_index ^ (sample_index >> 1);
float sobol_sample_value = sobol_sample(i, 1); // Assuming dimension 0 for simplicity
result = glms_vec4_add(result, (vec4s){sobol_sample_value, sobol_sample_value, sobol_sample_value, 1.0f});
break;
default:
break;
}
return (vec4s){sobol_sample_value, sobol_sample_value, sobol_sample_value, 1.0f};
return result;
case DEBUG_UV:
hit_result_t hit_result = ray_intersect_scene(&ray, scene);
return (vec4s){fmodf(fabsf(hit_result.uv.x), 1.0f), fmodf(fabsf(hit_result.uv.y), 1.0f), 0.0f, 1.0f};
default:
return glms_vec4_zero();
}
}