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:
@@ -1,14 +1,19 @@
|
||||
#include "Rendering/Scene.h"
|
||||
|
||||
bool scene_init(scene_t* scene, uint64_t triangle_count, uint8_t material_count, uint32_t punctual_light_count)
|
||||
bool scene_init(scene_t* scene, uint64_t triangle_count, uint16_t texture_count, uint8_t material_count, uint32_t punctual_light_count)
|
||||
{
|
||||
scene_t temp = {0};
|
||||
|
||||
if (!triangle_collection_init(&temp.triangles, triangle_count))
|
||||
if (!triangle_collection_init(triangle_count, &temp.triangles))
|
||||
{
|
||||
goto triangle_failed;
|
||||
}
|
||||
|
||||
if (!texture_collection_init(texture_count, &temp.textures))
|
||||
{
|
||||
goto texture_failed;
|
||||
}
|
||||
|
||||
if (!material_collection_init(material_count, &temp.materials))
|
||||
{
|
||||
goto material_failed;
|
||||
@@ -33,6 +38,8 @@ bool scene_init(scene_t* scene, uint64_t triangle_count, uint8_t material_count,
|
||||
light_failed:
|
||||
material_collection_free(&temp.materials);
|
||||
material_failed:
|
||||
texture_collection_free(&temp.textures);
|
||||
texture_failed:
|
||||
triangle_collection_free(&temp.triangles);
|
||||
triangle_failed:
|
||||
return false;
|
||||
@@ -58,8 +65,14 @@ bool scene_build_bvh(scene_t* scene)
|
||||
|
||||
void scene_free(scene_t* scene)
|
||||
{
|
||||
if (scene == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bvh_tree_free(&scene->bvh_tree);
|
||||
triangle_collection_free(&scene->triangles);
|
||||
texture_collection_free(&scene->textures);
|
||||
material_collection_free(&scene->materials);
|
||||
light_collection_free(&scene->lights);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user