-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAssetEntry.h
More file actions
58 lines (51 loc) · 1.47 KB
/
Copy pathAssetEntry.h
File metadata and controls
58 lines (51 loc) · 1.47 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
#pragma once
#include "Reflection.hpp" // CT3: was transitive via Core.Minimal.h
#include "Core.Minimal.h"
enum class ManagedAssetType
{
Model,
Material,
Texture,
SpriteFont,
// 아래 두 종은 나중에 추가되었다.
// assetTypeID가 정수로 직렬화되므로 기존 값의 순서를 바꾸면 에셋 번들 파일과
// 호환이 깨진다. 새 항목은 반드시 끝에만 추가할 것.
UITexture,
SpriteSheet
};
struct AssetEntry
{
public:
static consteval auto reflect()
{
using Self = AssetEntry;
return meta::schema<Self>(
meta::field<&Self::assetTypeID>,
meta::field<&Self::assetName>);
}
AssetEntry() = default;
AssetEntry(ManagedAssetType assetTypeID, const file::path& assetName)
: assetTypeID((int)assetTypeID), assetName(assetName.string()) {
}
~AssetEntry() = default;
AssetEntry(const AssetEntry&) = default;
AssetEntry(AssetEntry&&) noexcept = default;
AssetEntry& operator=(const AssetEntry&) = default;
AssetEntry& operator=(AssetEntry&&) noexcept = default;
void Clear()
{
assetTypeID = -1;
assetName.clear();
}
int assetTypeID{ -1 };
std::string assetName{};
friend auto operator<=>(const AssetEntry& lhs, const AssetEntry& rhs)
{
return std::tie(lhs.assetTypeID, lhs.assetName)
<=> std::tie(rhs.assetTypeID, rhs.assetName);
}
friend bool operator==(const AssetEntry& lhs, const AssetEntry& rhs)
{
return lhs.assetTypeID == rhs.assetTypeID && lhs.assetName == rhs.assetName;
}
};