Mesa (master): mesa: Remove _CosCutoffNeg from light state.

Mathias Fröhlich frohlich at kemper.freedesktop.org
Wed Feb 29 19:42:07 UTC 2012


Module: Mesa
Branch: master
Commit: 6b48d7e83d4ed09ae8db0da2f8a100d68d6e5e66
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6b48d7e83d4ed09ae8db0da2f8a100d68d6e5e66

Author: Mathias Fröhlich <Mathias.Froehlich at web.de>
Date:   Wed Feb 29 18:19:33 2012 +0100

mesa: Remove _CosCutoffNeg from light state.

It is only used as a temporary variable during computation of
_CosCutoff. So, don't store it.

Reviewed-by: Alex Deucher <alexdeucher at gmail.com>
Reviewed-by: Brian Paul <brianp at vmware.com>
Signed-off-by: Mathias Froehlich <Mathias.Froehlich at web.de>

---

 src/mesa/main/light.c  |    7 ++-----
 src/mesa/main/mtypes.h |    1 -
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index a16d0e9..552efa7 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -161,11 +161,9 @@ _mesa_light(struct gl_context *ctx, GLuint lnum, GLenum pname, const GLfloat *pa
          return;
       FLUSH_VERTICES(ctx, _NEW_LIGHT);
       light->SpotCutoff = params[0];
-      light->_CosCutoffNeg = (GLfloat) (cos(light->SpotCutoff * DEG2RAD));
-      if (light->_CosCutoffNeg < 0)
+      light->_CosCutoff = (GLfloat) (cos(light->SpotCutoff * DEG2RAD));
+      if (light->_CosCutoff < 0)
          light->_CosCutoff = 0;
-      else
-         light->_CosCutoff = light->_CosCutoffNeg;
       if (light->SpotCutoff != 180.0F)
          light->_Flags |= LIGHT_SPOT;
       else
@@ -1260,7 +1258,6 @@ init_light( struct gl_light *l, GLuint n )
    ASSIGN_3V( l->SpotDirection, 0.0, 0.0, -1.0 );
    l->SpotExponent = 0.0;
    l->SpotCutoff = 180.0;
-   l->_CosCutoffNeg = -1.0f;
    l->_CosCutoff = 0.0;		/* KW: -ve values not admitted */
    l->ConstantAttenuation = 1.0;
    l->LinearAttenuation = 0.0;
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 30b9c6a..b5753df 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -659,7 +659,6 @@ struct gl_light
    GLfloat SpotDirection[4];	/**< spotlight direction in eye coordinates */
    GLfloat SpotExponent;
    GLfloat SpotCutoff;		/**< in degrees */
-   GLfloat _CosCutoffNeg;	/**< = cos(SpotCutoff) */
    GLfloat _CosCutoff;		/**< = MAX(0, cos(SpotCutoff)) */
    GLfloat ConstantAttenuation;
    GLfloat LinearAttenuation;




More information about the mesa-commit mailing list