mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-12 07:34:30 +00:00
- put all the common part of buffer based drawing into a separate method of the vertex buffer.
This commit is contained in:
parent
23fbd69963
commit
09ba62fbef
7 changed files with 16 additions and 24 deletions
|
@ -70,6 +70,14 @@ public:
|
||||||
mCurIndex = newofs;
|
mCurIndex = newofs;
|
||||||
return diff;
|
return diff;
|
||||||
}
|
}
|
||||||
|
#ifdef __GL_PCH_H // we need the system includes for this but we cannot include them ourselves without creating #define clashes. The affected files wouldn't try to draw anyway.
|
||||||
|
void RenderCurrent(FFlatVertex *newptr, unsigned int primtype)
|
||||||
|
{
|
||||||
|
unsigned int offset;
|
||||||
|
unsigned int count = GetCount(newptr, &offset);
|
||||||
|
glDrawArrays(primtype, offset, count);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
void Reset()
|
void Reset()
|
||||||
{
|
{
|
||||||
mCurIndex = mIndex;
|
mCurIndex = mIndex;
|
||||||
|
|
|
@ -355,9 +355,7 @@ void GLWall::DrawDecal(DBaseDecal *decal)
|
||||||
ptr->Set(dv[i].x, dv[i].z, dv[i].y, dv[i].u, dv[i].v);
|
ptr->Set(dv[i].x, dv[i].z, dv[i].y, dv[i].u, dv[i].v);
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
unsigned int offset;
|
GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_FAN);
|
||||||
unsigned int count = GLRenderer->mVBO->GetCount(ptr, &offset);
|
|
||||||
glDrawArrays(GL_TRIANGLE_FAN, offset, count);
|
|
||||||
}
|
}
|
||||||
rendered_decals++;
|
rendered_decals++;
|
||||||
gl_RenderState.SetTextureMode(TM_MODULATE);
|
gl_RenderState.SetTextureMode(TM_MODULATE);
|
||||||
|
|
|
@ -1011,9 +1011,7 @@ void FDrawInfo::SetupFloodStencil(wallseg * ws)
|
||||||
ptr++;
|
ptr++;
|
||||||
ptr->Set(ws->x2, ws->z1, ws->y2, 0, 0);
|
ptr->Set(ws->x2, ws->z1, ws->y2, 0, 0);
|
||||||
ptr++;
|
ptr++;
|
||||||
unsigned int offset;
|
GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_FAN);
|
||||||
unsigned int count = GLRenderer->mVBO->GetCount(ptr, &offset);
|
|
||||||
glDrawArrays(GL_TRIANGLE_FAN, offset, count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
glStencilFunc(GL_EQUAL,recursion+1,~0); // draw sky into stencil
|
glStencilFunc(GL_EQUAL,recursion+1,~0); // draw sky into stencil
|
||||||
|
@ -1055,9 +1053,7 @@ void FDrawInfo::ClearFloodStencil(wallseg * ws)
|
||||||
ptr++;
|
ptr++;
|
||||||
ptr->Set(ws->x2, ws->z1, ws->y2, 0, 0);
|
ptr->Set(ws->x2, ws->z1, ws->y2, 0, 0);
|
||||||
ptr++;
|
ptr++;
|
||||||
unsigned int offset;
|
GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_FAN);
|
||||||
unsigned int count = GLRenderer->mVBO->GetCount(ptr, &offset);
|
|
||||||
glDrawArrays(GL_TRIANGLE_FAN, offset, count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// restore old stencil op.
|
// restore old stencil op.
|
||||||
|
@ -1158,9 +1154,7 @@ void FDrawInfo::DrawFloodedPlane(wallseg * ws, float planez, sector_t * sec, boo
|
||||||
ptr++;
|
ptr++;
|
||||||
ptr->Set(px4, planez, py4, px4 / 64, -py4 / 64);
|
ptr->Set(px4, planez, py4, px4 / 64, -py4 / 64);
|
||||||
ptr++;
|
ptr++;
|
||||||
unsigned int offset;
|
GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_FAN);
|
||||||
unsigned int count = GLRenderer->mVBO->GetCount(ptr, &offset);
|
|
||||||
glDrawArrays(GL_TRIANGLE_FAN, offset, count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pushed)
|
if (pushed)
|
||||||
|
|
|
@ -295,9 +295,7 @@ void GLFlat::DrawSubsector(subsector_t * sub)
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unsigned int offset;
|
GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_FAN);
|
||||||
unsigned int count = GLRenderer->mVBO->GetCount(ptr, &offset);
|
|
||||||
glDrawArrays(GL_TRIANGLE_FAN, offset, count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
flatvertices += sub->numlines;
|
flatvertices += sub->numlines;
|
||||||
|
|
|
@ -637,9 +637,7 @@ static void FillScreen()
|
||||||
ptr++;
|
ptr++;
|
||||||
ptr->Set((float)SCREENWIDTH, (float)SCREENHEIGHT, 0, 0, 0);
|
ptr->Set((float)SCREENWIDTH, (float)SCREENHEIGHT, 0, 0, 0);
|
||||||
ptr++;
|
ptr++;
|
||||||
unsigned int offset;
|
GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_STRIP);
|
||||||
unsigned int count = GLRenderer->mVBO->GetCount(ptr, &offset);
|
|
||||||
glDrawArrays(GL_TRIANGLE_FAN, offset, count);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -302,9 +302,7 @@ void GLWall::RenderWall(int textured, float * color2, ADynamicLight * light)
|
||||||
ptr->Set(glseg.x2, zbottom[1], glseg.y2, tcs[3].u, tcs[3].v);
|
ptr->Set(glseg.x2, zbottom[1], glseg.y2, tcs[3].u, tcs[3].v);
|
||||||
ptr++;
|
ptr++;
|
||||||
if (split && !(flags & GLWF_NOSPLITLOWER)) SplitLowerEdge(tcs, ptr);
|
if (split && !(flags & GLWF_NOSPLITLOWER)) SplitLowerEdge(tcs, ptr);
|
||||||
unsigned int offset;
|
GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_FAN);
|
||||||
unsigned int count = GLRenderer->mVBO->GetCount(ptr, &offset);
|
|
||||||
glDrawArrays(GL_TRIANGLE_FAN, offset, count);
|
|
||||||
vertexcount += 4;
|
vertexcount += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -174,9 +174,7 @@ void FGLRenderer::DrawPSprite (player_t * player,pspdef_t *psp,fixed_t sx, fixed
|
||||||
ptr++;
|
ptr++;
|
||||||
ptr->Set(x2, y2, 0, fU2, fV2);
|
ptr->Set(x2, y2, 0, fU2, fV2);
|
||||||
ptr++;
|
ptr++;
|
||||||
unsigned int offset;
|
GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_STRIP);
|
||||||
unsigned int count = GLRenderer->mVBO->GetCount(ptr, &offset);
|
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, offset, count);
|
|
||||||
}
|
}
|
||||||
if (tex->GetTransparent() || OverrideShader != 0)
|
if (tex->GetTransparent() || OverrideShader != 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue