mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +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->muClipSplit.Set(mClipSplit);
|
||||
activeShader->muSpecularMaterial.Set(mGlossiness, mSpecularLevel);
|
||||
activeShader->muAddColor.Set(mAddColor); // Can this be done without a shader?
|
||||
|
||||
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 uObjectColor2;\n";
|
||||
i_data += "uniform vec4 uDynLightColor;\n";
|
||||
i_data += "uniform vec4 uAddColor;\n";
|
||||
i_data += "uniform vec4 uFogColor;\n";
|
||||
i_data += "uniform float uDesaturationFactor;\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");
|
||||
muAlphaThreshold.Init(hShader, "uAlphaThreshold");
|
||||
muSpecularMaterial.Init(hShader, "uSpecularMaterial");
|
||||
muAddColor.Init(hShader, "uAddColor");
|
||||
muTimer.Init(hShader, "timer");
|
||||
|
||||
lights_index = glGetUniformLocation(hShader, "lights");
|
||||
|
|
|
@ -245,6 +245,7 @@ class FShader
|
|||
FBufferedUniform4f muDynLightColor;
|
||||
FBufferedUniformPE muObjectColor;
|
||||
FBufferedUniformPE muObjectColor2;
|
||||
FBufferedUniformPE muAddColor;
|
||||
FUniform4f muGlowBottomColor;
|
||||
FUniform4f muGlowTopColor;
|
||||
FUniform4f muGlowBottomPlane;
|
||||
|
|
|
@ -300,6 +300,7 @@ public:
|
|||
|
||||
FColormap Colormap; // light and fog
|
||||
PalEntry FlatColor;
|
||||
PalEntry AddColor;
|
||||
ERenderStyle renderstyle;
|
||||
|
||||
float alpha;
|
||||
|
|
|
@ -307,6 +307,7 @@ void GLFlat::DrawFlat(HWDrawInfo *di, FRenderState &state, bool translucent)
|
|||
state.SetColor(lightlevel, rel, di->isFullbrightScene(), Colormap, alpha);
|
||||
state.SetFog(lightlevel, rel, di->isFullbrightScene(), &Colormap, false);
|
||||
state.SetObjectColor(FlatColor | 0xff000000);
|
||||
state.SetAddColor(AddColor | 0xff000000);
|
||||
|
||||
if (hacktype & SSRF_PLANEHACK)
|
||||
{
|
||||
|
@ -357,6 +358,7 @@ void GLFlat::DrawFlat(HWDrawInfo *di, FRenderState &state, bool translucent)
|
|||
state.SetRenderStyle(DefaultRenderStyle());
|
||||
state.SetObjectColor(0xffffffff);
|
||||
}
|
||||
state.SetAddColor(0);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -441,16 +443,18 @@ void GLFlat::SetFrom3DFloor(F3DFloor *rover, bool top, bool underside)
|
|||
// FF_FOG requires an inverted logic where to get the light from
|
||||
lightlist_t *light = P_GetPlaneLight(sector, plane.plane, underside);
|
||||
lightlevel = hw_ClampLight(*light->p_lightlevel);
|
||||
|
||||
|
||||
if (rover->flags & FF_FOG)
|
||||
{
|
||||
Colormap.LightColor = light->extra_colormap.FadeColor;
|
||||
FlatColor = 0xffffffff;
|
||||
AddColor = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Colormap.CopyFrom3DLight(light);
|
||||
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());
|
||||
Colormap = frontsector->Colormap;
|
||||
FlatColor = frontsector->SpecialColors[sector_t::floor];
|
||||
AddColor = frontsector->SpecialColors[sector_t::add];
|
||||
port = frontsector->ValidatePortal(sector_t::floor);
|
||||
if ((stack = (port != NULL)))
|
||||
{
|
||||
|
@ -560,6 +565,7 @@ void GLFlat::ProcessSector(HWDrawInfo *di, sector_t * frontsector, int which)
|
|||
lightlevel = hw_ClampLight(frontsector->GetCeilingLight());
|
||||
Colormap = frontsector->Colormap;
|
||||
FlatColor = frontsector->SpecialColors[sector_t::ceiling];
|
||||
AddColor = frontsector->SpecialColors[sector_t::add];
|
||||
port = frontsector->ValidatePortal(sector_t::ceiling);
|
||||
if ((stack = (port != NULL)))
|
||||
{
|
||||
|
|
|
@ -144,11 +144,12 @@ protected:
|
|||
float mInterpolationFactor;
|
||||
|
||||
FStateVec4 mNormal;
|
||||
FStateVec4 mColor, mColorAdd;
|
||||
FStateVec4 mColor;
|
||||
FStateVec4 mGlowTop, mGlowBottom;
|
||||
FStateVec4 mGlowTopPlane, mGlowBottomPlane;
|
||||
FStateVec4 mGradientTopPlane, mGradientBottomPlane;
|
||||
FStateVec4 mSplitTopPlane, mSplitBottomPlane;
|
||||
PalEntry mAddColor;
|
||||
PalEntry mFogColor;
|
||||
PalEntry mObjectColor;
|
||||
PalEntry mObjectColor2;
|
||||
|
@ -181,6 +182,7 @@ public:
|
|||
mModelMatrixEnabled = false;
|
||||
mTextureMatrixEnabled = false;
|
||||
mSplitEnabled = false;
|
||||
mAddColor = 0;
|
||||
mObjectColor = 0xffffffff;
|
||||
mObjectColor2 = 0;
|
||||
mSoftLight = 0;
|
||||
|
@ -369,6 +371,11 @@ public:
|
|||
mObjectColor2 = pe;
|
||||
}
|
||||
|
||||
void SetAddColor(PalEntry pe)
|
||||
{
|
||||
mAddColor = pe;
|
||||
}
|
||||
|
||||
void SetFog(PalEntry c, float d)
|
||||
{
|
||||
const float LOG2E = 1.442692f; // = 1/log(2)
|
||||
|
|
|
@ -203,6 +203,7 @@ void Draw2D(F2DDrawer *drawer, FRenderState &state)
|
|||
}
|
||||
state.SetObjectColor(0xffffffff);
|
||||
state.SetObjectColor2(0);
|
||||
state.SetAddColor(0);
|
||||
state.EnableTextureMatrix(false);
|
||||
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_ceiling", p.e->Linked.Ceiling.Sectors)
|
||||
("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)
|
||||
.Terrain("floorterrain", p.terrainnum[0], &def->terrainnum[0])
|
||||
.Terrain("ceilingterrain", p.terrainnum[1], &def->terrainnum[1])
|
||||
|
|
|
@ -114,6 +114,8 @@ vec4 getTexel(vec2 st)
|
|||
if (uObjectColor2.a == 0.0) texel *= uObjectColor;
|
||||
else texel *= mix(uObjectColor, uObjectColor2, gradientdist.z);
|
||||
|
||||
texel += uAddColor;
|
||||
|
||||
return desaturate(texel);
|
||||
}
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@ struct Sector native play
|
|||
{
|
||||
|
||||
native readonly FColormap ColorMap;
|
||||
native readonly Color SpecialColors[5];
|
||||
native readonly Color SpecialColors[6];
|
||||
|
||||
native Actor SoundTarget;
|
||||
|
||||
|
|
Loading…
Reference in a new issue