mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-31 22:00:48 +00:00
- flat rendering must check for missing vertex buffer data.
This commit is contained in:
parent
60b6dbadb2
commit
2baed338f7
1 changed files with 28 additions and 25 deletions
|
@ -210,44 +210,47 @@ 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 (vcount > 0 && !gl_RenderState.GetClipLineShouldBeActive())
|
if (iboindex >= 0)
|
||||||
{
|
{
|
||||||
if (processlights) SetupSectorLights(flat, GLPASS_ALL, &dli);
|
if (vcount > 0 && !gl_RenderState.GetClipLineShouldBeActive())
|
||||||
drawcalls.Clock();
|
|
||||||
glDrawElements(GL_TRIANGLES, vcount, GL_UNSIGNED_INT, GLRenderer->mVBO->GetIndexPointer() + flat->iboindex);
|
|
||||||
drawcalls.Unclock();
|
|
||||||
flatvertices += vcount;
|
|
||||||
flatprimitives++;
|
|
||||||
}
|
|
||||||
else if (flat->iboindex >= 0)
|
|
||||||
{
|
|
||||||
int index = flat->iboindex;
|
|
||||||
for (int i=0; i<flat->sector->subsectorcount; i++)
|
|
||||||
{
|
{
|
||||||
subsector_t * sub = flat->sector->subsectors[i];
|
if (processlights) SetupSectorLights(flat, GLPASS_ALL, &dli);
|
||||||
if (sub->numlines <= 2) continue;
|
drawcalls.Clock();
|
||||||
|
glDrawElements(GL_TRIANGLES, vcount, GL_UNSIGNED_INT, GLRenderer->mVBO->GetIndexPointer() + iboindex);
|
||||||
if (ss_renderflags[sub->Index()]& flat->renderflags || istrans)
|
drawcalls.Unclock();
|
||||||
|
flatvertices += vcount;
|
||||||
|
flatprimitives++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int index = iboindex;
|
||||||
|
for (int i = 0; i < flat->sector->subsectorcount; i++)
|
||||||
{
|
{
|
||||||
if (processlights) SetupSubsectorLights(flat, GLPASS_ALL, sub, &dli);
|
subsector_t * sub = flat->sector->subsectors[i];
|
||||||
drawcalls.Clock();
|
if (sub->numlines <= 2) continue;
|
||||||
glDrawElements(GL_TRIANGLES, (sub->numlines - 2) * 3, GL_UNSIGNED_INT, GLRenderer->mVBO->GetIndexPointer() + index);
|
|
||||||
drawcalls.Unclock();
|
if (ss_renderflags[sub->Index()] & flat->renderflags || istrans)
|
||||||
flatvertices += sub->numlines;
|
{
|
||||||
flatprimitives++;
|
if (processlights) SetupSubsectorLights(flat, GLPASS_ALL, sub, &dli);
|
||||||
|
drawcalls.Clock();
|
||||||
|
glDrawElements(GL_TRIANGLES, (sub->numlines - 2) * 3, GL_UNSIGNED_INT, GLRenderer->mVBO->GetIndexPointer() + index);
|
||||||
|
drawcalls.Unclock();
|
||||||
|
flatvertices += sub->numlines;
|
||||||
|
flatprimitives++;
|
||||||
|
}
|
||||||
|
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++)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue