forked from teamnwah/openmw-tes3coop
Fix the water being affected by fog on the map
This commit is contained in:
parent
188df341c3
commit
e5ce94c336
1 changed files with 9 additions and 2 deletions
|
@ -3,23 +3,28 @@
|
||||||
|
|
||||||
#define SIMPLE_WATER @shGlobalSettingBool(simple_water)
|
#define SIMPLE_WATER @shGlobalSettingBool(simple_water)
|
||||||
|
|
||||||
|
|
||||||
#if SIMPLE_WATER
|
#if SIMPLE_WATER
|
||||||
// --------------------------------------- SIMPLE WATER ---------------------------------------------------
|
// --------------------------------------- SIMPLE WATER ---------------------------------------------------
|
||||||
|
|
||||||
|
#define FOG @shGlobalSettingBool(fog)
|
||||||
|
|
||||||
#ifdef SH_VERTEX_SHADER
|
#ifdef SH_VERTEX_SHADER
|
||||||
|
|
||||||
SH_BEGIN_PROGRAM
|
SH_BEGIN_PROGRAM
|
||||||
shUniform(float4x4, wvp) @shAutoConstant(wvp, worldviewproj_matrix)
|
shUniform(float4x4, wvp) @shAutoConstant(wvp, worldviewproj_matrix)
|
||||||
shVertexInput(float2, uv0)
|
shVertexInput(float2, uv0)
|
||||||
shOutput(float2, UV)
|
shOutput(float2, UV)
|
||||||
shOutput(float, depth)
|
|
||||||
|
|
||||||
|
#if FOG
|
||||||
|
shOutput(float, depth)
|
||||||
|
#endif
|
||||||
SH_START_PROGRAM
|
SH_START_PROGRAM
|
||||||
{
|
{
|
||||||
shOutputPosition = shMatrixMult(wvp, shInputPosition);
|
shOutputPosition = shMatrixMult(wvp, shInputPosition);
|
||||||
UV = uv0;
|
UV = uv0;
|
||||||
|
#if FOG
|
||||||
depth = shOutputPosition.z;
|
depth = shOutputPosition.z;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -38,8 +43,10 @@
|
||||||
shOutputColour(0).xyz = shSample(animatedTexture, UV * 15).xyz * float3(1.0, 1.0, 1.0);
|
shOutputColour(0).xyz = shSample(animatedTexture, UV * 15).xyz * float3(1.0, 1.0, 1.0);
|
||||||
shOutputColour(0).w = 0.7;
|
shOutputColour(0).w = 0.7;
|
||||||
|
|
||||||
|
#if FOG
|
||||||
float fogValue = shSaturate((depth - fogParams.y) * fogParams.w);
|
float fogValue = shSaturate((depth - fogParams.y) * fogParams.w);
|
||||||
shOutputColour(0).xyz = shLerp (shOutputColour(0).xyz, fogColor, fogValue);
|
shOutputColour(0).xyz = shLerp (shOutputColour(0).xyz, fogColor, fogValue);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue