-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathIModelManager.h
More file actions
39 lines (26 loc) · 1.02 KB
/
IModelManager.h
File metadata and controls
39 lines (26 loc) · 1.02 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
#pragma once
#include <IAsyncLoad.h>
X_NAMESPACE_BEGIN(model)
class XModel;
struct IModelManager : public core::IAssetLoader
{
using core::IAssetLoader::waitForLoad;
virtual ~IModelManager() = default;
// returns null if not found, ref count unaffected
virtual XModel* findModel(core::AssetID id) const X_ABSTRACT;
virtual XModel* findModel(core::string_view name) const X_ABSTRACT;
virtual XModel* loadModel(core::string_view name) X_ABSTRACT;
virtual XModel* getDefaultModel(void) const X_ABSTRACT;
virtual void releaseModel(XModel* pModel) X_ABSTRACT;
virtual bool waitForLoad(XModel* pModel) X_ABSTRACT; // returns true if load succeed.
X_INLINE bool waitForLoad(core::AssetBase* pModel) X_FINAL;
};
X_INLINE bool IModelManager::waitForLoad(core::AssetBase* pModel)
{
X_ASSERT(pModel->getType() == assetDb::AssetType::MODEL, "Invalid asset passed")();
if (pModel->isLoaded()) {
return true;
}
return waitForLoad(static_cast<XModel*>(pModel));
}
X_NAMESPACE_END