- objectcolor stuff.

# Conflicts:
#	src/gl/renderer/gl_renderstate.cpp
This commit is contained in:
Christoph Oelckers 2017-01-28 18:19:58 +01:00
parent dbbd797baa
commit 12d073a27d
7 changed files with 24 additions and 5 deletions

View file

@ -72,6 +72,7 @@ void FRenderState::Reset()
mModelMatrixEnabled = false;
mTextureMatrixEnabled = false;
mObjectColor = 0xffffffff;
mObjectColor2 = 0;
mVertexBuffer = mCurrentVertexBuffer = NULL;
mColormapState = CM_DEFAULT;
mSoftLight = 0;
@ -144,6 +145,8 @@ bool FRenderState::ApplyShader()
glVertexAttrib4fv(VATTR_COLOR, mColor.vec);
glVertexAttrib4fv(VATTR_NORMAL, mNormal.vec);
//activeShader->muObjectColor2.Set(mObjectColor2);
activeShader->muObjectColor2.Set(mObjectColor2);
activeShader->muDesaturation.Set(mDesaturation / 255.f);
activeShader->muFogEnabled.Set(fogset);

View file

@ -106,6 +106,7 @@ class FRenderState
FStateVec4 mClipLine;
PalEntry mFogColor;
PalEntry mObjectColor;
PalEntry mObjectColor2;
FStateVec4 mDynColor;
float mClipSplit[2];
@ -381,6 +382,11 @@ public:
mObjectColor = pe;
}
void SetObjectColor2(PalEntry pe)
{
mObjectColor2 = pe;
}
void SetFog(PalEntry c, float d)
{
const float LOG2E = 1.442692f; // = 1/log(2)

View file

@ -225,6 +225,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
muFogColor.Init(hShader, "uFogColor");
muDynLightColor.Init(hShader, "uDynLightColor");
muObjectColor.Init(hShader, "uObjectColor");
muObjectColor2.Init(hShader, "uObjectColor2");
muGlowBottomColor.Init(hShader, "uGlowBottomColor");
muGlowTopColor.Init(hShader, "uGlowTopColor");
muGlowBottomPlane.Init(hShader, "uGlowBottomPlane");

View file

@ -271,6 +271,7 @@ class FShader
FBufferedUniformPE muFogColor;
FBufferedUniform4f muDynLightColor;
FBufferedUniformPE muObjectColor;
FBufferedUniformPE muObjectColor2;
FUniform4f muGlowBottomColor;
FUniform4f muGlowTopColor;
FUniform4f muGlowBottomPlane;

View file

@ -1,5 +1,5 @@
in vec4 pixelpos;
in vec2 glowdist;
in vec3 glowdist;
in vec4 vWorldNormal;
in vec4 vEyeNormal;
@ -89,7 +89,8 @@ vec4 getTexel(vec2 st)
}
break;
}
texel *= uObjectColor;
if (uObjectColor2.a == 0) texel *= uObjectColor;
else texel *= mix(uObjectColor, uObjectColor2, glowdist.z);
return desaturate(texel);
}

View file

@ -6,7 +6,7 @@ in vec4 aColor;
in vec4 aVertex2;
in vec4 aNormal;
out vec4 pixelpos;
out vec2 glowdist;
out vec3 glowdist;
out vec4 vWorldNormal;
out vec4 vEyeNormal;
@ -50,8 +50,14 @@ void main()
pixelpos.xyz = worldcoord.xyz;
pixelpos.w = -eyeCoordPos.z/eyeCoordPos.w;
glowdist.x = -((uGlowTopPlane.w + uGlowTopPlane.x * worldcoord.x + uGlowTopPlane.y * worldcoord.z) * uGlowTopPlane.z) - worldcoord.y;
glowdist.y = worldcoord.y + ((uGlowBottomPlane.w + uGlowBottomPlane.x * worldcoord.x + uGlowBottomPlane.y * worldcoord.z) * uGlowBottomPlane.z);
float topatpoint = -((uGlowTopPlane.w + uGlowTopPlane.x * worldcoord.x + uGlowTopPlane.y * worldcoord.z) * uGlowTopPlane.z);
float bottomatpoint = -((uGlowBottomPlane.w + uGlowBottomPlane.x * worldcoord.x + uGlowBottomPlane.y * worldcoord.z) * uGlowBottomPlane.z);
glowdist.x = topatpoint - worldcoord.y;
glowdist.y = worldcoord.y - bottomatpoint;
glowdist.z = glowdist.x / (topatpoint - bottomatpoint);
return (uGlowTopPlane.w + normal.X*v->fX() + normal.Y*v->fY()) * negiC;
if (uSplitBottomPlane.z != 0.0)
{

View file

@ -15,6 +15,7 @@ uniform float uAlphaThreshold;
// colors
uniform vec4 uObjectColor;
uniform vec4 uObjectColor2;
uniform vec4 uDynLightColor;
uniform vec4 uFogColor;
uniform float uDesaturationFactor;