From 375dd7e28fbf1cc6f365755784c01e25547eb03f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 5 Nov 2018 22:14:18 +0100 Subject: [PATCH] - the sections are now being used as the smallest element to draw flat planes. This also removes one piece of code that was used to cope with the missing clip planes on old ATI cards, so support for those will most likely have to be dropped in the near future. --- src/hwrenderer/scene/hw_drawinfo.h | 5 ---- src/hwrenderer/scene/hw_flats.cpp | 34 +++++-------------------- src/hwrenderer/scene/hw_renderhacks.cpp | 2 -- src/hwrenderer/scene/hw_skydome.cpp | 5 ++++ src/hwrenderer/scene/hw_skydome.h | 1 + 5 files changed, 12 insertions(+), 35 deletions(-) diff --git a/src/hwrenderer/scene/hw_drawinfo.h b/src/hwrenderer/scene/hw_drawinfo.h index c3a9ddfb39..537c2a2027 100644 --- a/src/hwrenderer/scene/hw_drawinfo.h +++ b/src/hwrenderer/scene/hw_drawinfo.h @@ -256,11 +256,6 @@ public: VPUniforms.mClipHeight = 0; } - bool ClipLineShouldBeActive() - { - return (screen->hwcaps & RFL_NO_CLIP_PLANES) && VPUniforms.mClipLine.X > -1000000.f; - } - HWPortal * FindPortal(const void * src); void RenderBSPNode(void *node); void RenderBSP(void *node); diff --git a/src/hwrenderer/scene/hw_flats.cpp b/src/hwrenderer/scene/hw_flats.cpp index db9edfccbb..2278bbd586 100644 --- a/src/hwrenderer/scene/hw_flats.cpp +++ b/src/hwrenderer/scene/hw_flats.cpp @@ -182,8 +182,6 @@ void GLFlat::SetupLights(HWDrawInfo *di, FLightNode * node, FDynLightData &light void GLFlat::DrawSubsectors(HWDrawInfo *di, FRenderState &state) { - auto vcount = sector->ibocount; - if (level.HasDynamicLights && screen->BuffersArePersistent()) { SetupLights(di, sector->lighthead, lightdata, sector->PortalGroup); @@ -191,34 +189,13 @@ void GLFlat::DrawSubsectors(HWDrawInfo *di, FRenderState &state) state.SetLightIndex(dynlightindex); - if (vcount > 0 && !di->ClipLineShouldBeActive()) - { - state.DrawIndexed(DT_Triangles, iboindex, vcount); - flatvertices += vcount; - flatprimitives++; - } - else - { - /* - int index = iboindex; - bool applied = false; - for (int i = 0; i < sector->subsectorcount; i++) - { - subsector_t * sub = sector->subsectors[i]; - if (sub->numlines <= 2) continue; + state.DrawIndexed(DT_Triangles, iboindex + section->vertexindex, section->vertexcount); + flatvertices += section->vertexcount; + flatprimitives++; - if (di->ss_renderflags[sub->Index()] & renderflags) - { - state.DrawIndexed(DT_Triangles, index, (sub->numlines - 2) * 3, !applied); - applied = true; - flatvertices += sub->numlines; - flatprimitives++; - } - index += (sub->numlines - 2) * 3; - } - */ - } +#if 0 + //Temporarily disabled until the render hack code can be redone and refactored into its own draw elements if (!(renderflags&SSRF_RENDER3DPLANES)) { // Draw the subsectors assigned to it due to missing textures @@ -282,6 +259,7 @@ void GLFlat::DrawSubsectors(HWDrawInfo *di, FRenderState &state) } } +#endif } //========================================================================== diff --git a/src/hwrenderer/scene/hw_renderhacks.cpp b/src/hwrenderer/scene/hw_renderhacks.cpp index afc8aaab89..5fbc96aea3 100644 --- a/src/hwrenderer/scene/hw_renderhacks.cpp +++ b/src/hwrenderer/scene/hw_renderhacks.cpp @@ -1297,7 +1297,6 @@ void HWDrawInfo::ProcessSectorStacks(area_t in_area) { subsector_t *sub = HandledSubsectors[j]; ss_renderflags[sub->Index()] &= ~SSRF_RENDERCEILING; - sub->sector->ibocount = -1; // cannot render this sector in one go. if (sub->portalcoverage[sector_t::ceiling].subsectors == NULL) { @@ -1343,7 +1342,6 @@ void HWDrawInfo::ProcessSectorStacks(area_t in_area) { subsector_t *sub = HandledSubsectors[j]; ss_renderflags[sub->Index()] &= ~SSRF_RENDERFLOOR; - sub->sector->ibocount = -1; // cannot render this sector in one go. if (sub->portalcoverage[sector_t::floor].subsectors == NULL) { diff --git a/src/hwrenderer/scene/hw_skydome.cpp b/src/hwrenderer/scene/hw_skydome.cpp index 7184b7bad6..27342cf7dc 100644 --- a/src/hwrenderer/scene/hw_skydome.cpp +++ b/src/hwrenderer/scene/hw_skydome.cpp @@ -96,6 +96,11 @@ FSkyVertexBuffer::FSkyVertexBuffer() mVertexBuffer->SetData(mVertices.Size() * sizeof(FSkyVertex), &mVertices[0], true); } +FSkyVertexBuffer::~FSkyVertexBuffer() +{ + delete mVertexBuffer; +} + //----------------------------------------------------------------------------- // // diff --git a/src/hwrenderer/scene/hw_skydome.h b/src/hwrenderer/scene/hw_skydome.h index b441bc8ca7..ed130084cb 100644 --- a/src/hwrenderer/scene/hw_skydome.h +++ b/src/hwrenderer/scene/hw_skydome.h @@ -67,6 +67,7 @@ public: public: FSkyVertexBuffer(); + ~FSkyVertexBuffer(); void SetupMatrices(FMaterial *tex, float x_offset, float y_offset, bool mirror, int mode, VSMatrix &modelmatrix, VSMatrix &textureMatrix); std::pair GetBufferObjects() const {