- flat rendering must check for missing vertex buffer data.

This commit is contained in:
Christoph Oelckers 2018-06-05 21:44:38 +02:00
parent 60b6dbadb2
commit 2baed338f7
1 changed files with 28 additions and 25 deletions

View File

@ -210,30 +210,33 @@ void FDrawInfo::DrawSubsectors(GLFlat *flat, int pass, bool processlights, bool
auto vcount = flat->sector->ibocount; auto vcount = flat->sector->ibocount;
gl_RenderState.Apply(); gl_RenderState.Apply();
auto iboindex = flat->iboindex;
if (gl.legacyMode) if (gl.legacyMode)
{ {
processlights = false; processlights = false;
goto legacy; iboindex = -1;
} }
if (iboindex >= 0)
{
if (vcount > 0 && !gl_RenderState.GetClipLineShouldBeActive()) if (vcount > 0 && !gl_RenderState.GetClipLineShouldBeActive())
{ {
if (processlights) SetupSectorLights(flat, GLPASS_ALL, &dli); if (processlights) SetupSectorLights(flat, GLPASS_ALL, &dli);
drawcalls.Clock(); drawcalls.Clock();
glDrawElements(GL_TRIANGLES, vcount, GL_UNSIGNED_INT, GLRenderer->mVBO->GetIndexPointer() + flat->iboindex); glDrawElements(GL_TRIANGLES, vcount, GL_UNSIGNED_INT, GLRenderer->mVBO->GetIndexPointer() + iboindex);
drawcalls.Unclock(); drawcalls.Unclock();
flatvertices += vcount; flatvertices += vcount;
flatprimitives++; flatprimitives++;
} }
else if (flat->iboindex >= 0) else
{ {
int index = flat->iboindex; int index = iboindex;
for (int i=0; i<flat->sector->subsectorcount; i++) for (int i = 0; i < flat->sector->subsectorcount; i++)
{ {
subsector_t * sub = flat->sector->subsectors[i]; subsector_t * sub = flat->sector->subsectors[i];
if (sub->numlines <= 2) continue; if (sub->numlines <= 2) continue;
if (ss_renderflags[sub->Index()]& flat->renderflags || istrans) if (ss_renderflags[sub->Index()] & flat->renderflags || istrans)
{ {
if (processlights) SetupSubsectorLights(flat, GLPASS_ALL, sub, &dli); if (processlights) SetupSubsectorLights(flat, GLPASS_ALL, sub, &dli);
drawcalls.Clock(); drawcalls.Clock();
@ -245,9 +248,9 @@ void FDrawInfo::DrawSubsectors(GLFlat *flat, int pass, bool processlights, bool
index += (sub->numlines - 2) * 3; index += (sub->numlines - 2) * 3;
} }
} }
}
else else
{ {
legacy:
// Draw the subsectors belonging to this sector // Draw the subsectors belonging to this sector
for (int i=0; i<flat->sector->subsectorcount; i++) for (int i=0; i<flat->sector->subsectorcount; i++)
{ {