- moved dynamic lights out of the GL code into the common game code.

Since the true color software renderer also handles them there is no point keeping them on the GL side.
This also optimized how they are stored, because we no longer need to be aware of a base engine which doesn't have them.
This commit is contained in:
Christoph Oelckers 2017-03-12 16:56:00 +01:00
parent 6788b19e89
commit ef3421eee5
30 changed files with 330 additions and 429 deletions

View file

@ -32,6 +32,7 @@
#include "gl/gl_functions.h"
#include "g_level.h"
#include "actorinlines.h"
#include "a_dynlight.h"
#include "gl/system/gl_interface.h"
#include "gl/renderer/gl_renderer.h"
@ -50,18 +51,13 @@
//
//==========================================================================
CUSTOM_CVAR (Bool, gl_lights, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{
if (self) gl_RecreateAllAttachedLights();
else gl_DeleteAllAttachedLights();
}
CVAR (Bool, gl_attachedlights, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
CVAR (Bool, gl_lights_checkside, 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_shadowmap, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
CVAR(Int, gl_attenuate, -1, 0); // This is mainly a debug option.
//==========================================================================
//
// Sets up the parameters to render one dynamic light onto one plane
@ -112,7 +108,11 @@ bool gl_GetLight(int group, Plane & p, ADynamicLight * light, bool checkside, FD
// Store attenuate flag in the sign bit of the float.
float shadowIndex = GLRenderer->mShadowMap.ShadowMapIndex(light) + 1.0f;
if (!!(light->flags4 & MF4_ATTENUATE))
bool attenuate;
if (gl_attenuate == -1) attenuate = !!(light->flags4 & MF4_ATTENUATE);
else attenuate = !!gl_attenuate;
shadowIndex = -shadowIndex;
float *data = &ldata.arrays[i][ldata.arrays[i].Reserve(8)];