Renamed two functions

This commit is contained in:
Christoph Oelckers 2018-04-16 08:55:13 +02:00
parent 8a2e52d651
commit 3e6f69f64a
5 changed files with 14 additions and 22 deletions

View file

@ -53,13 +53,11 @@ struct FDynLightData
if (siz[1] > max) siz[1] = max; if (siz[1] > max) siz[1] = max;
if (siz[2] > max) siz[2] = 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 #endif

View file

@ -33,14 +33,7 @@
#include "actorinlines.h" #include "actorinlines.h"
#include "a_dynlight.h" #include "a_dynlight.h"
#include "gl/system/gl_interface.h" #include "gl_dynlight.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"
//========================================================================== //==========================================================================
@ -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_sprites, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
CVAR (Bool, gl_light_particles, 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 // 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); DVector3 pos = light->PosRelative(group);
float radius = (light->GetRadius()); float radius = (light->GetRadius());
@ -73,7 +67,7 @@ bool gl_GetLight(int group, Plane & p, ADynamicLight * light, bool checkside, FD
return false; return false;
} }
gl_AddLightToList(group, light, ldata); AddLightToList(group, light);
return true; 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 // 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; int i = 0;
@ -143,7 +137,7 @@ void gl_AddLightToList(int group, ADynamicLight * light, FDynLightData &ldata)
spotDirZ = -light->Angles.Yaw.Sin() * xzLen; 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[0] = pos.X;
data[1] = pos.Z; data[1] = pos.Z;
data[2] = pos.Y; data[2] = pos.Y;

View file

@ -130,7 +130,7 @@ void GLFlat::SetupSubsectorLights(int pass, subsector_t * sub, int *dli)
} }
iter_dlightf++; 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 // which we don't have for Legacy-style 3D-floors
double planeh = plane.plane.ZatPoint(light); double planeh = plane.plane.ZatPoint(light);
if ((planeh<light->Z() && ceiling) || (planeh>light->Z() && !ceiling)) if ((planeh<light->Z() && 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()); 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; node = node->nextLight;
} }

View file

@ -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 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); addedLights.push_back(light);
} }
} }

View file

@ -139,7 +139,7 @@ void GLWall::SetupLights()
} }
if (outcnt[0]!=4 && outcnt[1]!=4 && outcnt[2]!=4 && outcnt[3]!=4) 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);
} }
} }
} }