On 02/25/2015 12:21 PM, Jose Fonseca wrote:
On 24/02/15 23:30, Brian Paul wrote:
---
  src/mesa/main/imports.h  | 8 --------
  src/mesa/main/light.c    | 2 +-
  src/mesa/math/m_matrix.c | 4 ++--
  3 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index 356f0e1..d886427 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -79,14 +79,6 @@ typedef union { GLfloat f; GLint i; GLuint u; }
fi_type;



-/**********************************************************************
- * Math macros
- */
-
-/* Degrees to radians conversion: */
-#define DEG2RAD (M_PI/180.0)
-
-
  #if defined(_MSC_VER)
  #if _MSC_VER < 1800  /* Not req'd on VS2013 and above */
  #define strtoll(p, e, b) _strtoi64(p, e, b)
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index c4d3a53..4021dbe 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -156,7 +156,7 @@ _mesa_light(struct gl_context *ctx, GLuint lnum,
GLenum pname, const GLfloat *pa
           return;
        FLUSH_VERTICES(ctx, _NEW_LIGHT);
        light->SpotCutoff = params[0];
-      light->_CosCutoff = (GLfloat) (cos(light->SpotCutoff * DEG2RAD));
+      light->_CosCutoff = (GLfloat) (cos(light->SpotCutoff * M_PI /
180.0));

It might be worthwhile to add parenthesis  around M_PI / 180.0.

I'm not sure the compiler will fold, due to C operator precedence, and
the fact that floating point operations when not being associative:

Yeah, I'm wasn't too concerned about performance in these places, but I could add parens if anybody cares.

-Brian

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to