Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix lightning for inconsitent config
It's possible to configure to use the vertex color as lightning source without enabling the vertex color at all.
The old implementation will use zero, but it seems to be wrong (prooven by THPS3), more likely is to disable
the lightning and just return the global color.
This fixes THPS3 on OpenGL, but it isn't verifed on hardware
  • Loading branch information
degasus committed Aug 7, 2013
1 parent 9d0554e commit a6fd2c8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Source/Core/VideoCommon/Src/LightingShaderGen.h
Expand Up @@ -150,7 +150,10 @@ static void GenerateLightingShader(T& object, LightingUidData& uid_data, int com
else if (components & VB_HAS_COL0 )
object.Write("lacc = %s0;\n", inColorName);
else
object.Write("lacc = float4(0.0f, 0.0f, 0.0f, 0.0f);\n");
// TODO: this isn't verified. Here we want to read the ambient from the vertex,
// but the vertex itself has no color. So we don't know which value to read.
// Returing 1.0 is the same as disabled lightning, so this could be fine
object.Write("lacc = float4(1.0f, 1.0f, 1.0f, 1.0f);\n");
}
else // from color
{
Expand Down Expand Up @@ -191,7 +194,8 @@ static void GenerateLightingShader(T& object, LightingUidData& uid_data, int com
else if (components & VB_HAS_COL0 )
object.Write("lacc.w = %s0.w;\n", inColorName);
else
object.Write("lacc.w = 0.0f;\n");
// TODO: The same for alpha: We want to read from vertex, but the vertex has no color
object.Write("lacc.w = 1.0f;\n");
}
else // from color
{
Expand Down

0 comments on commit a6fd2c8

Please sign in to comment.