v3d/tex: handle correctly coordinates for cube/cubearrays images
[mesa.git] / src / mesa / math / m_norm_tmp.h
index 767d1feddf273a026587b951de218effcfaf797d..6f1db8d0bd0aeebe9852a3058476f5f7a77d9642 100644 (file)
@@ -1,10 +1,8 @@
-/* $Id: m_norm_tmp.h,v 1.10 2002/01/05 20:51:12 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
- * Version:  4.1
  *
- * Copyright (C) 1999-2002  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2003  Brian Paul   All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
  */
 
 /*
  * the transformation matrix, rescaling and normalization.
  */
 
-#include <math.h>
-#include "m_vertices.h"
-
-
 /*
  * mat - the 4x4 transformation matrix
  * scale - uniform scale factor of the transformation matrix (not always used)
@@ -44,7 +39,7 @@
  *           optimization)
  * dest - the destination vector of normals
  */
-static void _XFORMAPI
+static void
 TAG(transform_normalize_normals)( const GLmatrix *mat,
                                   GLfloat scale,
                                   const GLvector4f *in,
@@ -73,10 +68,10 @@ TAG(transform_normalize_normals)( const GLmatrix *mat,
         {
            GLdouble len = tx*tx + ty*ty + tz*tz;
            if (len > 1e-20) {
-              GLdouble scale = 1.0 / GL_SQRT(len);
-              out[i][0] = (GLfloat) (tx * scale);
-              out[i][1] = (GLfloat) (ty * scale);
-              out[i][2] = (GLfloat) (tz * scale);
+              GLfloat scale = 1.0f / sqrtf(len);
+              out[i][0] = tx * scale;
+              out[i][1] = ty * scale;
+              out[i][2] = tz * scale;
            }
            else {
               out[i][0] = out[i][1] = out[i][2] = 0;
@@ -85,7 +80,7 @@ TAG(transform_normalize_normals)( const GLmatrix *mat,
       }
    }
    else {
-      if (scale != 1.0) {
+      if (scale != 1.0f) {
         m0 *= scale,  m4 *= scale,  m8 *= scale;
         m1 *= scale,  m5 *= scale,  m9 *= scale;
         m2 *= scale,  m6 *= scale,  m10 *= scale;
@@ -111,7 +106,7 @@ TAG(transform_normalize_normals)( const GLmatrix *mat,
 }
 
 
-static void _XFORMAPI
+static void
 TAG(transform_normalize_normals_no_rot)( const GLmatrix *mat,
                                          GLfloat scale,
                                          const GLvector4f *in,
@@ -140,10 +135,10 @@ TAG(transform_normalize_normals_no_rot)( const GLmatrix *mat,
         {
            GLdouble len = tx*tx + ty*ty + tz*tz;
            if (len > 1e-20) {
-              GLdouble scale = 1.0 / GL_SQRT(len);
-              out[i][0] = (GLfloat) (tx * scale);
-              out[i][1] = (GLfloat) (ty * scale);
-              out[i][2] = (GLfloat) (tz * scale);
+              GLfloat scale = 1.0f / sqrtf(len);
+              out[i][0] = tx * scale;
+              out[i][1] = ty * scale;
+              out[i][2] = tz * scale;
            }
            else {
               out[i][0] = out[i][1] = out[i][2] = 0;
@@ -176,7 +171,7 @@ TAG(transform_normalize_normals_no_rot)( const GLmatrix *mat,
 }
 
 
-static void _XFORMAPI
+static void
 TAG(transform_rescale_normals_no_rot)( const GLmatrix *mat,
                                        GLfloat scale,
                                        const GLvector4f *in,
@@ -205,7 +200,7 @@ TAG(transform_rescale_normals_no_rot)( const GLmatrix *mat,
 }
 
 
-static void _XFORMAPI
+static void
 TAG(transform_rescale_normals)( const GLmatrix *mat,
                                 GLfloat scale,
                                 const GLvector4f *in,
@@ -237,7 +232,7 @@ TAG(transform_rescale_normals)( const GLmatrix *mat,
 }
 
 
-static void _XFORMAPI
+static void
 TAG(transform_normals_no_rot)( const GLmatrix *mat,
                               GLfloat scale,
                               const GLvector4f *in,
@@ -267,7 +262,7 @@ TAG(transform_normals_no_rot)( const GLmatrix *mat,
 }
 
 
-static void _XFORMAPI
+static void
 TAG(transform_normals)( const GLmatrix *mat,
                         GLfloat scale,
                         const GLvector4f *in,
@@ -297,7 +292,7 @@ TAG(transform_normals)( const GLmatrix *mat,
 }
 
 
-static void _XFORMAPI
+static void
 TAG(normalize_normals)( const GLmatrix *mat,
                         GLfloat scale,
                         const GLvector4f *in,
@@ -327,10 +322,10 @@ TAG(normalize_normals)( const GLmatrix *mat,
         const GLfloat x = from[0], y = from[1], z = from[2];
         GLdouble len = x * x + y * y + z * z;
         if (len > 1e-50) {
-           len = 1.0 / GL_SQRT(len);
-           out[i][0] = (GLfloat) (x * len);
-           out[i][1] = (GLfloat) (y * len);
-           out[i][2] = (GLfloat) (z * len);
+           len = 1.0f / sqrtf(len);
+           out[i][0] = (GLfloat)(x * len);
+           out[i][1] = (GLfloat)(y * len);
+           out[i][2] = (GLfloat)(z * len);
         }
         else {
            out[i][0] = x;
@@ -343,7 +338,7 @@ TAG(normalize_normals)( const GLmatrix *mat,
 }
 
 
-static void _XFORMAPI
+static void
 TAG(rescale_normals)( const GLmatrix *mat,
                       GLfloat scale,
                       const GLvector4f *in,
@@ -366,7 +361,7 @@ TAG(rescale_normals)( const GLmatrix *mat,
 }
 
 
-static void _XFORMAPI
+static void
 TAG(init_c_norm_transform)( void )
 {
    _mesa_normal_tab[NORM_TRANSFORM_NO_ROT] =