From 3e6f69f64aad9b96aca3d20f67f82bdacb1f1214 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 16 Apr 2018 08:55:13 +0200 Subject: [PATCH] Renamed two functions --- src/gl/dynlights/gl_dynlight.h | 10 ++++------ src/gl/dynlights/gl_dynlight1.cpp | 18 ++++++------------ src/gl/scene/gl_flats.cpp | 4 ++-- src/gl/scene/gl_spritelight.cpp | 2 +- src/gl/scene/gl_walls_draw.cpp | 2 +- 5 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/gl/dynlights/gl_dynlight.h b/src/gl/dynlights/gl_dynlight.h index 99979f034..cfa47bc69 100644 --- a/src/gl/dynlights/gl_dynlight.h +++ b/src/gl/dynlights/gl_dynlight.h @@ -53,13 +53,11 @@ struct FDynLightData if (siz[1] > max) siz[1] = max; if (siz[2] > max) siz[2] = max; } + + bool GetLight(int group, Plane & p, ADynamicLight * light, bool checkside); + void AddLightToList(int group, ADynamicLight * light); + }; - -bool gl_GetLight(int group, Plane & p, ADynamicLight * light, bool checkside, FDynLightData &data); -void gl_AddLightToList(int group, ADynamicLight * light, FDynLightData &ldata); -void gl_UploadLights(FDynLightData &data); - - #endif diff --git a/src/gl/dynlights/gl_dynlight1.cpp b/src/gl/dynlights/gl_dynlight1.cpp index 554719009..dfef66e46 100644 --- a/src/gl/dynlights/gl_dynlight1.cpp +++ b/src/gl/dynlights/gl_dynlight1.cpp @@ -33,14 +33,7 @@ #include "actorinlines.h" #include "a_dynlight.h" -#include "gl/system/gl_interface.h" -#include "gl/renderer/gl_renderer.h" -#include "gl/renderer/gl_lightdata.h" -#include "gl/dynlights/gl_dynlight.h" -#include "gl/scene/gl_drawinfo.h" -#include "gl/scene/gl_portal.h" -#include "gl/shaders/gl_shader.h" -#include "gl/textures/gl_material.h" +#include "gl_dynlight.h" //========================================================================== @@ -49,6 +42,7 @@ // //========================================================================== +// These shouldn't be called 'gl...' anymore... CVAR (Bool, gl_light_sprites, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG); CVAR (Bool, gl_light_particles, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG); @@ -59,7 +53,7 @@ CVAR(Int, gl_attenuate, -1, 0); // This is mainly a debug option. // Sets up the parameters to render one dynamic light onto one plane // //========================================================================== -bool gl_GetLight(int group, Plane & p, ADynamicLight * light, bool checkside, FDynLightData &ldata) +bool FDynLightData::GetLight(int group, Plane & p, ADynamicLight * light, bool checkside) { DVector3 pos = light->PosRelative(group); float radius = (light->GetRadius()); @@ -73,7 +67,7 @@ bool gl_GetLight(int group, Plane & p, ADynamicLight * light, bool checkside, FD return false; } - gl_AddLightToList(group, light, ldata); + AddLightToList(group, light); return true; } @@ -82,7 +76,7 @@ bool gl_GetLight(int group, Plane & p, ADynamicLight * light, bool checkside, FD // Add one dynamic light to the light data list // //========================================================================== -void gl_AddLightToList(int group, ADynamicLight * light, FDynLightData &ldata) +void FDynLightData::AddLightToList(int group, ADynamicLight * light) { int i = 0; @@ -143,7 +137,7 @@ void gl_AddLightToList(int group, ADynamicLight * light, FDynLightData &ldata) spotDirZ = -light->Angles.Yaw.Sin() * xzLen; } - float *data = &ldata.arrays[i][ldata.arrays[i].Reserve(16)]; + float *data = &arrays[i][arrays[i].Reserve(16)]; data[0] = pos.X; data[1] = pos.Z; data[2] = pos.Y; diff --git a/src/gl/scene/gl_flats.cpp b/src/gl/scene/gl_flats.cpp index eee7f951c..fec7e8127 100644 --- a/src/gl/scene/gl_flats.cpp +++ b/src/gl/scene/gl_flats.cpp @@ -130,7 +130,7 @@ void GLFlat::SetupSubsectorLights(int pass, subsector_t * sub, int *dli) } iter_dlightf++; - // we must do the side check here because gl_SetupLight needs the correct plane orientation + // we must do the side check here because gl_GetLight needs the correct plane orientation // which we don't have for Legacy-style 3D-floors double planeh = plane.plane.ZatPoint(light); if ((planehZ() && ceiling) || (planeh>light->Z() && !ceiling)) @@ -140,7 +140,7 @@ void GLFlat::SetupSubsectorLights(int pass, subsector_t * sub, int *dli) } p.Set(plane.plane.Normal(), plane.plane.fD()); - gl_GetLight(sub->sector->PortalGroup, p, light, false, lightdata); + lightdata.GetLight(sub->sector->PortalGroup, p, light, false); node = node->nextLight; } diff --git a/src/gl/scene/gl_spritelight.cpp b/src/gl/scene/gl_spritelight.cpp index d25339b94..45d8dc8dd 100644 --- a/src/gl/scene/gl_spritelight.cpp +++ b/src/gl/scene/gl_spritelight.cpp @@ -243,7 +243,7 @@ int gl_SetDynModelLight(AActor *self, int dynlightindex) { if (std::find(addedLights.begin(), addedLights.end(), light) == addedLights.end()) // Check if we already added this light from a different subsector { - gl_AddLightToList(group, light, modellightdata); + modellightdata.AddLightToList(group, light); addedLights.push_back(light); } } diff --git a/src/gl/scene/gl_walls_draw.cpp b/src/gl/scene/gl_walls_draw.cpp index a71053217..295a843a4 100644 --- a/src/gl/scene/gl_walls_draw.cpp +++ b/src/gl/scene/gl_walls_draw.cpp @@ -139,7 +139,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, lightdata); + lightdata.GetLight(seg->frontsector->PortalGroup, p, node->lightsource, true); } } }