-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAssetBundle.h
More file actions
54 lines (48 loc) · 1.27 KB
/
Copy pathAssetBundle.h
File metadata and controls
54 lines (48 loc) · 1.27 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
#pragma once
#include "Reflection.hpp" // CT3: was transitive via Core.Minimal.h
#include "AssetEntry.h"
struct AssetBundle
{
public:
static consteval auto reflect()
{
using Self = AssetBundle;
return meta::schema<Self>(
meta::field<&Self::name>,
meta::field<&Self::path>,
meta::field<&Self::assets>);
}
AssetBundle() = default;
AssetBundle(const std::string& name, const file::path& path)
: name(name), path(path.string()) {}
AssetBundle(const std::string& name, const std::string& path)
: name(name), path(path) {
}
~AssetBundle() = default;
void AddAsset(const AssetEntry& assetEntry)
{
if (-1 != assetEntry.assetTypeID)
{
assets.push_back(assetEntry);
}
}
void RemoveAsset(const AssetEntry& assetEntry)
{
auto it = std::remove(assets.begin(), assets.end(), assetEntry);
if (it != assets.end())
{
assets.erase(it, assets.end());
}
}
bool ContainsAsset(const AssetEntry& assetEntry) const
{
return std::find(assets.begin(), assets.end(), assetEntry) != assets.end();
}
void ClearAssets()
{
assets.clear();
}
std::string name; // Name of the asset bundle
std::string path; // Path to the asset bundle file
std::vector<AssetEntry> assets; // List of assets contained in the bundle
};