mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 15:02:39 +00:00
- objectcolor stuff.
# Conflicts: # src/gl/renderer/gl_renderstate.cpp
This commit is contained in:
parent
dbbd797baa
commit
12d073a27d
7 changed files with 24 additions and 5 deletions
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -271,6 +271,7 @@ class FShader
|
|||
FBufferedUniformPE muFogColor;
|
||||
FBufferedUniform4f muDynLightColor;
|
||||
FBufferedUniformPE muObjectColor;
|
||||
FBufferedUniformPE muObjectColor2;
|
||||
FUniform4f muGlowBottomColor;
|
||||
FUniform4f muGlowTopColor;
|
||||
FUniform4f muGlowBottomPlane;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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,9 +50,15 @@ 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)
|
||||
{
|
||||
gl_ClipDistance[3] = -((uSplitTopPlane.w + uSplitTopPlane.x * worldcoord.x + uSplitTopPlane.y * worldcoord.z) * uSplitTopPlane.z) - worldcoord.y;
|
||||
|
|
|
@ -15,6 +15,7 @@ uniform float uAlphaThreshold;
|
|||
|
||||
// colors
|
||||
uniform vec4 uObjectColor;
|
||||
uniform vec4 uObjectColor2;
|
||||
uniform vec4 uDynLightColor;
|
||||
uniform vec4 uFogColor;
|
||||
uniform float uDesaturationFactor;
|
||||
|
|
Loading…
Reference in a new issue