#ifndef GLTF_MODEL3D_HPP
#define GLTF_MODEL3D_HPP

#include "open_engine/renderer/model3d.hpp"

#include <fastgltf/types.hpp>
#include <vector>
#include <cstddef>

namespace OpenEngine {

    class GLTFModel3D : public Model3D
    {
        public:
            GLTFModel3D(const char* path);

            void loadPrimitive(fastgltf::Asset& asset,
                    fastgltf::Primitive& primitive,
                    Mesh& out);
            virtual const Mesh& GetMesh(int index) const override;
            virtual const std::vector<Mesh>& GetMeshes() const override;

            virtual size_t GetMeshCount() const override { return meshes.size(); };

            virtual std::vector<Mesh>::iterator begin() override { return meshes.begin(); };
            virtual std::vector<Mesh>::iterator end() override { return meshes.end(); };

            virtual std::vector<Mesh>::const_iterator begin() const override { return meshes.cbegin(); };
            virtual std::vector<Mesh>::const_iterator end() const override { return meshes.end(); };

        private:
            std::string name;
            std::vector<Mesh> meshes;
    };

}

#endif // GLTF_MODEL3D_HPP
