summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/PixelShaderManager.cpp
diff options
context:
space:
mode:
authorTony Wasserka <neobrainx@gmail.com>2014-06-21 12:17:26 +0200
committerTony Wasserka <neobrainx@gmail.com>2014-06-21 12:17:26 +0200
commitfbca397c924e3906e9ab26ec3f967760385cc8d6 (patch)
treeb8c94b60ef5805ae0d36919d3183c6b122d59f36 /Source/Core/VideoCommon/PixelShaderManager.cpp
parentddadb4f29dc96b988a004bda43becb621fe2ac7d (diff)
parent924ad1ee9ff7bfa19163082ca203961d65788253 (diff)
Merge pull request #439 from degasus/lighting-fix
Lighting cleanup
Diffstat (limited to 'Source/Core/VideoCommon/PixelShaderManager.cpp')
-rw-r--r--Source/Core/VideoCommon/PixelShaderManager.cpp73
1 files changed, 0 insertions, 73 deletions
diff --git a/Source/Core/VideoCommon/PixelShaderManager.cpp b/Source/Core/VideoCommon/PixelShaderManager.cpp
index 551f881c3e..3ea6713ebd 100644
--- a/Source/Core/VideoCommon/PixelShaderManager.cpp
+++ b/Source/Core/VideoCommon/PixelShaderManager.cpp
@@ -14,7 +14,6 @@
static bool s_bFogRangeAdjustChanged;
static bool s_bViewPortChanged;
-static int nLightsChanged[2]; // min,max
PixelShaderConstants PixelShaderManager::constants;
bool PixelShaderManager::dirty;
@@ -29,7 +28,6 @@ void PixelShaderManager::Dirty()
{
s_bFogRangeAdjustChanged = true;
s_bViewPortChanged = true;
- nLightsChanged[0] = 0; nLightsChanged[1] = 0x80;
SetColorChanged(0, 0);
SetColorChanged(0, 1);
@@ -100,45 +98,6 @@ void PixelShaderManager::SetConstants()
s_bFogRangeAdjustChanged = false;
}
- if (g_ActiveConfig.bEnablePixelLighting) // config check added because the code in here was crashing for me inside SetPSConstant4f
- {
- if (nLightsChanged[0] >= 0)
- {
- // TODO: Outdated comment
- // lights don't have a 1 to 1 mapping, the color component needs to be converted to 4 floats
- int istart = nLightsChanged[0] / 0x10;
- int iend = (nLightsChanged[1] + 15) / 0x10;
- const float* xfmemptr = (const float*)&xfmem.lights[0x10 * istart];
-
- for (int i = istart; i < iend; ++i)
- {
- u32 color = *(const u32*)(xfmemptr + 3);
- constants.plight_colors[i][0] = (color >> 24) & 0xFF;
- constants.plight_colors[i][1] = (color >> 16) & 0xFF;
- constants.plight_colors[i][2] = (color >> 8) & 0xFF;
- constants.plight_colors[i][3] = (color) & 0xFF;
- xfmemptr += 4;
-
- for (int j = 0; j < 4; ++j, xfmemptr += 3)
- {
- if (j == 1 &&
- fabs(xfmemptr[0]) < 0.00001f &&
- fabs(xfmemptr[1]) < 0.00001f &&
- fabs(xfmemptr[2]) < 0.00001f)
- // dist attenuation, make sure not equal to 0!!!
- constants.plights[4*i+j][0] = 0.00001f;
- else
- constants.plights[4*i+j][0] = xfmemptr[0];
- constants.plights[4*i+j][1] = xfmemptr[1];
- constants.plights[4*i+j][2] = xfmemptr[2];
- }
- }
- dirty = true;
-
- nLightsChanged[0] = nLightsChanged[1] = -1;
- }
- }
-
if (s_bViewPortChanged)
{
constants.zbias[1][0] = xfmem.viewport.farZ;
@@ -304,38 +263,6 @@ void PixelShaderManager::SetFogRangeAdjustChanged()
s_bFogRangeAdjustChanged = true;
}
-void PixelShaderManager::InvalidateXFRange(int start, int end)
-{
- if (start < XFMEM_LIGHTS_END && end > XFMEM_LIGHTS)
- {
- int _start = start < XFMEM_LIGHTS ? XFMEM_LIGHTS : start-XFMEM_LIGHTS;
- int _end = end < XFMEM_LIGHTS_END ? end-XFMEM_LIGHTS : XFMEM_LIGHTS_END-XFMEM_LIGHTS;
-
- if (nLightsChanged[0] == -1 )
- {
- nLightsChanged[0] = _start;
- nLightsChanged[1] = _end;
- }
- else
- {
- if (nLightsChanged[0] > _start) nLightsChanged[0] = _start;
- if (nLightsChanged[1] < _end) nLightsChanged[1] = _end;
- }
- }
-}
-
-void PixelShaderManager::SetMaterialColorChanged(int index, u32 color)
-{
- if (g_ActiveConfig.bEnablePixelLighting)
- {
- constants.pmaterials[index][0] = (color >> 24) & 0xFF;
- constants.pmaterials[index][1] = (color >> 16) & 0xFF;
- constants.pmaterials[index][2] = (color >> 8) & 0xFF;
- constants.pmaterials[index][3] = (color) & 0xFF;
- dirty = true;
- }
-}
-
void PixelShaderManager::DoState(PointerWrap &p)
{
p.Do(constants);