Skip to content

Commit

Permalink
- fixed fillSimplePoly for indexed data.
Browse files Browse the repository at this point in the history
On OpenGL this merely caused some visual glitches on the cheat automap - but the bad data in the buffer can make Vulkan abort entirely.
  • Loading branch information
coelckers authored and madame-rachelle committed Jun 7, 2019
1 parent d050627 commit 1818b5d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/rendering/2d/v_2ddrawer.cpp
Expand Up @@ -485,21 +485,22 @@ void F2DDrawer::AddPoly(FTexture *texture, FVector2 *points, int npoints,
mVertices[poly.mVertIndex+i].Set(points[i].X, points[i].Y, 0, u*uscale, v*vscale, color0);
}
poly.mIndexIndex = mIndices.Size();
poly.mIndexCount += (npoints - 2) * 3;

if (indices == nullptr || indexcount == 0)
{
poly.mIndexCount += (npoints - 2) * 3;
for (int i = 2; i < npoints; ++i)
{
AddIndices(poly.mVertIndex, 3, 0, i - 1, i);
}
}
else
{
poly.mIndexCount += (int)indexcount;
int addr = mIndices.Reserve(indexcount);
for (size_t i = 0; i < indexcount; i++)
{
mIndices[addr + i] = addr + indices[i];
mIndices[addr + i] = poly.mVertIndex + indices[i];
}
}

Expand Down

0 comments on commit 1818b5d

Please sign in to comment.