- use the attenuated light definitions from QZDoom.

- apply them also to Freedoom.
- to compensate for the increase in light size required for attenuated lights to look correct, when running in legacy mode, they to be reduced in size to 2/3 of their defined size because the textured lighting method does not support real attenuation.
- removed the ancient size limit of 255 for light sizes which comes from a time when args were bytes.
This commit is contained in:
Christoph Oelckers 2017-01-02 11:41:27 +01:00
parent d85496db5f
commit 9f4abcec89
5 changed files with 875 additions and 531 deletions

View file

@ -78,6 +78,7 @@
#include "gl/dynlights/gl_dynlight.h"
#include "gl/utility/gl_convert.h"
#include "gl/utility/gl_templates.h"
#include "gl/system//gl_interface.h"
EXTERN_CVAR(Int, vid_renderer)
@ -127,6 +128,10 @@ void AVavoomLightWhite::BeginPlay ()
args[LIGHT_GREEN] = 128;
args[LIGHT_BLUE] = 128;
if (gl.legacyMode && (flags4 & MF4_ATTENUATE))
{
m_Radius[0] = m_Radius[0] * 2 / 3;
}
Super::BeginPlay();
}
@ -140,6 +145,11 @@ void AVavoomLightColor::BeginPlay ()
args[LIGHT_GREEN] = l_args[2] >> 1;
args[LIGHT_BLUE] = l_args[3] >> 1;
if (gl.legacyMode && (flags4 & MF4_ATTENUATE))
{
m_Radius[0] = m_Radius[0] * 2 / 3;
}
Super::BeginPlay();
}
@ -195,6 +205,12 @@ void ADynamicLight::BeginPlay()
m_Radius[1] = args[LIGHT_SECONDARY_INTENSITY];
specialf1 = DAngle(double(SpawnAngle)).Normalized360().Degrees;
visibletoplayer = true;
if (gl.legacyMode && (flags4 & MF4_ATTENUATE))
{
m_Radius[0] = m_Radius[0] * 2 / 3;
m_Radius[1] = m_Radius[1] * 2 / 3;
}
}
//==========================================================================

View file

@ -56,6 +56,7 @@
#include "gl/utility/gl_clock.h"
#include "gl/utility/gl_convert.h"
#include "gl/data/gl_data.h"
#include "gl/system//gl_interface.h"
int ScriptDepth;
void gl_InitGlow(FScanner &sc);
@ -126,6 +127,7 @@ public:
void SetParameter(double p) { m_Param = p; }
void SetArg(int arg, BYTE val) { m_Args[arg] = val; }
BYTE GetArg(int arg) { return m_Args[arg]; }
uint8_t GetAttenuate() const { return m_attenuate; }
void SetOffset(float* ft) { m_Pos.X = ft[0]; m_Pos.Z = ft[1]; m_Pos.Y = ft[2]; }
void SetSubtractive(bool subtract) { m_subtractive = subtract; }
void SetAdditive(bool add) { m_additive = add; }
@ -342,6 +344,12 @@ void gl_AddLightDefaults(FLightDefaults *defaults)
}
}
if (gl.legacyMode && (defaults->GetAttenuate()))
{
defaults->SetArg(LIGHT_INTENSITY, defaults->GetArg(LIGHT_INTENSITY) * 2 / 3);
defaults->SetArg(LIGHT_SECONDARY_INTENSITY, defaults->GetArg(LIGHT_SECONDARY_INTENSITY) * 2 / 3);
}
LightDefaults.Push(defaults);
}
@ -469,11 +477,11 @@ void gl_ParsePulseLight(FScanner &sc)
defaults->SetOffset(floatTriple);
break;
case LIGHTTAG_SIZE:
intVal = clamp<int>(gl_ParseInt(sc), 0, 255);
intVal = clamp<int>(gl_ParseInt(sc), 0, 1024);
defaults->SetArg(LIGHT_INTENSITY, intVal);
break;
case LIGHTTAG_SECSIZE:
intVal = clamp<int>(gl_ParseInt(sc), 0, 255);
intVal = clamp<int>(gl_ParseInt(sc), 0, 1024);
defaults->SetArg(LIGHT_SECONDARY_INTENSITY, intVal);
break;
case LIGHTTAG_INTERVAL:

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff