Commit 213f7d9f authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

wined3d: Implement WINED3D_LIGHT_PARALLELPOINT support in the GLSL ffp.

parent e35f8266
...@@ -175,9 +175,6 @@ static HRESULT WINAPI d3d_light_SetLight(IDirect3DLight *iface, D3DLIGHT *data) ...@@ -175,9 +175,6 @@ static HRESULT WINAPI d3d_light_SetLight(IDirect3DLight *iface, D3DLIGHT *data)
if ((!data->dltType) || (data->dltType > D3DLIGHT_PARALLELPOINT)) if ((!data->dltType) || (data->dltType > D3DLIGHT_PARALLELPOINT))
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
if (data->dltType == D3DLIGHT_PARALLELPOINT)
FIXME("D3DLIGHT_PARALLELPOINT not implemented.\n");
/* Translate D3DLIGHT2 structure to D3DLIGHT7. */ /* Translate D3DLIGHT2 structure to D3DLIGHT7. */
light7->dltType = data->dltType; light7->dltType = data->dltType;
light7->dcvDiffuse = data->dcvColor; light7->dcvDiffuse = data->dcvColor;
......
...@@ -1455,7 +1455,6 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device, ...@@ -1455,7 +1455,6 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device,
{ {
case WINED3D_LIGHT_POINT: case WINED3D_LIGHT_POINT:
case WINED3D_LIGHT_SPOT: case WINED3D_LIGHT_SPOT:
case WINED3D_LIGHT_PARALLELPOINT:
case WINED3D_LIGHT_GLSPOT: case WINED3D_LIGHT_GLSPOT:
/* Incorrect attenuation values can cause the gl driver to crash. /* Incorrect attenuation values can cause the gl driver to crash.
* Happens with Need for speed most wanted. */ * Happens with Need for speed most wanted. */
...@@ -1467,6 +1466,7 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device, ...@@ -1467,6 +1466,7 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device,
break; break;
case WINED3D_LIGHT_DIRECTIONAL: case WINED3D_LIGHT_DIRECTIONAL:
case WINED3D_LIGHT_PARALLELPOINT:
/* Ignores attenuation */ /* Ignores attenuation */
break; break;
...@@ -1582,6 +1582,13 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device, ...@@ -1582,6 +1582,13 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device,
/* FIXME: Range */ /* FIXME: Range */
break; break;
case WINED3D_LIGHT_PARALLELPOINT:
object->position.x = light->position.x;
object->position.y = light->position.y;
object->position.z = light->position.z;
object->position.w = 1.0f;
break;
default: default:
FIXME("Unrecognized light type %#x.\n", light->type); FIXME("Unrecognized light type %#x.\n", light->type);
} }
......
...@@ -1186,6 +1186,11 @@ static void shader_glsl_ffp_vertex_light_uniform(const struct wined3d_context *c ...@@ -1186,6 +1186,11 @@ static void shader_glsl_ffp_vertex_light_uniform(const struct wined3d_context *c
GL_EXTCALL(glUniform3fv(prog->vs.light_location[light].direction, 1, &vec4.x)); GL_EXTCALL(glUniform3fv(prog->vs.light_location[light].direction, 1, &vec4.x));
break; break;
case WINED3D_LIGHT_PARALLELPOINT:
multiply_vector_matrix(&vec4, &light_info->position, view);
GL_EXTCALL(glUniform4fv(prog->vs.light_location[light].position, 1, &vec4.x));
break;
default: default:
FIXME("Unrecognized light type %#x.\n", light_info->OriginalParms.type); FIXME("Unrecognized light type %#x.\n", light_info->OriginalParms.type);
} }
...@@ -5538,6 +5543,18 @@ static void shader_glsl_ffp_vertex_lighting(struct wined3d_string_buffer *buffer ...@@ -5538,6 +5543,18 @@ static void shader_glsl_ffp_vertex_lighting(struct wined3d_string_buffer *buffer
" * ffp_light[%u].specular;\n", i); " * ffp_light[%u].specular;\n", i);
break; break;
case WINED3D_LIGHT_PARALLELPOINT:
shader_addline(buffer, "ambient += ffp_light[%u].ambient.xyz;\n", i);
if (!settings->normal)
break;
shader_addline(buffer, "dir = normalize(ffp_light[%u].position.xyz);\n", i);
shader_addline(buffer, "diffuse += clamp(dot(dir, normal), 0.0, 1.0)"
" * ffp_light[%u].diffuse.xyz;\n", i);
shader_addline(buffer, "t = dot(normal, normalize(dir - normalize(ec_pos.xyz)));\n");
shader_addline(buffer, "if (t > 0.0) specular += pow(t, ffp_material.shininess)"
" * ffp_light[%u].specular;\n", i);
break;
default: default:
if (light_type) if (light_type)
FIXME("Unhandled light type %#x.\n", light_type); FIXME("Unhandled light type %#x.\n", light_type);
......
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