From 31263eeac214590ad9ebfcd18f2e7cb890bed8f6 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 21 May 2018 10:49:24 +0200 Subject: [PATCH] - removed gl_drawinfo-> from FDrawInfo member functions and pass it to some other functions as a parameter. This really shouldn't be handled as a global variable. The mere fact that several member functions used it incorrectly is ample proof of that. --- src/gl/compatibility/gl_20.cpp | 58 +++++++++++++++++----------------- src/gl/scene/gl_drawinfo.cpp | 4 +-- src/gl/scene/gl_flats.cpp | 16 +++++----- src/gl/scene/gl_portal.cpp | 12 +++---- src/gl/scene/gl_portal.h | 2 +- src/gl/scene/gl_scene.cpp | 58 +++++++++++++++++----------------- src/gl/scene/gl_scenedrawer.h | 8 ++--- src/gl/scene/gl_sprite.cpp | 2 +- src/gl/scene/gl_walls_draw.cpp | 4 +-- 9 files changed, 82 insertions(+), 82 deletions(-) diff --git a/src/gl/compatibility/gl_20.cpp b/src/gl/compatibility/gl_20.cpp index 5ff6c7710..0f75ba467 100644 --- a/src/gl/compatibility/gl_20.cpp +++ b/src/gl/compatibility/gl_20.cpp @@ -586,7 +586,7 @@ bool FDrawInfo::PutFlatCompat(GLFlat *flat, bool fog) int list = list_indices[masked][foggy]; - auto newflat = gl_drawinfo->dldrawlists[list].NewFlat(); + auto newflat = dldrawlists[list].NewFlat(); *newflat = *flat; return true; } @@ -720,7 +720,7 @@ void FDrawInfo::DrawLightsCompat(GLFlat *flat, int pass) for (int i = 0; isector->subsectorcount; i++) { subsector_t * sub = flat->sector->subsectors[i]; - if (gl_drawinfo->ss_renderflags[sub->Index()] & flat->renderflags) + if (ss_renderflags[sub->Index()] & flat->renderflags) { DrawSubsectorLights(flat, sub, pass); } @@ -730,8 +730,8 @@ void FDrawInfo::DrawLightsCompat(GLFlat *flat, int pass) if (!(flat->renderflags&SSRF_RENDER3DPLANES)) { gl_subsectorrendernode * node = (flat->renderflags&SSRF_RENDERFLOOR) ? - gl_drawinfo->GetOtherFloorPlanes(flat->sector->sectornum) : - gl_drawinfo->GetOtherCeilingPlanes(flat->sector->sectornum); + GetOtherFloorPlanes(flat->sector->sectornum) : + GetOtherCeilingPlanes(flat->sector->sectornum); while (node) { @@ -854,7 +854,7 @@ void FDrawInfo::RenderLightsCompat(GLWall *wall, int pass) // //========================================================================== -void GLSceneDrawer::RenderMultipassStuff() +void GLSceneDrawer::RenderMultipassStuff(FDrawInfo *di) { // First pass: empty background with sector light only @@ -864,8 +864,8 @@ void GLSceneDrawer::RenderMultipassStuff() gl_RenderState.EnableTexture(false); gl_RenderState.EnableBrightmap(false); gl_RenderState.Apply(); - gl_drawinfo->dldrawlists[GLLDL_WALLS_PLAIN].DrawWalls(gl_drawinfo, GLPASS_ALL); - gl_drawinfo->dldrawlists[GLLDL_FLATS_PLAIN].DrawFlats(gl_drawinfo, GLPASS_ALL); + di->dldrawlists[GLLDL_WALLS_PLAIN].DrawWalls(di, GLPASS_ALL); + di->dldrawlists[GLLDL_FLATS_PLAIN].DrawFlats(di, GLPASS_ALL); // Part 2: masked geometry. This is set up so that only pixels with alpha>0.5 will show // This creates a blank surface that only fills the nontransparent parts of the texture @@ -873,18 +873,18 @@ void GLSceneDrawer::RenderMultipassStuff() gl_RenderState.SetTextureMode(TM_MASK); gl_RenderState.EnableBrightmap(true); gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_threshold); - gl_drawinfo->dldrawlists[GLLDL_WALLS_MASKED].DrawWalls(gl_drawinfo, GLPASS_ALL); - gl_drawinfo->dldrawlists[GLLDL_FLATS_MASKED].DrawFlats(gl_drawinfo, GLPASS_ALL); + di->dldrawlists[GLLDL_WALLS_MASKED].DrawWalls(di, GLPASS_ALL); + di->dldrawlists[GLLDL_FLATS_MASKED].DrawFlats(di, GLPASS_ALL); // Part 3: The base of fogged surfaces, including the texture gl_RenderState.EnableBrightmap(false); gl_RenderState.SetTextureMode(TM_MODULATE); gl_RenderState.AlphaFunc(GL_GEQUAL, 0); - gl_drawinfo->dldrawlists[GLLDL_WALLS_FOG].DrawWalls(gl_drawinfo, GLPASS_ALL); - gl_drawinfo->dldrawlists[GLLDL_FLATS_FOG].DrawFlats(gl_drawinfo, GLPASS_ALL); + di->dldrawlists[GLLDL_WALLS_FOG].DrawWalls(di, GLPASS_ALL); + di->dldrawlists[GLLDL_FLATS_FOG].DrawFlats(di, GLPASS_ALL); gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_threshold); - gl_drawinfo->dldrawlists[GLLDL_WALLS_FOGMASKED].DrawWalls(gl_drawinfo, GLPASS_ALL); - gl_drawinfo->dldrawlists[GLLDL_FLATS_FOGMASKED].DrawFlats(gl_drawinfo, GLPASS_ALL); + di->dldrawlists[GLLDL_WALLS_FOGMASKED].DrawWalls(di, GLPASS_ALL); + di->dldrawlists[GLLDL_FLATS_FOGMASKED].DrawFlats(di, GLPASS_ALL); // second pass: draw lights glDepthMask(false); @@ -895,10 +895,10 @@ void GLSceneDrawer::RenderMultipassStuff() gl_RenderState.BlendFunc(GL_ONE, GL_ONE); glDepthFunc(GL_EQUAL); if (level.lightmode == 8) gl_RenderState.SetSoftLightLevel(255); - gl_drawinfo->dldrawlists[GLLDL_WALLS_PLAIN].DrawWalls(gl_drawinfo, GLPASS_LIGHTTEX); - gl_drawinfo->dldrawlists[GLLDL_WALLS_MASKED].DrawWalls(gl_drawinfo, GLPASS_LIGHTTEX); - gl_drawinfo->dldrawlists[GLLDL_FLATS_PLAIN].DrawFlats(gl_drawinfo, GLPASS_LIGHTTEX); - gl_drawinfo->dldrawlists[GLLDL_FLATS_MASKED].DrawFlats(gl_drawinfo, GLPASS_LIGHTTEX); + di->dldrawlists[GLLDL_WALLS_PLAIN].DrawWalls(di, GLPASS_LIGHTTEX); + di->dldrawlists[GLLDL_WALLS_MASKED].DrawWalls(di, GLPASS_LIGHTTEX); + di->dldrawlists[GLLDL_FLATS_PLAIN].DrawFlats(di, GLPASS_LIGHTTEX); + di->dldrawlists[GLLDL_FLATS_MASKED].DrawFlats(di, GLPASS_LIGHTTEX); gl_RenderState.BlendEquation(GL_FUNC_ADD); } else gl_lights = false; @@ -910,11 +910,11 @@ void GLSceneDrawer::RenderMultipassStuff() gl_RenderState.EnableFog(false); gl_RenderState.AlphaFunc(GL_GEQUAL, 0); glDepthFunc(GL_LEQUAL); - gl_drawinfo->dldrawlists[GLLDL_WALLS_PLAIN].DrawWalls(gl_drawinfo, GLPASS_TEXONLY); - gl_drawinfo->dldrawlists[GLLDL_FLATS_PLAIN].DrawFlats(gl_drawinfo, GLPASS_TEXONLY); + di->dldrawlists[GLLDL_WALLS_PLAIN].DrawWalls(di, GLPASS_TEXONLY); + di->dldrawlists[GLLDL_FLATS_PLAIN].DrawFlats(di, GLPASS_TEXONLY); gl_RenderState.AlphaFunc(GL_GREATER, gl_mask_threshold); - gl_drawinfo->dldrawlists[GLLDL_WALLS_MASKED].DrawWalls(gl_drawinfo, GLPASS_TEXONLY); - gl_drawinfo->dldrawlists[GLLDL_FLATS_MASKED].DrawFlats(gl_drawinfo, GLPASS_TEXONLY); + di->dldrawlists[GLLDL_WALLS_MASKED].DrawWalls(di, GLPASS_TEXONLY); + di->dldrawlists[GLLDL_FLATS_MASKED].DrawFlats(di, GLPASS_TEXONLY); // fourth pass: additive lights gl_RenderState.EnableFog(true); @@ -922,14 +922,14 @@ void GLSceneDrawer::RenderMultipassStuff() glDepthFunc(GL_EQUAL); if (gl_SetupLightTexture()) { - gl_drawinfo->dldrawlists[GLLDL_WALLS_PLAIN].DrawWalls(gl_drawinfo, GLPASS_LIGHTTEX_ADDITIVE); - gl_drawinfo->dldrawlists[GLLDL_WALLS_MASKED].DrawWalls(gl_drawinfo, GLPASS_LIGHTTEX_ADDITIVE); - gl_drawinfo->dldrawlists[GLLDL_FLATS_PLAIN].DrawFlats(gl_drawinfo, GLPASS_LIGHTTEX_ADDITIVE); - gl_drawinfo->dldrawlists[GLLDL_FLATS_MASKED].DrawFlats(gl_drawinfo, GLPASS_LIGHTTEX_ADDITIVE); - gl_drawinfo->dldrawlists[GLLDL_WALLS_FOG].DrawWalls(gl_drawinfo, GLPASS_LIGHTTEX_FOGGY); - gl_drawinfo->dldrawlists[GLLDL_WALLS_FOGMASKED].DrawWalls(gl_drawinfo, GLPASS_LIGHTTEX_FOGGY); - gl_drawinfo->dldrawlists[GLLDL_FLATS_FOG].DrawFlats(gl_drawinfo, GLPASS_LIGHTTEX_FOGGY); - gl_drawinfo->dldrawlists[GLLDL_FLATS_FOGMASKED].DrawFlats(gl_drawinfo, GLPASS_LIGHTTEX_FOGGY); + di->dldrawlists[GLLDL_WALLS_PLAIN].DrawWalls(di, GLPASS_LIGHTTEX_ADDITIVE); + di->dldrawlists[GLLDL_WALLS_MASKED].DrawWalls(di, GLPASS_LIGHTTEX_ADDITIVE); + di->dldrawlists[GLLDL_FLATS_PLAIN].DrawFlats(di, GLPASS_LIGHTTEX_ADDITIVE); + di->dldrawlists[GLLDL_FLATS_MASKED].DrawFlats(di, GLPASS_LIGHTTEX_ADDITIVE); + di->dldrawlists[GLLDL_WALLS_FOG].DrawWalls(di, GLPASS_LIGHTTEX_FOGGY); + di->dldrawlists[GLLDL_WALLS_FOGMASKED].DrawWalls(di, GLPASS_LIGHTTEX_FOGGY); + di->dldrawlists[GLLDL_FLATS_FOG].DrawFlats(di, GLPASS_LIGHTTEX_FOGGY); + di->dldrawlists[GLLDL_FLATS_FOGMASKED].DrawFlats(di, GLPASS_LIGHTTEX_FOGGY); } else gl_lights = false; diff --git a/src/gl/scene/gl_drawinfo.cpp b/src/gl/scene/gl_drawinfo.cpp index b9ee2067d..ccd6567ce 100644 --- a/src/gl/scene/gl_drawinfo.cpp +++ b/src/gl/scene/gl_drawinfo.cpp @@ -81,13 +81,13 @@ void FDrawInfo::DoDrawSorted(HWDrawList *dl, SortNode * head) DoDrawSorted(dl, head->left); gl_RenderState.SetClipSplit(clipsplit); } - dl->DoDraw(gl_drawinfo, GLPASS_TRANSLUCENT, head->itemindex, true); + dl->DoDraw(this, GLPASS_TRANSLUCENT, head->itemindex, true); if (head->equal) { SortNode * ehead=head->equal; while (ehead) { - dl->DoDraw(gl_drawinfo, GLPASS_TRANSLUCENT, ehead->itemindex, true); + dl->DoDraw(this, GLPASS_TRANSLUCENT, ehead->itemindex, true); ehead=ehead->equal; } } diff --git a/src/gl/scene/gl_flats.cpp b/src/gl/scene/gl_flats.cpp index ff55d1161..380271989 100644 --- a/src/gl/scene/gl_flats.cpp +++ b/src/gl/scene/gl_flats.cpp @@ -141,7 +141,7 @@ void FDrawInfo::ProcessLights(GLFlat *flat, bool istrans) for (int i=0; i< flat->sector->subsectorcount; i++) { subsector_t * sub = flat->sector->subsectors[i]; - if (gl_drawinfo->ss_renderflags[sub->Index()]& flat->renderflags || istrans) + if (ss_renderflags[sub->Index()]& flat->renderflags || istrans) { SetupSubsectorLights(flat, GLPASS_LIGHTSONLY, sub, nullptr); } @@ -151,8 +151,8 @@ void FDrawInfo::ProcessLights(GLFlat *flat, bool istrans) if (!(flat->renderflags&SSRF_RENDER3DPLANES)) { gl_subsectorrendernode * node = (flat->renderflags&SSRF_RENDERFLOOR)? - gl_drawinfo->GetOtherFloorPlanes(flat->sector->sectornum) : - gl_drawinfo->GetOtherCeilingPlanes(flat->sector->sectornum); + GetOtherFloorPlanes(flat->sector->sectornum) : + GetOtherCeilingPlanes(flat->sector->sectornum); while (node) { @@ -182,7 +182,7 @@ void FDrawInfo::DrawSubsectors(GLFlat *flat, int pass, bool processlights, bool { subsector_t * sub = flat->sector->subsectors[i]; - if (gl_drawinfo->ss_renderflags[sub->Index()]& flat->renderflags || istrans) + if (ss_renderflags[sub->Index()]& flat->renderflags || istrans) { if (processlights) SetupSubsectorLights(flat, GLPASS_ALL, sub, &dli); drawcalls.Clock(); @@ -201,7 +201,7 @@ void FDrawInfo::DrawSubsectors(GLFlat *flat, int pass, bool processlights, bool for (int i=0; isector->subsectorcount; i++) { subsector_t * sub = flat->sector->subsectors[i]; - if (gl_drawinfo->ss_renderflags[sub->Index()]& flat->renderflags || istrans) + if (ss_renderflags[sub->Index()]& flat->renderflags || istrans) { if (processlights) SetupSubsectorLights(flat, GLPASS_ALL, sub, &dli); DrawSubsector(flat, sub); @@ -213,8 +213,8 @@ void FDrawInfo::DrawSubsectors(GLFlat *flat, int pass, bool processlights, bool if (!(flat->renderflags&SSRF_RENDER3DPLANES)) { gl_subsectorrendernode * node = (flat->renderflags&SSRF_RENDERFLOOR)? - gl_drawinfo->GetOtherFloorPlanes(flat->sector->sectornum) : - gl_drawinfo->GetOtherCeilingPlanes(flat->sector->sectornum); + GetOtherFloorPlanes(flat->sector->sectornum) : + GetOtherCeilingPlanes(flat->sector->sectornum); while (node) { @@ -399,7 +399,7 @@ void FDrawInfo::AddFlat(GLFlat *flat, bool fog) bool masked = flat->gltexture->isMasked() && ((flat->renderflags&SSRF_RENDER3DPLANES) || flat->stack); list = masked ? GLDL_MASKEDFLATS : GLDL_PLAINFLATS; } - auto newflat = gl_drawinfo->drawlists[list].NewFlat(); + auto newflat = drawlists[list].NewFlat(); *newflat = *flat; } diff --git a/src/gl/scene/gl_portal.cpp b/src/gl/scene/gl_portal.cpp index e5c1064af..12683c2d2 100644 --- a/src/gl/scene/gl_portal.cpp +++ b/src/gl/scene/gl_portal.cpp @@ -688,7 +688,7 @@ GLSectorStackPortal::~GLSectorStackPortal() // //----------------------------------------------------------------------------- -static uint8_t SetCoverage(void *node) +static uint8_t SetCoverage(FDrawInfo *di, void *node) { if (level.nodes.Size() == 0) { @@ -697,18 +697,18 @@ static uint8_t SetCoverage(void *node) if (!((size_t)node & 1)) // Keep going until found a subsector { node_t *bsp = (node_t *)node; - uint8_t coverage = SetCoverage(bsp->children[0]) | SetCoverage(bsp->children[1]); + uint8_t coverage = SetCoverage(di, bsp->children[0]) | SetCoverage(di, bsp->children[1]); gl_drawinfo->no_renderflags[bsp->Index()] = coverage; return coverage; } else { subsector_t *sub = (subsector_t *)((uint8_t *)node - 1); - return gl_drawinfo->ss_renderflags[sub->Index()] & SSRF_SEEN; + return di->ss_renderflags[sub->Index()] & SSRF_SEEN; } } -void GLSectorStackPortal::SetupCoverage() +void GLSectorStackPortal::SetupCoverage(FDrawInfo *di) { for(unsigned i=0; iss_renderflags[dsub->Index()] |= SSRF_SEEN; } } - SetCoverage(::level.HeadNode()); + SetCoverage(di, ::level.HeadNode()); } //----------------------------------------------------------------------------- @@ -742,7 +742,7 @@ void GLSectorStackPortal::DrawContents() drawer->SetupView(r_viewpoint.Pos.X, r_viewpoint.Pos.Y, r_viewpoint.Pos.Z, r_viewpoint.Angles.Yaw, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1)); SaveMapSection(); - SetupCoverage(); + SetupCoverage(gl_drawinfo); ClearClipper(); // If the viewpoint is not within the portal, we need to invalidate the entire clip area. diff --git a/src/gl/scene/gl_portal.h b/src/gl/scene/gl_portal.h index 628ea4614..5e5d02387 100644 --- a/src/gl/scene/gl_portal.h +++ b/src/gl/scene/gl_portal.h @@ -302,7 +302,7 @@ public: { origin=pt; } - void SetupCoverage(); + void SetupCoverage(FDrawInfo *di); void AddSubsector(subsector_t *sub) { subsectors.Push(sub); diff --git a/src/gl/scene/gl_scene.cpp b/src/gl/scene/gl_scene.cpp index 70350b018..9b0719679 100644 --- a/src/gl/scene/gl_scene.cpp +++ b/src/gl/scene/gl_scene.cpp @@ -253,7 +253,7 @@ void GLSceneDrawer::CreateScene() SetView(); validcount++; // used for processing sidedefs only once by the renderer. - + gl_drawinfo->clipPortal = !!GLRenderer->mClipPortal; gl_drawinfo->mAngles = GLRenderer->mAngles; gl_drawinfo->mViewVector = GLRenderer->mViewVector; @@ -289,7 +289,7 @@ void GLSceneDrawer::CreateScene() // //----------------------------------------------------------------------------- -void GLSceneDrawer::RenderScene(int recursion) +void GLSceneDrawer::RenderScene(FDrawInfo *di, int recursion) { RenderAll.Clock(); @@ -303,11 +303,11 @@ void GLSceneDrawer::RenderScene(int recursion) if (gl_sort_textures) { - gl_drawinfo->drawlists[GLDL_PLAINWALLS].SortWalls(); - gl_drawinfo->drawlists[GLDL_PLAINFLATS].SortFlats(); - gl_drawinfo->drawlists[GLDL_MASKEDWALLS].SortWalls(); - gl_drawinfo->drawlists[GLDL_MASKEDFLATS].SortFlats(); - gl_drawinfo->drawlists[GLDL_MASKEDWALLSOFS].SortWalls(); + di->drawlists[GLDL_PLAINWALLS].SortWalls(); + di->drawlists[GLDL_PLAINFLATS].SortFlats(); + di->drawlists[GLDL_MASKEDWALLS].SortWalls(); + di->drawlists[GLDL_MASKEDFLATS].SortFlats(); + di->drawlists[GLDL_MASKEDWALLSOFS].SortWalls(); } // if we don't have a persistently mapped buffer, we have to process all the dynamic lights up front, @@ -315,10 +315,10 @@ void GLSceneDrawer::RenderScene(int recursion) if (gl.lightmethod == LM_DEFERRED && level.HasDynamicLights && FixedColormap == CM_DEFAULT) { GLRenderer->mLights->Begin(); - gl_drawinfo->drawlists[GLDL_PLAINFLATS].DrawFlats(gl_drawinfo, GLPASS_LIGHTSONLY); - gl_drawinfo->drawlists[GLDL_MASKEDFLATS].DrawFlats(gl_drawinfo, GLPASS_LIGHTSONLY); - gl_drawinfo->drawlists[GLDL_TRANSLUCENTBORDER].Draw(gl_drawinfo, GLPASS_LIGHTSONLY); - gl_drawinfo->drawlists[GLDL_TRANSLUCENT].Draw(gl_drawinfo, GLPASS_LIGHTSONLY, true); + di->drawlists[GLDL_PLAINFLATS].DrawFlats(di, GLPASS_LIGHTSONLY); + di->drawlists[GLDL_MASKEDFLATS].DrawFlats(di, GLPASS_LIGHTSONLY); + di->drawlists[GLDL_TRANSLUCENTBORDER].Draw(di, GLPASS_LIGHTSONLY); + di->drawlists[GLDL_TRANSLUCENT].Draw(di, GLPASS_LIGHTSONLY, true); GLRenderer->mLights->Finish(); } @@ -336,7 +336,7 @@ void GLSceneDrawer::RenderScene(int recursion) else // GL 2.x legacy mode { // process everything that needs to handle textured dynamic lights. - if (level.HasDynamicLights) RenderMultipassStuff(); + if (level.HasDynamicLights) RenderMultipassStuff(di); // The remaining lists which are unaffected by dynamic lights are just processed as normal. pass = GLPASS_ALL; @@ -344,8 +344,8 @@ void GLSceneDrawer::RenderScene(int recursion) gl_RenderState.EnableTexture(gl_texture); gl_RenderState.EnableBrightmap(true); - gl_drawinfo->drawlists[GLDL_PLAINWALLS].DrawWalls(gl_drawinfo, pass); - gl_drawinfo->drawlists[GLDL_PLAINFLATS].DrawFlats(gl_drawinfo, pass); + di->drawlists[GLDL_PLAINWALLS].DrawWalls(di, pass); + di->drawlists[GLDL_PLAINFLATS].DrawFlats(di, pass); // Part 2: masked geometry. This is set up so that only pixels with alpha>gl_mask_threshold will show @@ -355,20 +355,20 @@ void GLSceneDrawer::RenderScene(int recursion) gl_RenderState.SetTextureMode(TM_MASK); } gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_threshold); - gl_drawinfo->drawlists[GLDL_MASKEDWALLS].DrawWalls(gl_drawinfo, pass); - gl_drawinfo->drawlists[GLDL_MASKEDFLATS].DrawFlats(gl_drawinfo, pass); + di->drawlists[GLDL_MASKEDWALLS].DrawWalls(di, pass); + di->drawlists[GLDL_MASKEDFLATS].DrawFlats(di, pass); // Part 3: masked geometry with polygon offset. This list is empty most of the time so only waste time on it when in use. - if (gl_drawinfo->drawlists[GLDL_MASKEDWALLSOFS].Size() > 0) + if (di->drawlists[GLDL_MASKEDWALLSOFS].Size() > 0) { glEnable(GL_POLYGON_OFFSET_FILL); glPolygonOffset(-1.0f, -128.0f); - gl_drawinfo->drawlists[GLDL_MASKEDWALLSOFS].DrawWalls(gl_drawinfo, pass); + di->drawlists[GLDL_MASKEDWALLSOFS].DrawWalls(di, pass); glDisable(GL_POLYGON_OFFSET_FILL); glPolygonOffset(0, 0); } - gl_drawinfo->drawlists[GLDL_MODELS].Draw(gl_drawinfo, pass); + di->drawlists[GLDL_MODELS].Draw(di, pass); gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -377,7 +377,7 @@ void GLSceneDrawer::RenderScene(int recursion) glEnable(GL_POLYGON_OFFSET_FILL); glPolygonOffset(-1.0f, -128.0f); glDepthMask(false); - gl_drawinfo->DrawDecals(); + di->DrawDecals(); gl_RenderState.SetTextureMode(TM_MODULATE); @@ -395,7 +395,7 @@ void GLSceneDrawer::RenderScene(int recursion) gl_RenderState.EnableFog(true); gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f); gl_RenderState.BlendFunc(GL_ONE,GL_ZERO); - gl_drawinfo->DrawUnhandledMissingTextures(); + di->DrawUnhandledMissingTextures(); glDepthMask(true); glPolygonOffset(0.0f, 0.0f); @@ -478,7 +478,7 @@ void GLSceneDrawer::DrawScene(int drawmode) } GLRenderer->mClipPortal = NULL; // this must be reset before any portal recursion takes place. - RenderScene(recursion); + RenderScene(gl_drawinfo, recursion); if (applySSAO && gl_RenderState.GetPassType() == GBUFFER_PASS) { @@ -505,7 +505,7 @@ void GLSceneDrawer::DrawScene(int drawmode) //----------------------------------------------------------------------------- -void GLSceneDrawer::EndDrawScene(sector_t * viewsector) +void GLSceneDrawer::EndDrawScene(FDrawInfo *di, sector_t * viewsector) { gl_RenderState.EnableFog(false); @@ -515,7 +515,7 @@ void GLSceneDrawer::EndDrawScene(sector_t * viewsector) { // [BB] The HUD model should be drawn over everything else already drawn. glClear(GL_DEPTH_BUFFER_BIT); - gl_drawinfo->DrawPlayerSprites(true); + di->DrawPlayerSprites(true); } glDisable(GL_STENCIL_TEST); @@ -525,7 +525,7 @@ void GLSceneDrawer::EndDrawScene(sector_t * viewsector) // Delay drawing psprites until after bloom has been applied, if enabled. if (!FGLRenderBuffers::IsEnabled() || !gl_bloom || FixedColormap != CM_DEFAULT) { - DrawEndScene2D(viewsector); + DrawEndScene2D(di, viewsector); } else { @@ -537,7 +537,7 @@ void GLSceneDrawer::EndDrawScene(sector_t * viewsector) } } -void GLSceneDrawer::DrawEndScene2D(sector_t * viewsector) +void GLSceneDrawer::DrawEndScene2D(FDrawInfo *di, sector_t * viewsector) { const bool renderHUDModel = gl_IsHUDModelForPlayerAvailable(players[consoleplayer].camera->player); @@ -549,7 +549,7 @@ void GLSceneDrawer::DrawEndScene2D(sector_t * viewsector) glDisable(GL_MULTISAMPLE); - gl_drawinfo->DrawPlayerSprites(false); + di->DrawPlayerSprites(false); if (gl.legacyMode) { @@ -696,11 +696,11 @@ sector_t * GLSceneDrawer::RenderViewpoint (AActor * camera, IntRect * bounds, fl FDrawInfo::StartDrawInfo(this); ProcessScene(toscreen); - if (mainview && toscreen) EndDrawScene(lviewsector); // do not call this for camera textures. + if (mainview && toscreen) EndDrawScene(gl_drawinfo, lviewsector); // do not call this for camera textures. if (mainview && FGLRenderBuffers::IsEnabled()) { - GLRenderer->PostProcessScene(FixedColormap, [&]() { if (gl_bloom && FixedColormap == CM_DEFAULT) DrawEndScene2D(lviewsector); }); + GLRenderer->PostProcessScene(FixedColormap, [&]() { if (gl_bloom && FixedColormap == CM_DEFAULT) DrawEndScene2D(gl_drawinfo, lviewsector); }); // This should be done after postprocessing, not before. GLRenderer->mBuffers->BindCurrentFB(); diff --git a/src/gl/scene/gl_scenedrawer.h b/src/gl/scene/gl_scenedrawer.h index cc712c4ac..9f7f27708 100644 --- a/src/gl/scene/gl_scenedrawer.h +++ b/src/gl/scene/gl_scenedrawer.h @@ -20,7 +20,7 @@ class GLSceneDrawer TMap weapondynlightindex; - void RenderMultipassStuff(); + void RenderMultipassStuff(FDrawInfo *di); void UnclipSubsector(subsector_t *sub); void AddLine (seg_t *seg, bool portalclip); @@ -33,7 +33,7 @@ class GLSceneDrawer void DoSubsector(subsector_t * sub); void RenderBSPNode(void *node); - void RenderScene(int recursion); + void RenderScene(FDrawInfo *di, int recursion); void RenderTranslucent(); void CreateScene(); @@ -60,8 +60,8 @@ public: void SetFixedColormap(player_t *player); void DrawScene(int drawmode); void ProcessScene(bool toscreen = false); - void EndDrawScene(sector_t * viewsector); - void DrawEndScene2D(sector_t * viewsector); + void EndDrawScene(FDrawInfo *di, sector_t * viewsector); + void DrawEndScene2D(FDrawInfo *di, sector_t * viewsector); sector_t *RenderViewpoint(AActor * camera, IntRect * bounds, float fov, float ratio, float fovratio, bool mainview, bool toscreen); sector_t *RenderView(player_t *player); diff --git a/src/gl/scene/gl_sprite.cpp b/src/gl/scene/gl_sprite.cpp index 2713cf759..2bafaf72a 100644 --- a/src/gl/scene/gl_sprite.cpp +++ b/src/gl/scene/gl_sprite.cpp @@ -327,7 +327,7 @@ void FDrawInfo::AddSprite(GLSprite *sprite, bool translucent) list = GLDL_MODELS; } - auto newsprt = gl_drawinfo->drawlists[list].NewSprite(); + auto newsprt = drawlists[list].NewSprite(); *newsprt = *sprite; } diff --git a/src/gl/scene/gl_walls_draw.cpp b/src/gl/scene/gl_walls_draw.cpp index a49593550..b8a2155c0 100644 --- a/src/gl/scene/gl_walls_draw.cpp +++ b/src/gl/scene/gl_walls_draw.cpp @@ -142,7 +142,7 @@ void FDrawInfo::RenderMirrorSurface(GLWall *wall) glEnable(GL_POLYGON_OFFSET_FILL); glPolygonOffset(-1.0f, -128.0f); glDepthMask(false); - gl_drawinfo->DrawDecalsForMirror(wall); + DrawDecalsForMirror(wall); glDepthMask(true); glPolygonOffset(0.0f, 0.0f); glDisable(GL_POLYGON_OFFSET_FILL); @@ -293,7 +293,7 @@ void FDrawInfo::DrawWall(GLWall *wall, int pass) case GLPASS_LIGHTTEX: case GLPASS_LIGHTTEX_ADDITIVE: case GLPASS_LIGHTTEX_FOGGY: - gl_drawinfo->RenderLightsCompat(wall, pass); + RenderLightsCompat(wall, pass); break; case GLPASS_TEXONLY: