Related FOG changes:

* revert back to proper upscale mantissa of parameters A and C
* properly downscale magnitude to 0.24 bits instead than ≡0.23
* Z Eyespace conversion for projection by original patent concept

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6463 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
gnick79
2010-11-23 13:57:01 +00:00
parent b0c94a47f9
commit 4267adbd5e
4 changed files with 29 additions and 14 deletions

View File

@ -1310,15 +1310,20 @@ static void WriteFog(char *&p)
if (bpmem.fog.c_proj_fsel.proj == 0)
{
// perspective
// ze = A/(B - Zs)
WRITE (p, " float ze = "I_FOG"[1].x / ("I_FOG"[1].y - zCoord);\n");
// ze = A/(B - (Zs >> B_SHF)
WRITE (p, " float ze = "I_FOG"[1].x / ("I_FOG"[1].y - (zCoord / "I_FOG"[1].w));\n");
}
else
{
// orthographic
// ze = a*Zs
// ze = a*Zs (here, no B_SHF)
WRITE (p, " float ze = "I_FOG"[1].x * zCoord;\n");
}
// stuff to do!
// here, where we'll have to add/handle x range adjustment (if related BP register it's enabled)
// x_adjust = sqrt((x-center)^2 + k^2)/k
// ze *= x_adjust
WRITE (p, " float fog = saturate(ze - "I_FOG"[1].z);\n");