Graphics/TileMap: Fix material index rendering

This commit is contained in:
Lynix 2019-03-10 18:13:03 +01:00
parent 4bf92457c5
commit cdf9611080
2 changed files with 4 additions and 3 deletions

View File

@ -166,6 +166,7 @@ Nazara Engine:
- Fixed SystemCursor_Move not showing up on Windows
- Fixed Window movement constructor/assignation operator
- Window::PushEvent is now public (useful for pushing external events ie. when using Qt or similar framework controlling window)
- Fixed TileMap not rendering the right materials if it had no tile using some materials in-between
Nazara Development Kit:
- Added ImageWidget (#139)

View File

@ -27,14 +27,14 @@ namespace Nz
{
const VertexStruct_XYZ_Color_UV* vertices = reinterpret_cast<const VertexStruct_XYZ_Color_UV*>(instanceData.data.data());
std::size_t matCount = 0;
std::size_t spriteCount = 0;
for (const Layer& layer : m_layers)
for (std::size_t layerIndex = 0; layerIndex < m_layers.size(); ++layerIndex)
{
const auto& layer = m_layers[layerIndex];
if (layer.tiles.empty())
continue;
renderQueue->AddSprites(instanceData.renderOrder, GetMaterial(matCount++), &vertices[4 * spriteCount], layer.tiles.size(), scissorRect);
renderQueue->AddSprites(instanceData.renderOrder, GetMaterial(layerIndex), &vertices[4 * spriteCount], layer.tiles.size(), scissorRect);
spriteCount += layer.tiles.size();
}