#ifndef __GLTF_HPP_ #define __GLTF_HPP_ #include #include using json = nlohmann::json; #include "material.hpp" #include "mesh.hpp" struct node { std::vector children; Mesh* mesh = nullptr; }; struct raw_image { int32_t x; int32_t y; int32_t n; uint8_t *data; }; namespace std::filesystem { class path; } 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); void load_materials(); json gltf_json; std::vector meshes; std::vector materials; std::vector textures; std::vector> buffers; }; #endif