From 3dd870b001bef62aaa501257352d968d1346c7f2 Mon Sep 17 00:00:00 2001 From: ladevieq Date: Sun, 25 Jul 2021 11:58:01 +0200 Subject: Use a different buffer for scene info, geometry, bvh and load gltf --- include/gltf.hpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 include/gltf.hpp (limited to 'include/gltf.hpp') diff --git a/include/gltf.hpp b/include/gltf.hpp new file mode 100644 index 0000000..80f2749 --- /dev/null +++ b/include/gltf.hpp @@ -0,0 +1,34 @@ +#ifndef __GLTF_HPP_ +#define __GLTF_HPP_ + +#include +#include + +#include + +using json = nlohmann::json; + +#include + +struct mesh_part { + std::vector indices; + std::vector positions; + std::vector normals; +}; + +struct mesh { + std::vector> nodes; +}; + +class gltf { +public: + static mesh load(std::filesystem::path &path, std::string &filename); + +private: + + static void load_node(json &gltf_json, json &node, std::vector> &buffers_content, mesh& gltf_mesh); + + static void load_primitive(json &gltf_json, json &primitive, std::vector> &buffers_content, mesh& gltf_mesh); +}; + +#endif -- cgit v1.3