From 2ab877586def383692c893e3948ccc6865966f3c Mon Sep 17 00:00:00 2001 From: iwubcode Date: Mon, 12 Feb 2024 18:42:01 -0600 Subject: VideoCommon: make mesh asset data loadable by asset loader --- Source/Core/VideoCommon/Assets/MeshAsset.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'Source/Core/VideoCommon/Assets/MeshAsset.cpp') diff --git a/Source/Core/VideoCommon/Assets/MeshAsset.cpp b/Source/Core/VideoCommon/Assets/MeshAsset.cpp index b8dd029375..05a4ba0961 100644 --- a/Source/Core/VideoCommon/Assets/MeshAsset.cpp +++ b/Source/Core/VideoCommon/Assets/MeshAsset.cpp @@ -12,6 +12,7 @@ #include "Common/IOFile.h" #include "Common/Logging/Log.h" #include "Common/StringUtil.h" +#include "VideoCommon/Assets/CustomAssetLibrary.h" namespace VideoCommon { @@ -645,4 +646,18 @@ bool MeshData::FromGLTF(std::string_view gltf_file, MeshData* data) ERROR_LOG_FMT(VIDEO, "GLTF '{}' has invalid extension", gltf_file); return false; } + +CustomAssetLibrary::LoadInfo MeshAsset::LoadImpl(const CustomAssetLibrary::AssetID& asset_id) +{ + auto potential_data = std::make_shared(); + const auto loaded_info = m_owning_library->LoadMesh(asset_id, potential_data.get()); + if (loaded_info.m_bytes_loaded == 0) + return {}; + { + std::lock_guard lk(m_data_lock); + m_loaded = true; + m_data = std::move(potential_data); + } + return loaded_info; +} } // namespace VideoCommon -- cgit v1.2.3