summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/light.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-04-03 09:55:10 -0600
committerBrian Paul <[email protected]>2009-04-03 10:09:27 -0600
commit650d147289014e8a98f65fbbcd1855b2a4f19d2f (patch)
tree3464c81f196cd59bdbdcbdce75f1d08dc71cc4e8 /src/mesa/main/light.c
parentbe4c2d9a335aa38418000dd55845cea39c84261f (diff)
mesa: don't normalize spot light direction until validation time
In glLight() we're only supposed to transform the direction by the modelview matrix, not normalized it too.
Diffstat (limited to 'src/mesa/main/light.c')
-rw-r--r--src/mesa/main/light.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index a15c1f0be05..f72841b8ccb 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -209,7 +209,6 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
_math_matrix_analyse(ctx->ModelviewMatrixStack.Top);
}
TRANSFORM_DIRECTION(temp, params, ctx->ModelviewMatrixStack.Top->m);
- NORMALIZE_3FV(temp);
params = temp;
break;
case GL_SPOT_EXPONENT:
@@ -1137,12 +1136,18 @@ compute_light_positions( GLcontext *ctx )
}
if (light->_Flags & LIGHT_SPOT) {
+ /* Note: we normalize the spot direction now */
+
if (ctx->_NeedEyeCoords) {
COPY_3V( light->_NormDirection, light->EyeDirection );
+ NORMALIZE_3FV( light->_NormDirection );
}
else {
+ GLfloat spotDir[3];
+ COPY_3V(spotDir, light->EyeDirection);
+ NORMALIZE_3FV(spotDir);
TRANSFORM_NORMAL( light->_NormDirection,
- light->EyeDirection,
+ spotDir,
ctx->ModelviewMatrixStack.Top->m);
}