-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAssetExtensions.cpp
More file actions
69 lines (67 loc) · 1.59 KB
/
Copy pathAssetExtensions.cpp
File metadata and controls
69 lines (67 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include "AssetExtensions.h"
namespace sh::editor
{
std::unordered_map<std::string, AssetExtensions::Type> AssetExtensions::extensions
{
{".obj", Type::Model},
{".glb", Type::Model},
{".png", Type::Texture},
{".jpg", Type::Texture},
{".mat", Type::Material},
{".world", Type::World},
{".shader", Type::Shader},
{".prefab", Type::Prefab},
{".txt", Type::Text},
{".json", Type::Text},
{".font", Type::Font},
{".ttf", Type::Binary},
{".ogg", Type::Sound},
{".wav", Type::Sound},
{".srpo", Type::ScriptableObject},
{".compute", Type::ComputeShader}
};
SH_EDITOR_API void AssetExtensions::AddExtension(const std::string& ext, Type type)
{
extensions.insert({ ext, type });
}
SH_EDITOR_API auto AssetExtensions::CheckType(const std::string& extension) -> AssetExtensions::Type
{
auto it = extensions.find(extension);
if (it == extensions.end())
return Type::None;
return it->second;
}
SH_EDITOR_API auto AssetExtensions::ToString(Type type) -> const char*
{
switch (type)
{
case Type::None:
return "None";
case Type::Model:
return "Model";
case Type::Texture:
return "Texture";
case Type::Material:
return "Material";
case Type::World:
return "World";
case Type::Shader:
return "Shader";
case Type::Prefab:
return "Prefab";
case Type::Text:
return "Text";
case Type::Font:
return "Font";
case Type::Binary:
return "Binary";
case Type::Sound:
return "Sound";
case Type::ScriptableObject:
return "ScriptableObject";
case Type::ComputeShader:
return "ComputeShader";
}
return "None";
}
}//namespace