diff options
author | Brian Paul <[email protected]> | 2000-10-20 19:54:49 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2000-10-20 19:54:49 +0000 |
commit | d475730357ff1595470fbe9856b2c88ad0a771ca (patch) | |
tree | 4e08bd0daca110c84d6deaeff942a5adc1076890 /src/mesa | |
parent | a2d2aed64aebcce9cb3aa777628bc14a08f595aa (diff) |
Changes for multitexture > 3, code clean-ups.
Added GLboolean ctx->Texture.MultiTextureEnabled to determine when
multitexture is enabled. Eventually ctx->Texture.ReallyEnabled may
become a boolean.
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/context.c | 12 | ||||
-rw-r--r-- | src/mesa/main/lines.c | 6 | ||||
-rw-r--r-- | src/mesa/main/points.c | 10 | ||||
-rw-r--r-- | src/mesa/main/state.c | 7 | ||||
-rw-r--r-- | src/mesa/main/varray.c | 18 |
5 files changed, 39 insertions, 14 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 34180a78c23..3f4bcec2fb5 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1,4 +1,4 @@ -/* $Id: context.c,v 1.92 2000/10/09 22:42:40 brianp Exp $ */ +/* $Id: context.c,v 1.93 2000/10/20 19:54:49 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -882,8 +882,14 @@ init_attrib_groups( GLcontext *ctx ) ASSIGN_3V( ctx->Current.Normal, 0.0, 0.0, 1.0 ); ctx->Current.Primitive = (GLenum) (GL_POLYGON + 1); - ctx->Current.Flag = (VERT_NORM|VERT_INDEX|VERT_RGBA|VERT_EDGE| - VERT_TEX0_1|VERT_TEX1_1|VERT_MATERIAL); + ctx->Current.Flag = (VERT_NORM | + VERT_INDEX | + VERT_RGBA | + VERT_EDGE | + VERT_TEX0_1 | + VERT_TEX1_1 | + VERT_TEX2_1 | /* XXX fix for MAX_TEXTURE_UNITS > 3 */ + VERT_MATERIAL); init_fallback_arrays( ctx ); diff --git a/src/mesa/main/lines.c b/src/mesa/main/lines.c index 7330ea573bd..41d3262eadf 100644 --- a/src/mesa/main/lines.c +++ b/src/mesa/main/lines.c @@ -1,4 +1,4 @@ -/* $Id: lines.c,v 1.15 2000/09/30 18:42:29 brianp Exp $ */ +/* $Id: lines.c,v 1.16 2000/10/20 19:54:49 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1086,7 +1086,7 @@ void gl_set_line_function( GLcontext *ctx ) /* antialiased lines */ if (rgbmode) { if (ctx->Texture.ReallyEnabled) { - if (ctx->Texture.ReallyEnabled >= TEXTURE1_1D + if (ctx->Texture.MultiTextureEnabled || ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) /* Multitextured! */ ctx->Driver.LineFunc = aa_multitex_rgba_line; @@ -1101,7 +1101,7 @@ void gl_set_line_function( GLcontext *ctx ) } } else if (ctx->Texture.ReallyEnabled) { - if (ctx->Texture.ReallyEnabled >= TEXTURE1_1D + if (ctx->Texture.MultiTextureEnabled || ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) { /* multi-texture and/or separate specular color */ if (ctx->Light.ShadeModel==GL_SMOOTH) diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c index 75f12443010..0ab383bc9d6 100644 --- a/src/mesa/main/points.c +++ b/src/mesa/main/points.c @@ -1,4 +1,4 @@ -/* $Id: points.c,v 1.14 2000/09/29 16:58:44 brianp Exp $ */ +/* $Id: points.c,v 1.15 2000/10/20 19:54:49 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -590,7 +590,7 @@ antialiased_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) /* coverage is in [0,256] */ alpha = (alpha * coverage) >> 8; } - if (ctx->Texture.ReallyEnabled >= TEXTURE1_1D) { + if (ctx->Texture.MultiTextureEnabled) { PB_WRITE_MULTITEX_PIXEL( PB, x,y,z, red, green, blue, alpha, texcoord ); } @@ -974,7 +974,7 @@ dist_atten_textured_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) for (iy = y0; iy <= y1; iy++) { for (ix = x0; ix <= x1; ix++) { - if (ctx->Texture.ReallyEnabled >= TEXTURE1_1D) { + if (ctx->Texture.MultiTextureEnabled) { PB_WRITE_MULTITEX_PIXEL( PB, ix, iy, z, red, green, blue, alpha, texcoord ); @@ -1092,7 +1092,7 @@ dist_atten_antialiased_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) alpha = (alpha * coverage) >> 8; } alpha = (GLint) (alpha * alphaf); - if (ctx->Texture.ReallyEnabled >= TEXTURE1_1D) { + if (ctx->Texture.MultiTextureEnabled) { PB_WRITE_MULTITEX_PIXEL( PB, x, y, z, red, green, blue, alpha, texcoord ); @@ -1230,7 +1230,7 @@ void gl_set_point_function( GLcontext *ctx ) ctx->Driver.PointsFunc = antialiased_rgba_points; } else if (ctx->Texture.ReallyEnabled) { - if (ctx->Texture.ReallyEnabled >= TEXTURE1_1D || + if (ctx->Texture.MultiTextureEnabled || ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) { ctx->Driver.PointsFunc = multitextured_rgba_points; } diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index eeb73634549..bc0e0142139 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1,4 +1,4 @@ -/* $Id: state.c,v 1.31 2000/10/18 15:02:59 brianp Exp $ */ +/* $Id: state.c,v 1.32 2000/10/20 19:54:49 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -853,6 +853,7 @@ void gl_update_state( GLcontext *ctx ) } if (ctx->NewState & (NEW_TEXTURING | NEW_TEXTURE_ENABLE)) { + ctx->Texture.MultiTextureEnabled = GL_FALSE; ctx->Texture.NeedNormals = GL_FALSE; gl_update_dirty_texobjs(ctx); ctx->Enabled &= ~(ENABLE_TEXGEN0 | ENABLE_TEXGEN1 | ENABLE_TEXGEN2); @@ -877,6 +878,10 @@ void gl_update_state( GLcontext *ctx ) ctx->Texture.NeedEyeCoords = GL_TRUE; } } + + if (i > 0 && ctx->Texture.Unit[i].ReallyEnabled) { + ctx->Texture.MultiTextureEnabled = GL_TRUE; + } } } diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 62e5019dc92..78cff94bd00 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -1,4 +1,4 @@ -/* $Id: varray.c,v 1.24 2000/10/18 15:02:59 brianp Exp $ */ +/* $Id: varray.c,v 1.25 2000/10/20 19:54:49 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -490,11 +490,18 @@ void gl_exec_array_elements( GLcontext *ctx, struct immediate *IM, #if MAX_TEXTURE_UNITS > 2 if (translate & VERT_TEX2_ANY) - (ctx->Array.TexCoordEltFunc[1])( IM->TexCoord[2], + (ctx->Array.TexCoordEltFunc[2])( IM->TexCoord[2], &ctx->Array.TexCoord[2], flags, elts, (VERT_ELT|VERT_TEX2_ANY), start, count); #endif +#if MAX_TEXTURE_UNITS > 3 + if (translate & VERT_TEX3_ANY) + (ctx->Array.TexCoordEltFunc[3])( IM->TexCoord[3], + &ctx->Array.TexCoord[3], + flags, elts, (VERT_ELT|VERT_TEX3_ANY), + start, count); +#endif for (i = start ; i < count ; i++) if (flags[i] & VERT_ELT) @@ -711,6 +718,13 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count) TexCoord[2], start, n ); } #endif +#if MAX_TEXTURE_UNITS > 3 + if (required & VERT_TEX3_ANY) { + IM->v.TexCoord[3].size = TexCoord[3]->Size; + ctx->Array.TexCoordFunc[3]( IM->TexCoord[3] + VB_START, + TexCoord[3], start, n ); + } +#endif VB->ObjPtr = &IM->v.Obj; VB->NormalPtr = &IM->v.Normal; |