Add basic loader for gltf

Added loading of avocado. Something is still wrong though,
becaus I cannot see the seed. But basic functionality is there.
This commit is contained in:
Piotr Krygier
2026-03-19 21:00:39 +01:00
parent 984a56a8e8
commit 99fb36d9fd
14 changed files with 186 additions and 32 deletions
+2 -4
View File
@@ -247,24 +247,22 @@ rse_err_t file_write(const char* file_name, size_t bytes_count, char* buffer)
return ret;
}
rse_err_t file_load_gltf(const char* file_name)
rse_err_t file_load_gltf(const char* file_name, cgltf_data** data)
{
char real_path[MAX_PATH_LENGTH] = {0};
rse_err_t ret = RSE_ERROR_NO_ERROR;
cgltf_options options = {0};
cgltf_data* data = NULL;
strncpy(real_path, file_name, MAX_PATH_LENGTH);
if ((ret = file_append_full_path(real_path, MAX_PATH_LENGTH)) != RSE_ERROR_NO_ERROR) {
return ret;
}
if (cgltf_parse_file(&options, real_path, &data) != cgltf_result_success) {
if (cgltf_parse_file(&options, real_path, data) != cgltf_result_success) {
SDL_LogCritical(SDL_LOG_CATEGORY_APPLICATION, "Failed to parse GLTF data");
return RSE_ERROR_INTERNAL_ERROR;
}
cgltf_free(data);
return ret;
}