asset.cpp
cross platform rendering playgroundsrc/asset/asset.cpp
484 B#include "asset.h"
AssetHandle AssetManager::load(const char *path) {
AssetHandle h{(u32)assets.size()};
assets.emplace_back();
if (!load_gltf_asset(path, assets.back())) {
assets.pop_back();
return {};
}
return h;
}
const AssetScene *AssetManager::get(AssetHandle h) const {
return h.id < assets.size() ? &assets[h.id] : nullptr;
}
AssetScene *AssetManager::get(AssetHandle h) {
return h.id < assets.size() ? &assets[h.id] : nullptr;
}