LkEngine 0.1.2
 
Loading...
Searching...
No Matches
IAssetManager.h
1#pragma once
2
3#include <unordered_set>
4
6#include "LkEngine/Core/LObject/ObjectPtr.h"
7
8#include "Asset.h"
9#include "AssetRegistry.h"
10
11#include "AssimpMeshImporter.h"
12
13
14namespace LkEngine {
15
16 static FAssetMetadata NullMetadata{};
17
18 class IAssetManager : public LObject
19 {
20 public:
21 virtual ~IAssetManager() = default;
22
23 virtual void Initialize() = 0;
24 virtual void Destroy() = 0;
25
26 virtual FAssetHandle ImportAsset(const std::filesystem::path& Filepath) = 0;
27
28 virtual TObjectPtr<LAsset> GetAsset(const FAssetHandle Handle) = 0;
29 virtual EAssetType GetAssetType(const FAssetHandle Handle) = 0;
30
31 virtual bool ReloadData(const FAssetHandle Handle) = 0;
32 virtual void RemoveAsset(const FAssetHandle Handle) = 0;
33 virtual void AddMemoryOnlyAsset(TObjectPtr<LAsset> Asset) = 0;
34
35 virtual bool IsAssetLoaded(const FAssetHandle Handle) const = 0;
36 virtual bool IsAssetHandleValid(const FAssetHandle Handle) const = 0;
37 virtual bool IsMemoryAsset(const FAssetHandle Handle) const = 0;
38
39 virtual const std::unordered_map<FAssetHandle, TObjectPtr<LAsset>>& GetLoadedAssets() const = 0;
40 virtual const std::unordered_map<FAssetHandle, TObjectPtr<LAsset>>& GetMemoryOnlyAssets() const = 0;
41
42 virtual std::unordered_set<FAssetHandle> GetAllAssetsWithType(const EAssetType AssetType) = 0;
43 virtual std::size_t GetAllAssetsWithType(const EAssetType AssetType,
44 std::unordered_set<FAssetHandle>& AssetsOfType) = 0;
45
46 virtual FAssetHandle GetAssetHandleFromFilePath(const std::filesystem::path& InFilePath) const = 0;
47 virtual EAssetType GetAssetTypeFromExtension(const std::string& Extension) const = 0;
48 virtual EAssetType GetAssetTypeFromPath(const std::filesystem::path& InFilePath) const = 0;
49
50 virtual const FAssetMetadata& GetMetadata(const FAssetHandle Handle) const = 0;
51 virtual const FAssetMetadata& GetMetadata(const TObjectPtr<LAsset>& Asset) const = 0;
52 virtual const FAssetMetadata& GetMetadata(const std::filesystem::path& InFilePath) const = 0;
53
54 virtual bool LoadAssetRegistry() = 0;
55 virtual void WriteRegistryToDisk() = 0;
56
57 protected:
58 virtual FAssetMetadata& GetMetadataInternal(const FAssetHandle Handle) = 0;
59
60 private:
62 };
63
64}
LObject implementation.
Definition IAssetManager.h:19
virtual void Initialize()=0
Initialize object.
virtual void Destroy()=0
Destroy object, releasing all resources.
Definition Object.h:46
Definition ObjectPtr.h:102
#define LCLASS(Class)
Definition CoreMacros.h:226
Definition Asset.h:11
EAssetType
Definition AssetTypes.h:24
Definition Asset.h:92
Definition UUID.h:13