Do not generate render data in case CDecal calculated wrong coordinates.

Tested By: OptimusShepard, Stan
Differential Revision: https://code.wildfiregames.com/D3578
This was SVN commit r24932.
This commit is contained in:
vladislavbelov
2021-02-18 21:09:41 +00:00
parent e8fb314996
commit 03ed891029
+9 -2
View File
@@ -234,6 +234,15 @@ void CDecalRData::BuildVertexData()
ssize_t i0, j0, i1, j1;
m_Decal->CalcVertexExtents(i0, j0, i1, j1);
// Currently CalcVertexExtents might return empty rectangle, that means
// we can't render it.
if (i1 <= i0 && j1 <= j0)
{
// We have nothing to render.
m_VBDecals.Reset();
m_VBDecalsIndices.Reset();
return;
}
CmpPtr<ICmpWaterManager> cmpWaterManager(*m_Simulation, SYSTEM_ENTITY);
@@ -300,8 +309,6 @@ void CDecalRData::BuildVertexData()
}
}
ENSURE(!indices.empty());
// Construct vertex buffer.
if (!m_VBDecalsIndices || m_VBDecalsIndices->m_Count != indices.size())
m_VBDecalsIndices = g_VBMan.AllocateChunk(sizeof(u16), indices.size(), GL_STATIC_DRAW, GL_ELEMENT_ARRAY_BUFFER);