mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-13 16:07:45 +00:00
- ensure that the radius of a dynamic light remains positive to avoid problems with the assumption that a light has an actual size.
- extended the maximum settable light size in GLDEFS to 1024 throughout. - fixed: A fullbright flat should not be subjected to a sector's material color.
This commit is contained in:
parent
a2a1d214c0
commit
1884c8a98d
3 changed files with 15 additions and 11 deletions
|
@ -209,7 +209,7 @@ void ADynamicLight::Activate(AActor *activator)
|
||||||
m_cycler.SetCycleType(CYCLE_Sin);
|
m_cycler.SetCycleType(CYCLE_Sin);
|
||||||
m_currentRadius = m_cycler.GetVal();
|
m_currentRadius = m_cycler.GetVal();
|
||||||
}
|
}
|
||||||
assert(m_currentRadius > 0);
|
if (m_currentRadius <= 0) m_currentRadius = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -334,6 +334,7 @@ void ADynamicLight::Tick()
|
||||||
m_currentRadius = float(args[LIGHT_INTENSITY]);
|
m_currentRadius = float(args[LIGHT_INTENSITY]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (m_currentRadius <= 0) m_currentRadius = 1;
|
||||||
UpdateLocation();
|
UpdateLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -194,6 +194,7 @@ void FLightDefaults::ApplyProperties(ADynamicLight * light) const
|
||||||
light->m_cycler.ShouldCycle(true);
|
light->m_cycler.ShouldCycle(true);
|
||||||
light->m_cycler.SetCycleType(CYCLE_Sin);
|
light->m_cycler.SetCycleType(CYCLE_Sin);
|
||||||
light->m_currentRadius = light->m_cycler.GetVal();
|
light->m_currentRadius = light->m_cycler.GetVal();
|
||||||
|
if (light->m_currentRadius <= 0) light->m_currentRadius = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (m_attenuate)
|
switch (m_attenuate)
|
||||||
|
@ -369,7 +370,7 @@ void gl_ParsePointLight(FScanner &sc)
|
||||||
defaults->SetOffset(floatTriple);
|
defaults->SetOffset(floatTriple);
|
||||||
break;
|
break;
|
||||||
case LIGHTTAG_SIZE:
|
case LIGHTTAG_SIZE:
|
||||||
intVal = clamp<int>(gl_ParseInt(sc), 0, 255);
|
intVal = clamp<int>(gl_ParseInt(sc), 1, 1024);
|
||||||
defaults->SetArg(LIGHT_INTENSITY, intVal);
|
defaults->SetArg(LIGHT_INTENSITY, intVal);
|
||||||
break;
|
break;
|
||||||
case LIGHTTAG_SUBTRACTIVE:
|
case LIGHTTAG_SUBTRACTIVE:
|
||||||
|
@ -446,11 +447,11 @@ void gl_ParsePulseLight(FScanner &sc)
|
||||||
defaults->SetOffset(floatTriple);
|
defaults->SetOffset(floatTriple);
|
||||||
break;
|
break;
|
||||||
case LIGHTTAG_SIZE:
|
case LIGHTTAG_SIZE:
|
||||||
intVal = clamp<int>(gl_ParseInt(sc), 0, 1024);
|
intVal = clamp<int>(gl_ParseInt(sc), 1, 1024);
|
||||||
defaults->SetArg(LIGHT_INTENSITY, intVal);
|
defaults->SetArg(LIGHT_INTENSITY, intVal);
|
||||||
break;
|
break;
|
||||||
case LIGHTTAG_SECSIZE:
|
case LIGHTTAG_SECSIZE:
|
||||||
intVal = clamp<int>(gl_ParseInt(sc), 0, 1024);
|
intVal = clamp<int>(gl_ParseInt(sc), 1, 1024);
|
||||||
defaults->SetArg(LIGHT_SECONDARY_INTENSITY, intVal);
|
defaults->SetArg(LIGHT_SECONDARY_INTENSITY, intVal);
|
||||||
break;
|
break;
|
||||||
case LIGHTTAG_INTERVAL:
|
case LIGHTTAG_INTERVAL:
|
||||||
|
@ -536,11 +537,11 @@ void gl_ParseFlickerLight(FScanner &sc)
|
||||||
defaults->SetOffset(floatTriple);
|
defaults->SetOffset(floatTriple);
|
||||||
break;
|
break;
|
||||||
case LIGHTTAG_SIZE:
|
case LIGHTTAG_SIZE:
|
||||||
intVal = clamp<int>(gl_ParseInt(sc), 0, 255);
|
intVal = clamp<int>(gl_ParseInt(sc), 1, 1024);
|
||||||
defaults->SetArg(LIGHT_INTENSITY, intVal);
|
defaults->SetArg(LIGHT_INTENSITY, intVal);
|
||||||
break;
|
break;
|
||||||
case LIGHTTAG_SECSIZE:
|
case LIGHTTAG_SECSIZE:
|
||||||
intVal = clamp<int>(gl_ParseInt(sc), 0, 255);
|
intVal = clamp<int>(gl_ParseInt(sc), 1, 1024);
|
||||||
defaults->SetArg(LIGHT_SECONDARY_INTENSITY, intVal);
|
defaults->SetArg(LIGHT_SECONDARY_INTENSITY, intVal);
|
||||||
break;
|
break;
|
||||||
case LIGHTTAG_CHANCE:
|
case LIGHTTAG_CHANCE:
|
||||||
|
@ -618,11 +619,11 @@ void gl_ParseFlickerLight2(FScanner &sc)
|
||||||
defaults->SetOffset(floatTriple);
|
defaults->SetOffset(floatTriple);
|
||||||
break;
|
break;
|
||||||
case LIGHTTAG_SIZE:
|
case LIGHTTAG_SIZE:
|
||||||
intVal = clamp<int>(gl_ParseInt(sc), 0, 255);
|
intVal = clamp<int>(gl_ParseInt(sc), 1, 1024);
|
||||||
defaults->SetArg(LIGHT_INTENSITY, intVal);
|
defaults->SetArg(LIGHT_INTENSITY, intVal);
|
||||||
break;
|
break;
|
||||||
case LIGHTTAG_SECSIZE:
|
case LIGHTTAG_SECSIZE:
|
||||||
intVal = clamp<int>(gl_ParseInt(sc), 0, 255);
|
intVal = clamp<int>(gl_ParseInt(sc), 1, 1024);
|
||||||
defaults->SetArg(LIGHT_SECONDARY_INTENSITY, intVal);
|
defaults->SetArg(LIGHT_SECONDARY_INTENSITY, intVal);
|
||||||
break;
|
break;
|
||||||
case LIGHTTAG_INTERVAL:
|
case LIGHTTAG_INTERVAL:
|
||||||
|
@ -707,7 +708,7 @@ void gl_ParseSectorLight(FScanner &sc)
|
||||||
break;
|
break;
|
||||||
case LIGHTTAG_SCALE:
|
case LIGHTTAG_SCALE:
|
||||||
floatVal = gl_ParseFloat(sc);
|
floatVal = gl_ParseFloat(sc);
|
||||||
defaults->SetArg(LIGHT_SCALE, (BYTE)(floatVal * 255));
|
defaults->SetArg(LIGHT_SCALE, clamp((int)(floatVal * 255), 1, 1024));
|
||||||
break;
|
break;
|
||||||
case LIGHTTAG_SUBTRACTIVE:
|
case LIGHTTAG_SUBTRACTIVE:
|
||||||
defaults->SetSubtractive(gl_ParseInt(sc) != 0);
|
defaults->SetSubtractive(gl_ParseInt(sc) != 0);
|
||||||
|
|
|
@ -379,7 +379,8 @@ void GLFlat::Draw(int pass, bool trans) // trans only has meaning for GLPASS_LIG
|
||||||
case GLPASS_ALL: // Same, but also creates the dynlight data.
|
case GLPASS_ALL: // Same, but also creates the dynlight data.
|
||||||
gl_SetColor(lightlevel, rel, Colormap,1.0f);
|
gl_SetColor(lightlevel, rel, Colormap,1.0f);
|
||||||
gl_SetFog(lightlevel, rel, &Colormap, false);
|
gl_SetFog(lightlevel, rel, &Colormap, false);
|
||||||
gl_RenderState.SetObjectColor(FlatColor | 0xff000000);
|
if (!gltexture->tex->isFullbright())
|
||||||
|
gl_RenderState.SetObjectColor(FlatColor | 0xff000000);
|
||||||
if (sector->special != GLSector_Skybox)
|
if (sector->special != GLSector_Skybox)
|
||||||
{
|
{
|
||||||
gl_RenderState.SetMaterial(gltexture, CLAMP_NONE, 0, -1, false);
|
gl_RenderState.SetMaterial(gltexture, CLAMP_NONE, 0, -1, false);
|
||||||
|
@ -406,7 +407,8 @@ void GLFlat::Draw(int pass, bool trans) // trans only has meaning for GLPASS_LIG
|
||||||
if (renderstyle==STYLE_Add) gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE);
|
if (renderstyle==STYLE_Add) gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||||
gl_SetColor(lightlevel, rel, Colormap, alpha);
|
gl_SetColor(lightlevel, rel, Colormap, alpha);
|
||||||
gl_SetFog(lightlevel, rel, &Colormap, false);
|
gl_SetFog(lightlevel, rel, &Colormap, false);
|
||||||
gl_RenderState.SetObjectColor(FlatColor | 0xff000000);
|
if (!gltexture || !gltexture->tex->isFullbright())
|
||||||
|
gl_RenderState.SetObjectColor(FlatColor | 0xff000000);
|
||||||
if (!gltexture)
|
if (!gltexture)
|
||||||
{
|
{
|
||||||
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
|
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
|
||||||
|
|
Loading…
Reference in a new issue