Commit 540130bf authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

wined3d: Store the directional light direction in the lightDirn field.

It's only an implementation detail that the direction needs to be passed to the fixed function GL pipeline as GL_POSITION.
parent b5affa6d
......@@ -1531,10 +1531,10 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device,
case WINED3D_LIGHT_DIRECTIONAL:
/* Direction */
object->lightPosn[0] = -light->direction.x;
object->lightPosn[1] = -light->direction.y;
object->lightPosn[2] = -light->direction.z;
object->lightPosn[3] = 0.0f;
object->lightDirn[0] = -light->direction.x;
object->lightDirn[1] = -light->direction.y;
object->lightDirn[2] = -light->direction.z;
object->lightDirn[3] = 0.0f;
object->exponent = 0.0f;
object->cutoff = 180.0f;
break;
......
......@@ -7529,6 +7529,9 @@ static void glsl_vertex_pipe_view(struct wined3d_context *context, const struct
{
if (!(light = state->lights[k]))
continue;
if (light->OriginalParms.type == WINED3D_LIGHT_DIRECTIONAL)
gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT0 + light->glIndex, GL_POSITION, light->lightDirn);
else
gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT0 + light->glIndex, GL_POSITION, light->lightPosn);
checkGLcall("glLightfv posn");
gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT0 + light->glIndex, GL_SPOT_DIRECTION, light->lightDirn);
......
......@@ -3973,6 +3973,9 @@ static void transform_view(struct wined3d_context *context, const struct wined3d
{
if (!(light = state->lights[k]))
continue;
if (light->OriginalParms.type == WINED3D_LIGHT_DIRECTIONAL)
gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT0 + light->glIndex, GL_POSITION, light->lightDirn);
else
gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT0 + light->glIndex, GL_POSITION, light->lightPosn);
checkGLcall("glLightfv posn");
gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT0 + light->glIndex, GL_SPOT_DIRECTION, light->lightDirn);
......@@ -4800,7 +4803,7 @@ void light(struct wined3d_context *context, const struct wined3d_state *state, D
case WINED3D_LIGHT_DIRECTIONAL:
/* Direction */
/* Note GL uses w position of 0 for direction! */
gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT0 + Index, GL_POSITION, lightInfo->lightPosn);
gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT0 + Index, GL_POSITION, lightInfo->lightDirn);
checkGLcall("glLightfv");
gl_info->gl_ops.gl.p_glLightf(GL_LIGHT0 + Index, GL_SPOT_CUTOFF, lightInfo->cutoff);
checkGLcall("glLightf");
......
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