Skip to content

Commit

Permalink
GLTF Model: added GetIndexAllocatorIndex method
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMostDiligent committed Feb 21, 2024
1 parent b0fc9e3 commit 7da1541
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 13 additions & 1 deletion AssetLoader/interface/GLTFLoader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -936,11 +936,22 @@ struct Model
0;
}

/// Returns an index of the vertex pool in the resource manager.
///
/// \remarks This index should be passed to the GetVertexPool method of the resource manager.
Uint32 GetVertexPoolIndex() const
{
return VertexData.PoolId;
}

/// Returns an index of the index buffer allocator in the resource manager.
///
/// \remarks This index should be passed to the GetIndexBuffer method of the resource manager.
Uint32 GetIndexAllocatorIndex() const
{
return IndexData.AllocatorId;
}

struct ImageData
{
int Width = 0;
Expand Down Expand Up @@ -1062,7 +1073,8 @@ struct Model
RefCntAutoPtr<IBuffer> pBuffer;
RefCntAutoPtr<IBufferSuballocation> pAllocation;

Uint32 IndexSize = 0;
Uint32 AllocatorId = 0; // Index buffer allocator index
Uint32 IndexSize = 0;
};
IndexDataInfo IndexData;

Expand Down
3 changes: 3 additions & 0 deletions AssetLoader/src/GLTFBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,9 @@ void ModelBuilder::InitIndexBuffer(IRenderDevice* pDevice)
auto pBuffInitData = BufferInitData::Create();
pBuffInitData->Data.emplace_back(std::move(m_IndexData));
m_Model.IndexData.pAllocation->SetUserData(pBuffInitData);

m_Model.IndexData.AllocatorId = m_CI.pResourceManager->GetIndexAllocatorIndex(m_Model.IndexData.pAllocation->GetAllocator());
VERIFY_EXPR(m_Model.IndexData.AllocatorId != ~0u);
}
else
{
Expand Down

0 comments on commit 7da1541

Please sign in to comment.