MCPcopy Create free account
hub / github.com/Illation/ETEngine / LoadGLTF

Method LoadGLTF

Engine/source/EtRendering/GraphicsTypes/Mesh.cpp:613–646  ·  view source on GitHub ↗

--------------------------------- MeshAsset::LoadGLTF Convert a gltf asset to a CPU side MeshDataContainer

Source from the content-addressed store, hash-verified

611// Convert a gltf asset to a CPU side MeshDataContainer
612//
613MeshDataContainer* MeshAsset::LoadGLTF(std::vector<uint8> const& data, std::string const& path, std::string const& extension)
614{
615 glTF::glTFAsset asset;
616 if (!glTF::ParseGLTFData(data, path, extension, asset))
617 {
618 LOG("failed to load the glTF asset", core::LogLevel::Warning);
619 return nullptr;
620 }
621
622 std::vector<MeshDataContainer*> containers;
623 if (!glTF::GetMeshContainers(asset, containers))
624 {
625 LOG("failed to construct mesh data containers from glTF", core::LogLevel::Warning);
626 return nullptr;
627 }
628
629 if (containers.size() == 0)
630 {
631 LOG("no mesh data containers found in glTF asset", core::LogLevel::Warning);
632 return nullptr;
633 }
634
635 MeshDataContainer* ret = containers[0];
636
637 if (containers.size() > 1)
638 {
639 for (size_t i = 1u; i < containers.size(); ++i)
640 {
641 delete containers[i];
642 }
643 }
644
645 return ret;
646}
647
648
649} // namespace render

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected