From 2655e68504786b62a8463d04eaa74a953e5d2871 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 11 Oct 2003 16:34:32 +0000 Subject: fix some sphere texgen bugs (reported by Daniel Borca) --- src/mesa/tnl/t_vb_texgen.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/tnl/t_vb_texgen.c b/src/mesa/tnl/t_vb_texgen.c index 22cb07edf3..a9ae9cc999 100644 --- a/src/mesa/tnl/t_vb_texgen.c +++ b/src/mesa/tnl/t_vb_texgen.c @@ -319,6 +319,7 @@ static void texgen_sphere_map( GLcontext *ctx, GLfloat (*f)[3] = store->tmp_f; GLfloat *m = store->tmp_m; + /* _mesa_debug(NULL, "%s normstride %d eyestride %d\n", */ /* __FUNCTION__, VB->NormalPtr->stride, */ /* VB->EyePtr->stride); */ @@ -356,22 +357,20 @@ static void texgen( GLcontext *ctx, struct vertex_buffer *VB = &tnl->vb; GLvector4f *in = VB->TexCoordPtr[unit]; GLvector4f *out = &store->texcoord[unit]; - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; const GLvector4f *obj = VB->ObjPtr; const GLvector4f *eye = VB->EyePtr; const GLvector4f *normal = VB->NormalPtr; + const GLfloat *m = store->tmp_m; + const GLuint count = VB->Count; GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->data; - GLfloat *indata; - GLuint count = VB->Count; GLfloat (*f)[3] = store->tmp_f; - GLfloat *m = store->tmp_m; GLuint holes = 0; - if (texUnit->_GenFlags & TEXGEN_NEED_M) { - build_m_tab[in->size]( store->tmp_f, store->tmp_m, normal, eye ); + build_m_tab[eye->size]( store->tmp_f, store->tmp_m, normal, eye ); } else if (texUnit->_GenFlags & TEXGEN_NEED_F) { - build_f_tab[in->size]( (GLfloat *)store->tmp_f, 3, normal, eye ); + build_f_tab[eye->size]( (GLfloat *)store->tmp_f, 3, normal, eye ); } if (!in) { @@ -417,8 +416,8 @@ static void texgen( GLcontext *ctx, texUnit->EyePlaneS ); break; case GL_SPHERE_MAP: - for (indata=in->start,i=0 ; istride)) - texcoord[i][0] = indata[0] * m[i] + 0.5F; + for (i = 0; i < count; i++) + texcoord[i][0] = f[i][0] * m[i] + 0.5F; break; case GL_REFLECTION_MAP_NV: for (i=0;iEyePlaneT ); break; case GL_SPHERE_MAP: - for (indata=in->start,i=0; istride)) - texcoord[i][1] = indata[1] * m[i] + 0.5F; + for (i = 0; i < count; i++) + texcoord[i][1] = f[i][1] * m[i] + 0.5F; break; case GL_REFLECTION_MAP_NV: for (i=0;iTexgenSize[i] = sz; store->TexgenHoles[i] = (all_bits[sz] & ~texUnit->TexGenEnabled); - store->TexgenFunc[i] = texgen; + store->TexgenFunc[i] = texgen; /* general solution */ + /* look for special texgen cases */ if (texUnit->TexGenEnabled == (S_BIT|T_BIT|R_BIT)) { if (texUnit->_GenFlags == TEXGEN_REFLECTION_MAP_NV) { store->TexgenFunc[i] = texgen_reflection_map_nv; -- cgit v1.2.3