From e7856ce1e354da13f2b5ffd9795b0bfb1586e37e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 4 Sep 2016 12:35:26 +0200 Subject: [PATCH] - removed unused forceadditive parameter from gl_GetLight. - restricted gl_lights_additive to legacy code and removed menu entry for this. For modern hardware this setting is completely pointless, it offers no advantage and degrades visual quality. Its only reason for existence was that drawing additive lights with textures is a lot faster, and that's all it's being used for now. --- src/gl/compatibility/gl_20.cpp | 4 +++- src/gl/dynlights/a_dynlight.cpp | 1 - src/gl/dynlights/gl_dynlight.h | 2 +- src/gl/dynlights/gl_dynlight1.cpp | 9 ++------- src/gl/scene/gl_flats.cpp | 2 +- src/gl/scene/gl_walls_draw.cpp | 2 +- src/gl/system/gl_cvars.h | 1 - wadsrc/static/menudef.z | 1 - 8 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/gl/compatibility/gl_20.cpp b/src/gl/compatibility/gl_20.cpp index fdda99130..60dd9ecdb 100644 --- a/src/gl/compatibility/gl_20.cpp +++ b/src/gl/compatibility/gl_20.cpp @@ -57,6 +57,8 @@ #include "gl/data/gl_vertexbuffer.h" +CVAR(Bool, gl_lights_additive, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) + //========================================================================== // // Do some tinkering with the menus so that certain options only appear @@ -478,7 +480,7 @@ bool GLWall::PutWallCompat(int passflag) if (sub->lighthead == nullptr) return false; } - bool foggy = !gl_isBlack(Colormap.FadeColor) || (level.flags&LEVEL_HASFADETABLE) || gl_lights_additive; + bool foggy = gl_CheckFog(&Colormap, lightlevel) || (level.flags&LEVEL_HASFADETABLE) || gl_lights_additive; bool masked = passflag == 2 && gltexture->isMasked(); int list = list_indices[masked][foggy]; diff --git a/src/gl/dynlights/a_dynlight.cpp b/src/gl/dynlights/a_dynlight.cpp index ef96fdd3e..e90bbdc80 100644 --- a/src/gl/dynlights/a_dynlight.cpp +++ b/src/gl/dynlights/a_dynlight.cpp @@ -58,7 +58,6 @@ #include "gl/utility/gl_templates.h" EXTERN_CVAR (Float, gl_lights_size); -EXTERN_CVAR (Bool, gl_lights_additive); EXTERN_CVAR(Int, vid_renderer) diff --git a/src/gl/dynlights/gl_dynlight.h b/src/gl/dynlights/gl_dynlight.h index 513245be5..6b6e40c2d 100644 --- a/src/gl/dynlights/gl_dynlight.h +++ b/src/gl/dynlights/gl_dynlight.h @@ -184,7 +184,7 @@ struct FDynLightData -bool gl_GetLight(int group, Plane & p, ADynamicLight * light, bool checkside, bool forceadditive, FDynLightData &data); +bool gl_GetLight(int group, Plane & p, ADynamicLight * light, bool checkside, FDynLightData &data); void gl_UploadLights(FDynLightData &data); diff --git a/src/gl/dynlights/gl_dynlight1.cpp b/src/gl/dynlights/gl_dynlight1.cpp index 361b94618..eb3c45f9c 100644 --- a/src/gl/dynlights/gl_dynlight1.cpp +++ b/src/gl/dynlights/gl_dynlight1.cpp @@ -74,18 +74,13 @@ CVAR (Float, gl_lights_intensity, 1.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG); CVAR (Float, gl_lights_size, 1.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG); CVAR (Bool, gl_light_sprites, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG); CVAR (Bool, gl_light_particles, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG); -CUSTOM_CVAR (Bool, gl_lights_additive, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) -{ - gl_DeleteAllAttachedLights(); - gl_RecreateAllAttachedLights(); -} //========================================================================== // // Sets up the parameters to render one dynamic light onto one plane // //========================================================================== -bool gl_GetLight(int group, Plane & p, ADynamicLight * light, bool checkside, bool forceadditive, FDynLightData &ldata) +bool gl_GetLight(int group, Plane & p, ADynamicLight * light, bool checkside, FDynLightData &ldata) { int i = 0; @@ -103,7 +98,7 @@ bool gl_GetLight(int group, Plane & p, ADynamicLight * light, bool checkside, bo float cs; - if (gl_lights_additive || light->flags4&MF4_ADDITIVE || forceadditive) + if (light->IsAdditive()) { cs = 0.2f; i = 2; diff --git a/src/gl/scene/gl_flats.cpp b/src/gl/scene/gl_flats.cpp index 1a3fe994b..9e9a73e5d 100644 --- a/src/gl/scene/gl_flats.cpp +++ b/src/gl/scene/gl_flats.cpp @@ -154,7 +154,7 @@ void GLFlat::SetupSubsectorLights(int pass, subsector_t * sub, int *dli) } p.Set(plane.plane); - gl_GetLight(sub->sector->PortalGroup, p, light, false, false, lightdata); + gl_GetLight(sub->sector->PortalGroup, p, light, false, lightdata); node = node->nextLight; } diff --git a/src/gl/scene/gl_walls_draw.cpp b/src/gl/scene/gl_walls_draw.cpp index 40145abc4..9599b8fa3 100644 --- a/src/gl/scene/gl_walls_draw.cpp +++ b/src/gl/scene/gl_walls_draw.cpp @@ -158,7 +158,7 @@ void GLWall::SetupLights() } if (outcnt[0]!=4 && outcnt[1]!=4 && outcnt[2]!=4 && outcnt[3]!=4) { - gl_GetLight(seg->frontsector->PortalGroup, p, node->lightsource, true, false, lightdata); + gl_GetLight(seg->frontsector->PortalGroup, p, node->lightsource, true, lightdata); } } } diff --git a/src/gl/system/gl_cvars.h b/src/gl/system/gl_cvars.h index 0c31f53a8..da1febe3c 100644 --- a/src/gl/system/gl_cvars.h +++ b/src/gl/system/gl_cvars.h @@ -26,7 +26,6 @@ EXTERN_CVAR (Bool, gl_attachedlights); EXTERN_CVAR (Bool, gl_lights_checkside); EXTERN_CVAR (Float, gl_lights_intensity); EXTERN_CVAR (Float, gl_lights_size); -EXTERN_CVAR (Bool, gl_lights_additive); EXTERN_CVAR (Bool, gl_light_sprites); EXTERN_CVAR (Bool, gl_light_particles); diff --git a/wadsrc/static/menudef.z b/wadsrc/static/menudef.z index 86e2d5dc0..abc7cfacc 100644 --- a/wadsrc/static/menudef.z +++ b/wadsrc/static/menudef.z @@ -198,7 +198,6 @@ OptionMenu "GLLightOptions" Option "$GLLIGHTMNU_CLIPLIGHTS", gl_lights_checkside, "YesNo" Option "$GLLIGHTMNU_LIGHTSPRITES", gl_light_sprites, "YesNo" Option "$GLLIGHTMNU_LIGHTPARTICLES", gl_light_particles, "YesNo" - Option "$GLLIGHTMNU_FORCEADDITIVE", gl_lights_additive, "YesNo" Slider "$GLLIGHTMNU_LIGHTINTENSITY", gl_lights_intensity, 0.0, 1.0, 0.1 Slider "$GLLIGHTMNU_LIGHTSIZE", gl_lights_size, 0.0, 2.0, 0.1 }