diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-12-11 05:57:10 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-12-11 05:57:10 +0000 |
| commit | d1120ace145bb3a2b0006659c128a4162df15985 (patch) | |
| tree | 647d5b74105f3b420e41f8ccf6f4defeb75a9e07 /AssetLoader/interface | |
| parent | GLTFLoader: updated node transforms handling (diff) | |
| download | DiligentTools-d1120ace145bb3a2b0006659c128a4162df15985.tar.gz DiligentTools-d1120ace145bb3a2b0006659c128a4162df15985.zip | |
GLTFLoader: added option to not load animation data and skin
Diffstat (limited to 'AssetLoader/interface')
| -rw-r--r-- | AssetLoader/interface/GLTFLoader.hpp | 21 | ||||
| -rw-r--r-- | AssetLoader/interface/GLTFResourceManager.hpp | 9 |
2 files changed, 19 insertions, 11 deletions
diff --git a/AssetLoader/interface/GLTFLoader.hpp b/AssetLoader/interface/GLTFLoader.hpp index aba68c3..91f4aef 100644 --- a/AssetLoader/interface/GLTFLoader.hpp +++ b/AssetLoader/interface/GLTFLoader.hpp @@ -284,7 +284,7 @@ struct Animation struct Model { - struct VertexAttribs0 + struct VertexBasicAttribs { float3 pos; float3 normal; @@ -292,7 +292,7 @@ struct Model float2 uv1; }; - struct VertexAttribs1 + struct VertexSkinAttribs { float4 joint0; float4 weight0; @@ -300,8 +300,8 @@ struct Model enum BUFFER_ID { - BUFFER_ID_VERTEX0 = 0, - BUFFER_ID_VERTEX1, + BUFFER_ID_VERTEX_BASIC_ATTRIBS = 0, + BUFFER_ID_VERTEX_SKIN_ATTRIBS, BUFFER_ID_INDEX, BUFFER_ID_NUM_BUFFERS }; @@ -348,6 +348,10 @@ struct Model /// Optional resource cache usage info. ResourceCacheUseInfo* pCacheInfo = nullptr; + + /// Whether to load animation and initialize skin attributes + /// buffer. + bool LoadAnimationAndSkin = true; }; Model(IRenderDevice* pDevice, IDeviceContext* pContext, @@ -383,11 +387,11 @@ struct Model Uint32 GetBaseVertex() const { - auto& VertBuff = Buffers[BUFFER_ID_VERTEX0]; - VERIFY(!VertBuff.pSuballocation || VertBuff.pSuballocation->GetOffset() % sizeof(VertexAttribs0) == 0, + auto& VertBuff = Buffers[BUFFER_ID_VERTEX_BASIC_ATTRIBS]; + VERIFY(!VertBuff.pSuballocation || VertBuff.pSuballocation->GetOffset() % sizeof(VertexBasicAttribs) == 0, "Allocation offset is not multiple of sizeof(VertexAttribs0)"); return VertBuff.pSuballocation ? - static_cast<Uint32>(VertBuff.pSuballocation->GetOffset() / sizeof(VertexAttribs0)) : + static_cast<Uint32>(VertBuff.pSuballocation->GetOffset() / sizeof(VertexBasicAttribs)) : 0; } @@ -400,7 +404,8 @@ private: Node* parent, const tinygltf::Node& gltf_node, uint32_t nodeIndex, - const tinygltf::Model& gltf_model); + const tinygltf::Model& gltf_model, + bool LoadSkin); void LoadSkins(const tinygltf::Model& gltf_model); diff --git a/AssetLoader/interface/GLTFResourceManager.hpp b/AssetLoader/interface/GLTFResourceManager.hpp index bd3ea19..f42c975 100644 --- a/AssetLoader/interface/GLTFResourceManager.hpp +++ b/AssetLoader/interface/GLTFResourceManager.hpp @@ -82,7 +82,7 @@ public: RefCntAutoPtr<ITextureAtlasSuballocation> FindAllocation(const char* CacheId); - Uint32 GetResourceVersion() + Uint32 GetTextureVersion() { Uint32 Version = 0; @@ -93,6 +93,11 @@ public: return Version; } + Uint32 GetBufferVersion(Uint32 Index) const + { + return m_BufferSuballocators[Index]->GetVersion(); + } + IBuffer* GetBuffer(Uint32 Index, IRenderDevice* pDevice, IDeviceContext* pContext) { return m_BufferSuballocators[Index]->GetBuffer(pDevice, pContext); @@ -131,8 +136,6 @@ private: using TexAllocationsHashMapType = std::unordered_map<std::string, RefCntWeakPtr<ITextureAtlasSuballocation>>; std::mutex m_TexAllocationsMtx; TexAllocationsHashMapType m_TexAllocations; - - std::atomic_uint32_t m_ResourceVersion = {}; }; } // namespace GLTF |
