- use more desctiptive names for the predefined vertex buffer indices.

This commit is contained in:
Christoph Oelckers 2016-08-25 22:23:31 +02:00
parent 4a822a8f50
commit 4ab8ca63ce
6 changed files with 19 additions and 2 deletions

View file

@ -772,11 +772,13 @@ void GLWall::RenderLightsCompat(int pass)
} }
if (PrepareLight(light, pass)) if (PrepareLight(light, pass))
{ {
vertcount = 0;
RenderWall(RWF_TEXTURED, NULL); RenderWall(RWF_TEXTURED, NULL);
} }
node = node->nextLight; node = node->nextLight;
} }
memcpy(tcs, save, sizeof(tcs)); memcpy(tcs, save, sizeof(tcs));
vertcount = 0;
} }
//========================================================================== //==========================================================================

View file

@ -83,6 +83,13 @@ class FFlatVertexBuffer : public FVertexBuffer
static const unsigned int BUFFER_SIZE_TO_USE = 1999500; static const unsigned int BUFFER_SIZE_TO_USE = 1999500;
public: public:
enum
{
QUAD_INDEX = 0,
FULLSCREEN_INDEX = 4,
PRESENT_INDEX = 8
};
TArray<FFlatVertex> vbo_shadowdata; // this is kept around for updating the actual (non-readable) buffer and as stand-in for pre GL 4.x TArray<FFlatVertex> vbo_shadowdata; // this is kept around for updating the actual (non-readable) buffer and as stand-in for pre GL 4.x
FFlatVertexBuffer(int width, int height); FFlatVertexBuffer(int width, int height);

View file

@ -114,7 +114,7 @@ void FGLRenderer::RenderScreenQuad()
{ {
mVBO->BindVBO(); mVBO->BindVBO();
gl_RenderState.ResetVertexBuffer(); gl_RenderState.ResetVertexBuffer();
glDrawArrays(GL_TRIANGLE_STRIP, 8, 4); glDrawArrays(GL_TRIANGLE_STRIP, FFlatVertexBuffer::PRESENT_INDEX, 4);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View file

@ -81,6 +81,6 @@ void FQuadDrawer::DoRender(int type)
glUniformMatrix4fv(shader->vertexmatrix_index, 1, false, matV); glUniformMatrix4fv(shader->vertexmatrix_index, 1, false, matV);
glUniformMatrix4fv(shader->texcoordmatrix_index, 1, false, matT); glUniformMatrix4fv(shader->texcoordmatrix_index, 1, false, matT);
glUniform1i(shader->quadmode_index, 1); glUniform1i(shader->quadmode_index, 1);
GLRenderer->mVBO->RenderArray(type, 0, 4); GLRenderer->mVBO->RenderArray(type, FFlatVertexBuffer::QUAD_INDEX, 4);
glUniform1i(shader->quadmode_index, 0); glUniform1i(shader->quadmode_index, 0);
} }

View file

@ -172,6 +172,9 @@ public:
float zceil[2]; float zceil[2];
float zfloor[2]; float zfloor[2];
unsigned int vertindex;
unsigned int vertcount;
public: public:
seg_t * seg; // this gives the easiest access to all other structs involved seg_t * seg; // this gives the easiest access to all other structs involved
subsector_t * sub; // For polyobjects subsector_t * sub; // For polyobjects

View file

@ -1467,6 +1467,8 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
// note: we always have a valid sidedef and linedef reference when getting here. // note: we always have a valid sidedef and linedef reference when getting here.
this->seg = seg; this->seg = seg;
vertindex = 0;
vertcount = 0;
if ((seg->sidedef->Flags & WALLF_POLYOBJ) && seg->backsector) if ((seg->sidedef->Flags & WALLF_POLYOBJ) && seg->backsector)
{ {
@ -1760,6 +1762,9 @@ void GLWall::ProcessLowerMiniseg(seg_t *seg, sector_t * frontsector, sector_t *
float ffh = frontsector->GetPlaneTexZ(sector_t::floor); float ffh = frontsector->GetPlaneTexZ(sector_t::floor);
float bfh = backsector->GetPlaneTexZ(sector_t::floor); float bfh = backsector->GetPlaneTexZ(sector_t::floor);
vertindex = 0;
vertcount = 0;
if (bfh > ffh) if (bfh > ffh)
{ {
this->seg = seg; this->seg = seg;