Skip to content

Commit 7da1541

Browse files
GLTF Model: added GetIndexAllocatorIndex method
1 parent b0fc9e3 commit 7da1541

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

AssetLoader/interface/GLTFLoader.hpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -936,11 +936,22 @@ struct Model
936936
0;
937937
}
938938

939+
/// Returns an index of the vertex pool in the resource manager.
940+
///
941+
/// \remarks This index should be passed to the GetVertexPool method of the resource manager.
939942
Uint32 GetVertexPoolIndex() const
940943
{
941944
return VertexData.PoolId;
942945
}
943946

947+
/// Returns an index of the index buffer allocator in the resource manager.
948+
///
949+
/// \remarks This index should be passed to the GetIndexBuffer method of the resource manager.
950+
Uint32 GetIndexAllocatorIndex() const
951+
{
952+
return IndexData.AllocatorId;
953+
}
954+
944955
struct ImageData
945956
{
946957
int Width = 0;
@@ -1062,7 +1073,8 @@ struct Model
10621073
RefCntAutoPtr<IBuffer> pBuffer;
10631074
RefCntAutoPtr<IBufferSuballocation> pAllocation;
10641075

1065-
Uint32 IndexSize = 0;
1076+
Uint32 AllocatorId = 0; // Index buffer allocator index
1077+
Uint32 IndexSize = 0;
10661078
};
10671079
IndexDataInfo IndexData;
10681080

AssetLoader/src/GLTFBuilder.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,9 @@ void ModelBuilder::InitIndexBuffer(IRenderDevice* pDevice)
254254
auto pBuffInitData = BufferInitData::Create();
255255
pBuffInitData->Data.emplace_back(std::move(m_IndexData));
256256
m_Model.IndexData.pAllocation->SetUserData(pBuffInitData);
257+
258+
m_Model.IndexData.AllocatorId = m_CI.pResourceManager->GetIndexAllocatorIndex(m_Model.IndexData.pAllocation->GetAllocator());
259+
VERIFY_EXPR(m_Model.IndexData.AllocatorId != ~0u);
257260
}
258261
else
259262
{

0 commit comments

Comments
 (0)