PixelShader: Store fog color as an integer.

This commit is contained in:
Tony Wasserka
2013-10-27 13:10:00 +01:00
parent 0238a56816
commit 68e91f0d55
4 changed files with 34 additions and 28 deletions

View File

@ -84,15 +84,16 @@ void PixelShaderManager::SetConstants()
// they always seems to be larger than 256 so my theory is :
// they are the coefficients from the center to the border of the screen
// so to simplify I use the hi coefficient as K in the shader taking 256 as the scale
constants.fog[2][0] = ScreenSpaceCenter;
constants.fog[2][1] = (float)Renderer::EFBToScaledX((int)(2.0f * xfregs.viewport.wd));
constants.fog[2][2] = bpmem.fogRange.K[4].HI / 256.0f;
// TODO: Shouldn't this be EFBToScaledXf?
constants.fog[1][0] = ScreenSpaceCenter;
constants.fog[1][1] = (float)Renderer::EFBToScaledX((int)(2.0f * xfregs.viewport.wd));
constants.fog[1][2] = bpmem.fogRange.K[4].HI / 256.0f;
}
else
{
constants.fog[2][0] = 0;
constants.fog[2][1] = 1;
constants.fog[2][2] = 1;
constants.fog[1][0] = 0;
constants.fog[1][1] = 1;
constants.fog[1][2] = 1;
}
dirty = true;
@ -270,9 +271,9 @@ void PixelShaderManager::SetTexCoordChanged(u8 texmapid)
void PixelShaderManager::SetFogColorChanged()
{
constants.fog[0][0] = bpmem.fog.color.r / 255.0f;
constants.fog[0][1] = bpmem.fog.color.g / 255.0f;
constants.fog[0][2] = bpmem.fog.color.b / 255.0f;
constants.fogcolor[0] = bpmem.fog.color.r;
constants.fogcolor[1] = bpmem.fog.color.g;
constants.fogcolor[2] = bpmem.fog.color.b;
dirty = true;
}
@ -280,17 +281,17 @@ void PixelShaderManager::SetFogParamChanged()
{
if (!g_ActiveConfig.bDisableFog)
{
constants.fog[1][0] = bpmem.fog.a.GetA();
constants.fog[1][1] = (float)bpmem.fog.b_magnitude / 0xFFFFFF;
constants.fog[1][2] = bpmem.fog.c_proj_fsel.GetC();
constants.fog[1][3] = (float)(1 << bpmem.fog.b_shift);
constants.fog[0][0] = bpmem.fog.a.GetA();
constants.fog[0][1] = (float)bpmem.fog.b_magnitude / 0xFFFFFF;
constants.fog[0][2] = bpmem.fog.c_proj_fsel.GetC();
constants.fog[0][3] = (float)(1 << bpmem.fog.b_shift);
}
else
{
constants.fog[1][0] = 0;
constants.fog[1][1] = 1;
constants.fog[1][2] = 0;
constants.fog[1][3] = 1;
constants.fog[0][0] = 0;
constants.fog[0][1] = 1;
constants.fog[0][2] = 0;
constants.fog[0][3] = 1;
}
dirty = true;
}