- reuse the same vertex buffer data for all slices of a decal.

This commit is contained in:
Christoph Oelckers 2016-02-01 21:50:55 +01:00
parent f11f86f05d
commit 9453a8a7e6

View file

@ -327,20 +327,23 @@ void GLWall::DrawDecal(DBaseDecal *decal)
{
gl_RenderState.SetFog(0,-1);
}
FFlatVertex *ptr = GLRenderer->mVBO->GetBuffer();
for (i = 0; i < 4; i++)
{
ptr->Set(dv[i].x, dv[i].z, dv[i].y, dv[i].u, dv[i].v);
ptr++;
}
if (lightlist == NULL)
{
gl_RenderState.Apply();
FFlatVertex *ptr = GLRenderer->mVBO->GetBuffer();
for (i = 0; i < 4; i++)
{
ptr->Set(dv[i].x, dv[i].z, dv[i].y, dv[i].u, dv[i].v);
ptr++;
}
GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_FAN);
}
else
{
unsigned int offset;
unsigned int count = GLRenderer->mVBO->GetCount(ptr, &offset);
for (unsigned k = 0; k < lightlist->Size(); k++)
{
secplane_t &lowplane = k == (*lightlist).Size() - 1 ? bottomplane : (*lightlist)[k + 1].plane;
@ -360,13 +363,7 @@ void GLWall::DrawDecal(DBaseDecal *decal)
gl_RenderState.SetSplitPlanes((*lightlist)[k].plane, lowplane);
gl_RenderState.Apply();
FFlatVertex *ptr = GLRenderer->mVBO->GetBuffer();
for (i = 0; i < 4; i++)
{
ptr->Set(dv[i].x, dv[i].z, dv[i].y, dv[i].u, dv[i].v);
ptr++;
}
GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_FAN);
GLRenderer->mVBO->RenderArray(GL_TRIANGLE_FAN, offset, count);
}
if (low1 <= dv[0].z && low2 <= dv[3].z) break;
}