9#ifndef AVARA3D_SCENE_IMPORTER_GLTFIMPORTER_H
10#define AVARA3D_SCENE_IMPORTER_GLTFIMPORTER_H
17#include <fastgltf/types.hpp>
19#include "a3d/scene/Scene.h"
39 explicit GlTFImporter(
const std::filesystem::path& path,
44 std::unique_ptr<Scene> scene();
45 std::shared_ptr<Mesh> firstMesh();
47 const std::filesystem::path& path()
const;
54 void visitGlTFNode(fastgltf::Asset& asset, fastgltf::Node& node, Node* parent);
55 std::shared_ptr<Mesh> meshFromGlTFNode(fastgltf::Asset& asset, fastgltf::Node& node);
56 std::shared_ptr<Mesh> meshFromGlTFMeshIndex(fastgltf::Asset& asset, std::size_t meshIndex);
57 std::unique_ptr<MeshElement> meshElementFromGlTFPrimitive(fastgltf::Asset& asset,
58 fastgltf::Primitive& primitive);
59 std::shared_ptr<Material> materialFromGlTFPrimitive(fastgltf::Asset& asset,
60 fastgltf::Primitive& primitive);
61 std::shared_ptr<Texture> textureFromGlTFTextureIndex(fastgltf::Asset& asset, std::size_t textureIndex);
63 std::shared_ptr<Sampler> samplerFromGlTFTexture(fastgltf::Asset& asset, fastgltf::Texture& texture);
64 std::shared_ptr<Image> imageFromGlTFTexture(fastgltf::Asset& asset, fastgltf::Texture& texture);
65 std::shared_ptr<Light> lightFromGlTFNode(fastgltf::Asset& asset, fastgltf::Node& node);
66 std::shared_ptr<Camera> cameraFromGlTFNode(fastgltf::Asset& asset, fastgltf::Node& node);
71 fastgltf::Asset _asset;
72 std::unique_ptr<Scene> _scene;
73 std::filesystem::path _path;
75 std::map<std::size_t, std::shared_ptr<Camera>> _cameras;
76 std::map<std::size_t, std::shared_ptr<Mesh>> _meshes;
77 std::map<std::size_t, std::shared_ptr<Image>> _images;
78 std::map<std::size_t, std::shared_ptr<Light>> _lights;
79 std::map<std::size_t, std::shared_ptr<Material>> _materials;
80 std::map<std::size_t, std::shared_ptr<Texture>> _textures;
81 std::map<std::size_t, std::shared_ptr<Sampler>> _samplers;
ImportOptions
Selects which resource categories are imported by FromFile().
@ ImportAll
Import all supported resource categories.