mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 06:53:58 +00:00
Rename ColorAdd to AddColor, and use it ingame
Rename ColorAdd to AddColor Add AddColor to FRenderState Tweak SpecialColors array in ZScript to include the additive color Add uAddColor to the shader compiler Add uAddColor to the texel
This commit is contained in:
parent
e5d43a734a
commit
758cd77e55
10 changed files with 25 additions and 4 deletions
|
@ -145,6 +145,7 @@ bool FGLRenderState::ApplyShader()
|
||||||
activeShader->muLightIndex.Set(-1);
|
activeShader->muLightIndex.Set(-1);
|
||||||
activeShader->muClipSplit.Set(mClipSplit);
|
activeShader->muClipSplit.Set(mClipSplit);
|
||||||
activeShader->muSpecularMaterial.Set(mGlossiness, mSpecularLevel);
|
activeShader->muSpecularMaterial.Set(mGlossiness, mSpecularLevel);
|
||||||
|
activeShader->muAddColor.Set(mAddColor); // Can this be done without a shader?
|
||||||
|
|
||||||
if (mGlowEnabled)
|
if (mGlowEnabled)
|
||||||
{
|
{
|
||||||
|
|
|
@ -241,6 +241,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
||||||
i_data += "uniform vec4 uObjectColor;\n";
|
i_data += "uniform vec4 uObjectColor;\n";
|
||||||
i_data += "uniform vec4 uObjectColor2;\n";
|
i_data += "uniform vec4 uObjectColor2;\n";
|
||||||
i_data += "uniform vec4 uDynLightColor;\n";
|
i_data += "uniform vec4 uDynLightColor;\n";
|
||||||
|
i_data += "uniform vec4 uAddColor;\n";
|
||||||
i_data += "uniform vec4 uFogColor;\n";
|
i_data += "uniform vec4 uFogColor;\n";
|
||||||
i_data += "uniform float uDesaturationFactor;\n";
|
i_data += "uniform float uDesaturationFactor;\n";
|
||||||
i_data += "uniform float uInterpolationFactor;\n";
|
i_data += "uniform float uInterpolationFactor;\n";
|
||||||
|
@ -534,6 +535,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
||||||
muInterpolationFactor.Init(hShader, "uInterpolationFactor");
|
muInterpolationFactor.Init(hShader, "uInterpolationFactor");
|
||||||
muAlphaThreshold.Init(hShader, "uAlphaThreshold");
|
muAlphaThreshold.Init(hShader, "uAlphaThreshold");
|
||||||
muSpecularMaterial.Init(hShader, "uSpecularMaterial");
|
muSpecularMaterial.Init(hShader, "uSpecularMaterial");
|
||||||
|
muAddColor.Init(hShader, "uAddColor");
|
||||||
muTimer.Init(hShader, "timer");
|
muTimer.Init(hShader, "timer");
|
||||||
|
|
||||||
lights_index = glGetUniformLocation(hShader, "lights");
|
lights_index = glGetUniformLocation(hShader, "lights");
|
||||||
|
|
|
@ -245,6 +245,7 @@ class FShader
|
||||||
FBufferedUniform4f muDynLightColor;
|
FBufferedUniform4f muDynLightColor;
|
||||||
FBufferedUniformPE muObjectColor;
|
FBufferedUniformPE muObjectColor;
|
||||||
FBufferedUniformPE muObjectColor2;
|
FBufferedUniformPE muObjectColor2;
|
||||||
|
FBufferedUniformPE muAddColor;
|
||||||
FUniform4f muGlowBottomColor;
|
FUniform4f muGlowBottomColor;
|
||||||
FUniform4f muGlowTopColor;
|
FUniform4f muGlowTopColor;
|
||||||
FUniform4f muGlowBottomPlane;
|
FUniform4f muGlowBottomPlane;
|
||||||
|
|
|
@ -300,6 +300,7 @@ public:
|
||||||
|
|
||||||
FColormap Colormap; // light and fog
|
FColormap Colormap; // light and fog
|
||||||
PalEntry FlatColor;
|
PalEntry FlatColor;
|
||||||
|
PalEntry AddColor;
|
||||||
ERenderStyle renderstyle;
|
ERenderStyle renderstyle;
|
||||||
|
|
||||||
float alpha;
|
float alpha;
|
||||||
|
|
|
@ -307,6 +307,7 @@ void GLFlat::DrawFlat(HWDrawInfo *di, FRenderState &state, bool translucent)
|
||||||
state.SetColor(lightlevel, rel, di->isFullbrightScene(), Colormap, alpha);
|
state.SetColor(lightlevel, rel, di->isFullbrightScene(), Colormap, alpha);
|
||||||
state.SetFog(lightlevel, rel, di->isFullbrightScene(), &Colormap, false);
|
state.SetFog(lightlevel, rel, di->isFullbrightScene(), &Colormap, false);
|
||||||
state.SetObjectColor(FlatColor | 0xff000000);
|
state.SetObjectColor(FlatColor | 0xff000000);
|
||||||
|
state.SetAddColor(AddColor | 0xff000000);
|
||||||
|
|
||||||
if (hacktype & SSRF_PLANEHACK)
|
if (hacktype & SSRF_PLANEHACK)
|
||||||
{
|
{
|
||||||
|
@ -357,6 +358,7 @@ void GLFlat::DrawFlat(HWDrawInfo *di, FRenderState &state, bool translucent)
|
||||||
state.SetRenderStyle(DefaultRenderStyle());
|
state.SetRenderStyle(DefaultRenderStyle());
|
||||||
state.SetObjectColor(0xffffffff);
|
state.SetObjectColor(0xffffffff);
|
||||||
}
|
}
|
||||||
|
state.SetAddColor(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -446,11 +448,13 @@ void GLFlat::SetFrom3DFloor(F3DFloor *rover, bool top, bool underside)
|
||||||
{
|
{
|
||||||
Colormap.LightColor = light->extra_colormap.FadeColor;
|
Colormap.LightColor = light->extra_colormap.FadeColor;
|
||||||
FlatColor = 0xffffffff;
|
FlatColor = 0xffffffff;
|
||||||
|
AddColor = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Colormap.CopyFrom3DLight(light);
|
Colormap.CopyFrom3DLight(light);
|
||||||
FlatColor = *plane.flatcolor;
|
FlatColor = *plane.flatcolor;
|
||||||
|
// AddColor = sector->SpecialColors[sector_t::add];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -505,6 +509,7 @@ void GLFlat::ProcessSector(HWDrawInfo *di, sector_t * frontsector, int which)
|
||||||
lightlevel = hw_ClampLight(frontsector->GetFloorLight());
|
lightlevel = hw_ClampLight(frontsector->GetFloorLight());
|
||||||
Colormap = frontsector->Colormap;
|
Colormap = frontsector->Colormap;
|
||||||
FlatColor = frontsector->SpecialColors[sector_t::floor];
|
FlatColor = frontsector->SpecialColors[sector_t::floor];
|
||||||
|
AddColor = frontsector->SpecialColors[sector_t::add];
|
||||||
port = frontsector->ValidatePortal(sector_t::floor);
|
port = frontsector->ValidatePortal(sector_t::floor);
|
||||||
if ((stack = (port != NULL)))
|
if ((stack = (port != NULL)))
|
||||||
{
|
{
|
||||||
|
@ -560,6 +565,7 @@ void GLFlat::ProcessSector(HWDrawInfo *di, sector_t * frontsector, int which)
|
||||||
lightlevel = hw_ClampLight(frontsector->GetCeilingLight());
|
lightlevel = hw_ClampLight(frontsector->GetCeilingLight());
|
||||||
Colormap = frontsector->Colormap;
|
Colormap = frontsector->Colormap;
|
||||||
FlatColor = frontsector->SpecialColors[sector_t::ceiling];
|
FlatColor = frontsector->SpecialColors[sector_t::ceiling];
|
||||||
|
AddColor = frontsector->SpecialColors[sector_t::add];
|
||||||
port = frontsector->ValidatePortal(sector_t::ceiling);
|
port = frontsector->ValidatePortal(sector_t::ceiling);
|
||||||
if ((stack = (port != NULL)))
|
if ((stack = (port != NULL)))
|
||||||
{
|
{
|
||||||
|
|
|
@ -144,11 +144,12 @@ protected:
|
||||||
float mInterpolationFactor;
|
float mInterpolationFactor;
|
||||||
|
|
||||||
FStateVec4 mNormal;
|
FStateVec4 mNormal;
|
||||||
FStateVec4 mColor, mColorAdd;
|
FStateVec4 mColor;
|
||||||
FStateVec4 mGlowTop, mGlowBottom;
|
FStateVec4 mGlowTop, mGlowBottom;
|
||||||
FStateVec4 mGlowTopPlane, mGlowBottomPlane;
|
FStateVec4 mGlowTopPlane, mGlowBottomPlane;
|
||||||
FStateVec4 mGradientTopPlane, mGradientBottomPlane;
|
FStateVec4 mGradientTopPlane, mGradientBottomPlane;
|
||||||
FStateVec4 mSplitTopPlane, mSplitBottomPlane;
|
FStateVec4 mSplitTopPlane, mSplitBottomPlane;
|
||||||
|
PalEntry mAddColor;
|
||||||
PalEntry mFogColor;
|
PalEntry mFogColor;
|
||||||
PalEntry mObjectColor;
|
PalEntry mObjectColor;
|
||||||
PalEntry mObjectColor2;
|
PalEntry mObjectColor2;
|
||||||
|
@ -181,6 +182,7 @@ public:
|
||||||
mModelMatrixEnabled = false;
|
mModelMatrixEnabled = false;
|
||||||
mTextureMatrixEnabled = false;
|
mTextureMatrixEnabled = false;
|
||||||
mSplitEnabled = false;
|
mSplitEnabled = false;
|
||||||
|
mAddColor = 0;
|
||||||
mObjectColor = 0xffffffff;
|
mObjectColor = 0xffffffff;
|
||||||
mObjectColor2 = 0;
|
mObjectColor2 = 0;
|
||||||
mSoftLight = 0;
|
mSoftLight = 0;
|
||||||
|
@ -369,6 +371,11 @@ public:
|
||||||
mObjectColor2 = pe;
|
mObjectColor2 = pe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetAddColor(PalEntry pe)
|
||||||
|
{
|
||||||
|
mAddColor = pe;
|
||||||
|
}
|
||||||
|
|
||||||
void SetFog(PalEntry c, float d)
|
void SetFog(PalEntry c, float d)
|
||||||
{
|
{
|
||||||
const float LOG2E = 1.442692f; // = 1/log(2)
|
const float LOG2E = 1.442692f; // = 1/log(2)
|
||||||
|
|
|
@ -203,6 +203,7 @@ void Draw2D(F2DDrawer *drawer, FRenderState &state)
|
||||||
}
|
}
|
||||||
state.SetObjectColor(0xffffffff);
|
state.SetObjectColor(0xffffffff);
|
||||||
state.SetObjectColor2(0);
|
state.SetObjectColor2(0);
|
||||||
|
state.SetAddColor(0);
|
||||||
state.EnableTextureMatrix(false);
|
state.EnableTextureMatrix(false);
|
||||||
state.SetEffect(EFF_NONE);
|
state.SetEffect(EFF_NONE);
|
||||||
|
|
||||||
|
|
|
@ -293,7 +293,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, sector_t &p, sector_t
|
||||||
("linked_floor", p.e->Linked.Floor.Sectors)
|
("linked_floor", p.e->Linked.Floor.Sectors)
|
||||||
("linked_ceiling", p.e->Linked.Ceiling.Sectors)
|
("linked_ceiling", p.e->Linked.Ceiling.Sectors)
|
||||||
("colormap", p.Colormap, def->Colormap)
|
("colormap", p.Colormap, def->Colormap)
|
||||||
.Array("specialcolors", p.SpecialColors, def->SpecialColors, 5, true)
|
.Array("specialcolors", p.SpecialColors, def->SpecialColors, 6, true)
|
||||||
("gravity", p.gravity, def->gravity)
|
("gravity", p.gravity, def->gravity)
|
||||||
.Terrain("floorterrain", p.terrainnum[0], &def->terrainnum[0])
|
.Terrain("floorterrain", p.terrainnum[0], &def->terrainnum[0])
|
||||||
.Terrain("ceilingterrain", p.terrainnum[1], &def->terrainnum[1])
|
.Terrain("ceilingterrain", p.terrainnum[1], &def->terrainnum[1])
|
||||||
|
|
|
@ -114,6 +114,8 @@ vec4 getTexel(vec2 st)
|
||||||
if (uObjectColor2.a == 0.0) texel *= uObjectColor;
|
if (uObjectColor2.a == 0.0) texel *= uObjectColor;
|
||||||
else texel *= mix(uObjectColor, uObjectColor2, gradientdist.z);
|
else texel *= mix(uObjectColor, uObjectColor2, gradientdist.z);
|
||||||
|
|
||||||
|
texel += uAddColor;
|
||||||
|
|
||||||
return desaturate(texel);
|
return desaturate(texel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -235,7 +235,7 @@ struct Sector native play
|
||||||
{
|
{
|
||||||
|
|
||||||
native readonly FColormap ColorMap;
|
native readonly FColormap ColorMap;
|
||||||
native readonly Color SpecialColors[5];
|
native readonly Color SpecialColors[6];
|
||||||
|
|
||||||
native Actor SoundTarget;
|
native Actor SoundTarget;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue