Added function to manually compile shaders by path
This commit is contained in:
parent
b10da2d160
commit
2102835629
|
@ -246,6 +246,28 @@ namespace SHADE
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AssetID SHAssetManager::CompileAsset(AssetPath path) noexcept
|
||||||
|
{
|
||||||
|
SHAsset newAsset
|
||||||
|
{
|
||||||
|
.name = path.stem().string(),
|
||||||
|
.location = 0
|
||||||
|
};
|
||||||
|
|
||||||
|
auto const ext{ path.extension().string() };
|
||||||
|
if (ext == GLSL_EXTENSION.data())
|
||||||
|
{
|
||||||
|
newAsset.path = SHShaderSourceCompiler::LoadAndCompileShader(path).value();
|
||||||
|
newAsset.id = GenerateAssetID(AssetType::SHADER_BUILT_IN);
|
||||||
|
newAsset.type = AssetType::SHADER_BUILT_IN;
|
||||||
|
}
|
||||||
|
|
||||||
|
assetCollection.push_back(newAsset);
|
||||||
|
SHAssetMetaHandler::WriteMetaData(newAsset);
|
||||||
|
|
||||||
|
return newAsset.id;
|
||||||
|
}
|
||||||
|
|
||||||
bool SHAssetManager::IsRecognised(char const* ext) noexcept
|
bool SHAssetManager::IsRecognised(char const* ext) noexcept
|
||||||
{
|
{
|
||||||
for (auto const& e : EXTENSIONS)
|
for (auto const& e : EXTENSIONS)
|
||||||
|
|
|
@ -83,6 +83,8 @@ namespace SHADE
|
||||||
static std::vector<SHAssetData const*> GetAllDataOfType(AssetType type) noexcept;
|
static std::vector<SHAssetData const*> GetAllDataOfType(AssetType type) noexcept;
|
||||||
static std::vector<SHAsset> GetAllRecordOfType(AssetType type) noexcept;
|
static std::vector<SHAsset> GetAllRecordOfType(AssetType type) noexcept;
|
||||||
|
|
||||||
|
static AssetID CompileAsset(AssetPath path) noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static void InitLoaders() noexcept;
|
static void InitLoaders() noexcept;
|
||||||
|
|
Loading…
Reference in New Issue