From f6544f3c4472062cfe43dbd2d04dc7d5a8f91f77 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 26 Aug 2016 00:04:29 +0200 Subject: [PATCH] - removed unused GLFLat::sub and all codes depending on it a valid pointer. --- src/gl/compatibility/gl_20.cpp | 40 +++++------ src/gl/scene/gl_flats.cpp | 126 ++++++++++++++------------------- src/gl/scene/gl_wall.h | 1 - 3 files changed, 70 insertions(+), 97 deletions(-) diff --git a/src/gl/compatibility/gl_20.cpp b/src/gl/compatibility/gl_20.cpp index f05256452..8e6682f17 100644 --- a/src/gl/compatibility/gl_20.cpp +++ b/src/gl/compatibility/gl_20.cpp @@ -647,35 +647,27 @@ void GLFlat::DrawSubsectorLights(subsector_t * sub, int pass) void GLFlat::DrawLightsCompat(int pass) { gl_RenderState.Apply(); - if (sub) + // Draw the subsectors belonging to this sector + for (int i = 0; isubsectorcount; i++) { - // This represents a single subsector - DrawSubsectorLights(sub, pass); - } - else - { - // Draw the subsectors belonging to this sector - for (int i = 0; isubsectorcount; i++) + subsector_t * sub = sector->subsectors[i]; + if (gl_drawinfo->ss_renderflags[sub - subsectors] & renderflags) { - subsector_t * sub = sector->subsectors[i]; - if (gl_drawinfo->ss_renderflags[sub - subsectors] & renderflags) - { - DrawSubsectorLights(sub, pass); - } + DrawSubsectorLights(sub, pass); } + } - // Draw the subsectors assigned to it due to missing textures - if (!(renderflags&SSRF_RENDER3DPLANES)) + // Draw the subsectors assigned to it due to missing textures + if (!(renderflags&SSRF_RENDER3DPLANES)) + { + gl_subsectorrendernode * node = (renderflags&SSRF_RENDERFLOOR) ? + gl_drawinfo->GetOtherFloorPlanes(sector->sectornum) : + gl_drawinfo->GetOtherCeilingPlanes(sector->sectornum); + + while (node) { - gl_subsectorrendernode * node = (renderflags&SSRF_RENDERFLOOR) ? - gl_drawinfo->GetOtherFloorPlanes(sector->sectornum) : - gl_drawinfo->GetOtherCeilingPlanes(sector->sectornum); - - while (node) - { - DrawSubsectorLights(node->sub, pass); - node = node->next; - } + DrawSubsectorLights(node->sub, pass); + node = node->next; } } } diff --git a/src/gl/scene/gl_flats.cpp b/src/gl/scene/gl_flats.cpp index 3ce888089..bd55a1a09 100644 --- a/src/gl/scene/gl_flats.cpp +++ b/src/gl/scene/gl_flats.cpp @@ -204,35 +204,27 @@ void GLFlat::ProcessLights(bool istrans) { dynlightindex = GLRenderer->mLights->GetIndexPtr(); - if (sub) + // Draw the subsectors belonging to this sector + for (int i=0; isubsectorcount; i++) { - // This represents a single subsector - SetupSubsectorLights(GLPASS_LIGHTSONLY, sub); - } - else - { - // Draw the subsectors belonging to this sector - for (int i=0; isubsectorcount; i++) + subsector_t * sub = sector->subsectors[i]; + if (gl_drawinfo->ss_renderflags[sub-subsectors]&renderflags || istrans) { - subsector_t * sub = sector->subsectors[i]; - if (gl_drawinfo->ss_renderflags[sub-subsectors]&renderflags || istrans) - { - SetupSubsectorLights(GLPASS_LIGHTSONLY, sub); - } + SetupSubsectorLights(GLPASS_LIGHTSONLY, sub); } + } - // Draw the subsectors assigned to it due to missing textures - if (!(renderflags&SSRF_RENDER3DPLANES)) + // Draw the subsectors assigned to it due to missing textures + if (!(renderflags&SSRF_RENDER3DPLANES)) + { + gl_subsectorrendernode * node = (renderflags&SSRF_RENDERFLOOR)? + gl_drawinfo->GetOtherFloorPlanes(sector->sectornum) : + gl_drawinfo->GetOtherCeilingPlanes(sector->sectornum); + + while (node) { - gl_subsectorrendernode * node = (renderflags&SSRF_RENDERFLOOR)? - gl_drawinfo->GetOtherFloorPlanes(sector->sectornum) : - gl_drawinfo->GetOtherCeilingPlanes(sector->sectornum); - - while (node) - { - SetupSubsectorLights(GLPASS_LIGHTSONLY, node->sub); - node = node->next; - } + SetupSubsectorLights(GLPASS_LIGHTSONLY, node->sub); + node = node->next; } } } @@ -249,60 +241,51 @@ void GLFlat::DrawSubsectors(int pass, bool processlights, bool istrans) int dli = dynlightindex; gl_RenderState.Apply(); - if (sub) + if (vboindex >= 0) { - // This represents a single subsector - if (processlights) SetupSubsectorLights(GLPASS_ALL, sub, &dli); - DrawSubsector(sub); - } - else - { - if (vboindex >= 0) + int index = vboindex; + for (int i=0; isubsectorcount; i++) { - int index = vboindex; - for (int i=0; isubsectorcount; i++) - { - subsector_t * sub = sector->subsectors[i]; + subsector_t * sub = sector->subsectors[i]; - if (gl_drawinfo->ss_renderflags[sub-subsectors]&renderflags || istrans) - { - if (processlights) SetupSubsectorLights(GLPASS_ALL, sub, &dli); - drawcalls.Clock(); - glDrawArrays(GL_TRIANGLE_FAN, index, sub->numlines); - drawcalls.Unclock(); - flatvertices += sub->numlines; - flatprimitives++; - } - index += sub->numlines; - } - } - else - { - // Draw the subsectors belonging to this sector - for (int i=0; isubsectorcount; i++) - { - subsector_t * sub = sector->subsectors[i]; - if (gl_drawinfo->ss_renderflags[sub-subsectors]&renderflags || istrans) - { - if (processlights) SetupSubsectorLights(GLPASS_ALL, sub, &dli); - DrawSubsector(sub); - } + if (gl_drawinfo->ss_renderflags[sub-subsectors]&renderflags || istrans) + { + if (processlights) SetupSubsectorLights(GLPASS_ALL, sub, &dli); + drawcalls.Clock(); + glDrawArrays(GL_TRIANGLE_FAN, index, sub->numlines); + drawcalls.Unclock(); + flatvertices += sub->numlines; + flatprimitives++; + } + index += sub->numlines; + } + } + else + { + // Draw the subsectors belonging to this sector + for (int i=0; isubsectorcount; i++) + { + subsector_t * sub = sector->subsectors[i]; + if (gl_drawinfo->ss_renderflags[sub-subsectors]&renderflags || istrans) + { + if (processlights) SetupSubsectorLights(GLPASS_ALL, sub, &dli); + DrawSubsector(sub); } } + } - // Draw the subsectors assigned to it due to missing textures - if (!(renderflags&SSRF_RENDER3DPLANES)) - { - gl_subsectorrendernode * node = (renderflags&SSRF_RENDERFLOOR)? - gl_drawinfo->GetOtherFloorPlanes(sector->sectornum) : - gl_drawinfo->GetOtherCeilingPlanes(sector->sectornum); + // Draw the subsectors assigned to it due to missing textures + if (!(renderflags&SSRF_RENDER3DPLANES)) + { + gl_subsectorrendernode * node = (renderflags&SSRF_RENDERFLOOR)? + gl_drawinfo->GetOtherFloorPlanes(sector->sectornum) : + gl_drawinfo->GetOtherCeilingPlanes(sector->sectornum); - while (node) - { - if (processlights) SetupSubsectorLights(GLPASS_ALL, node->sub, &dli); - DrawSubsector(node->sub); - node = node->next; - } + while (node) + { + if (processlights) SetupSubsectorLights(GLPASS_ALL, node->sub, &dli); + DrawSubsector(node->sub); + node = node->next; } } } @@ -565,7 +548,6 @@ void GLFlat::ProcessSector(sector_t * frontsector) // Get the real sector for this one. sector = §ors[frontsector->sectornum]; extsector_t::xfloor &x = sector->e->XFloor; - this->sub = NULL; dynlightindex = -1; byte &srf = gl_drawinfo->sectorrenderflags[sector->sectornum]; diff --git a/src/gl/scene/gl_wall.h b/src/gl/scene/gl_wall.h index 60da86130..ae7014c7d 100644 --- a/src/gl/scene/gl_wall.h +++ b/src/gl/scene/gl_wall.h @@ -288,7 +288,6 @@ public: friend struct GLDrawList; sector_t * sector; - subsector_t * sub; // only used for translucent planes float dz; // z offset for rendering hacks float z; // the z position of the flat (only valid for non-sloped planes) FMaterial *gltexture;