From d5ae547334b5f8229313182705da42c5e904a633 Mon Sep 17 00:00:00 2001 From: Omniscient Date: Tue, 5 Mar 2024 22:18:45 +1100 Subject: loads and runs now (no visuals yet) --- src/resources/obj.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/resources') diff --git a/src/resources/obj.c b/src/resources/obj.c index d56e212..994e12a 100644 --- a/src/resources/obj.c +++ b/src/resources/obj.c @@ -11,8 +11,8 @@ #include #include "core.h" -#include "file.h" #include "darray.h" +#include "file.h" #include "log.h" #include "maths.h" #include "render.h" @@ -39,7 +39,7 @@ bool model_load_obj_str(const char *file_string, model *out_model, bool invert_t model_handle model_load_obj(core *core, const char *path, bool invert_textures_y) { printf("Path %s\n", path); const char *file_string = string_from_file(path); - printf("Loaded file %s\n", file_string); + /* printf("Loaded file %s\n", file_string); */ model model; bool success = model_load_obj_str(file_string, &model, invert_textures_y); @@ -195,15 +195,14 @@ bool model_load_obj_str(const char *file_string, model *out_model, bool invert_t if (mesh_darray_len(meshes) > 256) { printf("num meshes: %ld\n", mesh_darray_len(meshes)); } - for (int i = 0; i < mesh_darray_len(meshes); i++) { - mesh_darray_push(&out_model->meshes, ((mesh *)meshes->data)[i]); - // TODO: bounding box calculation for each mesh - } + out_model->meshes = meshes; + /* for (int i = 0; i < mesh_darray_len(meshes); i++) { */ + /* mesh_darray_push(&out_model->meshes, ((mesh *)meshes->data)[i]); */ + /* } */ + // TODO: bounding box calculation for each mesh // TODO: bounding box calculation for model - for (int i = 0; i < material_darray_len(materials); i++) { - material_darray_push(&out_model->materials, ((material *)materials->data)[i]); - } + out_model->materials = materials; return true; } -- cgit v1.2.3-70-g09d2