mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 12:31:51 +00:00
feat: reloading assets for textures, models and animation
This commit is contained in:
parent
103ca99d81
commit
c8605fe78b
5 changed files with 190 additions and 110 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue