burning: GL_FOG_COORDINATE_SOURCE ,GL_FRAGMENT_DEPTH -> abs(EyeSpace.vertex.z)

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6104 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
engineer_apple 2020-03-01 16:19:03 +00:00
parent ae64a8ef22
commit f74abf1d2b

@ -1592,16 +1592,21 @@ void CBurningVideoDriver::VertexCache_fill(const u32 sourceIndex, const u32 dest
{ {
f32 fog_factor = 1.f; f32 fog_factor = 1.f;
// GL_FRAGMENT_DEPTH -> abs(EyeSpace.vertex.z)
ieee754 fog_frag_coord;
fog_frag_coord.f = EyeSpace.vertex.z;
fog_frag_coord.fields.sign = 0;
switch (FogType) switch (FogType)
{ {
case EFT_FOG_LINEAR: case EFT_FOG_LINEAR:
fog_factor = (FogEnd - EyeSpace.vertex.z) * EyeSpace.fog_scale; fog_factor = (FogEnd - fog_frag_coord.f) * EyeSpace.fog_scale;
break; break;
case EFT_FOG_EXP: case EFT_FOG_EXP:
fog_factor = (f32)exp(-FogDensity * EyeSpace.vertex.z); fog_factor = (f32)exp(-FogDensity * fog_frag_coord.f);
break; break;
case EFT_FOG_EXP2: case EFT_FOG_EXP2:
fog_factor = (f32)exp(-FogDensity * FogDensity * EyeSpace.vertex.z * EyeSpace.vertex.z); fog_factor = (f32)exp(-FogDensity * FogDensity * fog_frag_coord.f * fog_frag_coord.f);
break; break;
} }