summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/LightingShaderGen.cpp
diff options
context:
space:
mode:
authorJMC47 <JMC4789@gmail.com>2022-04-22 23:24:22 -0400
committerGitHub <noreply@github.com>2022-04-22 23:24:22 -0400
commit56bb965ab944bd01bf511df31b7c9d91f8e62bd4 (patch)
treea6078a76e52a86d89ec2f53b94bab9aeb0894bd0 /Source/Core/VideoCommon/LightingShaderGen.cpp
parent2e01dc0c82b5f73215e3425ab45ff6c7ee50b389 (diff)
parent784079853d9daa4d5e4de0b49b610ec0e58a2b0c (diff)
Merge pull request #10584 from Pokechu22/emboss-single-normal-v2
VideoCommon: Handle emboss texgen with only a single normal
Diffstat (limited to 'Source/Core/VideoCommon/LightingShaderGen.cpp')
-rw-r--r--Source/Core/VideoCommon/LightingShaderGen.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/Source/Core/VideoCommon/LightingShaderGen.cpp b/Source/Core/VideoCommon/LightingShaderGen.cpp
index a9ff3119bc..5b34e3c89f 100644
--- a/Source/Core/VideoCommon/LightingShaderGen.cpp
+++ b/Source/Core/VideoCommon/LightingShaderGen.cpp
@@ -27,11 +27,11 @@ static void GenerateLightShader(ShaderCode& object, const LightingUidData& uid_d
case AttenuationFunc::Dir:
object.Write("ldir = normalize(" LIGHT_POS ".xyz - pos.xyz);\n", LIGHT_POS_PARAMS(index));
object.Write("attn = 1.0;\n");
- object.Write("if (length(ldir) == 0.0)\n\t ldir = _norm0;\n");
+ object.Write("if (length(ldir) == 0.0)\n\t ldir = _normal;\n");
break;
case AttenuationFunc::Spec:
object.Write("ldir = normalize(" LIGHT_POS ".xyz - pos.xyz);\n", LIGHT_POS_PARAMS(index));
- object.Write("attn = (dot(_norm0, ldir) >= 0.0) ? max(0.0, dot(_norm0, " LIGHT_DIR
+ object.Write("attn = (dot(_normal, ldir) >= 0.0) ? max(0.0, dot(_normal, " LIGHT_DIR
".xyz)) : 0.0;\n",
LIGHT_DIR_PARAMS(index));
object.Write("cosAttn = " LIGHT_COSATT ".xyz;\n", LIGHT_COSATT_PARAMS(index));
@@ -64,7 +64,8 @@ static void GenerateLightShader(ShaderCode& object, const LightingUidData& uid_d
break;
case DiffuseFunc::Sign:
case DiffuseFunc::Clamp:
- object.Write("lacc.{} += int{}(round(attn * {}dot(ldir, _norm0)) * float{}(" LIGHT_COL ")));\n",
+ object.Write("lacc.{} += int{}(round(attn * {}dot(ldir, _normal)) * float{}(" LIGHT_COL
+ ")));\n",
swizzle, swizzle_components, diffusefunc != DiffuseFunc::Sign ? "max(0.0," : "(",
swizzle_components, LIGHT_COL_PARAMS(index, swizzle));
break;