summaryrefslogtreecommitdiffstats
path: root/AssetLoader/interface
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-12-10 21:06:36 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-12-10 21:06:36 +0000
commit3725eda0af93bd59408f7dcd5ac1349045438c38 (patch)
tree9c3a58dc461f940da7cd1b64492472cdc92fa38f /AssetLoader/interface
parentFixed clang build errors (diff)
downloadDiligentTools-3725eda0af93bd59408f7dcd5ac1349045438c38.tar.gz
DiligentTools-3725eda0af93bd59408f7dcd5ac1349045438c38.zip
GLTFLoader: updated model initialization API; few minor improvements to loading
Diffstat (limited to 'AssetLoader/interface')
-rw-r--r--AssetLoader/interface/GLTFLoader.hpp40
1 files changed, 26 insertions, 14 deletions
diff --git a/AssetLoader/interface/GLTFLoader.hpp b/AssetLoader/interface/GLTFLoader.hpp
index 2976210..604c838 100644
--- a/AssetLoader/interface/GLTFLoader.hpp
+++ b/AssetLoader/interface/GLTFLoader.hpp
@@ -54,7 +54,7 @@ namespace Diligent
namespace GLTF
{
-struct GLTFCacheInfo
+struct ResourceCacheUseInfo
{
ResourceManager* pResourceMgr = nullptr;
@@ -335,11 +335,26 @@ struct Model
std::unordered_map<std::string, RefCntWeakPtr<ITexture>> Textures;
};
- Model(IRenderDevice* pDevice,
- IDeviceContext* pContext,
- const std::string& filename,
- TextureCacheType* pTextureCache = nullptr,
- GLTFCacheInfo* pCache = nullptr);
+ /// Model create information
+ struct CreateInfo
+ {
+ /// File name
+ const char* FileName = nullptr;
+
+ /// Optional texture cache to use when loading the model.
+ /// The loader will try to find all the textures in the cache
+ /// and add all new textures to the cache.
+ TextureCacheType* pTextureCache = nullptr;
+
+ /// Optional resource cache usage info.
+ ResourceCacheUseInfo* pCacheInfo = nullptr;
+
+ /// Optional transform to apply to the model
+ const float4x4* pTransform = nullptr;
+ };
+ Model(IRenderDevice* pDevice,
+ IDeviceContext* pContext,
+ const CreateInfo& CI);
~Model();
@@ -378,11 +393,9 @@ struct Model
}
private:
- void LoadFromFile(IRenderDevice* pDevice,
- IDeviceContext* pContext,
- const std::string& filename,
- TextureCacheType* pTextureCache,
- GLTFCacheInfo* pCache);
+ void LoadFromFile(IRenderDevice* pDevice,
+ IDeviceContext* pContext,
+ const CreateInfo& CI);
void LoadNode(IRenderDevice* pDevice,
Node* parent,
@@ -395,7 +408,8 @@ private:
void LoadTextures(IRenderDevice* pDevice,
const tinygltf::Model& gltf_model,
const std::string& BaseDir,
- TextureCacheType* pTextureCache);
+ TextureCacheType* pTextureCache,
+ ResourceManager* pResourceMgr);
void LoadTextureSamplers(IRenderDevice* pDevice, const tinygltf::Model& gltf_model);
void LoadMaterials(const tinygltf::Model& gltf_model);
@@ -405,8 +419,6 @@ private:
Node* FindNode(Node* parent, Uint32 index);
Node* NodeFromIndex(uint32_t index);
- GLTFCacheInfo CacheInfo;
-
struct ResourceInitData;
std::unique_ptr<ResourceInitData> InitData;