Reload of recompiled data
This commit is contained in:
parent
a391d9373e
commit
5d3e755b9b
|
@ -41,7 +41,7 @@ namespace SHADE
|
||||||
std::vector<SHAssetLoader*> SHAssetManager::loaders(TYPE_COUNT);
|
std::vector<SHAssetLoader*> SHAssetManager::loaders(TYPE_COUNT);
|
||||||
|
|
||||||
std::unordered_map<AssetID, SHAsset> SHAssetManager::assetCollection;
|
std::unordered_map<AssetID, SHAsset> SHAssetManager::assetCollection;
|
||||||
std::unordered_map<AssetID, SHAssetData * const> SHAssetManager::assetData;
|
std::unordered_map<AssetID, SHAssetData *> SHAssetManager::assetData;
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -460,6 +460,22 @@ namespace SHADE
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
target = GetAssetIDFromPath(path);
|
target = GetAssetIDFromPath(path);
|
||||||
|
|
||||||
|
//Reload data
|
||||||
|
auto result = GetAsset(target);
|
||||||
|
if (result.has_value())
|
||||||
|
{
|
||||||
|
auto const& asset{ result.value() };
|
||||||
|
auto newData = loaders[static_cast<size_t>(asset.type)]->Load(asset.path);
|
||||||
|
delete assetData[target];
|
||||||
|
assetData[target] = newData;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SHLOG_ERROR("[Asset Manager] Critical: reload of existing compiled data failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// send compile asset event
|
// send compile asset event
|
||||||
SHCompileAssetEvent compileShaderEvent
|
SHCompileAssetEvent compileShaderEvent
|
||||||
{
|
{
|
||||||
|
@ -470,10 +486,6 @@ namespace SHADE
|
||||||
SHEventManager::BroadcastEvent<SHCompileAssetEvent>(compileShaderEvent, SH_ASSET_COMPILE_EVENT);
|
SHEventManager::BroadcastEvent<SHCompileAssetEvent>(compileShaderEvent, SH_ASSET_COMPILE_EVENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO SEND EVENT HERE
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
FolderPointer SHAssetManager::GetRootFolder() noexcept
|
FolderPointer SHAssetManager::GetRootFolder() noexcept
|
||||||
{
|
{
|
||||||
return folderRoot;
|
return folderRoot;
|
||||||
|
|
|
@ -123,7 +123,7 @@ namespace SHADE
|
||||||
|
|
||||||
// For all resources
|
// For all resources
|
||||||
static std::unordered_map<AssetID, SHAsset> assetCollection;
|
static std::unordered_map<AssetID, SHAsset> assetCollection;
|
||||||
static std::unordered_map<AssetID, SHAssetData * const> assetData;
|
static std::unordered_map<AssetID, SHAssetData *> assetData;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue