Added built in shader extension
Collision check for asset IDs
This commit is contained in:
parent
c0c6d35b29
commit
54796773b2
|
@ -45,6 +45,7 @@ enum class AssetType : AssetTypeMeta
|
|||
INVALID = 0,
|
||||
AUDIO = 1,
|
||||
SHADER,
|
||||
SHADER_BUILT_IN,
|
||||
MATERIAL,
|
||||
IMAGE,
|
||||
TEXTURE,
|
||||
|
@ -71,6 +72,7 @@ constexpr std::string_view META_EXTENSION {".shmeta"};
|
|||
constexpr std::string_view AUDIO_EXTENSION {".ogg"};
|
||||
constexpr std::string_view AUDIO_WAV_EXTENSION {".wav"};
|
||||
constexpr std::string_view SHADER_EXTENSION{ ".shshader" };
|
||||
constexpr std::string_view SHADER_BUILT_IN_EXTENSION{".shshaderb"};
|
||||
constexpr std::string_view SCRIPT_EXTENSION {".cs"};
|
||||
constexpr std::string_view SCENE_EXTENSION {".shade"};
|
||||
constexpr std::string_view PREFAB_EXTENSION {".shprefab"};
|
||||
|
@ -81,6 +83,7 @@ constexpr std::string_view MESH_EXTENSION {".shmesh"};
|
|||
constexpr std::string_view EXTENSIONS[] = {
|
||||
AUDIO_EXTENSION,
|
||||
SHADER_EXTENSION,
|
||||
SHADER_BUILT_IN_EXTENSION,
|
||||
MATERIAL_EXTENSION,
|
||||
TEXTURE_EXTENSION,
|
||||
MESH_EXTENSION,
|
||||
|
|
|
@ -46,7 +46,13 @@ namespace SHADE
|
|||
|
||||
result |= unique;
|
||||
|
||||
while (result == 0)
|
||||
while (result == 0 ||
|
||||
std::ranges::any_of(
|
||||
assetCollection.begin(),
|
||||
assetCollection.end(),
|
||||
[result](SHAsset const& asset) { return asset.id == result; }
|
||||
)
|
||||
)
|
||||
{
|
||||
result = GenerateAssetID(type);
|
||||
}
|
||||
|
@ -278,6 +284,7 @@ namespace SHADE
|
|||
{
|
||||
loaders[static_cast<size_t>(AssetType::AUDIO)] = nullptr;
|
||||
loaders[static_cast<size_t>(AssetType::SHADER)] = dynamic_cast<SHAssetLoader*>(new SHShaderSourceLoader());
|
||||
loaders[static_cast<size_t>(AssetType::SHADER_BUILT_IN)] = loaders[static_cast<size_t>(AssetType::SHADER)];
|
||||
loaders[static_cast<size_t>(AssetType::MATERIAL)] = nullptr;
|
||||
loaders[static_cast<size_t>(AssetType::TEXTURE)] = dynamic_cast<SHAssetLoader*>(new SHTextureLoader());
|
||||
loaders[static_cast<size_t>(AssetType::MESH)] = dynamic_cast<SHAssetLoader*>(new SHMeshLoader());
|
||||
|
|
Loading…
Reference in New Issue