Implemented scanline and silhouette effect #363

Merged
Xenosas1337 merged 12 commits from SP3-1-Rendering into main 2023-02-24 17:20:46 +08:00
3 changed files with 23 additions and 6 deletions
Showing only changes of commit ff76704a86 - Show all commits

View File

@ -167,6 +167,17 @@ namespace SHADE
return {};
}
AssetID SHAssetManager::GetAssetIDFromPath(AssetPath const& path) noexcept
{
for (auto const& pair : assetCollection)
{
if (pair.second.path.stem() == path.stem())
return pair.first;
}
return 0;
}
/****************************************************************************
* \brief Create record for new asset. CAN ONLY CREATE FOR CUSTOM
* ASSETS CREATED BY THE ENGINE.
@ -383,7 +394,7 @@ namespace SHADE
return result;
}
void SHAssetManager::CompileAsset(AssetPath const& path, bool genMeta, AssetID id) noexcept
void SHAssetManager::CompileAsset(AssetPath const& path, bool genMeta) noexcept
{
if (!std::filesystem::exists(path))
{
@ -438,14 +449,19 @@ namespace SHADE
return;
}
AssetID target{ 0 };
if (genMeta)
{
GenerateNewMeta(newPath);
auto result = GenerateNewMeta(newPath);
target = result.has_value() ? result.value() : 0;
}
else
{
//send event here
target = GetAssetIDFromPath(path);
}
//TODO SEND EVENT HERE
}
FolderPointer SHAssetManager::GetRootFolder() noexcept

View File

@ -50,7 +50,7 @@ namespace SHADE
* \return const& to unordered_map<AssetName, AssetID>
****************************************************************************/
static std::vector<SHAsset> GetAllAssets() noexcept;
static std::optional<SHAsset> GetAsset(AssetID id) noexcept;
static std::optional<SHAsset> GetAsset(AssetID id) noexcept;
static AssetType GetType(AssetID id) noexcept;
@ -90,13 +90,14 @@ namespace SHADE
static std::vector<SHAssetData const*> GetAllDataOfType(AssetType type) noexcept;
static std::vector<SHAsset> GetAllRecordOfType(AssetType type) noexcept;
static void CompileAsset(AssetPath const& path, bool genMeta, AssetID id = 0) noexcept;
static void CompileAsset(AssetPath const& path, bool genMeta) noexcept;
static FolderPointer GetRootFolder() noexcept;
static void RefreshDirectory() noexcept;
private:
static AssetID GetAssetIDFromPath(AssetPath const& path) noexcept;
static void InitLoaders() noexcept;
static void LoadAllData() noexcept;
static SHAssetData* LoadData(SHAsset const& asset) noexcept;

View File

@ -233,7 +233,7 @@ namespace SHADE
{
if(ImGui::Selectable("Compile"))
{
SHAssetManager::CompileAsset(file.path, !file.compiled, file.assetMeta ? file.assetMeta->id : 0);
SHAssetManager::CompileAsset(file.path, !file.compiled);
QueueRefresh();
}
ImGui::EndPopup();