summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-03-05 23:37:08 +1100
committeromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-03-05 23:37:08 +1100
commitc5bdf826bb0206e22c5b7cc8d7917a549a8c13ac (patch)
treebe28aca1bd38a17c71059793164b3f6a9358a8b5 /src
parent99f8b3e17fe4bff76d5b11335c65c5eba14729c7 (diff)
add some TODO comments for tomorrow
Diffstat (limited to 'src')
-rw-r--r--src/resources/obj.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/resources/obj.c b/src/resources/obj.c
index 5fbfcdd..19e85c0 100644
--- a/src/resources/obj.c
+++ b/src/resources/obj.c
@@ -40,6 +40,8 @@ model_handle model_load_obj(core *core, const char *path, bool invert_textures_y
TRACE("Loading model at Path %s\n", path);
const char *file_string = string_from_file(path);
+ // TODO: store the relative path without the name.obj at the end
+
model model = { 0 };
model.meshes = mesh_darray_new(1);
model.materials = material_darray_new(1);
@@ -64,6 +66,10 @@ bool model_load_obj_str(const char *file_string, model *out_model, bool invert_t
vec3_darray *tmp_normals = vec3_darray_new(1000);
vec2_darray *tmp_uvs = vec2_darray_new(1000);
face_darray *tmp_faces = face_darray_new(1000);
+ // TODO: In the future I'd like these temporary arrays to be allocated from an arena provided
+ // by the function one level up, model_load_obj. That way we can just `return false;` anywhere in this code
+ // to indicate an error, and be sure that all that memory will be cleaned up without having to call
+ // vec3_darray_free in every single error case before returning.
// Other state
bool object_set = false;
@@ -192,17 +198,13 @@ bool model_load_obj_str(const char *file_string, model *out_model, bool invert_t
face_darray_free(tmp_faces);
TRACE("Freed temporary OBJ loading data");
- /* memset(out_model, 0, sizeof(model)); */
if (mesh_darray_len(out_model->meshes) > 256) {
printf("num meshes: %ld\n", mesh_darray_len(out_model->meshes));
}
- /* out_model->meshes = meshes; */
// TODO: bounding box calculation for each mesh
// TODO: bounding box calculation for model
- /* out_model->materials = materials; */
-
return true;
}