mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-24 12:51:09 +00:00
- split off the vertex creation from RenderWall.
This commit is contained in:
parent
4ab8ca63ce
commit
8cf53f04e8
2 changed files with 38 additions and 20 deletions
|
@ -195,6 +195,7 @@ private:
|
||||||
|
|
||||||
void SetupLights();
|
void SetupLights();
|
||||||
bool PrepareLight(ADynamicLight * light, int pass);
|
bool PrepareLight(ADynamicLight * light, int pass);
|
||||||
|
void MakeVertices(bool nosplit);
|
||||||
void RenderWall(int textured, unsigned int *store = NULL);
|
void RenderWall(int textured, unsigned int *store = NULL);
|
||||||
void RenderTextured(int rflags);
|
void RenderTextured(int rflags);
|
||||||
|
|
||||||
|
|
|
@ -167,27 +167,19 @@ void GLWall::SetupLights()
|
||||||
dynlightindex = GLRenderer->mLights->UploadLights(lightdata);
|
dynlightindex = GLRenderer->mLights->UploadLights(lightdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// General purpose wall rendering function
|
// build the vertices for this wall
|
||||||
// everything goes through here
|
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void GLWall::RenderWall(int textured, unsigned int *store)
|
void GLWall::MakeVertices(bool nosplit)
|
||||||
{
|
{
|
||||||
bool split = (gl_seamless && !(textured&RWF_NOSPLIT) && seg->sidedef != NULL && !(seg->sidedef->Flags & WALLF_POLYOBJ) && !(flags & GLWF_NOSPLIT));
|
if (vertcount == 0)
|
||||||
|
|
||||||
if (!(textured & RWF_NORENDER))
|
|
||||||
{
|
{
|
||||||
gl_RenderState.Apply();
|
bool split = (gl_seamless && !nosplit && seg->sidedef != NULL && !(seg->sidedef->Flags & WALLF_POLYOBJ) && !(flags & GLWF_NOSPLIT));
|
||||||
gl_RenderState.ApplyLightIndex(dynlightindex);
|
|
||||||
}
|
|
||||||
|
|
||||||
// the rest of the code is identical for textured rendering and lights
|
|
||||||
FFlatVertex *ptr = GLRenderer->mVBO->GetBuffer();
|
FFlatVertex *ptr = GLRenderer->mVBO->GetBuffer();
|
||||||
unsigned int count, offset;
|
|
||||||
|
|
||||||
ptr->Set(glseg.x1, zbottom[0], glseg.y1, tcs[LOLFT].u, tcs[LOLFT].v);
|
ptr->Set(glseg.x1, zbottom[0], glseg.y1, tcs[LOLFT].u, tcs[LOLFT].v);
|
||||||
ptr++;
|
ptr++;
|
||||||
|
@ -201,7 +193,32 @@ void GLWall::RenderWall(int textured, unsigned int *store)
|
||||||
ptr->Set(glseg.x2, zbottom[1], glseg.y2, tcs[LORGT].u, tcs[LORGT].v);
|
ptr->Set(glseg.x2, zbottom[1], glseg.y2, tcs[LORGT].u, tcs[LORGT].v);
|
||||||
ptr++;
|
ptr++;
|
||||||
if (split && !(flags & GLWF_NOSPLITLOWER)) SplitLowerEdge(ptr);
|
if (split && !(flags & GLWF_NOSPLITLOWER)) SplitLowerEdge(ptr);
|
||||||
count = GLRenderer->mVBO->GetCount(ptr, &offset);
|
vertcount = GLRenderer->mVBO->GetCount(ptr, &vertindex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// General purpose wall rendering function
|
||||||
|
// everything goes through here
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
void GLWall::RenderWall(int textured, unsigned int *store)
|
||||||
|
{
|
||||||
|
if (!(textured & RWF_NORENDER))
|
||||||
|
{
|
||||||
|
gl_RenderState.Apply();
|
||||||
|
gl_RenderState.ApplyLightIndex(dynlightindex);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gl.buffermethod != BM_DEFERRED)
|
||||||
|
{
|
||||||
|
MakeVertices(!(textured&RWF_NOSPLIT));
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int count = vertcount, offset = vertindex;
|
||||||
if (!(textured & RWF_NORENDER))
|
if (!(textured & RWF_NORENDER))
|
||||||
{
|
{
|
||||||
GLRenderer->mVBO->RenderArray(GL_TRIANGLE_FAN, offset, count);
|
GLRenderer->mVBO->RenderArray(GL_TRIANGLE_FAN, offset, count);
|
||||||
|
|
Loading…
Reference in a new issue