From 37fdcb8a0f435c42f737252450626f2bd38bbd0f Mon Sep 17 00:00:00 2001 From: ladevieq Date: Tue, 5 May 2026 00:50:13 +0200 Subject: Clean up around included files --- include/gltf.hpp | 67 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 34 insertions(+), 33 deletions(-) (limited to 'include/gltf.hpp') diff --git a/include/gltf.hpp b/include/gltf.hpp index 1ccaf56..72d757c 100644 --- a/include/gltf.hpp +++ b/include/gltf.hpp @@ -3,59 +3,60 @@ #include -#include - -using json = nlohmann::json; - -#include "material.hpp" +#include "utils.hpp" +#include "handle.hpp" #include "mesh.hpp" +#include "material.hpp" struct node { - std::vector children; - Mesh* mesh = nullptr; + std::vector children; + u32 mesh; }; struct raw_image { int32_t width; int32_t height; int32_t channels; - uint8_t *data; + const uint8_t *data; }; -namespace std::filesystem { - class path; -} +struct buffer { + u8* bytes; + size_t size; +}; class gltf { public: - gltf(const std::filesystem::path &filepath); - - node root_node; - -private: - - void load_node(uint32_t index, node &parent); - - void load_meshes(); - - Mesh::submesh load_primitive(const json &primitive); - - Mesh::attribute load_attribute(uint32_t accessor_index); - - void load_textures(const std::filesystem::path &path); + gltf(const char* filepath); + void deinit(); - void load_materials(); + std::vector root_nodes; - json gltf_json; + std::vector nodes; std::vector meshes; std::vector materials; -#ifdef API_TEST std::vector> textures; // handle samplers; -#else - std::vector textures; -#endif // API_TEST - std::vector> buffers; + std::vector buffers; + + + // gbl only + struct glb_chunk { + u32 length; + u32 type; + u8 data[1]; + }; + + struct glb_header { + u32 magic; + u32 version; + u32 length; + }; + std::vector chunks; + glb_header* header; + + // TODO: remove + bool is_glb; }; #endif -- cgit v1.3