- removed unused GLFLat::sub and all codes depending on it a valid pointer.

This commit is contained in:
Christoph Oelckers 2016-08-26 00:04:29 +02:00
parent 6755cb2a25
commit f6544f3c44
3 changed files with 70 additions and 97 deletions

View file

@ -647,35 +647,27 @@ void GLFlat::DrawSubsectorLights(subsector_t * sub, int pass)
void GLFlat::DrawLightsCompat(int pass) void GLFlat::DrawLightsCompat(int pass)
{ {
gl_RenderState.Apply(); gl_RenderState.Apply();
if (sub) // Draw the subsectors belonging to this sector
for (int i = 0; i<sector->subsectorcount; i++)
{ {
// This represents a single subsector subsector_t * sub = sector->subsectors[i];
DrawSubsectorLights(sub, pass); if (gl_drawinfo->ss_renderflags[sub - subsectors] & renderflags)
}
else
{
// Draw the subsectors belonging to this sector
for (int i = 0; i<sector->subsectorcount; i++)
{ {
subsector_t * sub = sector->subsectors[i]; DrawSubsectorLights(sub, pass);
if (gl_drawinfo->ss_renderflags[sub - subsectors] & renderflags)
{
DrawSubsectorLights(sub, pass);
}
} }
}
// Draw the subsectors assigned to it due to missing textures // Draw the subsectors assigned to it due to missing textures
if (!(renderflags&SSRF_RENDER3DPLANES)) 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) ? DrawSubsectorLights(node->sub, pass);
gl_drawinfo->GetOtherFloorPlanes(sector->sectornum) : node = node->next;
gl_drawinfo->GetOtherCeilingPlanes(sector->sectornum);
while (node)
{
DrawSubsectorLights(node->sub, pass);
node = node->next;
}
} }
} }
} }

View file

