- added a few more texture coloring options to the shader.
Aside from adding an additive component it can now also do: - desaturation (not limited to the range of 0..1 so it can also be used for oversaturation by applying a negative number or negative saturation by going above 1.0. - invert the texture - apply a blend, including 3 special mode taken from EDuke32. Currently only the implementation is done, it is not exposed to UDMF yet.
This commit is contained in:
parent
41a9496bef
commit
3209d4ed23
7 changed files with 142 additions and 6 deletions
|
|
@ -138,6 +138,11 @@ bool FGLRenderState::ApplyShader()
|
|||
activeShader->muClipSplit.Set(mClipSplit);
|
||||
activeShader->muSpecularMaterial.Set(mGlossiness, mSpecularLevel);
|
||||
activeShader->muAddColor.Set(mStreamData.uAddColor);
|
||||
activeShader->muBlendColor.Set(mStreamData.uBlendColor);
|
||||
activeShader->muObjectBlendMode.Set(mStreamData.uObjectBlendMode);
|
||||
activeShader->muObjectColorizeFactor.Set(mStreamData.uObjectColorizeFactor);
|
||||
activeShader->muObjectDesaturationFactor.Set(mStreamData.uObjectDesaturationFactor);
|
||||
activeShader->muObjectInvertColor.Set(mStreamData.uObjectInvertColor);
|
||||
|
||||
if (mGlowEnabled || activeShader->currentglowstate)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -242,10 +242,17 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
i_data += "uniform vec4 uObjectColor2;\n";
|
||||
i_data += "uniform vec4 uDynLightColor;\n";
|
||||
i_data += "uniform vec4 uAddColor;\n";
|
||||
i_data += "uniform vec4 uBlendColor;\n";
|
||||
i_data += "uniform vec4 uFogColor;\n";
|
||||
i_data += "uniform float uDesaturationFactor;\n";
|
||||
i_data += "uniform float uInterpolationFactor;\n";
|
||||
|
||||
i_data += "uniform float uObjectDesaturationFactor;\n";
|
||||
i_data += "uniform float uObjectColorizeFactor;\n";
|
||||
i_data += "uniform int uObjectBlendMode;\n";
|
||||
i_data += "uniform int uObjectInvertColor;\n";
|
||||
|
||||
|
||||
// Glowing walls stuff
|
||||
i_data += "uniform vec4 uGlowTopPlane;\n";
|
||||
i_data += "uniform vec4 uGlowTopColor;\n";
|
||||
|
|
@ -536,6 +543,11 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
muAlphaThreshold.Init(hShader, "uAlphaThreshold");
|
||||
muSpecularMaterial.Init(hShader, "uSpecularMaterial");
|
||||
muAddColor.Init(hShader, "uAddColor");
|
||||
muBlendColor.Init(hShader, "uBlendColor");
|
||||
muObjectDesaturationFactor.Init(hShader, "uObjectDesaturationFactor");
|
||||
muObjectColorizeFactor.Init(hShader, "uObjectColorizeFactor");
|
||||
muObjectBlendMode.Init(hShader, "uObjectBlendMode");
|
||||
muObjectInvertColor.Init(hShader, "uObjectInvertColor");
|
||||
muTimer.Init(hShader, "timer");
|
||||
|
||||
lights_index = glGetUniformLocation(hShader, "lights");
|
||||
|
|
|
|||
|
|
@ -246,6 +246,7 @@ class FShader
|
|||
FBufferedUniformPE muObjectColor;
|
||||
FBufferedUniformPE muObjectColor2;
|
||||
FBufferedUniformPE muAddColor;
|
||||
FBufferedUniformPE muBlendColor;
|
||||
FUniform4f muGlowBottomColor;
|
||||
FUniform4f muGlowTopColor;
|
||||
FUniform4f muGlowBottomPlane;
|
||||
|
|
@ -259,6 +260,11 @@ class FShader
|
|||
FBufferedUniform2f muSpecularMaterial;
|
||||
FBufferedUniform1f muTimer;
|
||||
|
||||
FBufferedUniform1f muObjectDesaturationFactor;
|
||||
FBufferedUniform1f muObjectColorizeFactor;
|
||||
FBufferedUniform1i muObjectBlendMode;
|
||||
FBufferedUniform1i muObjectInvertColor;
|
||||
|
||||
int lights_index;
|
||||
int modelmatrix_index;
|
||||
int normalmodelmatrix_index;
|
||||
|
|
|
|||
|
|
@ -158,11 +158,16 @@ struct StreamData
|
|||
FVector4PalEntry uObjectColor2;
|
||||
FVector4 uDynLightColor;
|
||||
FVector4PalEntry uAddColor;
|
||||
FVector4PalEntry uBlendColor;
|
||||
FVector4PalEntry uFogColor;
|
||||
float uDesaturationFactor;
|
||||
float uInterpolationFactor;
|
||||
float timer;
|
||||
int useVertexData;
|
||||
float uObjectDesaturationFactor;
|
||||
float uObjectColorizeFactor;
|
||||
int uObjectBlendMode;
|
||||
int uObjectInvertColor;
|
||||
FVector4 uVertexColor;
|
||||
FVector4 uVertexNormal;
|
||||
|
||||
|
|
@ -236,6 +241,11 @@ public:
|
|||
mStreamData.uAddColor = 0;
|
||||
mStreamData.uObjectColor = 0xffffffff;
|
||||
mStreamData.uObjectColor2 = 0;
|
||||
mStreamData.uBlendColor = 0;
|
||||
mStreamData.uObjectDesaturationFactor = 0;
|
||||
mStreamData.uObjectBlendMode = 0;
|
||||
mStreamData.uObjectColorizeFactor = 1;
|
||||
mStreamData.uObjectInvertColor = 0;
|
||||
mSoftLight = 0;
|
||||
mLightParms[0] = mLightParms[1] = mLightParms[2] = 0.0f;
|
||||
mLightParms[3] = -1.f;
|
||||
|
|
@ -445,6 +455,31 @@ public:
|
|||
mStreamData.uAddColor = pe;
|
||||
}
|
||||
|
||||
void SetBlendColor(PalEntry pe)
|
||||
{
|
||||
mStreamData.uBlendColor = pe;
|
||||
}
|
||||
|
||||
void SetColorizeFactor(float f)
|
||||
{
|
||||
mStreamData.uObjectColorizeFactor = f;
|
||||
}
|
||||
|
||||
void SetObjectDesaturateFactor(float f)
|
||||
{
|
||||
mStreamData.uObjectDesaturationFactor = f;
|
||||
}
|
||||
|
||||
void SetObjectInvert(bool on)
|
||||
{
|
||||
mStreamData.uObjectInvertColor = on;
|
||||
}
|
||||
|
||||
void SetObjectBlendMode(int b)
|
||||
{
|
||||
mStreamData.uObjectBlendMode = b;
|
||||
}
|
||||
|
||||
void SetFog(PalEntry c, float d)
|
||||
{
|
||||
const float LOG2E = 1.442692f; // = 1/log(2)
|
||||
|
|
|
|||
|
|
@ -175,6 +175,7 @@ void HWWall::RenderTexturedWall(HWDrawInfo *di, FRenderState &state, int rflags)
|
|||
state.SetObjectColor(color1);
|
||||
state.SetObjectColor2((color1 != color2) ? color2 : PalEntry(0));
|
||||
state.SetAddColor(side->GetAdditiveColor(tierndx, frontsector));
|
||||
|
||||
if (color1 != color2)
|
||||
{
|
||||
// Do gradient setup only if there actually is a gradient.
|
||||
|
|
@ -243,6 +244,9 @@ void HWWall::RenderTexturedWall(HWDrawInfo *di, FRenderState &state, int rflags)
|
|||
state.SetTextureMode(tmode);
|
||||
state.EnableGlow(false);
|
||||
state.EnableGradient(false);
|
||||
state.SetObjectDesaturateFactor(0);
|
||||
state.SetObjectInvert(false);
|
||||
state.SetObjectBlendMode(0);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
|||
|
|
@ -118,11 +118,16 @@ static const char *shaderBindings = R"(
|
|||
vec4 uObjectColor2;
|
||||
vec4 uDynLightColor;
|
||||
vec4 uAddColor;
|
||||
vec4 uBlendColor;
|
||||
vec4 uFogColor;
|
||||
float uDesaturationFactor;
|
||||
float uInterpolationFactor;
|
||||
float timer; // timer data for material shaders
|
||||
int useVertexData;
|
||||
float uObjectDesaturationFactor;
|
||||
float uObjectColorizeFactor;
|
||||
int uObjectBlendMode;
|
||||
int uObjectInvertColor;
|
||||
vec4 uVertexColor;
|
||||
vec4 uVertexNormal;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue