summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Assets/MeshAsset.cpp
diff options
context:
space:
mode:
authorMai <mai.iam2048@gmail.com>2024-02-13 07:42:57 -0500
committerGitHub <noreply@github.com>2024-02-13 07:42:57 -0500
commit9e6d701fbce863e9dddb8d4c11327508098d64fc (patch)
tree71e9c0c70e85d1819abf4fa99a10a62cf3c644a6 /Source/Core/VideoCommon/Assets/MeshAsset.cpp
parent38696949449058f3aa8b456259f06d50f2a9c1d1 (diff)
parent2ab877586def383692c893e3948ccc6865966f3c (diff)
Merge pull request #12577 from iwubcode/mesh_for_asset_loader
VideoCommon: make mesh asset data loadable by asset loader
Diffstat (limited to 'Source/Core/VideoCommon/Assets/MeshAsset.cpp')
-rw-r--r--Source/Core/VideoCommon/Assets/MeshAsset.cpp15
1 files changed, 15 insertions, 0 deletions
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<MeshData>();
+ 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