@ -204,35 +204,27 @@ void GLFlat::ProcessLights(bool istrans)
{ {
dynlightindex = GLRenderer->mLights->GetIndexPtr(); dynlightindex = GLRenderer->mLights->GetIndexPtr();
if (sub) // Draw the subsectors belonging to this sector
for (int i=0; i<sector->subsectorcount; i++)
{ {
// This represents a single subsector subsector_t * sub = sector->subsectors[i];
SetupSubsectorLights(GLPASS_LIGHTSONLY, sub); if (gl_drawinfo->ss_renderflags[sub-subsectors]&renderflags || istrans)
}
else
{
// Draw the subsectors belonging to this sector
for (int i=0; i<sector->subsectorcount; i++)
{ {
subsector_t * sub = sector->subsectors[i]; SetupSubsectorLights(GLPASS_LIGHTSONLY, sub);
if (gl_drawinfo->ss_renderflags[sub-subsectors]&renderflags || istrans)
{
SetupSubsectorLights(GLPASS_LIGHTSONLY, sub);
}
} }
}
// Draw the subsectors assigned to it due to missing textures // Draw the subsectors assigned to it due to missing textures
if (!(renderflags&SSRF_RENDER3DPLANES)) 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)? SetupSubsectorLights(GLPASS_LIGHTSONLY, node->sub);
gl_drawinfo->GetOtherFloorPlanes(sector->sectornum) : node = node->next;
gl_drawinfo->GetOtherCeilingPlanes(sector->sectornum);
while (node)
{
SetupSubsectorLights(GLPASS_LIGHTSONLY, node->sub);
node = node->next;
}
} }
} }
} }
@ -249,60 +241,51 @@ void GLFlat::DrawSubsectors(int pass, bool processlights, bool istrans)
int dli = dynlightindex; int dli = dynlightindex;
gl_RenderState.Apply(); gl_RenderState.Apply();
if (sub) if (vboindex >= 0)
{ {
// This represents a single subsector int index = vboindex;
if (processlights) SetupSubsectorLights(GLPASS_ALL, sub, &dli); for (int i=0; i<sector->subsectorcount; i++)
DrawSubsector(sub);
}
else
{
if (vboindex >= 0)
{ {
int index = vboindex; subsector_t * sub = sector->subsectors[i];
for (int i=0; i<sector->subsectorcount; i++)
{
subsector_t * sub = sector->subsectors[i];
if (gl_drawinfo->ss_renderflags[sub-subsectors]&renderflags || istrans) if (gl_drawinfo->ss_renderflags[sub-subsectors]&renderflags || istrans)
{ {
if (processlights) SetupSubsectorLights(GLPASS_ALL, sub, &dli); if (processlights) SetupSubsectorLights(GLPASS_ALL, sub, &dli);
drawcalls.Clock(); drawcalls.Clock();
glDrawArrays(GL_TRIANGLE_FAN, index, sub->numlines); glDrawArrays(GL_TRIANGLE_FAN, index, sub->numlines);
drawcalls.Unclock(); drawcalls.Unclock();
flatvertices += sub->numlines; flatvertices += sub->numlines;
flatprimitives++; flatprimitives++;
} }
index += sub->numlines; index += sub->numlines;
} }
} }
else else
{ {
// Draw the subsectors belonging to this sector // Draw the subsectors belonging to this sector
for (int i=0; i<sector->subsectorcount; i++) for (int i=0; i<sector->subsectorcount; i++)
{ {
subsector_t * sub = sector->subsectors[i]; subsector_t * sub = sector->subsectors[i];
if (gl_drawinfo->ss_renderflags[sub-subsectors]&renderflags || istrans) if (gl_drawinfo->ss_renderflags[sub-subsectors]&renderflags || istrans)
{ {
if (processlights) SetupSubsectorLights(GLPASS_ALL, sub, &dli); if (processlights) SetupSubsectorLights(GLPASS_ALL, sub, &dli);
DrawSubsector(sub); DrawSubsector(sub);
}
} }
} }
}
// Draw the subsectors assigned to it due to missing textures // Draw the subsectors assigned to it due to missing textures
if (!(renderflags&SSRF_RENDER3DPLANES)) if (!(renderflags&SSRF_RENDER3DPLANES))
{ {
gl_subsectorrendernode * node = (renderflags&SSRF_RENDERFLOOR)? gl_subsectorrendernode * node = (renderflags&SSRF_RENDERFLOOR)?
gl_drawinfo->GetOtherFloorPlanes(sector->sectornum) : gl_drawinfo->GetOtherFloorPlanes(sector->sectornum) :
gl_drawinfo->GetOtherCeilingPlanes(sector->sectornum); gl_drawinfo->GetOtherCeilingPlanes(sector->sectornum);
while (node) while (node)
{ {
if (processlights) SetupSubsectorLights(GLPASS_ALL, node->sub, &dli); if (processlights) SetupSubsectorLights(GLPASS_ALL, node->sub, &dli);
DrawSubsector(node->sub); DrawSubsector(node->sub);
node = node->next; node = node->next;
}
} }
} }
} }
@ -565,7 +548,6 @@ void GLFlat::ProcessSector(sector_t * frontsector)
// Get the real sector for this one. // Get the real sector for this one.
sector = &sectors[frontsector->sectornum]; sector = &sectors[frontsector->sectornum];
extsector_t::xfloor &x = sector->e->XFloor; extsector_t::xfloor &x = sector->e->XFloor;
this->sub = NULL;
dynlightindex = -1; dynlightindex = -1;
byte &srf = gl_drawinfo->sectorrenderflags[sector->sectornum]; byte &srf = gl_drawinfo->sectorrenderflags[sector->sectornum];

View file

@ -288,7 +288,6 @@ public:
friend struct GLDrawList; friend struct GLDrawList;
sector_t * sector; sector_t * sector;
subsector_t * sub; // only used for translucent planes
float dz; // z offset for rendering hacks float dz; // z offset for rendering hacks
float z; // the z position of the flat (only valid for non-sloped planes) float z; // the z position of the flat (only valid for non-sloped planes)
FMaterial *gltexture; FMaterial *gltexture;