Invert the nesting of specularIsZero and lmode conditions in VS.

This commit is contained in:
Henrik Rydgård committed 2023-01-04 11:04:24 +01:00
1 parent ae383147db
commit b84e24cb89
1 file changed
+6 -10
+6 -10
View File
@@ -1153,22 +1153,18 @@ bool GenerateVertexShader(const VShaderID &id, char *buffer, const ShaderLanguag
if (enableLighting) {
WRITE(p, " lightSum0 = clamp(lightSum0, 0.0, 1.0);\n");
// Sum up ambient, emissive here.
if (lmode) {
if (specularIsZero) {
WRITE(p, " %sv_color0 = lightSum0;\n", compat.vsOutPrefix);
// v_color1 only exists when lmode = 1.
if (specularIsZero) {
WRITE(p, " %sv_color1 = splat3(0.0);\n", compat.vsOutPrefix);
} else {
WRITE(p, " %sv_color1 = clamp(lightSum1, 0.0, 1.0);\n", compat.vsOutPrefix);
}
WRITE(p, " %sv_color1 = splat3(0.0);\n", compat.vsOutPrefix);
} else {
if (specularIsZero) {
if (lmode) {
WRITE(p, " %sv_color0 = lightSum0;\n", compat.vsOutPrefix);
// v_color1 only exists when lmode = 1.
WRITE(p, " %sv_color1 = clamp(lightSum1, 0.0, 1.0);\n", compat.vsOutPrefix);
} else {
WRITE(p, " %sv_color0 = clamp(lightSum0 + vec4(lightSum1, 0.0), 0.0, 1.0);\n", compat.vsOutPrefix);
WRITE(p, " %sv_color1 = splat3(0.0);\n", compat.vsOutPrefix);
}
WRITE(p, " %sv_color1 = splat3(0.0);\n", compat.vsOutPrefix);
}
} else {
// Lighting doesn't affect color.