From 84a55667d9b22f9cc47258826c43bf0761123f01 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 14 Aug 2018 00:11:59 +0200 Subject: [PATCH] - removed more old code from flat renderer. VBOHeightCheck was from early development when interpolation was not reflected by the vertex buffer. # Conflicts: # src/gl/scene/gl_flats.cpp --- src/gl/scene/gl_flats.cpp | 49 +++++++++++-------------------- src/hwrenderer/scene/hw_flats.cpp | 28 ++---------------- src/r_defs.h | 1 - 3 files changed, 20 insertions(+), 58 deletions(-) diff --git a/src/gl/scene/gl_flats.cpp b/src/gl/scene/gl_flats.cpp index 98314af8a..2c194395d 100644 --- a/src/gl/scene/gl_flats.cpp +++ b/src/gl/scene/gl_flats.cpp @@ -118,46 +118,31 @@ void FDrawInfo::DrawSubsectors(GLFlat *flat, int pass, bool istrans) flat->SetupLights(this, flat->sector->lighthead, lightdata, flat->sector->PortalGroup); } gl_RenderState.ApplyLightIndex(flat->dynlightindex); - if (iboindex >= 0) + if (vcount > 0 && !ClipLineShouldBeActive()) { - if (vcount > 0 && !ClipLineShouldBeActive()) - { - drawcalls.Clock(); - glDrawElements(GL_TRIANGLES, vcount, GL_UNSIGNED_INT, GLRenderer->mVBO->GetIndexPointer() + iboindex); - drawcalls.Unclock(); - flatvertices += vcount; - flatprimitives++; - } - else - { - int index = iboindex; - for (int i = 0; i < flat->sector->subsectorcount; i++) - { - subsector_t * sub = flat->sector->subsectors[i]; - if (sub->numlines <= 2) continue; - - if (ss_renderflags[sub->Index()] & flat->renderflags || istrans) - { - 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; - } - } + drawcalls.Clock(); + glDrawElements(GL_TRIANGLES, vcount, GL_UNSIGNED_INT, GLRenderer->mVBO->GetIndexPointer() + iboindex); + drawcalls.Unclock(); + flatvertices += vcount; + flatprimitives++; } else { - // Draw the subsectors belonging to this sector - for (int i=0; isector->subsectorcount; i++) + int index = iboindex; + for (int i = 0; i < flat->sector->subsectorcount; i++) { subsector_t * sub = flat->sector->subsectors[i]; - if (ss_renderflags[sub->Index()]& flat->renderflags || istrans) + if (sub->numlines <= 2) continue; + + if (ss_renderflags[sub->Index()] & flat->renderflags || istrans) { - DrawSubsector(flat, sub); + 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; } } diff --git a/src/hwrenderer/scene/hw_flats.cpp b/src/hwrenderer/scene/hw_flats.cpp index 0973b0314..e63f3e74c 100644 --- a/src/hwrenderer/scene/hw_flats.cpp +++ b/src/hwrenderer/scene/hw_flats.cpp @@ -269,14 +269,7 @@ void GLFlat::SetFrom3DFloor(F3DFloor *rover, bool top, bool underside) alpha = rover->alpha/255.0f; renderstyle = rover->flags&FF_ADDITIVETRANS? STYLE_Add : STYLE_Translucent; - if (plane.model->VBOHeightcheck(plane.isceiling)) - { - iboindex = plane.vindex; - } - else - { - iboindex = -1; - } + iboindex = plane.vindex; } //========================================================================== @@ -339,14 +332,7 @@ void GLFlat::ProcessSector(HWDrawInfo *di, sector_t * frontsector) if (alpha != 0.f && frontsector->GetTexture(sector_t::floor) != skyflatnum) { - if (frontsector->VBOHeightcheck(sector_t::floor)) - { - iboindex = frontsector->iboindex[sector_t::floor]; - } - else - { - iboindex = -1; - } + iboindex = frontsector->iboindex[sector_t::floor]; ceiling = false; renderflags = SSRF_RENDERFLOOR; @@ -399,15 +385,7 @@ void GLFlat::ProcessSector(HWDrawInfo *di, sector_t * frontsector) if (alpha != 0.f && frontsector->GetTexture(sector_t::ceiling) != skyflatnum) { - if (frontsector->VBOHeightcheck(sector_t::ceiling)) - { - iboindex = frontsector->iboindex[sector_t::ceiling]; - } - else - { - iboindex = -1; - } - + iboindex = frontsector->iboindex[sector_t::ceiling]; ceiling = true; renderflags = SSRF_RENDERCEILING; diff --git a/src/r_defs.h b/src/r_defs.h index ffe526969..6c1d0da67 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -1092,7 +1092,6 @@ public: int ibocount; // number of indices per plane (identical for all planes.) If this is -1 the index buffer is not in use. float GetReflect(int pos) { return gl_plane_reflection_i? reflect[pos] : 0; } - bool VBOHeightcheck(int pos) const { return vboheight[pos] == GetPlaneTexZ(pos); } FSectorPortalGroup *GetPortalGroup(int plane) { return portals[plane]; } enum