Commit 826b67e3 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

wined3d: Treat zero shininess as no specular lighting in legacy lighting mode.

parent 26b8581f
...@@ -8998,7 +8998,7 @@ static const char *shader_glsl_ffp_mcs(enum wined3d_material_color_source mcs, c ...@@ -8998,7 +8998,7 @@ static const char *shader_glsl_ffp_mcs(enum wined3d_material_color_source mcs, c
} }
static void shader_glsl_ffp_vertex_lighting_footer(struct wined3d_string_buffer *buffer, static void shader_glsl_ffp_vertex_lighting_footer(struct wined3d_string_buffer *buffer,
const struct wined3d_ffp_vs_settings *settings, unsigned int idx) const struct wined3d_ffp_vs_settings *settings, unsigned int idx, BOOL legacy_lighting)
{ {
shader_addline(buffer, "diffuse += clamp(dot(dir, normal), 0.0, 1.0)" shader_addline(buffer, "diffuse += clamp(dot(dir, normal), 0.0, 1.0)"
" * ffp_light[%u].diffuse.xyz * att;\n", idx); " * ffp_light[%u].diffuse.xyz * att;\n", idx);
...@@ -9006,8 +9006,9 @@ static void shader_glsl_ffp_vertex_lighting_footer(struct wined3d_string_buffer ...@@ -9006,8 +9006,9 @@ static void shader_glsl_ffp_vertex_lighting_footer(struct wined3d_string_buffer
shader_addline(buffer, "t = dot(normal, normalize(dir - normalize(ec_pos.xyz)));\n"); shader_addline(buffer, "t = dot(normal, normalize(dir - normalize(ec_pos.xyz)));\n");
else else
shader_addline(buffer, "t = dot(normal, normalize(dir + vec3(0.0, 0.0, -1.0)));\n"); shader_addline(buffer, "t = dot(normal, normalize(dir + vec3(0.0, 0.0, -1.0)));\n");
shader_addline(buffer, "if (dot(dir, normal) > 0.0 && t > 0.0) specular +=" shader_addline(buffer, "if (dot(dir, normal) > 0.0 && t > 0.0%s) specular +="
" pow(t, ffp_material.shininess) * ffp_light[%u].specular * att;\n", idx); " pow(t, ffp_material.shininess) * ffp_light[%u].specular * att;\n",
legacy_lighting ? " && ffp_material.shininess > 0.0" : "", idx);
} }
static void shader_glsl_ffp_vertex_lighting(struct wined3d_string_buffer *buffer, static void shader_glsl_ffp_vertex_lighting(struct wined3d_string_buffer *buffer,
...@@ -9062,7 +9063,7 @@ static void shader_glsl_ffp_vertex_lighting(struct wined3d_string_buffer *buffer ...@@ -9062,7 +9063,7 @@ static void shader_glsl_ffp_vertex_lighting(struct wined3d_string_buffer *buffer
continue; continue;
} }
shader_addline(buffer, "dir = normalize(dir);\n"); shader_addline(buffer, "dir = normalize(dir);\n");
shader_glsl_ffp_vertex_lighting_footer(buffer, settings, idx); shader_glsl_ffp_vertex_lighting_footer(buffer, settings, idx, legacy_lighting);
shader_addline(buffer, "}\n"); shader_addline(buffer, "}\n");
} }
...@@ -9103,7 +9104,7 @@ static void shader_glsl_ffp_vertex_lighting(struct wined3d_string_buffer *buffer ...@@ -9103,7 +9104,7 @@ static void shader_glsl_ffp_vertex_lighting(struct wined3d_string_buffer *buffer
shader_addline(buffer, "}\n"); shader_addline(buffer, "}\n");
continue; continue;
} }
shader_glsl_ffp_vertex_lighting_footer(buffer, settings, idx); shader_glsl_ffp_vertex_lighting_footer(buffer, settings, idx, legacy_lighting);
shader_addline(buffer, "}\n"); shader_addline(buffer, "}\n");
} }
...@@ -9114,7 +9115,7 @@ static void shader_glsl_ffp_vertex_lighting(struct wined3d_string_buffer *buffer ...@@ -9114,7 +9115,7 @@ static void shader_glsl_ffp_vertex_lighting(struct wined3d_string_buffer *buffer
continue; continue;
shader_addline(buffer, "att = 1.0;\n"); shader_addline(buffer, "att = 1.0;\n");
shader_addline(buffer, "dir = normalize(ffp_light[%u].direction.xyz);\n", idx); shader_addline(buffer, "dir = normalize(ffp_light[%u].direction.xyz);\n", idx);
shader_glsl_ffp_vertex_lighting_footer(buffer, settings, idx); shader_glsl_ffp_vertex_lighting_footer(buffer, settings, idx, legacy_lighting);
} }
for (i = 0; i < settings->parallel_point_light_count; ++i, ++idx) for (i = 0; i < settings->parallel_point_light_count; ++i, ++idx)
...@@ -9124,7 +9125,7 @@ static void shader_glsl_ffp_vertex_lighting(struct wined3d_string_buffer *buffer ...@@ -9124,7 +9125,7 @@ static void shader_glsl_ffp_vertex_lighting(struct wined3d_string_buffer *buffer
continue; continue;
shader_addline(buffer, "att = 1.0;\n"); shader_addline(buffer, "att = 1.0;\n");
shader_addline(buffer, "dir = normalize(ffp_light[%u].position.xyz);\n", idx); shader_addline(buffer, "dir = normalize(ffp_light[%u].position.xyz);\n", idx);
shader_glsl_ffp_vertex_lighting_footer(buffer, settings, idx); shader_glsl_ffp_vertex_lighting_footer(buffer, settings, idx, legacy_lighting);
} }
shader_addline(buffer, "ffp_varying_diffuse.xyz = %s.xyz * ambient + %s.xyz * diffuse + %s.xyz;\n", shader_addline(buffer, "ffp_varying_diffuse.xyz = %s.xyz * ambient + %s.xyz * diffuse + %s.xyz;\n",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment