feat: reloading assets for textures, models and animation

This commit is contained in:
MihailRis 2026-08-30 23:37:58 +03:00
parent 103ca99d81
commit c8605fe78b
5 changed files with 190 additions and 110 deletions

View file

@ -86,6 +86,13 @@ struct aloader_entry {
std::shared_ptr<AssetCfg> config;
};
using AssetFullId = std::pair<std::string, AssetType>;
struct AssetsLoadInfo {
std::map<AssetFullId, aloader_entry> processedEntries;
std::multimap<io::path, AssetFullId> referencedAssets;
};
class AssetsLoader {
public:
AssetsLoader(Engine& engine, Assets& assets, const ResPaths& paths);
@ -126,6 +133,9 @@ public:
const std::vector<io::path>& alternatives
);
int addReload(const io::path& path, AssetsLoader& dst);
void attachToFile(const io::path& file, AssetFullId assetId);
Assets& getAssets();
Engine& getEngine();
private:
@ -133,8 +143,10 @@ private:
Assets& assets;
std::map<AssetType, aloader_func> loaders;
std::queue<aloader_entry> entries;
std::set<std::pair<AssetType, std::string>> enqueued;
std::set<AssetFullId> enqueued;
const ResPaths& paths;
AssetsLoadInfo& assetsLoadInfo;
void processPreload(
AssetType tag, const std::string& name, const dv::value& map