Cogs.Core
AssetManager.h
1#pragma once
2
3#include "ResourceManager.h"
4
5#include "Asset.h"
6
7#include "Serialization/AssetReader.h"
8
9namespace Cogs::Core
10{
12 {
13
14 };
15
16 class COGSCORE_DLL_API AssetManager : public ResourceManager<Asset, AssetLoadInfo>
17 {
18 public:
20 AssetManager(Context * context) : ResourceManager(context) {}
21
24
25 void initialize() override;
26
27 AssetHandle loadAsset(const StringView & path, ResourceId resourceId, AssetLoadFlags flags);
28 void reloadAsset(AssetHandle & asset);
29
30 void handleReload(ResourceHandleBase handle) override;
31
33 void handleLoad(AssetLoadInfo * loadInfo) override;
34
35 void instantiateResource(AssetHandle asset, const ResourceDefinition & resourceDefinition);
36
37 AssetHandle instantiateAsset(AssetHandle owner, const ResourceDefinition& assetDefinition);
38 ModelHandle instantiateModel(AssetHandle asset, const ResourceDefinition & modelDefinition);
39 TextureHandle instantiateTexture(AssetHandle asset, const ResourceDefinition & textureDefinition);
40 MaterialInstanceHandle instantiateMaterialInstance(AssetHandle asset, const ResourceDefinition & materialInstanceDefinition);
41 };
42}
AssetManager(Context *context)
Constructs a AssetManager in the given context.
Definition: AssetManager.h:20
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition: Context.h:83
The generic resource manager provides a base implementation for specialized resource managers to buil...
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:24
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
AssetLoadFlags
Asset and Scene loading flags. May be combined with resource loading flags.
Resource handle base class handling reference counting of resources derived from ResourceBase.