diff options
Diffstat (limited to 'xc/extras/Mesa/src/tnl/t_vb_texgen.c')
-rw-r--r-- | xc/extras/Mesa/src/tnl/t_vb_texgen.c | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/xc/extras/Mesa/src/tnl/t_vb_texgen.c b/xc/extras/Mesa/src/tnl/t_vb_texgen.c index 1e78644fa..25ae2bcd5 100644 --- a/xc/extras/Mesa/src/tnl/t_vb_texgen.c +++ b/xc/extras/Mesa/src/tnl/t_vb_texgen.c @@ -1,4 +1,3 @@ -/* $Id: t_vb_texgen.c,v 1.1.1.1 2002/10/22 13:06:26 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -24,8 +23,8 @@ * 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> */ @@ -34,7 +33,7 @@ #include "context.h" #include "macros.h" #include "mmath.h" -#include "mem.h" +#include "imports.h" #include "mtypes.h" #include "math/m_xform.h" @@ -95,7 +94,7 @@ static GLuint all_bits[5] = { static void build_m3( GLfloat f[][3], GLfloat m[], - const GLvector3f *normal, + const GLvector4f *normal, const GLvector4f *eye ) { GLuint stride = eye->stride; @@ -122,7 +121,7 @@ static void build_m3( GLfloat f[][3], GLfloat m[], static void build_m2( GLfloat f[][3], GLfloat m[], - const GLvector3f *normal, + const GLvector4f *normal, const GLvector4f *eye ) { GLuint stride = eye->stride; @@ -152,7 +151,7 @@ static void build_m2( GLfloat f[][3], GLfloat m[], typedef void (*build_m_func)( GLfloat f[][3], GLfloat m[], - const GLvector3f *normal, + const GLvector4f *normal, const GLvector4f *eye ); @@ -171,7 +170,7 @@ static build_m_func build_m_tab[5] = { */ static void build_f3( GLfloat *f, GLuint fstride, - const GLvector3f *normal, + const GLvector4f *normal, const GLvector4f *eye ) { GLuint stride = eye->stride; @@ -198,7 +197,7 @@ static void build_f3( GLfloat *f, static void build_f2( GLfloat *f, GLuint fstride, - const GLvector3f *normal, + const GLvector4f *normal, const GLvector4f *eye ) { GLuint stride = eye->stride; @@ -226,7 +225,7 @@ static void build_f2( GLfloat *f, typedef void (*build_f_func)( GLfloat *f, GLuint fstride, - const GLvector3f *normal_vec, + const GLvector4f *normal_vec, const GLvector4f *eye ); @@ -281,7 +280,7 @@ static void texgen_normal_map_nv( GLcontext *ctx, struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; GLvector4f *in = VB->TexCoordPtr[unit]; GLvector4f *out = &store->texcoord[unit]; - GLvector3f *normal = VB->NormalPtr; + GLvector4f *normal = VB->NormalPtr; GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->start; GLuint count = VB->Count; GLuint i; @@ -322,7 +321,7 @@ static void texgen_sphere_map( GLcontext *ctx, GLfloat (*f)[3] = store->tmp_f; GLfloat *m = store->tmp_m; -/* fprintf(stderr, "%s normstride %d eyestride %d\n", */ +/* _mesa_debug(NULL, "%s normstride %d eyestride %d\n", */ /* __FUNCTION__, VB->NormalPtr->stride, */ /* VB->EyePtr->stride); */ @@ -362,7 +361,7 @@ static void texgen( GLcontext *ctx, struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; const GLvector4f *obj = VB->ObjPtr; const GLvector4f *eye = VB->EyePtr; - const GLvector3f *normal = VB->NormalPtr; + const GLvector4f *normal = VB->NormalPtr; GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->data; GLfloat *indata; GLuint count = VB->Count; @@ -529,7 +528,7 @@ static GLboolean run_texgen_stage( GLcontext *ctx, for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) if (ctx->Texture._TexGenEnabled & ENABLE_TEXGEN(i)) { - if (stage->changed_inputs & (VERT_EYE | VERT_NORM | VERT_TEX(i))) + if (stage->changed_inputs & (VERT_BIT_EYE | VERT_BIT_NORMAL | VERT_BIT_TEX(i))) store->TexgenFunc[i]( ctx, store, i ); VB->TexCoordPtr[i] = &store->texcoord[i]; @@ -591,28 +590,28 @@ static void check_texgen( GLcontext *ctx, struct gl_pipeline_stage *stage ) GLuint i; stage->active = 0; - if (ctx->Texture._TexGenEnabled) { + if (ctx->Texture._TexGenEnabled && !ctx->VertexProgram.Enabled) { GLuint inputs = 0; GLuint outputs = 0; if (ctx->Texture._GenFlags & TEXGEN_OBJ_LINEAR) - inputs |= VERT_OBJ; + inputs |= VERT_BIT_POS; if (ctx->Texture._GenFlags & TEXGEN_NEED_EYE_COORD) - inputs |= VERT_EYE; + inputs |= VERT_BIT_EYE; if (ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS) - inputs |= VERT_NORM; + inputs |= VERT_BIT_NORMAL; for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) if (ctx->Texture._TexGenEnabled & ENABLE_TEXGEN(i)) { - outputs |= VERT_TEX(i); + outputs |= VERT_BIT_TEX(i); /* Need the original input in case it contains a Q coord: * (sigh) */ - inputs |= VERT_TEX(i); + inputs |= VERT_BIT_TEX(i); /* Something for Feedback? */ } @@ -678,11 +677,14 @@ static void free_texgen_data( struct gl_pipeline_stage *stage ) const struct gl_pipeline_stage _tnl_texgen_stage = { - "texgen", + "texgen", /* name */ _NEW_TEXTURE, /* when to call check() */ _NEW_TEXTURE, /* when to invalidate stored data */ - 0,0,0, /* active, inputs, outputs */ - 0,0, /* changed_inputs, private */ + GL_FALSE, /* active? */ + 0, /* inputs */ + 0, /* outputs */ + 0, /* changed_inputs */ + NULL, /* private data */ free_texgen_data, /* destructor */ check_texgen, /* check */ alloc_texgen_data /* run -- initially set to alloc data */ |