--------------------------------- MeshAsset::LoadGLTF Convert a gltf asset to a CPU side MeshDataContainer
| 611 | // Convert a gltf asset to a CPU side MeshDataContainer |
| 612 | // |
| 613 | MeshDataContainer* 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 |
nothing calls this directly
no outgoing calls
no test coverage detected