diff options
-rw-r--r-- | examples/obj_loading/ex_obj_loading.c | 3 | ||||
-rw-r--r-- | src/platform/file.c | 6 | ||||
-rw-r--r-- | src/renderer/render.h | 1 | ||||
-rw-r--r-- | src/resources/loaders.h | 3 | ||||
-rw-r--r-- | src/resources/obj.c | 4 | ||||
-rw-r--r-- | src/std/str.h | 7 | ||||
-rw-r--r-- | xmake.lua | 1 |
7 files changed, 20 insertions, 5 deletions
diff --git a/examples/obj_loading/ex_obj_loading.c b/examples/obj_loading/ex_obj_loading.c index 3b2354a..87aeb2d 100644 --- a/examples/obj_loading/ex_obj_loading.c +++ b/examples/obj_loading/ex_obj_loading.c @@ -6,6 +6,9 @@ int main() { core* core = core_bringup(); + // Set up our scene + model_handle cube = model_load_obj(core, "assets/models/obj/cube/cube.obj", true); + // Main loop while (!glfwWindowShouldClose(core->renderer.window)) { input_update(&core->input); diff --git a/src/platform/file.c b/src/platform/file.c index 44aa9d0..4eeee46 100644 --- a/src/platform/file.c +++ b/src/platform/file.c @@ -12,6 +12,7 @@ const char *string_from_file(const char *path) { FILE *f = fopen(path, "rb"); + printf("Hello\n"); if (f == NULL) { ERROR("Error reading file: %s. errno: %d", path, errno); return NULL; @@ -20,6 +21,7 @@ const char *string_from_file(const char *path) { ERROR("Error reading file: %s. errno: %d", path, errno); return NULL; } + printf("Hello2\n"); fseek(f, 0, SEEK_END); long fsize = ftell(f); rewind(f); @@ -29,6 +31,8 @@ const char *string_from_file(const char *path) { fclose(f); string[fsize] = '\0'; + printf("Hello3\n"); + printf("Hello %s\n", string); return string; } @@ -60,4 +64,4 @@ str8_opt str8_from_file(arena *a, str8 path) { result.has_value = true; return result; -}
\ No newline at end of file +} diff --git a/src/renderer/render.h b/src/renderer/render.h index c4e0dd6..d1de515 100644 --- a/src/renderer/render.h +++ b/src/renderer/render.h @@ -1,6 +1,7 @@ #pragma once #include "render_types.h" +#include "loaders.h" // --- Lifecycle /** @brief initialise the render system frontend */ diff --git a/src/resources/loaders.h b/src/resources/loaders.h index ba38ec4..8904655 100644 --- a/src/resources/loaders.h +++ b/src/resources/loaders.h @@ -3,7 +3,6 @@ #include "defines.h" struct core; -typedef u32 model_handle; model_handle model_load_obj(struct core *core, const char *path, bool invert_texture_y); -model_handle model_load_gltf(struct core *core, const char *path, bool invert_texture_y);
\ No newline at end of file +model_handle model_load_gltf(struct core *core, const char *path, bool invert_texture_y); diff --git a/src/resources/obj.c b/src/resources/obj.c index 9e12f79..05aa96e 100644 --- a/src/resources/obj.c +++ b/src/resources/obj.c @@ -36,7 +36,9 @@ bool load_material_lib(const char *path, material_darray *materials); bool model_load_obj_str(const char *file_string, model *out_model, bool invert_textures_y); 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); model model; bool success = model_load_obj_str(file_string, &model, invert_textures_y); @@ -89,7 +91,7 @@ bool model_load_obj_str(const char *file_string, model *out_model, bool invert_t } else { // read the first word of the line int res = sscanf(pch, "%s %n", line_header, &offset); - // printf("header: %s, offset : %d res: %d\n",line_header, offset, res); + /* printf("header: %s, offset : %d res: %d\n",line_header, offset, res); */ if (res != 1) { break; } diff --git a/src/std/str.h b/src/std/str.h index f6f8820..9f96430 100644 --- a/src/std/str.h +++ b/src/std/str.h @@ -70,4 +70,9 @@ str8 str8_concat(arena* a, str8 left, str8 right); static inline bool str8_is_null_term(str8 a) { return a.buf[a.len] == 0; // This doesn't seem safe. YOLO -}
\ No newline at end of file +} + +// TODO: move or delete this and replace with handling using our internal type +static void skip_space(char *p) { + while (isspace((unsigned char)*p)) ++p; +} @@ -60,6 +60,7 @@ target("core_config") add_includedirs("src/platform/", {public = true}) add_includedirs("src/renderer/", {public = true}) add_includedirs("src/renderer/backends/", {public = true}) + add_includedirs("src/resources/", {public = true}) add_includedirs("src/std/", {public = true}) add_includedirs("src/std/containers", {public = true}) add_includedirs("src/systems/", {public = true}) |