-/* $Id: t_vb_texgen.c,v 1.13 2002/06/29 19:48:17 brianp Exp $ */
+/* $Id: t_vb_texgen.c,v 1.19 2003/03/31 16:48:35 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 5.1
*
- * Copyright (C) 1999-2001 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"),
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Authors:
- * Brian Paul <brian@valinux.com>
- * Keith Whitwell <keithw@valinux.com>
+ * Brian Paul
+ * Keith Whitwell <keith@tungstengraphics.com>
*/
#include "colormac.h"
#include "context.h"
#include "macros.h"
-#include "mmath.h"
-#include "mem.h"
+#include "imports.h"
#include "mtypes.h"
#include "math/m_xform.h"
/* Per-texunit derived state.
*/
- GLuint TexgenSize[MAX_TEXTURE_UNITS];
- GLuint TexgenHoles[MAX_TEXTURE_UNITS];
- texgen_func TexgenFunc[MAX_TEXTURE_UNITS];
+ GLuint TexgenSize[MAX_TEXTURE_COORD_UNITS];
+ GLuint TexgenHoles[MAX_TEXTURE_COORD_UNITS];
+ texgen_func TexgenFunc[MAX_TEXTURE_COORD_UNITS];
/* Temporary values used in texgen.
*/
/* Buffered outputs of the stage.
*/
- GLvector4f texcoord[MAX_TEXTURE_UNITS];
+ GLvector4f texcoord[MAX_TEXTURE_COORD_UNITS];
};
fz = f[i][2] = u[2] - norm[2] * two_nu;
m[i] = fx * fx + fy * fy + (fz + 1.0F) * (fz + 1.0F);
if (m[i] != 0.0F) {
- m[i] = 0.5F / (GLfloat) GL_SQRT(m[i]);
+ m[i] = 0.5F * _mesa_inv_sqrtf(m[i]);
}
}
}
fz = f[i][2] = u[2] - norm[2] * two_nu;
m[i] = fx * fx + fy * fy + (fz + 1.0F) * (fz + 1.0F);
if (m[i] != 0.0F) {
- m[i] = 0.5F / (GLfloat) GL_SQRT(m[i]);
+ m[i] = 0.5F * _mesa_inv_sqrtf(m[i]);
}
}
}
GLuint count = VB->Count;
GLfloat (*f)[3] = store->tmp_f;
GLfloat *m = store->tmp_m;
- GLuint holes = 0;
+ GLuint holes = 0;
if (texUnit->_GenFlags & TEXGEN_NEED_M) {
}
if (holes) {
+ if (holes & VEC_DIRTY_3) _mesa_vector4f_clean_elem(out, count, 3);
if (holes & VEC_DIRTY_2) _mesa_vector4f_clean_elem(out, count, 2);
if (holes & VEC_DIRTY_1) _mesa_vector4f_clean_elem(out, count, 1);
if (holes & VEC_DIRTY_0) _mesa_vector4f_clean_elem(out, count, 0);
GLuint i;
if (store) {
- for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++)
+ for (i = 0 ; i < MAX_TEXTURE_COORD_UNITS ; i++)
if (store->texcoord[i].data)
_mesa_vector4f_free( &store->texcoord[i] );