EXT_secondary_color is disabled until we get some dispatch offsets from SGI.tags/mesa_3_5
| @@ -886,6 +886,7 @@ void fxDDInitExtensions( GLcontext *ctx ) | |||
| gl_extensions_disable(ctx, "GL_EXT_blend_minmax"); | |||
| gl_extensions_disable(ctx, "GL_EXT_blend_subtract"); | |||
| gl_extensions_disable(ctx, "GL_EXT_blend_color"); | |||
| gl_extensions_disable(ctx, "GL_EXT_fog_coord"); | |||
| gl_extensions_add(ctx, DEFAULT_ON, "3DFX_set_global_palette", 0); | |||
| @@ -1,4 +1,4 @@ | |||
| /* $Id: clip.c,v 1.9 2000/09/26 20:53:53 brianp Exp $ */ | |||
| /* $Id: clip.c,v 1.10 2000/10/27 16:44:40 keithw Exp $ */ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| @@ -396,7 +396,7 @@ void gl_update_clipmask( GLcontext *ctx ) | |||
| mask |= CLIP_INDEX1; | |||
| } | |||
| if (ctx->FogMode == FOG_FRAGMENT && (ctx->TriangleCaps & DD_CLIP_FOG_COORD)) | |||
| if (ctx->Fog.Enabled) | |||
| mask |= CLIP_FOG_COORD; | |||
| ctx->ClipInterpFunc = clip_interp_tab[mask]; | |||
| @@ -1,4 +1,4 @@ | |||
| /* $Id: context.c,v 1.95 2000/10/23 00:16:28 gareth Exp $ */ | |||
| /* $Id: context.c,v 1.96 2000/10/27 16:44:40 keithw Exp $ */ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| @@ -698,6 +698,22 @@ init_fallback_arrays( GLcontext *ctx ) | |||
| cl->Ptr = (void *) ctx->Current.ByteColor; | |||
| cl->Enabled = 1; | |||
| cl = &ctx->Fallback.SecondaryColor; | |||
| cl->Size = 3; | |||
| cl->Type = GL_UNSIGNED_BYTE; | |||
| cl->Stride = 0; | |||
| cl->StrideB = 0; | |||
| cl->Ptr = (void *) ctx->Current.SecondaryColor; | |||
| cl->Enabled = 1; | |||
| cl = &ctx->Fallback.FogCoord; | |||
| cl->Size = 1; | |||
| cl->Type = GL_FLOAT; | |||
| cl->Stride = 0; | |||
| cl->StrideB = 0; | |||
| cl->Ptr = (void *) &ctx->Current.FogCoord; | |||
| cl->Enabled = 1; | |||
| cl = &ctx->Fallback.Index; | |||
| cl->Size = 1; | |||
| cl->Type = GL_UNSIGNED_INT; | |||
| @@ -887,6 +903,8 @@ init_attrib_groups( GLcontext *ctx ) | |||
| ctx->Current.Flag = (VERT_NORM | | |||
| VERT_INDEX | | |||
| VERT_RGBA | | |||
| VERT_SPEC_RGB | | |||
| VERT_FOG_COORD | | |||
| VERT_EDGE | | |||
| VERT_TEX0_1 | | |||
| VERT_TEX1_1 | | |||
| @@ -969,6 +987,8 @@ init_attrib_groups( GLcontext *ctx ) | |||
| ctx->Fog.Density = 1.0; | |||
| ctx->Fog.Start = 0.0; | |||
| ctx->Fog.End = 1.0; | |||
| ctx->Fog.ColorSumEnabled = GL_FALSE; | |||
| ctx->Fog.FogCoordinateSource = GL_FRAGMENT_DEPTH_EXT; | |||
| /* Hint group */ | |||
| ctx->Hint.PerspectiveCorrection = GL_DONT_CARE; | |||
| @@ -1,4 +1,4 @@ | |||
| /* $Id: dlist.c,v 1.46 2000/09/26 20:53:53 brianp Exp $ */ | |||
| /* $Id: dlist.c,v 1.47 2000/10/27 16:44:40 keithw Exp $ */ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| @@ -5076,6 +5076,10 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ) | |||
| table->FeedbackBuffer = _mesa_FeedbackBuffer; | |||
| table->Finish = _mesa_Finish; | |||
| table->Flush = _mesa_Flush; | |||
| table->FogCoordfEXT = _mesa_FogCoordfEXT; | |||
| table->FogCoordfvEXT = _mesa_FogCoordfvEXT; | |||
| table->FogCoorddEXT = _mesa_FogCoorddEXT; | |||
| table->FogCoorddvEXT = _mesa_FogCoorddvEXT; | |||
| table->Fogf = save_Fogf; | |||
| table->Fogfv = save_Fogfv; | |||
| table->Fogi = save_Fogi; | |||
| @@ -5226,6 +5230,26 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ) | |||
| table->Scaled = save_Scaled; | |||
| table->Scalef = save_Scalef; | |||
| table->Scissor = save_Scissor; | |||
| #if 0 | |||
| table->SecondaryColor3fEXT = _mesa_SecondaryColor3bEXT; | |||
| table->SecondaryColor3fvEXT = _mesa_SecondaryColor3bvEXT; | |||
| table->SecondaryColor3dEXT = _mesa_SecondaryColor3sEXT; | |||
| table->SecondaryColordvEXT = _mesa_SecondaryColor3svEXT; | |||
| table->SecondaryColor3fEXT = _mesa_SecondaryColor3iEXT; | |||
| table->SecondaryColor3fvEXT = _mesa_SecondaryColor3ivEXT; | |||
| table->SecondaryColor3dEXT = _mesa_SecondaryColor3fEXT; | |||
| table->SecondaryColordvEXT = _mesa_SecondaryColor3fvEXT; | |||
| table->SecondaryColor3fEXT = _mesa_SecondaryColor3dEXT; | |||
| table->SecondaryColor3fvEXT = _mesa_SecondaryColor3dvEXT; | |||
| table->SecondaryColor3dEXT = _mesa_SecondaryColor3ubEXT; | |||
| table->SecondaryColordvEXT = _mesa_SecondaryColor3ubvEXT; | |||
| table->SecondaryColor3fEXT = _mesa_SecondaryColor3usEXT; | |||
| table->SecondaryColor3fvEXT = _mesa_SecondaryColor3usvEXT; | |||
| table->SecondaryColor3dEXT = _mesa_SecondaryColor3uiEXT; | |||
| table->SecondaryColordvEXT = _mesa_SecondaryColor3uivEXT; | |||
| #endif | |||
| table->SelectBuffer = _mesa_SelectBuffer; | |||
| table->ShadeModel = save_ShadeModel; | |||
| table->StencilFunc = save_StencilFunc; | |||
| @@ -1,4 +1,4 @@ | |||
| /* $Id: drawpix.c,v 1.38 2000/10/17 00:42:02 brianp Exp $ */ | |||
| /* $Id: drawpix.c,v 1.39 2000/10/27 16:44:40 keithw Exp $ */ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| @@ -239,7 +239,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, | |||
| GLint row; | |||
| for (row=0; row<drawHeight; row++) { | |||
| gl_write_zoomed_rgba_span(ctx, drawWidth, destX, destY, | |||
| zSpan, (void *) src, zoomY0); | |||
| zSpan, 0, (void *) src, zoomY0); | |||
| src += rowLength * 4; | |||
| destY++; | |||
| } | |||
| @@ -276,7 +276,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, | |||
| GLint row; | |||
| for (row=0; row<drawHeight; row++) { | |||
| gl_write_zoomed_rgb_span(ctx, drawWidth, destX, destY, | |||
| zSpan, (void *) src, zoomY0); | |||
| zSpan, 0, (void *) src, zoomY0); | |||
| src += rowLength * 3; | |||
| destY++; | |||
| } | |||
| @@ -335,7 +335,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, | |||
| rgb[i][2] = src[i]; | |||
| } | |||
| gl_write_zoomed_rgb_span(ctx, drawWidth, destX, destY, | |||
| zSpan, (void *) rgb, zoomY0); | |||
| zSpan, 0, (void *) rgb, zoomY0); | |||
| src += rowLength; | |||
| destY++; | |||
| } | |||
| @@ -400,7 +400,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, | |||
| rgba[i][3] = *ptr++; | |||
| } | |||
| gl_write_zoomed_rgba_span(ctx, drawWidth, destX, destY, | |||
| zSpan, (void *) rgba, zoomY0); | |||
| zSpan, 0, (void *) rgba, zoomY0); | |||
| src += rowLength*2; | |||
| destY++; | |||
| } | |||
| @@ -447,7 +447,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, | |||
| ASSERT(drawWidth < MAX_WIDTH); | |||
| _mesa_map_ci8_to_rgba(ctx, drawWidth, src, rgba); | |||
| gl_write_zoomed_rgba_span(ctx, drawWidth, destX, destY, | |||
| zSpan, (void *) rgba, zoomY0); | |||
| zSpan, 0, (void *) rgba, zoomY0); | |||
| src += rowLength; | |||
| destY++; | |||
| } | |||
| @@ -520,10 +520,10 @@ draw_index_pixels( GLcontext *ctx, GLint x, GLint y, | |||
| type, source, &ctx->Unpack, | |||
| ctx->ImageTransferState); | |||
| if (zoom) { | |||
| gl_write_zoomed_index_span(ctx, drawWidth, x, y, zspan, indexes, desty); | |||
| gl_write_zoomed_index_span(ctx, drawWidth, x, y, zspan, 0, indexes, desty); | |||
| } | |||
| else { | |||
| gl_write_index_span(ctx, drawWidth, x, y, zspan, indexes, GL_BITMAP); | |||
| gl_write_index_span(ctx, drawWidth, x, y, zspan, 0, indexes, GL_BITMAP); | |||
| } | |||
| } | |||
| } | |||
| @@ -643,7 +643,7 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, | |||
| GLint i; | |||
| for (i = 0; i < width; i++) | |||
| zspan[i] = zptr[i]; | |||
| gl_write_rgba_span( ctx, width, x, y, zspan, rgba, GL_BITMAP ); | |||
| gl_write_rgba_span( ctx, width, x, y, zspan, 0, rgba, GL_BITMAP ); | |||
| } | |||
| } | |||
| else if (type==GL_UNSIGNED_INT && ctx->Visual.DepthBits == 32 | |||
| @@ -653,7 +653,7 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, | |||
| for (row = 0; row < height; row++, y++) { | |||
| const GLuint *zptr = _mesa_image_address(&ctx->Unpack, | |||
| pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0); | |||
| gl_write_rgba_span( ctx, width, x, y, zptr, rgba, GL_BITMAP ); | |||
| gl_write_rgba_span( ctx, width, x, y, zptr, 0, rgba, GL_BITMAP ); | |||
| } | |||
| } | |||
| else { | |||
| @@ -667,20 +667,21 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, | |||
| &ctx->Unpack, ctx->ImageTransferState ); | |||
| if (ctx->Visual.RGBAflag) { | |||
| if (zoom) { | |||
| gl_write_zoomed_rgba_span(ctx, width, x, y, zspan, | |||
| gl_write_zoomed_rgba_span(ctx, width, x, y, zspan, 0, | |||
| (const GLubyte (*)[4])rgba, desty); | |||
| } | |||
| else { | |||
| gl_write_rgba_span(ctx, width, x, y, zspan, rgba, GL_BITMAP); | |||
| gl_write_rgba_span(ctx, width, x, y, zspan, 0, rgba, GL_BITMAP); | |||
| } | |||
| } | |||
| else { | |||
| if (zoom) { | |||
| gl_write_zoomed_index_span(ctx, width, x, y, zspan, | |||
| gl_write_zoomed_index_span(ctx, width, x, y, zspan, 0, | |||
| ispan, GL_BITMAP); | |||
| } | |||
| else { | |||
| gl_write_index_span(ctx, width, x, y, zspan, ispan, GL_BITMAP); | |||
| gl_write_index_span(ctx, width, x, y, zspan, 0, | |||
| ispan, GL_BITMAP); | |||
| } | |||
| } | |||
| @@ -827,11 +828,12 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, | |||
| (CONST GLubyte (*)[]) rgba, NULL); | |||
| } | |||
| else if (zoom) { | |||
| gl_write_zoomed_rgba_span( ctx, width, x, y, zspan, | |||
| gl_write_zoomed_rgba_span( ctx, width, x, y, zspan, 0, | |||
| (CONST GLubyte (*)[]) rgba, desty ); | |||
| } | |||
| else { | |||
| gl_write_rgba_span( ctx, (GLuint) width, x, y, zspan, rgba, GL_BITMAP); | |||
| gl_write_rgba_span( ctx, (GLuint) width, x, y, zspan, 0, | |||
| rgba, GL_BITMAP); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,4 +1,4 @@ | |||
| /* $Id: enable.c,v 1.26 2000/10/21 01:29:12 brianp Exp $ */ | |||
| /* $Id: enable.c,v 1.27 2000/10/27 16:44:40 keithw Exp $ */ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| @@ -535,6 +535,16 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) | |||
| } | |||
| break; | |||
| /* GL_EXT_secondary_color */ | |||
| case GL_COLOR_SUM_EXT: | |||
| ctx->Fog.ColorSumEnabled = state; | |||
| if (state) | |||
| SET_BITS(ctx->TriangleCaps, DD_SEPERATE_SPECULAR); | |||
| else if (ctx->Light.Model.ColorControl == GL_SINGLE_COLOR) | |||
| CLEAR_BITS(ctx->TriangleCaps, DD_SEPERATE_SPECULAR); | |||
| ctx->NewState |= NEW_RASTER_OPS; | |||
| break; | |||
| default: | |||
| gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); | |||
| return; | |||
| @@ -815,6 +825,12 @@ client_state( GLcontext *ctx, GLenum cap, GLboolean state ) | |||
| case GL_EDGE_FLAG_ARRAY: | |||
| ctx->Array.EdgeFlag.Enabled = state; | |||
| break; | |||
| case GL_FOG_COORDINATE_ARRAY_EXT: | |||
| ctx->Array.FogCoord.Enabled = state; | |||
| break; | |||
| case GL_SECONDARY_COLOR_ARRAY_EXT: | |||
| ctx->Array.SecondaryColor.Enabled = state; | |||
| break; | |||
| default: | |||
| gl_error( ctx, GL_INVALID_ENUM, "glEnable/DisableClientState" ); | |||
| } | |||
| @@ -1,4 +1,4 @@ | |||
| /* $Id: extensions.c,v 1.36 2000/09/25 16:03:59 brianp Exp $ */ | |||
| /* $Id: extensions.c,v 1.37 2000/10/27 16:44:40 keithw Exp $ */ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| @@ -92,7 +92,12 @@ static struct { int enabled; const char *name; } default_extensions[] = { | |||
| { DEFAULT_ON, "GL_SGIS_pixel_texture" }, | |||
| { DEFAULT_ON, "GL_SGIS_texture_edge_clamp" }, | |||
| { DEFAULT_ON, "GL_SGIX_pixel_texture" }, | |||
| { DEFAULT_OFF, "GL_3DFX_texture_compression_FXT1" } | |||
| { DEFAULT_OFF, "GL_3DFX_texture_compression_FXT1" }, | |||
| { DEFAULT_OFF, "GL_EXT_secondary_color" }, | |||
| { DEFAULT_ON, "GL_EXT_fog_coord" }, | |||
| { DEFAULT_OFF, "GL_EXT_bgra" }, | |||
| { DEFAULT_OFF, "GL_EXT_cull_vertex" }, | |||
| }; | |||
| @@ -1,4 +1,4 @@ | |||
| /* $Id: fog.c,v 1.20 2000/09/26 20:53:53 brianp Exp $ */ | |||
| /* $Id: fog.c,v 1.21 2000/10/27 16:44:40 keithw Exp $ */ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| @@ -64,6 +64,7 @@ _mesa_Fogiv(GLenum pname, const GLint *params ) | |||
| case GL_FOG_START: | |||
| case GL_FOG_END: | |||
| case GL_FOG_INDEX: | |||
| case GL_FOG_COORDINATE_SOURCE_EXT: | |||
| p[0] = (GLfloat) *params; | |||
| break; | |||
| case GL_FOG_COLOR: | |||
| @@ -123,6 +124,14 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params ) | |||
| ctx->Fog.Color[2] = params[2]; | |||
| ctx->Fog.Color[3] = params[3]; | |||
| break; | |||
| case GL_FOG_COORDINATE_SOURCE_EXT: { | |||
| GLenum p = (GLenum)(GLint) *params; | |||
| if (p == GL_FOG_COORDINATE_EXT || p == GL_FRAGMENT_DEPTH_EXT) | |||
| ctx->Fog.FogCoordinateSource = p; | |||
| else | |||
| gl_error( ctx, GL_INVALID_ENUM, "glFog" ); | |||
| break; | |||
| } | |||
| default: | |||
| gl_error( ctx, GL_INVALID_ENUM, "glFog" ); | |||
| return; | |||
| @@ -136,157 +145,183 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params ) | |||
| } | |||
| typedef void (*fog_func)( struct vertex_buffer *VB, GLuint side, | |||
| GLubyte flag ); | |||
| typedef void (*fog_coord_func)( struct vertex_buffer *VB, | |||
| const GLvector4f *from, | |||
| GLubyte flag ); | |||
| static fog_func fog_ci_tab[2]; | |||
| static fog_func fog_rgba_tab[2]; | |||
| static fog_coord_func make_fog_coord_tab[2]; | |||
| /* | |||
| * Compute the fogged color for an array of vertices. | |||
| * Input: n - number of vertices | |||
| * v - array of vertices | |||
| * color - the original vertex colors | |||
| * Output: color - the fogged colors | |||
| * | |||
| */ | |||
| #define TAG(x) x##_raw | |||
| #define CULLCHECK | |||
| #define IDX 0 | |||
| #include "fog_tmp.h" | |||
| #define TAG(x) x##_masked | |||
| #define CULLCHECK if (cullmask[i]&flag) | |||
| #define IDX 1 | |||
| #include "fog_tmp.h" | |||
| void | |||
| _mesa_init_fog( void ) | |||
| { | |||
| init_fog_tab_masked(); | |||
| init_fog_tab_raw(); | |||
| } | |||
| static GLvector1f *get_fogcoord_ptr( GLcontext *ctx, GLvector1f *tmp ) | |||
| { | |||
| struct vertex_buffer *VB = ctx->VB; | |||
| if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT) { | |||
| if (!ctx->NeedEyeCoords) { | |||
| GLfloat *m = ctx->ModelView.m; | |||
| GLfloat plane[4]; | |||
| plane[0] = m[2]; | |||
| plane[1] = m[6]; | |||
| plane[2] = m[10]; | |||
| plane[3] = m[14]; | |||
| /* Full eye coords weren't required, just calculate the | |||
| * eye Z values. | |||
| */ | |||
| gl_dotprod_tab[0][VB->ObjPtr->size](&VB->Eye, 2, | |||
| VB->ObjPtr, plane, 0 ); | |||
| tmp->data = &(VB->Eye.data[0][2]); | |||
| tmp->start = VB->Eye.start+2; | |||
| tmp->stride = VB->Eye.stride; | |||
| return tmp; | |||
| } | |||
| else | |||
| { | |||
| if (VB->EyePtr->size < 2) | |||
| gl_vector4f_clean_elem( &VB->Eye, VB->Count, 2 ); | |||
| tmp->data = &(VB->EyePtr->data[0][2]); | |||
| tmp->start = VB->EyePtr->start+2; | |||
| tmp->stride = VB->EyePtr->stride; | |||
| return tmp; | |||
| } | |||
| } else | |||
| return VB->FogCoordPtr; | |||
| } | |||
| /* | |||
| * Compute fog for the vertices in the vertex buffer. | |||
| /* Use lookup table & interpolation? | |||
| */ | |||
| void | |||
| _mesa_fog_vertices( struct vertex_buffer *VB ) | |||
| static void | |||
| make_win_fog_coords( struct vertex_buffer *VB, | |||
| GLvector1f *fogcoord) | |||
| { | |||
| GLcontext *ctx = VB->ctx; | |||
| GLuint i = VB->CullMode & 1; | |||
| if (ctx->Visual.RGBAflag) { | |||
| /* Fog RGB colors */ | |||
| if (ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE) { | |||
| fog_rgba_tab[i]( VB, 0, VERT_FACE_FRONT ); | |||
| fog_rgba_tab[i]( VB, 1, VERT_FACE_REAR ); | |||
| } else { | |||
| fog_rgba_tab[i]( VB, 0, VERT_FACE_FRONT|VERT_FACE_REAR ); | |||
| const GLcontext *ctx = VB->ctx; | |||
| GLfloat end = ctx->Fog.End; | |||
| GLfloat *v = fogcoord->start; | |||
| GLuint stride = fogcoord->stride; | |||
| GLuint n = VB->Count - VB->Start; | |||
| GLfloat *out; | |||
| GLfloat d; | |||
| GLuint i; | |||
| VB->FogCoordPtr = VB->store.FogCoord; | |||
| out = VB->FogCoordPtr->data + VB->Start; | |||
| switch (ctx->Fog.Mode) { | |||
| case GL_LINEAR: | |||
| d = 1.0F / (ctx->Fog.End - ctx->Fog.Start); | |||
| for ( i = 0 ; i < n ; i++, STRIDE_F(v, stride)) { | |||
| out[i] = (end - ABSF(*v)) * d; | |||
| if (0) fprintf(stderr, "z %f out %f\n", *v, out[i]); | |||
| } | |||
| } | |||
| else { | |||
| /* Fog color indexes */ | |||
| if (ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE) { | |||
| fog_ci_tab[i]( VB, 0, VERT_FACE_FRONT ); | |||
| fog_ci_tab[i]( VB, 1, VERT_FACE_REAR ); | |||
| } else { | |||
| fog_ci_tab[i]( VB, 0, VERT_FACE_FRONT|VERT_FACE_REAR ); | |||
| break; | |||
| case GL_EXP: | |||
| d = -ctx->Fog.Density; | |||
| for ( i = 0 ; i < n ; i++, STRIDE_F(v,stride)) { | |||
| out[i] = exp( d*ABSF(*v) ); | |||
| if (0) fprintf(stderr, "z %f out %f\n", *v, out[i]); | |||
| } | |||
| break; | |||
| case GL_EXP2: | |||
| d = -(ctx->Fog.Density*ctx->Fog.Density); | |||
| for ( i = 0 ; i < n ; i++, STRIDE_F(v, stride)) { | |||
| GLfloat z = *v; | |||
| out[i] = exp( d*z*z ); | |||
| if (0) fprintf(stderr, "z %f out %f\n", *v, out[i]); | |||
| } | |||
| break; | |||
| default: | |||
| gl_problem(ctx, "Bad fog mode in make_fog_coord"); | |||
| return; | |||
| } | |||
| } | |||
| static void check_fog_coords( GLcontext *ctx, struct gl_pipeline_stage *d ) | |||
| void | |||
| _mesa_make_win_fog_coords( struct vertex_buffer *VB ) | |||
| { | |||
| d->type = 0; | |||
| GLvector1f tmp; | |||
| if (ctx->FogMode==FOG_FRAGMENT) | |||
| { | |||
| d->type = PIPE_IMMEDIATE|PIPE_PRECALC; | |||
| d->inputs = VERT_OBJ_ANY; | |||
| d->outputs = VERT_FOG_COORD; | |||
| } | |||
| make_win_fog_coords( VB, get_fogcoord_ptr( VB->ctx, &tmp ) ); | |||
| } | |||
| static void gl_make_fog_coords( struct vertex_buffer *VB ) | |||
| /* | |||
| * Apply fog to an array of RGBA pixels. | |||
| * Input: n - number of pixels | |||
| * fog - array of interpolated screen-space fog coordinates in [0..1] | |||
| * red, green, blue, alpha - pixel colors | |||
| * Output: red, green, blue, alpha - fogged pixel colors | |||
| */ | |||
| void | |||
| _mesa_fog_rgba_pixels( const GLcontext *ctx, | |||
| GLuint n, | |||
| const GLfixed fog[], | |||
| GLubyte rgba[][4] ) | |||
| { | |||
| GLcontext *ctx = VB->ctx; | |||
| /* If full eye coords weren't required, just calculate the eye Z | |||
| * values. | |||
| */ | |||
| if (!ctx->NeedEyeCoords) { | |||
| GLfloat *m = ctx->ModelView.m; | |||
| GLfloat plane[4]; | |||
| plane[0] = m[2]; | |||
| plane[1] = m[6]; | |||
| plane[2] = m[10]; | |||
| plane[3] = m[14]; | |||
| gl_dotprod_tab[0][VB->ObjPtr->size](&VB->Eye, | |||
| 2, /* fill z coordinates */ | |||
| VB->ObjPtr, | |||
| plane, | |||
| 0 ); | |||
| make_fog_coord_tab[0]( VB, &VB->Eye, 0 ); | |||
| } | |||
| else | |||
| { | |||
| make_fog_coord_tab[0]( VB, VB->EyePtr, 0 ); | |||
| GLfixed rFog = ctx->Fog.Color[0] * 255.0; | |||
| GLfixed gFog = ctx->Fog.Color[1] * 255.0; | |||
| GLfixed bFog = ctx->Fog.Color[2] * 255.0; | |||
| GLuint i; | |||
| for (i=0;i<n;i++) { | |||
| GLfixed f = CLAMP(fog[i], 0, FIXED_ONE); | |||
| GLfixed g = FIXED_ONE - f; | |||
| /* fprintf(stderr, "f %d/%f g %d ONE %d\n", f, f/(float)FIXED_ONE, g, FIXED_ONE); */ | |||
| rgba[i][0] = (f*rgba[i][0] + g*rFog) >> FIXED_SHIFT; | |||
| rgba[i][1] = (f*rgba[i][1] + g*gFog) >> FIXED_SHIFT; | |||
| rgba[i][2] = (f*rgba[i][2] + g*bFog) >> FIXED_SHIFT; | |||
| } | |||
| } | |||
| /* Drivers that want fog coordinates in VB->Spec[0] alpha, can substitute this | |||
| * stage for the default PIPE_OP_FOG pipeline stage. | |||
| */ | |||
| struct gl_pipeline_stage gl_fog_coord_stage = { | |||
| "build fog coordinates", | |||
| PIPE_OP_FOG, | |||
| PIPE_PRECALC|PIPE_IMMEDIATE, | |||
| 0, | |||
| NEW_FOG, | |||
| NEW_LIGHTING|NEW_RASTER_OPS|NEW_FOG|NEW_MODELVIEW, | |||
| 0, 0, | |||
| 0, 0, 0, | |||
| check_fog_coords, | |||
| gl_make_fog_coords | |||
| }; | |||
| /* | |||
| * Apply fog to an array of color index pixels. | |||
| * Input: n - number of pixels | |||
| * z - array of integer depth values | |||
| * index - pixel color indexes | |||
| * Output: index - fogged pixel color indexes | |||
| */ | |||
| void | |||
| _mesa_fog_ci_pixels( const GLcontext *ctx, | |||
| GLuint n, const GLfixed fog[], GLuint index[] ) | |||
| { | |||
| GLuint idx = ctx->Fog.Index; | |||
| GLuint i; | |||
| for (i=0;i<n;i++) { | |||
| GLfixed f = FixedToFloat(CLAMP(fog[i], 0, FIXED_ONE)); | |||
| index[i] = (GLuint) ((GLfloat) index[i] + (1.0F-f) * idx); | |||
| } | |||
| } | |||
| /* | |||
| * Apply fog to an array of RGBA pixels. | |||
| * Calculate fog coords from window z values | |||
| * Input: n - number of pixels | |||
| * z - array of integer depth values | |||
| * red, green, blue, alpha - pixel colors | |||
| * Output: red, green, blue, alpha - fogged pixel colors | |||
| * | |||
| * Use lookup table & interpolation? | |||
| */ | |||
| void | |||
| _mesa_fog_rgba_pixels( const GLcontext *ctx, | |||
| GLuint n, const GLdepth z[], GLubyte rgba[][4] ) | |||
| _mesa_win_fog_coords_from_z( const GLcontext *ctx, | |||
| GLuint n, | |||
| const GLdepth z[], | |||
| GLfixed fogcoord[] ) | |||
| { | |||
| GLfloat c = ctx->ProjectionMatrix.m[10]; | |||
| GLfloat d = ctx->ProjectionMatrix.m[14]; | |||
| GLuint i; | |||
| GLfloat rFog = ctx->Fog.Color[0] * 255.0F; | |||
| GLfloat gFog = ctx->Fog.Color[1] * 255.0F; | |||
| GLfloat bFog = ctx->Fog.Color[2] * 255.0F; | |||
| GLfloat tz = ctx->Viewport.WindowMap.m[MAT_TZ]; | |||
| GLfloat szInv = 1.0F / ctx->Viewport.WindowMap.m[MAT_SZ]; | |||
| @@ -298,14 +333,8 @@ _mesa_fog_rgba_pixels( const GLcontext *ctx, | |||
| for (i=0;i<n;i++) { | |||
| GLfloat ndcz = ((GLfloat) z[i] - tz) * szInv; | |||
| GLfloat eyez = -d / (c+ndcz); | |||
| GLfloat f, g; | |||
| if (eyez < 0.0) eyez = -eyez; | |||
| f = (fogEnd - eyez) * fogScale; | |||
| f = CLAMP( f, 0.0F, 1.0F ); | |||
| g = 1.0F - f; | |||
| rgba[i][RCOMP] = (GLint) (f * rgba[i][RCOMP] + g * rFog); | |||
| rgba[i][GCOMP] = (GLint) (f * rgba[i][GCOMP] + g * gFog); | |||
| rgba[i][BCOMP] = (GLint) (f * rgba[i][BCOMP] + g * bFog); | |||
| if (eyez < 0.0) eyez = -eyez; | |||
| fogcoord[i] = (fogEnd - eyez) * fogScale; | |||
| } | |||
| } | |||
| break; | |||
| @@ -313,14 +342,8 @@ _mesa_fog_rgba_pixels( const GLcontext *ctx, | |||
| for (i=0;i<n;i++) { | |||
| GLfloat ndcz = ((GLfloat) z[i] - tz) * szInv; | |||
| GLfloat eyez = d / (c+ndcz); | |||
| GLfloat f, g; | |||
| if (eyez < 0.0) | |||
| eyez = -eyez; | |||
| f = exp( -ctx->Fog.Density * eyez ); | |||
| g = 1.0F - f; | |||
| rgba[i][RCOMP] = (GLint) (f * rgba[i][RCOMP] + g * rFog); | |||
| rgba[i][GCOMP] = (GLint) (f * rgba[i][GCOMP] + g * gFog); | |||
| rgba[i][BCOMP] = (GLint) (f * rgba[i][BCOMP] + g * bFog); | |||
| if (eyez < 0.0) eyez = -eyez; | |||
| fogcoord[i] = exp( -ctx->Fog.Density * eyez ); | |||
| } | |||
| break; | |||
| case GL_EXP2: | |||
| @@ -329,29 +352,37 @@ _mesa_fog_rgba_pixels( const GLcontext *ctx, | |||
| for (i=0;i<n;i++) { | |||
| GLfloat ndcz = ((GLfloat) z[i] - tz) * szInv; | |||
| GLfloat eyez = d / (c+ndcz); | |||
| GLfloat f, g; | |||
| GLfloat tmp = negDensitySquared * eyez * eyez; | |||
| #ifdef __alpha__ | |||
| /* XXX this underflow check may be needed for other systems */ | |||
| if (tmp < FLT_MIN_10_EXP) | |||
| f = exp( FLT_MIN_10_EXP ); | |||
| else | |||
| tmp = FLT_MIN_10_EXP; | |||
| #endif | |||
| f = exp( tmp ); | |||
| g = 1.0F - f; | |||
| rgba[i][RCOMP] = (GLint) (f * rgba[i][RCOMP] + g * rFog); | |||
| rgba[i][GCOMP] = (GLint) (f * rgba[i][GCOMP] + g * gFog); | |||
| rgba[i][BCOMP] = (GLint) (f * rgba[i][BCOMP] + g * bFog); | |||
| fogcoord[i] = exp( tmp ); | |||
| } | |||
| } | |||
| break; | |||
| default: | |||
| gl_problem(ctx, "Bad fog mode in _mesa_fog_rgba_pixels"); | |||
| gl_problem(ctx, "Bad fog mode in _mesa_win_fog_coords_from_z"); | |||
| return; | |||
| } | |||
| } | |||
| /* | |||
| * Apply fog to an array of RGBA pixels. | |||
| * Input: n - number of pixels | |||
| * z - array of integer depth values | |||
| * red, green, blue, alpha - pixel colors | |||
| * Output: red, green, blue, alpha - fogged pixel colors | |||
| */ | |||
| void | |||
| _mesa_depth_fog_rgba_pixels( const GLcontext *ctx, | |||
| GLuint n, const GLdepth z[], GLubyte rgba[][4] ) | |||
| { | |||
| GLfixed fog[MAX_WIDTH]; | |||
| _mesa_win_fog_coords_from_z( ctx, n, z, fog ); | |||
| _mesa_fog_rgba_pixels( ctx, n, fog, rgba ); | |||
| } | |||
| /* | |||
| @@ -362,68 +393,11 @@ _mesa_fog_rgba_pixels( const GLcontext *ctx, | |||
| * Output: index - fogged pixel color indexes | |||
| */ | |||
| void | |||
| _mesa_fog_ci_pixels( const GLcontext *ctx, | |||
| _mesa_depth_fog_ci_pixels( const GLcontext *ctx, | |||
| GLuint n, const GLdepth z[], GLuint index[] ) | |||
| { | |||
| GLfloat c = ctx->ProjectionMatrix.m[10]; | |||
| GLfloat d = ctx->ProjectionMatrix.m[14]; | |||
| GLuint i; | |||
| GLfloat tz = ctx->Viewport.WindowMap.m[MAT_TZ]; | |||
| GLfloat szInv = 1.0F / ctx->Viewport.WindowMap.m[MAT_SZ]; | |||
| switch (ctx->Fog.Mode) { | |||
| case GL_LINEAR: | |||
| { | |||
| GLfloat fogEnd = ctx->Fog.End; | |||
| GLfloat fogScale = 1.0F / (ctx->Fog.End - ctx->Fog.Start); | |||
| for (i=0;i<n;i++) { | |||
| GLfloat ndcz = ((GLfloat) z[i] - tz) * szInv; | |||
| GLfloat eyez = -d / (c+ndcz); | |||
| GLfloat f; | |||
| if (eyez < 0.0) eyez = -eyez; | |||
| f = (fogEnd - eyez) * fogScale; | |||
| f = CLAMP( f, 0.0F, 1.0F ); | |||
| index[i] = (GLuint) ((GLfloat) index[i] + (1.0F-f) * ctx->Fog.Index); | |||
| } | |||
| } | |||
| break; | |||
| case GL_EXP: | |||
| for (i=0;i<n;i++) { | |||
| GLfloat ndcz = ((GLfloat) z[i] - tz) * szInv; | |||
| GLfloat eyez = -d / (c+ndcz); | |||
| GLfloat f; | |||
| if (eyez < 0.0) | |||
| eyez = -eyez; | |||
| f = exp( -ctx->Fog.Density * eyez ); | |||
| f = CLAMP( f, 0.0F, 1.0F ); | |||
| index[i] = (GLuint) ((GLfloat) index[i] + (1.0F-f) * ctx->Fog.Index); | |||
| } | |||
| break; | |||
| case GL_EXP2: | |||
| { | |||
| GLfloat negDensitySquared = -ctx->Fog.Density * ctx->Fog.Density; | |||
| for (i=0;i<n;i++) { | |||
| GLfloat ndcz = ((GLfloat) z[i] - tz) * szInv; | |||
| GLfloat eyez = -d / (c+ndcz); | |||
| GLfloat tmp, f; | |||
| if (eyez < 0.0) | |||
| eyez = -eyez; | |||
| tmp = negDensitySquared * eyez * eyez; | |||
| #ifdef __alpha__ | |||
| /* XXX this underflow check may be needed for other systems */ | |||
| if (tmp < FLT_MIN_10_EXP) | |||
| f = exp( FLT_MIN_10_EXP ); | |||
| else | |||
| #endif | |||
| f = exp( tmp ); | |||
| f = CLAMP( f, 0.0F, 1.0F ); | |||
| index[i] = (GLuint) ((GLfloat) index[i] + (1.0F-f) * ctx->Fog.Index); | |||
| } | |||
| } | |||
| break; | |||
| default: | |||
| gl_problem(ctx, "Bad fog mode in _mesa_fog_ci_pixels"); | |||
| return; | |||
| } | |||
| GLfixed fog[MAX_WIDTH]; | |||
| _mesa_win_fog_coords_from_z( ctx, n, z, fog ); | |||
| _mesa_fog_ci_pixels( ctx, n, fog, index ); | |||
| } | |||
| @@ -1,4 +1,4 @@ | |||
| /* $Id: fog.h,v 1.4 2000/04/05 22:08:54 brianp Exp $ */ | |||
| /* $Id: fog.h,v 1.5 2000/10/27 16:44:40 keithw Exp $ */ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| @@ -32,8 +32,6 @@ | |||
| #include "types.h" | |||
| extern struct gl_pipeline_stage gl_fog_coord_stage; | |||
| extern void | |||
| _mesa_Fogf(GLenum pname, GLfloat param); | |||
| @@ -57,12 +55,32 @@ _mesa_fog_vertices( struct vertex_buffer *VB ); | |||
| extern void | |||
| _mesa_fog_rgba_pixels( const GLcontext *ctx, | |||
| GLuint n, const GLdepth z[], | |||
| GLuint n, const GLfixed fog[], | |||
| GLubyte rgba[][4] ); | |||
| extern void | |||
| _mesa_fog_ci_pixels( const GLcontext *ctx, | |||
| GLuint n, const GLdepth z[], GLuint indx[] ); | |||
| GLuint n, const GLfixed fog[], GLuint indx[] ); | |||
| extern void | |||
| _mesa_make_win_fog_coords( struct vertex_buffer *VB ); | |||
| extern void | |||
| _mesa_win_fog_coords_from_z( const GLcontext *ctx, | |||
| GLuint n, | |||
| const GLdepth z[], | |||
| GLfixed fogcoord[] ); | |||
| extern void | |||
| _mesa_depth_fog_rgba_pixels( const GLcontext *ctx, | |||
| GLuint n, const GLdepth z[], GLubyte rgba[][4] ); | |||
| extern void | |||
| _mesa_depth_fog_ci_pixels( const GLcontext *ctx, | |||
| GLuint n, const GLdepth z[], GLuint index[] ); | |||
| extern void | |||
| @@ -1,4 +1,4 @@ | |||
| /* $Id: get.c,v 1.34 2000/09/26 20:53:53 brianp Exp $ */ | |||
| /* $Id: get.c,v 1.35 2000/10/27 16:44:40 keithw Exp $ */ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| @@ -58,6 +58,7 @@ | |||
| #endif | |||
| static GLenum | |||
| pixel_texgen_mode(const GLcontext *ctx) | |||
| { | |||
| @@ -1228,6 +1229,42 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) | |||
| case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: | |||
| *params = ctx->Pixel.PostColorMatrixColorTableEnabled; | |||
| break; | |||
| /* GL_EXT_secondary_color */ | |||
| case GL_COLOR_SUM_EXT: | |||
| *params = ctx->Fog.ColorSumEnabled; | |||
| break; | |||
| case GL_CURRENT_SECONDARY_COLOR_EXT: | |||
| params[0] = INT_TO_BOOL(ctx->Current.SecondaryColor[0]); | |||
| params[1] = INT_TO_BOOL(ctx->Current.SecondaryColor[1]); | |||
| params[2] = INT_TO_BOOL(ctx->Current.SecondaryColor[2]); | |||
| break; | |||
| case GL_SECONDARY_COLOR_ARRAY_EXT: | |||
| *params = ctx->Array.SecondaryColor.Enabled; | |||
| break; | |||
| case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: | |||
| *params = ENUM_TO_BOOL(ctx->Array.SecondaryColor.Type); | |||
| break; | |||
| case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: | |||
| *params = INT_TO_BOOL(ctx->Array.SecondaryColor.Stride); | |||
| break; | |||
| case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: | |||
| *params = INT_TO_BOOL(ctx->Array.SecondaryColor.Stride); | |||
| break; | |||
| /* GL_EXT_fog_coord */ | |||
| case GL_CURRENT_FOG_COORDINATE_EXT: | |||
| *params = FLOAT_TO_BOOL(ctx->Current.FogCoord); | |||
| break; | |||
| case GL_FOG_COORDINATE_ARRAY_EXT: | |||
| *params = ctx->Array.FogCoord.Enabled; | |||
| break; | |||
| case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: | |||
| *params = ENUM_TO_BOOL(ctx->Array.FogCoord.Type); | |||
| break; | |||
| case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: | |||
| *params = INT_TO_BOOL(ctx->Array.FogCoord.Stride); | |||
| break; | |||
| default: | |||
| gl_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" ); | |||
| @@ -2384,6 +2421,43 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) | |||
| *params = (GLdouble) ctx->Pixel.PostColorMatrixColorTableEnabled; | |||
| break; | |||
| /* GL_EXT_secondary_color */ | |||
| case GL_COLOR_SUM_EXT: | |||
| *params = (GLdouble) ctx->Fog.ColorSumEnabled; | |||
| break; | |||
| case GL_CURRENT_SECONDARY_COLOR_EXT: | |||
| params[0] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[0]); | |||
| params[1] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[1]); | |||
| params[2] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[2]); | |||
| break; | |||
| case GL_SECONDARY_COLOR_ARRAY_EXT: | |||
| *params = (GLdouble) ctx->Array.SecondaryColor.Enabled; | |||
| break; | |||
| case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: | |||
| *params = (GLdouble) ctx->Array.SecondaryColor.Type; | |||
| break; | |||
| case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: | |||
| *params = (GLdouble) ctx->Array.SecondaryColor.Stride; | |||
| break; | |||
| case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: | |||
| *params = (GLdouble) ctx->Array.SecondaryColor.Stride; | |||
| break; | |||
| /* GL_EXT_fog_coord */ | |||
| case GL_CURRENT_FOG_COORDINATE_EXT: | |||
| *params = (GLdouble) ctx->Current.FogCoord; | |||
| break; | |||
| case GL_FOG_COORDINATE_ARRAY_EXT: | |||
| *params = (GLdouble) ctx->Array.FogCoord.Enabled; | |||
| break; | |||
| case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: | |||
| *params = (GLdouble) ctx->Array.FogCoord.Type; | |||
| break; | |||
| case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: | |||
| *params = (GLdouble) ctx->Array.FogCoord.Stride; | |||
| break; | |||
| default: | |||
| gl_error( ctx, GL_INVALID_ENUM, "glGetDoublev" ); | |||
| } | |||
| @@ -3510,6 +3584,43 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) | |||
| *params = (GLfloat) ctx->Pixel.PostColorMatrixColorTableEnabled; | |||
| break; | |||
| /* GL_EXT_secondary_color */ | |||
| case GL_COLOR_SUM_EXT: | |||
| *params = (GLfloat) ctx->Fog.ColorSumEnabled; | |||
| break; | |||
| case GL_CURRENT_SECONDARY_COLOR_EXT: | |||
| params[0] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[0]); | |||
| params[1] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[1]); | |||
| params[2] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[2]); | |||
| break; | |||
| case GL_SECONDARY_COLOR_ARRAY_EXT: | |||
| *params = (GLfloat) ctx->Array.SecondaryColor.Enabled; | |||
| break; | |||
| case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: | |||
| *params = (GLfloat) ctx->Array.SecondaryColor.Type; | |||
| break; | |||
| case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: | |||
| *params = (GLfloat) ctx->Array.SecondaryColor.Stride; | |||
| break; | |||
| case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: | |||
| *params = (GLfloat) ctx->Array.SecondaryColor.Stride; | |||
| break; | |||
| /* GL_EXT_fog_coord */ | |||
| case GL_CURRENT_FOG_COORDINATE_EXT: | |||
| *params = (GLfloat) ctx->Current.FogCoord; | |||
| break; | |||
| case GL_FOG_COORDINATE_ARRAY_EXT: | |||
| *params = (GLfloat) ctx->Array.FogCoord.Enabled; | |||
| break; | |||
| case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: | |||
| *params = (GLfloat) ctx->Array.FogCoord.Type; | |||
| break; | |||
| case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: | |||
| *params = (GLfloat) ctx->Array.FogCoord.Stride; | |||
| break; | |||
| default: | |||
| gl_error( ctx, GL_INVALID_ENUM, "glGetFloatv" ); | |||
| } | |||
| @@ -4667,6 +4778,43 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) | |||
| *params = (GLint) ctx->Pixel.PostColorMatrixColorTableEnabled; | |||
| break; | |||
| /* GL_EXT_secondary_color */ | |||
| case GL_COLOR_SUM_EXT: | |||
| *params = (GLint) ctx->Fog.ColorSumEnabled; | |||
| break; | |||
| case GL_CURRENT_SECONDARY_COLOR_EXT: | |||
| params[0] = FLOAT_TO_INT( UBYTE_COLOR_TO_FLOAT_COLOR( ctx->Current.SecondaryColor[0] ) ); | |||
| params[1] = FLOAT_TO_INT( UBYTE_COLOR_TO_FLOAT_COLOR( ctx->Current.SecondaryColor[1] ) ); | |||
| params[2] = FLOAT_TO_INT( UBYTE_COLOR_TO_FLOAT_COLOR( ctx->Current.SecondaryColor[2] ) ); | |||
| break; | |||
| case GL_SECONDARY_COLOR_ARRAY_EXT: | |||
| *params = (GLint) ctx->Array.SecondaryColor.Enabled; | |||
| break; | |||
| case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: | |||
| *params = (GLint) ctx->Array.SecondaryColor.Type; | |||
| break; | |||
| case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: | |||
| *params = (GLint) ctx->Array.SecondaryColor.Stride; | |||
| break; | |||
| case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: | |||
| *params = (GLint) ctx->Array.SecondaryColor.Stride; | |||
| break; | |||
| /* GL_EXT_fog_coord */ | |||
| case GL_CURRENT_FOG_COORDINATE_EXT: | |||
| *params = (GLint) ctx->Current.FogCoord; | |||
| break; | |||
| case GL_FOG_COORDINATE_ARRAY_EXT: | |||
| *params = (GLint) ctx->Array.FogCoord.Enabled; | |||
| break; | |||
| case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: | |||
| *params = (GLint) ctx->Array.FogCoord.Type; | |||
| break; | |||
| case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: | |||
| *params = (GLint) ctx->Array.FogCoord.Stride; | |||
| break; | |||
| default: | |||
| gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); | |||
| } | |||
| @@ -4702,6 +4850,12 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params ) | |||
| case GL_COLOR_ARRAY_POINTER: | |||
| *params = ctx->Array.Color.Ptr; | |||
| break; | |||
| case GL_SECONDARY_COLOR_ARRAY_POINTER_EXT: | |||
| *params = ctx->Array.SecondaryColor.Ptr; | |||
| break; | |||
| case GL_FOG_COORDINATE_ARRAY_POINTER_EXT: | |||
| *params = ctx->Array.FogCoord.Ptr; | |||
| break; | |||
| case GL_INDEX_ARRAY_POINTER: | |||
| *params = ctx->Array.Index.Ptr; | |||
| break; | |||
| @@ -1,4 +1,4 @@ | |||
| /* $Id: light.c,v 1.17 2000/09/26 20:53:53 brianp Exp $ */ | |||
| /* $Id: light.c,v 1.18 2000/10/27 16:44:40 keithw Exp $ */ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| @@ -385,7 +385,8 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params ) | |||
| case GL_LIGHT_MODEL_COLOR_CONTROL: | |||
| if (params[0] == (GLfloat) GL_SINGLE_COLOR) { | |||
| ctx->Light.Model.ColorControl = GL_SINGLE_COLOR; | |||
| CLEAR_BITS(ctx->TriangleCaps, DD_SEPERATE_SPECULAR); | |||
| if (!ctx->Fog.ColorSumEnabled) | |||
| CLEAR_BITS(ctx->TriangleCaps, DD_SEPERATE_SPECULAR); | |||
| } | |||
| else if (params[0] == (GLfloat) GL_SEPARATE_SPECULAR_COLOR) { | |||
| ctx->Light.Model.ColorControl = GL_SEPARATE_SPECULAR_COLOR; | |||
| @@ -1,4 +1,4 @@ | |||
| /* $Id: lines.c,v 1.16 2000/10/20 19:54:49 brianp Exp $ */ | |||
| /* $Id: lines.c,v 1.17 2000/10/27 16:44:40 keithw Exp $ */ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| @@ -119,7 +119,7 @@ static void flat_ci_line( GLcontext *ctx, | |||
| PB_SET_INDEX( ctx->PB, ctx->VB->IndexPtr->data[pvert] ); | |||
| #define INTERP_XY 1 | |||
| #define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, 0); | |||
| #define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, 0, 0); | |||
| #include "linetemp.h" | |||
| @@ -136,7 +136,7 @@ static void flat_ci_z_line( GLcontext *ctx, | |||
| #define INTERP_XY 1 | |||
| #define INTERP_Z 1 | |||
| #define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z); | |||
| #define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z, fog0); | |||
| #include "linetemp.h" | |||
| @@ -153,7 +153,7 @@ static void flat_rgba_line( GLcontext *ctx, | |||
| PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] ); | |||
| #define INTERP_XY 1 | |||
| #define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, 0); | |||
| #define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, 0, 0); | |||
| #include "linetemp.h" | |||
| @@ -171,7 +171,7 @@ static void flat_rgba_z_line( GLcontext *ctx, | |||
| #define INTERP_XY 1 | |||
| #define INTERP_Z 1 | |||
| #define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z); | |||
| #define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z, fog0); | |||
| #include "linetemp.h" | |||
| @@ -282,6 +282,7 @@ static void smooth_rgba_z_line( GLcontext *ctx, | |||
| GLint *pbx = ctx->PB->x; | |||
| GLint *pby = ctx->PB->y; | |||
| GLdepth *pbz = ctx->PB->z; | |||
| GLfixed *pbfog = ctx->PB->fog; | |||
| GLubyte (*pbrgba)[4] = ctx->PB->rgba; | |||
| (void) pvert; | |||
| @@ -296,6 +297,7 @@ static void smooth_rgba_z_line( GLcontext *ctx, | |||
| pbx[count] = X; \ | |||
| pby[count] = Y; \ | |||
| pbz[count] = Z; \ | |||
| pbfog[count] = fog0; \ | |||
| pbrgba[count][RCOMP] = FixedToInt(r0); \ | |||
| pbrgba[count][GCOMP] = FixedToInt(g0); \ | |||
| pbrgba[count][BCOMP] = FixedToInt(b0); \ | |||
| @@ -326,6 +328,7 @@ static void general_smooth_ci_line( GLcontext *ctx, | |||
| GLint *pbx = ctx->PB->x; | |||
| GLint *pby = ctx->PB->y; | |||
| GLdepth *pbz = ctx->PB->z; | |||
| GLfixed *pbfog = ctx->PB->fog; | |||
| GLuint *pbi = ctx->PB->index; | |||
| (void) pvert; | |||
| @@ -342,6 +345,7 @@ static void general_smooth_ci_line( GLcontext *ctx, | |||
| pbx[count] = X; \ | |||
| pby[count] = Y; \ | |||
| pbz[count] = Z; \ | |||
| pbfog[count] = fog0; \ | |||
| pbi[count] = I; \ | |||
| count++; \ | |||
| CHECK_FULL(count); | |||
| @@ -358,6 +362,7 @@ static void general_smooth_ci_line( GLcontext *ctx, | |||
| pbx[count] = X; pbx[count+1] = X; \ | |||
| pby[count] = Y; pby[count+1] = Y+1; \ | |||
| pbz[count] = Z; pbz[count+1] = Z; \ | |||
| pbfog[count] = fog0; pbfog[count+1] = fog0; \ | |||
| pbi[count] = I; pbi[count+1] = I; \ | |||
| count += 2; \ | |||
| CHECK_FULL(count); | |||
| @@ -365,6 +370,7 @@ static void general_smooth_ci_line( GLcontext *ctx, | |||
| pbx[count] = X; pbx[count+1] = X+1; \ | |||
| pby[count] = Y; pby[count+1] = Y; \ | |||
| pbz[count] = Z; pbz[count+1] = Z; \ | |||
| pbfog[count] = fog0; pbfog[count+1] = fog0; \ | |||
| pbi[count] = I; pbi[count+1] = I; \ | |||
| count += 2; \ | |||
| CHECK_FULL(count); | |||
| @@ -381,6 +387,7 @@ static void general_smooth_ci_line( GLcontext *ctx, | |||
| pby[count] = Y; \ | |||
| pbz[count] = Z; \ | |||
| pbi[count] = I; \ | |||
| pbfog[count] = fog0; \ | |||
| count++; \ | |||
| CHECK_FULL(count); | |||
| #include "linetemp.h" | |||
| @@ -400,6 +407,7 @@ static void general_flat_ci_line( GLcontext *ctx, | |||
| GLint *pbx = ctx->PB->x; | |||
| GLint *pby = ctx->PB->y; | |||
| GLdepth *pbz = ctx->PB->z; | |||
| GLfixed *pbfog = ctx->PB->fog; | |||
| PB_SET_INDEX( ctx->PB, ctx->VB->IndexPtr->data[pvert] ); | |||
| count = ctx->PB->count; | |||
| @@ -413,6 +421,7 @@ static void general_flat_ci_line( GLcontext *ctx, | |||
| pbx[count] = X; \ | |||
| pby[count] = Y; \ | |||
| pbz[count] = Z; \ | |||
| pbfog[count] = fog0; \ | |||
| count++; \ | |||
| CHECK_FULL(count); | |||
| #include "linetemp.h" | |||
| @@ -427,12 +436,14 @@ static void general_flat_ci_line( GLcontext *ctx, | |||
| pbx[count] = X; pbx[count+1] = X; \ | |||
| pby[count] = Y; pby[count+1] = Y+1; \ | |||
| pbz[count] = Z; pbz[count+1] = Z; \ | |||
| pbfog[count] = fog0; pbfog[count+1] = fog0; \ | |||
| count += 2; \ | |||
| CHECK_FULL(count); | |||
| #define YMAJOR_PLOT(X,Y) \ | |||
| pbx[count] = X; pbx[count+1] = X+1; \ | |||
| pby[count] = Y; pby[count+1] = Y; \ | |||
| pbz[count] = Z; pbz[count+1] = Z; \ | |||
| pbfog[count] = fog0; pbfog[count+1] = fog0; \ | |||
| count += 2; \ | |||
| CHECK_FULL(count); | |||
| #include "linetemp.h" | |||
| @@ -446,6 +457,7 @@ static void general_flat_ci_line( GLcontext *ctx, | |||
| pbx[count] = X; \ | |||
| pby[count] = Y; \ | |||
| pbz[count] = Z; \ | |||
| pbfog[count] = fog0; \ | |||
| count++; \ | |||
| CHECK_FULL(count); | |||
| #include "linetemp.h" | |||
| @@ -465,6 +477,7 @@ static void general_smooth_rgba_line( GLcontext *ctx, | |||
| GLint *pbx = ctx->PB->x; | |||
| GLint *pby = ctx->PB->y; | |||
| GLdepth *pbz = ctx->PB->z; | |||
| GLfixed *pbfog = ctx->PB->fog; | |||
| GLubyte (*pbrgba)[4] = ctx->PB->rgba; | |||
| (void) pvert; | |||
| @@ -482,6 +495,7 @@ static void general_smooth_rgba_line( GLcontext *ctx, | |||
| pbx[count] = X; \ | |||
| pby[count] = Y; \ | |||
| pbz[count] = Z; \ | |||
| pbfog[count] = fog0; \ | |||
| pbrgba[count][RCOMP] = FixedToInt(r0); \ | |||
| pbrgba[count][GCOMP] = FixedToInt(g0); \ | |||
| pbrgba[count][BCOMP] = FixedToInt(b0); \ | |||
| @@ -502,6 +516,7 @@ static void general_smooth_rgba_line( GLcontext *ctx, | |||
| pbx[count] = X; pbx[count+1] = X; \ | |||
| pby[count] = Y; pby[count+1] = Y+1; \ | |||
| pbz[count] = Z; pbz[count+1] = Z; \ | |||
| pbfog[count] = fog0; pbfog[count+1] = fog0; \ | |||
| pbrgba[count][RCOMP] = FixedToInt(r0); \ | |||
| pbrgba[count][GCOMP] = FixedToInt(g0); \ | |||
| pbrgba[count][BCOMP] = FixedToInt(b0); \ | |||
| @@ -516,6 +531,7 @@ static void general_smooth_rgba_line( GLcontext *ctx, | |||
| pbx[count] = X; pbx[count+1] = X+1; \ | |||
| pby[count] = Y; pby[count+1] = Y; \ | |||
| pbz[count] = Z; pbz[count+1] = Z; \ | |||
| pbfog[count] = fog0; pbfog[count+1] = fog0; \ | |||
| pbrgba[count][RCOMP] = FixedToInt(r0); \ | |||
| pbrgba[count][GCOMP] = FixedToInt(g0); \ | |||
| pbrgba[count][BCOMP] = FixedToInt(b0); \ | |||
| @@ -539,6 +555,7 @@ static void general_smooth_rgba_line( GLcontext *ctx, | |||
| pbx[count] = X; \ | |||
| pby[count] = Y; \ | |||
| pbz[count] = Z; \ | |||
| pbfog[count] = fog0; \ | |||
| pbrgba[count][RCOMP] = FixedToInt(r0); \ | |||
| pbrgba[count][GCOMP] = FixedToInt(g0); \ | |||
| pbrgba[count][BCOMP] = FixedToInt(b0); \ | |||
| @@ -566,7 +583,7 @@ static void general_flat_rgba_line( GLcontext *ctx, | |||
| #define INTERP_Z 1 | |||
| #define WIDE 1 | |||
| #define STIPPLE 1 | |||
| #define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z); | |||
| #define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z, fog0); | |||
| #include "linetemp.h" | |||
| } | |||
| else { | |||
| @@ -575,10 +592,10 @@ static void general_flat_rgba_line( GLcontext *ctx, | |||
| /* special case: unstippled and width=2 */ | |||
| #define INTERP_XY 1 | |||
| #define INTERP_Z 1 | |||
| #define XMAJOR_PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z); \ | |||
| PB_WRITE_PIXEL(ctx->PB, X, Y+1, Z); | |||
| #define YMAJOR_PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z); \ | |||
| PB_WRITE_PIXEL(ctx->PB, X+1, Y, Z); | |||
| #define XMAJOR_PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z, fog0); \ | |||
| PB_WRITE_PIXEL(ctx->PB, X, Y+1, Z, fog0); | |||
| #define YMAJOR_PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z, fog0); \ | |||
| PB_WRITE_PIXEL(ctx->PB, X+1, Y, Z, fog0); | |||
| #include "linetemp.h" | |||
| } | |||
| else { | |||
| @@ -586,7 +603,7 @@ static void general_flat_rgba_line( GLcontext *ctx, | |||
| #define INTERP_XY 1 | |||
| #define INTERP_Z 1 | |||
| #define WIDE 1 | |||
| #define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z); | |||
| #define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z, fog0); | |||
| #include "linetemp.h" | |||
| } | |||
| } | |||
| @@ -603,6 +620,7 @@ static void flat_textured_line( GLcontext *ctx, | |||
| GLint *pbx = ctx->PB->x; | |||
| GLint *pby = ctx->PB->y; | |||
| GLdepth *pbz = ctx->PB->z; | |||
| GLfixed *pbfog = ctx->PB->fog; | |||
| GLfloat *pbs = ctx->PB->s[0]; | |||
| GLfloat *pbt = ctx->PB->t[0]; | |||
| GLfloat *pbu = ctx->PB->u[0]; | |||
| @@ -622,6 +640,7 @@ static void flat_textured_line( GLcontext *ctx, | |||
| pbx[count] = X; \ | |||
| pby[count] = Y; \ | |||
| pbz[count] = Z; \ | |||
| pbfog[count] = fog0; \ | |||
| pbs[count] = fragTexcoord[0];\ | |||
| pbt[count] = fragTexcoord[1];\ | |||
| pbu[count] = fragTexcoord[2];\ | |||
| @@ -641,6 +660,7 @@ static void flat_textured_line( GLcontext *ctx, | |||
| pbx[count] = X; \ | |||
| pby[count] = Y; \ | |||
| pbz[count] = Z; \ | |||
| pbfog[count] = fog0; \ | |||
| pbs[count] = fragTexcoord[0];\ | |||
| pbt[count] = fragTexcoord[1];\ | |||
| pbu[count] = fragTexcoord[2];\ | |||
| @@ -664,6 +684,7 @@ static void smooth_textured_line( GLcontext *ctx, | |||
| GLint *pbx = ctx->PB->x; | |||
| GLint *pby = ctx->PB->y; | |||
| GLdepth *pbz = ctx->PB->z; | |||
| GLfixed *pbfog = ctx->PB->fog; | |||
| GLfloat *pbs = ctx->PB->s[0]; | |||
| GLfloat *pbt = ctx->PB->t[0]; | |||
| GLfloat *pbu = ctx->PB->u[0]; | |||
| @@ -686,6 +707,7 @@ static void smooth_textured_line( GLcontext *ctx, | |||
| pbx[count] = X; \ | |||
| pby[count] = Y; \ | |||
| pbz[count] = Z; \ | |||
| pbfog[count] = fog0; \ | |||
| pbs[count] = fragTexcoord[0]; \ | |||
| pbt[count] = fragTexcoord[1]; \ | |||
| pbu[count] = fragTexcoord[2]; \ | |||
| @@ -711,6 +733,7 @@ static void smooth_textured_line( GLcontext *ctx, | |||
| pbx[count] = X; \ | |||
| pby[count] = Y; \ | |||
| pbz[count] = Z; \ | |||
| pbfog[count] = fog0; \ | |||
| pbs[count] = fragTexcoord[0]; \ | |||
| pbt[count] = fragTexcoord[1]; \ | |||
| pbu[count] = fragTexcoord[2]; \ | |||
| @@ -739,6 +762,7 @@ static void smooth_multitextured_line( GLcontext *ctx, | |||
| GLint *pbx = ctx->PB->x; | |||
| GLint *pby = ctx->PB->y; | |||
| GLdepth *pbz = ctx->PB->z; | |||
| GLfixed *pbfog = ctx->PB->fog; | |||
| GLubyte (*pbrgba)[4] = ctx->PB->rgba; | |||
| GLubyte (*pbspec)[3] = ctx->PB->spec; | |||
| (void) pvert; | |||
| @@ -761,6 +785,7 @@ static void smooth_multitextured_line( GLcontext *ctx, | |||
| pbx[count] = X; \ | |||
| pby[count] = Y; \ | |||
| pbz[count] = Z; \ | |||
| pbfog[count] = fog0; \ | |||
| pbrgba[count][RCOMP] = FixedToInt(r0); \ | |||
| pbrgba[count][GCOMP] = FixedToInt(g0); \ | |||
| pbrgba[count][BCOMP] = FixedToInt(b0); \ | |||
| @@ -796,6 +821,7 @@ static void smooth_multitextured_line( GLcontext *ctx, | |||
| pbx[count] = X; \ | |||
| pby[count] = Y; \ | |||
| pbz[count] = Z; \ | |||
| pbfog[count] = fog0; \ | |||
| pbrgba[count][RCOMP] = FixedToInt(r0); \ | |||
| pbrgba[count][GCOMP] = FixedToInt(g0); \ | |||
| pbrgba[count][BCOMP] = FixedToInt(b0); \ | |||
| @@ -832,12 +858,13 @@ static void flat_multitextured_line( GLcontext *ctx, | |||
| GLint *pbx = ctx->PB->x; | |||
| GLint *pby = ctx->PB->y; | |||
| GLdepth *pbz = ctx->PB->z; | |||
| GLfixed *pbfog = ctx->PB->fog; | |||
| GLubyte (*pbrgba)[4] = ctx->PB->rgba; | |||
| GLubyte (*pbspec)[3] = ctx->PB->spec; | |||
| GLubyte *color = ctx->VB->ColorPtr->data[pvert]; | |||
| GLubyte sRed = ctx->VB->Specular ? ctx->VB->Specular[pvert][0] : 0; | |||
| GLubyte sGreen = ctx->VB->Specular ? ctx->VB->Specular[pvert][1] : 0; | |||
| GLubyte sBlue = ctx->VB->Specular ? ctx->VB->Specular[pvert][2] : 0; | |||
| GLubyte sRed = ctx->VB->SecondaryColorPtr->data ? ctx->VB->SecondaryColorPtr->data[pvert][0] : 0; | |||
| GLubyte sGreen = ctx->VB->SecondaryColorPtr->data ? ctx->VB->SecondaryColorPtr->data[pvert][1] : 0; | |||
| GLubyte sBlue = ctx->VB->SecondaryColorPtr->data ? ctx->VB->SecondaryColorPtr->data[pvert][2] : 0; | |||
| (void) pvert; | |||
| @@ -857,6 +884,7 @@ static void flat_multitextured_line( GLcontext *ctx, | |||
| pbx[count] = X; \ | |||
| pby[count] = Y; \ | |||
| pbz[count] = Z; \ | |||
| pbfog[count] = fog0; \ | |||
| pbrgba[count][RCOMP] = color[0]; \ | |||
| pbrgba[count][GCOMP] = color[1]; \ | |||
| pbrgba[count][BCOMP] = color[2]; \ | |||
| @@ -890,6 +918,7 @@ static void flat_multitextured_line( GLcontext *ctx, | |||
| pbx[count] = X; \ | |||
| pby[count] = Y; \ | |||
| pbz[count] = Z; \ | |||
| pbfog[count] = fog0; \ | |||
| pbrgba[count][RCOMP] = color[0]; \ | |||
| pbrgba[count][GCOMP] = color[1]; \ | |||
| pbrgba[count][BCOMP] = color[2]; \ | |||
| @@ -931,7 +960,7 @@ static void aa_rgba_line( GLcontext *ctx, | |||
| #define INTERP_RGBA 1 | |||
| #define PLOT(x, y) \ | |||
| { \ | |||
| PB_WRITE_RGBA_PIXEL( pb, (x), (y), z, \ | |||
| PB_WRITE_RGBA_PIXEL( pb, (x), (y), z, fog0, \ | |||
| red, green, blue, coverage ); \ | |||
| } | |||
| #include "lnaatemp.h" | |||
| @@ -951,7 +980,8 @@ static void aa_tex_rgba_line( GLcontext *ctx, | |||
| #define INTERP_TEX 1 | |||
| #define PLOT(x, y) \ | |||
| { \ | |||
| PB_WRITE_TEX_PIXEL( pb, (x), (y), z, red, green, blue, coverage, \ | |||
| PB_WRITE_TEX_PIXEL( pb, (x), (y), z, fog0, \ | |||
| red, green, blue, coverage, \ | |||
| fragTexcoord[0], fragTexcoord[1], fragTexcoord[2] ); \ | |||
| } | |||
| #include "lnaatemp.h" | |||
| @@ -973,7 +1003,7 @@ static void aa_multitex_rgba_line( GLcontext *ctx, | |||
| #define INTERP_MULTITEX 1 | |||
| #define PLOT(x, y) \ | |||
| { \ | |||
| PB_WRITE_MULTITEX_SPEC_PIXEL( pb, (x), (y), z, \ | |||
| PB_WRITE_MULTITEX_SPEC_PIXEL( pb, (x), (y), z, fog0, \ | |||
| red, green, blue, coverage, specRed, specGreen, specBlue, \ | |||
| fragTexcoord ); \ | |||
| } | |||
| @@ -990,7 +1020,7 @@ static void aa_ci_line( GLcontext *ctx, | |||
| #define INTERP_INDEX 1 | |||
| #define PLOT(x, y) \ | |||
| { \ | |||
| PB_WRITE_CI_PIXEL( pb, (x), (y), z, index + coverage ); \ | |||
| PB_WRITE_CI_PIXEL( pb, (x), (y), z, fog0, index + coverage ); \ | |||
| } | |||
| #include "lnaatemp.h" | |||
| } | |||
| @@ -1057,7 +1087,7 @@ _mesa_print_line_function(GLcontext *ctx) | |||
| else if (ctx->Driver.LineFunc == null_line) | |||
| printf("null_line\n"); | |||
| else | |||
| printf("Driver func %p\n", ctx->Driver.PointsFunc); | |||
| printf("Driver func %p\n", ctx->Driver.LineFunc); | |||
| } | |||
| #endif | |||
| @@ -1087,7 +1117,8 @@ void gl_set_line_function( GLcontext *ctx ) | |||
| if (rgbmode) { | |||
| if (ctx->Texture.ReallyEnabled) { | |||
| if (ctx->Texture.MultiTextureEnabled | |||
| || ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) | |||
| || ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR | |||
| || ctx->Fog.ColorSumEnabled) | |||
| /* Multitextured! */ | |||
| ctx->Driver.LineFunc = aa_multitex_rgba_line; | |||
| else | |||
| @@ -1136,7 +1167,7 @@ void gl_set_line_function( GLcontext *ctx ) | |||
| else { | |||
| if (ctx->Light.ShadeModel==GL_SMOOTH) { | |||
| /* Width==1, non-stippled, smooth-shaded */ | |||
| if (ctx->Depth.Test || ctx->FogMode == FOG_FRAGMENT) { | |||
| if (ctx->Depth.Test || ctx->Fog.Enabled) { | |||
| if (rgbmode) | |||
| ctx->Driver.LineFunc = smooth_rgba_z_line; | |||
| else | |||
| @@ -1151,7 +1182,7 @@ void gl_set_line_function( GLcontext *ctx ) | |||
| } | |||
| else { | |||
| /* Width==1, non-stippled, flat-shaded */ | |||
| if (ctx->Depth.Test || ctx->FogMode == FOG_FRAGMENT) { | |||
| if (ctx->Depth.Test || ctx->Fog.Enabled) { | |||
| if (rgbmode) | |||
| ctx->Driver.LineFunc = flat_rgba_z_line; | |||
| else | |||
| @@ -1,4 +1,4 @@ | |||
| /* $Id: points.c,v 1.15 2000/10/20 19:54:49 brianp Exp $ */ | |||
| /* $Id: points.c,v 1.16 2000/10/27 16:44:41 keithw Exp $ */ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| @@ -153,19 +153,23 @@ size1_ci_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| { | |||
| struct vertex_buffer *VB = ctx->VB; | |||
| struct pixel_buffer *PB = ctx->PB; | |||
| GLfloat *win; | |||
| GLfloat *win, *fog; | |||
| GLint *pbx = PB->x, *pby = PB->y; | |||
| GLdepth *pbz = PB->z; | |||
| GLfixed *pbfog = PB->fog; | |||
| GLuint *pbi = PB->index; | |||
| GLuint pbcount = PB->count; | |||
| GLuint i; | |||
| win = &VB->Win.data[first][0]; | |||
| fog = &VB->FogCoordPtr->data[first]; | |||
| for (i = first; i <= last; i++) { | |||
| if (VB->ClipMask[i] == 0) { | |||
| pbx[pbcount] = (GLint) win[0]; | |||
| pby[pbcount] = (GLint) win[1]; | |||
| pbz[pbcount] = (GLint) (win[2] + ctx->PointZoffset); | |||
| pbfog[pbcount] = FloatToFixed(fog[i]); | |||
| pbi[pbcount] = VB->IndexPtr->data[i]; | |||
| pbcount++; | |||
| } | |||
| @@ -190,18 +194,21 @@ size1_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| for (i = first; i <= last; i++) { | |||
| if (VB->ClipMask[i] == 0) { | |||
| GLint x, y, z; | |||
| GLint fog; | |||
| GLint red, green, blue, alpha; | |||
| x = (GLint) VB->Win.data[i][0]; | |||
| y = (GLint) VB->Win.data[i][1]; | |||
| z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); | |||
| fog = FloatToFixed( VB->FogCoordPtr->data[i] ); | |||
| red = VB->ColorPtr->data[i][0]; | |||
| green = VB->ColorPtr->data[i][1]; | |||
| blue = VB->ColorPtr->data[i][2]; | |||
| alpha = VB->ColorPtr->data[i][3]; | |||
| PB_WRITE_RGBA_PIXEL( PB, x, y, z, red, green, blue, alpha ); | |||
| PB_WRITE_RGBA_PIXEL( PB, x, y, z, fog, red, green, blue, alpha ); | |||
| } | |||
| } | |||
| PB_CHECK_FLUSH(ctx, PB); | |||
| @@ -230,6 +237,8 @@ general_ci_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| GLint y = (GLint) VB->Win.data[i][1]; | |||
| GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); | |||
| GLfixed fog = FloatToFixed( VB->FogCoordPtr->data[i] ); | |||
| if (isize & 1) { | |||
| /* odd size */ | |||
| x0 = x - radius; | |||
| @@ -249,7 +258,7 @@ general_ci_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| for (iy = y0; iy <= y1; iy++) { | |||
| for (ix = x0; ix <= x1; ix++) { | |||
| PB_WRITE_PIXEL( PB, ix, iy, z ); | |||
| PB_WRITE_PIXEL( PB, ix, iy, z, fog ); | |||
| } | |||
| } | |||
| PB_CHECK_FLUSH(ctx,PB); | |||
| @@ -279,6 +288,8 @@ general_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| GLint y = (GLint) VB->Win.data[i][1]; | |||
| GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); | |||
| GLfixed fog = FloatToFixed( VB->FogCoordPtr->data[i] ); | |||
| if (isize & 1) { | |||
| /* odd size */ | |||
| x0 = x - radius; | |||
| @@ -302,7 +313,7 @@ general_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| for (iy = y0; iy <= y1; iy++) { | |||
| for (ix = x0; ix <= x1; ix++) { | |||
| PB_WRITE_PIXEL( PB, ix, iy, z ); | |||
| PB_WRITE_PIXEL( PB, ix, iy, z, fog ); | |||
| } | |||
| } | |||
| PB_CHECK_FLUSH(ctx,PB); | |||
| @@ -335,6 +346,8 @@ textured_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); | |||
| GLint isize = (GLint) (ctx->Point.Size + 0.5F); | |||
| GLfixed fog = FloatToFixed( VB->FogCoordPtr->data[i] ); | |||
| if (isize < 1) { | |||
| isize = 1; | |||
| } | |||
| @@ -389,7 +402,7 @@ textured_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| for (iy = y0; iy <= y1; iy++) { | |||
| for (ix = x0; ix <= x1; ix++) { | |||
| PB_WRITE_TEX_PIXEL( PB, ix, iy, z, red, green, blue, alpha, | |||
| PB_WRITE_TEX_PIXEL( PB, ix, iy, z, fog, red, green, blue, alpha, | |||
| s, t, u ); | |||
| } | |||
| } | |||
| @@ -416,9 +429,9 @@ multitextured_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| const GLint green = VB->ColorPtr->data[i][1]; | |||
| const GLint blue = VB->ColorPtr->data[i][2]; | |||
| const GLint alpha = VB->ColorPtr->data[i][3]; | |||
| const GLint sRed = VB->Specular ? VB->Specular[i][0] : 0; | |||
| const GLint sGreen = VB->Specular ? VB->Specular[i][1] : 0; | |||
| const GLint sBlue = VB->Specular ? VB->Specular[i][2] : 0; | |||
| const GLint sRed = VB->SecondaryColorPtr->data ? VB->SecondaryColorPtr->data[i][0] : 0; | |||
| const GLint sGreen = VB->SecondaryColorPtr->data ? VB->SecondaryColorPtr->data[i][1] : 0; | |||
| const GLint sBlue = VB->SecondaryColorPtr->data ? VB->SecondaryColorPtr->data[i][2] : 0; | |||
| const GLint x = (GLint) VB->Win.data[i][0]; | |||
| const GLint y = (GLint) VB->Win.data[i][1]; | |||
| const GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); | |||
| @@ -428,6 +441,8 @@ multitextured_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| GLint radius, u; | |||
| GLint isize = (GLint) (ctx->Point.Size + 0.5F); | |||
| GLfixed fog = FloatToFixed( VB->FogCoordPtr->data[i] ); | |||
| if (isize < 1) { | |||
| isize = 1; | |||
| } | |||
| @@ -483,7 +498,7 @@ multitextured_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| for (iy = y0; iy <= y1; iy++) { | |||
| for (ix = x0; ix <= x1; ix++) { | |||
| PB_WRITE_MULTITEX_SPEC_PIXEL( PB, ix, iy, z, | |||
| PB_WRITE_MULTITEX_SPEC_PIXEL( PB, ix, iy, z, fog, | |||
| red, green, blue, alpha, | |||
| sRed, sGreen, sBlue, | |||
| texcoord ); | |||
| @@ -541,6 +556,8 @@ antialiased_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| GLfloat texcoord[MAX_TEXTURE_UNITS][4]; | |||
| GLint u, alpha; | |||
| GLfixed fog = FloatToFixed( VB->FogCoordPtr->data[i] ); | |||
| for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { | |||
| if (ctx->Texture.Unit[u].ReallyEnabled) { | |||
| switch (VB->TexCoordPtr[0]->size) { | |||
| @@ -591,11 +608,13 @@ antialiased_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| alpha = (alpha * coverage) >> 8; | |||
| } | |||
| if (ctx->Texture.MultiTextureEnabled) { | |||
| PB_WRITE_MULTITEX_PIXEL( PB, x,y,z, red, green, blue, | |||
| PB_WRITE_MULTITEX_PIXEL( PB, x,y,z, fog, | |||
| red, green, blue, | |||
| alpha, texcoord ); | |||
| } | |||
| else { | |||
| PB_WRITE_TEX_PIXEL( PB, x,y,z, red, green, blue, alpha, | |||
| PB_WRITE_TEX_PIXEL( PB, x,y,z, fog, | |||
| red, green, blue, alpha, | |||
| texcoord[0][0], | |||
| texcoord[0][1], | |||
| texcoord[0][2] ); | |||
| @@ -622,6 +641,8 @@ antialiased_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| const GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); | |||
| GLint x, y; | |||
| GLfixed fog = FloatToFixed( VB->FogCoordPtr->data[i] ); | |||
| /* | |||
| printf("point %g, %g\n", VB->Win.data[i][0], VB->Win.data[i][1]); | |||
| printf("%d..%d X %d..%d\n", xmin, xmax, ymin, ymax); | |||
| @@ -638,7 +659,8 @@ antialiased_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| /* coverage is in [0,256] */ | |||
| alpha = (alpha * coverage) >> 8; | |||
| } | |||
| PB_WRITE_RGBA_PIXEL(PB, x, y, z, red, green, blue, alpha); | |||
| PB_WRITE_RGBA_PIXEL(PB, x, y, z, fog, | |||
| red, green, blue, alpha); | |||
| } | |||
| } | |||
| } | |||
| @@ -715,35 +737,6 @@ static dist_func eye_dist_tab[5] = { | |||
| }; | |||
| static void | |||
| clip_dist(GLfloat *out, GLuint first, GLuint last, | |||
| const GLcontext *ctx, GLvector4f *clip) | |||
| { | |||
| /* this is never called */ | |||
| gl_problem(NULL, "clip_dist() called - dead code!\n"); | |||
| (void) out; | |||
| (void) first; | |||
| (void) last; | |||
| (void) ctx; | |||
| (void) clip; | |||
| #if 0 | |||
| GLuint i; | |||
| const GLfloat *from = (GLfloat *)clip_vec->start; | |||
| const GLuint stride = clip_vec->stride; | |||
| for (i = first ; i <= last ; i++ ) | |||
| { | |||
| GLfloat dist = win[i][2]; | |||
| out[i] = 1/(ctx->Point.Params[0]+ | |||
| dist * (ctx->Point.Params[1] + | |||
| dist * ctx->Point.Params[2])); | |||
| } | |||
| #endif | |||
| } | |||
| /* | |||
| * Distance Attenuated General CI points. | |||
| @@ -757,10 +750,9 @@ dist_atten_general_ci_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| const GLfloat psize = ctx->Point.Size; | |||
| GLuint i; | |||
| if (ctx->NeedEyeCoords) | |||
| (eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr ); | |||
| else | |||
| clip_dist( dist, first, last, ctx, VB->ClipPtr ); | |||
| ASSERT(ctx->NeedEyeCoords); | |||
| (eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr ); | |||
| for (i=first;i<=last;i++) { | |||
| if (VB->ClipMask[i]==0) { | |||
| @@ -772,6 +764,8 @@ dist_atten_general_ci_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); | |||
| GLfloat dsize = psize * dist[i]; | |||
| GLfixed fog = FloatToFixed( VB->FogCoordPtr->data[i] ); | |||
| if (dsize >= ctx->Point.Threshold) { | |||
| isize = (GLint) (MIN2(dsize, ctx->Point.MaxSize) + 0.5F); | |||
| } | |||
| @@ -799,7 +793,7 @@ dist_atten_general_ci_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| for (iy=y0;iy<=y1;iy++) { | |||
| for (ix=x0;ix<=x1;ix++) { | |||
| PB_WRITE_PIXEL( PB, ix, iy, z ); | |||
| PB_WRITE_PIXEL( PB, ix, iy, z, fog ); | |||
| } | |||
| } | |||
| PB_CHECK_FLUSH(ctx,PB); | |||
| @@ -819,10 +813,8 @@ dist_atten_general_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| const GLfloat psize = ctx->Point.Size; | |||
| GLuint i; | |||
| if (ctx->NeedEyeCoords) | |||
| (eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr ); | |||
| else | |||
| clip_dist( dist, first, last, ctx, VB->ClipPtr ); | |||
| ASSERT (ctx->NeedEyeCoords); | |||
| (eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr ); | |||
| for (i=first;i<=last;i++) { | |||
| if (VB->ClipMask[i]==0) { | |||
| @@ -835,6 +827,8 @@ dist_atten_general_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| GLfloat dsize=psize*dist[i]; | |||
| GLubyte alpha; | |||
| GLfixed fog = FloatToFixed( VB->FogCoordPtr->data[i] ); | |||
| if (dsize >= ctx->Point.Threshold) { | |||
| isize = (GLint) (MIN2(dsize,ctx->Point.MaxSize)+0.5F); | |||
| alpha = VB->ColorPtr->data[i][3]; | |||
| @@ -869,7 +863,7 @@ dist_atten_general_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| for (iy = y0; iy <= y1; iy++) { | |||
| for (ix = x0; ix <= x1; ix++) { | |||
| PB_WRITE_PIXEL( PB, ix, iy, z ); | |||
| PB_WRITE_PIXEL( PB, ix, iy, z, fog ); | |||
| } | |||
| } | |||
| PB_CHECK_FLUSH(ctx,PB); | |||
| @@ -889,10 +883,8 @@ dist_atten_textured_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| const GLfloat psize = ctx->Point.Size; | |||
| GLuint i; | |||
| if (ctx->NeedEyeCoords) | |||
| (eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr ); | |||
| else | |||
| clip_dist( dist, first, last, ctx, VB->ClipPtr ); | |||
| ASSERT(ctx->NeedEyeCoords); | |||
| (eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr ); | |||
| for (i=first;i<=last;i++) { | |||
| if (VB->ClipMask[i]==0) { | |||
| @@ -908,6 +900,8 @@ dist_atten_textured_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| GLint isize, radius; | |||
| GLfloat dsize = psize*dist[i]; | |||
| GLfixed fog = FloatToFixed( VB->FogCoordPtr->data[i] ); | |||
| /* compute point size and alpha */ | |||
| if (dsize >= ctx->Point.Threshold) { | |||
| isize = (GLint) (MIN2(dsize, ctx->Point.MaxSize) + 0.5F); | |||
| @@ -975,12 +969,13 @@ 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.MultiTextureEnabled) { | |||
| PB_WRITE_MULTITEX_PIXEL( PB, ix, iy, z, | |||
| PB_WRITE_MULTITEX_PIXEL( PB, ix, iy, z, fog, | |||
| red, green, blue, alpha, | |||
| texcoord ); | |||
| } | |||
| else { | |||
| PB_WRITE_TEX_PIXEL( PB, ix, iy, z, red, green, blue, alpha, | |||
| PB_WRITE_TEX_PIXEL( PB, ix, iy, z, fog, | |||
| red, green, blue, alpha, | |||
| texcoord[0][0], | |||
| texcoord[0][1], | |||
| texcoord[0][2] ); | |||
| @@ -1004,10 +999,8 @@ dist_atten_antialiased_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| const GLfloat psize = ctx->Point.Size; | |||
| GLuint i; | |||
| if (ctx->NeedEyeCoords) | |||
| (eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr ); | |||
| else | |||
| clip_dist( dist, first, last, ctx, VB->ClipPtr ); | |||
| ASSERT(ctx->NeedEyeCoords); | |||
| (eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr ); | |||
| if (ctx->Texture.ReallyEnabled) { | |||
| for (i=first;i<=last;i++) { | |||
| @@ -1020,6 +1013,8 @@ dist_atten_antialiased_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| GLfloat dsize = psize * dist[i]; | |||
| GLint u; | |||
| GLfixed fog = FloatToFixed( VB->FogCoordPtr->data[i] ); | |||
| if (dsize >= ctx->Point.Threshold) { | |||
| radius = MIN2(dsize, ctx->Point.MaxSize) * 0.5F; | |||
| alphaf = 1.0F; | |||
| @@ -1093,12 +1088,13 @@ dist_atten_antialiased_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| } | |||
| alpha = (GLint) (alpha * alphaf); | |||
| if (ctx->Texture.MultiTextureEnabled) { | |||
| PB_WRITE_MULTITEX_PIXEL( PB, x, y, z, | |||
| PB_WRITE_MULTITEX_PIXEL( PB, x, y, z, fog, | |||
| red, green, blue, alpha, | |||
| texcoord ); | |||
| } | |||
| else { | |||
| PB_WRITE_TEX_PIXEL( PB, x,y,z, red, green, blue, alpha, | |||
| PB_WRITE_TEX_PIXEL( PB, x,y,z, fog, | |||
| red, green, blue, alpha, | |||
| texcoord[0][0], | |||
| texcoord[0][1], | |||
| texcoord[0][2] ); | |||
| @@ -1117,6 +1113,7 @@ dist_atten_antialiased_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| GLfloat radius, rmin, rmax, rmin2, rmax2, cscale, alphaf; | |||
| GLint xmin, ymin, xmax, ymax; | |||
| GLint x, y, z; | |||
| GLfixed fog; | |||
| GLint red, green, blue, alpha; | |||
| GLfloat dsize = psize * dist[i]; | |||
| @@ -1141,6 +1138,8 @@ dist_atten_antialiased_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| ymax = (GLint) (VB->Win.data[i][1] + radius); | |||
| z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); | |||
| fog = FloatToFixed( VB->FogCoordPtr->data[i] ); | |||
| red = VB->ColorPtr->data[i][0]; | |||
| green = VB->ColorPtr->data[i][1]; | |||
| blue = VB->ColorPtr->data[i][2]; | |||
| @@ -1158,7 +1157,8 @@ dist_atten_antialiased_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) | |||
| alpha = (alpha * coverage) >> 8; | |||
| } | |||
| alpha = (GLint) (alpha * alphaf); | |||
| PB_WRITE_RGBA_PIXEL(PB, x, y, z, red, green, blue, alpha); | |||
| PB_WRITE_RGBA_PIXEL(PB, x, y, z, fog, | |||
| red, green, blue, alpha); | |||
| } | |||
| } | |||
| } | |||
| @@ -1231,7 +1231,8 @@ void gl_set_point_function( GLcontext *ctx ) | |||
| } | |||
| else if (ctx->Texture.ReallyEnabled) { | |||
| if (ctx->Texture.MultiTextureEnabled || | |||
| ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) { | |||
| ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR || | |||
| ctx->Fog.ColorSumEnabled) { | |||
| ctx->Driver.PointsFunc = multitextured_rgba_points; | |||
| } | |||
| else { | |||
| @@ -1,4 +1,4 @@ | |||
| /* $Id: state.c,v 1.33 2000/10/21 01:29:12 brianp Exp $ */ | |||
| /* $Id: state.c,v 1.34 2000/10/27 16:44:41 keithw Exp $ */ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| @@ -203,6 +203,13 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize) | |||
| exec->FeedbackBuffer = _mesa_FeedbackBuffer; | |||
| exec->Finish = _mesa_Finish; | |||
| exec->Flush = _mesa_Flush; | |||
| exec->FogCoordfEXT = _mesa_FogCoordfEXT; | |||
| exec->FogCoordfvEXT = _mesa_FogCoordfvEXT; | |||
| exec->FogCoorddEXT = _mesa_FogCoorddEXT; | |||
| exec->FogCoorddvEXT = _mesa_FogCoorddvEXT; | |||
| exec->FogCoordPointerEXT = _mesa_FogCoordPointerEXT; | |||
| exec->Fogf = _mesa_Fogf; | |||
| exec->Fogfv = _mesa_Fogfv; | |||
| exec->Fogi = _mesa_Fogi; | |||
| @@ -353,6 +360,27 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize) | |||
| exec->Scaled = _mesa_Scaled; | |||
| exec->Scalef = _mesa_Scalef; | |||
| exec->Scissor = _mesa_Scissor; | |||
| #if 0 | |||
| exec->SecondaryColor3fEXT = _mesa_SecondaryColor3bEXT; | |||
| exec->SecondaryColor3fvEXT = _mesa_SecondaryColor3bvEXT; | |||
| exec->SecondaryColor3dEXT = _mesa_SecondaryColor3sEXT; | |||
| exec->SecondaryColordvEXT = _mesa_SecondaryColor3svEXT; | |||
| exec->SecondaryColor3fEXT = _mesa_SecondaryColor3iEXT; | |||
| exec->SecondaryColor3fvEXT = _mesa_SecondaryColor3ivEXT; | |||
| exec->SecondaryColor3dEXT = _mesa_SecondaryColor3fEXT; | |||
| exec->SecondaryColordvEXT = _mesa_SecondaryColor3fvEXT; | |||
| exec->SecondaryColor3fEXT = _mesa_SecondaryColor3dEXT; | |||
| exec->SecondaryColor3fvEXT = _mesa_SecondaryColor3dvEXT; | |||
| exec->SecondaryColor3dEXT = _mesa_SecondaryColor3ubEXT; | |||
| exec->SecondaryColordvEXT = _mesa_SecondaryColor3ubvEXT; | |||
| exec->SecondaryColor3fEXT = _mesa_SecondaryColor3usEXT; | |||
| exec->SecondaryColor3fvEXT = _mesa_SecondaryColor3usvEXT; | |||
| exec->SecondaryColor3dEXT = _mesa_SecondaryColor3uiEXT; | |||
| exec->SecondaryColordvEXT = _mesa_SecondaryColor3uivEXT; | |||
| exec->SecondaryColorPointerEXT = _mesa_SecondaryColorPointerEXT; | |||
| #endif | |||
| exec->SelectBuffer = _mesa_SelectBuffer; | |||
| exec->ShadeModel = _mesa_ShadeModel; | |||
| exec->StencilFunc = _mesa_StencilFunc; | |||
| @@ -666,30 +694,6 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize) | |||
| /**********************************************************************/ | |||
| static void update_fog_mode( GLcontext *ctx ) | |||
| { | |||
| int old_mode = ctx->FogMode; | |||
| if (ctx->Fog.Enabled) { | |||
| if (ctx->Texture.ReallyEnabled) | |||
| ctx->FogMode = FOG_FRAGMENT; | |||
| else if (ctx->Hint.Fog == GL_NICEST) | |||
| ctx->FogMode = FOG_FRAGMENT; | |||
| else | |||
| ctx->FogMode = FOG_VERTEX; | |||
| if (ctx->Driver.GetParameteri) | |||
| if ((ctx->Driver.GetParameteri)( ctx, DD_HAVE_HARDWARE_FOG )) | |||
| ctx->FogMode = FOG_FRAGMENT; | |||
| } | |||
| else { | |||
| ctx->FogMode = FOG_NONE; | |||
| } | |||
| if (old_mode != ctx->FogMode) | |||
| ctx->NewState |= NEW_FOG; | |||
| } | |||
| /* | |||
| * Recompute the value of ctx->RasterMask, etc. according to | |||
| @@ -702,7 +706,7 @@ static void update_rasterflags( GLcontext *ctx ) | |||
| if (ctx->Color.AlphaEnabled) ctx->RasterMask |= ALPHATEST_BIT; | |||
| if (ctx->Color.BlendEnabled) ctx->RasterMask |= BLEND_BIT; | |||
| if (ctx->Depth.Test) ctx->RasterMask |= DEPTH_BIT; | |||
| if (ctx->FogMode == FOG_FRAGMENT) ctx->RasterMask |= FOG_BIT; | |||
| if (ctx->Fog.Enabled) ctx->RasterMask |= FOG_BIT; | |||
| if (ctx->Scissor.Enabled) ctx->RasterMask |= SCISSOR_BIT; | |||
| if (ctx->Stencil.Enabled) ctx->RasterMask |= STENCIL_BIT; | |||
| if (ctx->Visual.RGBAflag) { | |||
| @@ -891,9 +895,6 @@ void gl_update_state( GLcontext *ctx ) | |||
| ctx->NeedNormals = (ctx->Light.Enabled || ctx->Texture.NeedNormals); | |||
| } | |||
| if (ctx->NewState & NEW_FOG) { | |||
| update_fog_mode(ctx); | |||
| } | |||
| if (ctx->NewState & NEW_RASTER_OPS) { | |||
| update_rasterflags(ctx); | |||
| @@ -1,4 +1,4 @@ | |||
| /* $Id: varray.c,v 1.25 2000/10/20 19:54:49 brianp Exp $ */ | |||
| /* $Id: varray.c,v 1.26 2000/10/27 16:44:41 keithw Exp $ */ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| @@ -216,6 +216,40 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) | |||
| void | |||
| _mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr) | |||
| { | |||
| GET_CURRENT_CONTEXT(ctx); | |||
| if (stride<0) { | |||
| gl_error( ctx, GL_INVALID_VALUE, "glFogCoordPointer(stride)" ); | |||
| return; | |||
| } | |||
| ctx->Array.FogCoord.StrideB = stride; | |||
| if (!stride) { | |||
| switch (type) { | |||
| case GL_FLOAT: | |||
| ctx->Array.FogCoord.StrideB = sizeof(GLfloat); | |||
| break; | |||
| case GL_DOUBLE: | |||
| ctx->Array.FogCoord.StrideB = sizeof(GLdouble); | |||
| break; | |||
| default: | |||
| gl_error( ctx, GL_INVALID_ENUM, "glFogCoordPointer(type)" ); | |||
| return; | |||
| } | |||
| } | |||
| ctx->Array.FogCoord.Type = type; | |||
| ctx->Array.FogCoord.Stride = stride; | |||
| ctx->Array.FogCoord.Ptr = (void *) ptr; | |||
| ctx->Array.FogCoordFunc = gl_trans_1f_tab[TYPE_IDX(type)]; | |||
| ctx->Array.FogCoordEltFunc = gl_trans_elt_1f_tab[TYPE_IDX(type)]; | |||
| ctx->Array.NewArrayState |= VERT_FOG_COORD; | |||
| ctx->NewState |= NEW_CLIENT_STATE; | |||
| } | |||
| void | |||
| _mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr) | |||
| { | |||
| @@ -259,6 +293,71 @@ _mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr) | |||
| } | |||
| void | |||
| _mesa_SecondaryColorPointerEXT(GLint size, GLenum type, | |||
| GLsizei stride, const GLvoid *ptr) | |||
| { | |||
| GET_CURRENT_CONTEXT(ctx); | |||
| fprintf(stderr, "%s\n", __FUNCTION__); | |||
| if (size != 3 && size != 4) { | |||
| gl_error( ctx, GL_INVALID_VALUE, "glColorPointer(size)" ); | |||
| return; | |||
| } | |||
| if (stride<0) { | |||
| gl_error( ctx, GL_INVALID_VALUE, "glColorPointer(stride)" ); | |||
| return; | |||
| } | |||
| if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) | |||
| fprintf(stderr, "glColorPointer( sz %d type %s stride %d )\n", size, | |||
| gl_lookup_enum_by_nr( type ), | |||
| stride); | |||
| ctx->Array.SecondaryColor.StrideB = stride; | |||
| if (!stride) { | |||
| switch (type) { | |||
| case GL_BYTE: | |||
| ctx->Array.SecondaryColor.StrideB = size*sizeof(GLbyte); | |||
| break; | |||
| case GL_UNSIGNED_BYTE: | |||
| ctx->Array.SecondaryColor.StrideB = size*sizeof(GLubyte); | |||
| break; | |||
| case GL_SHORT: | |||
| ctx->Array.SecondaryColor.StrideB = size*sizeof(GLshort); | |||
| break; | |||
| case GL_UNSIGNED_SHORT: | |||
| ctx->Array.SecondaryColor.StrideB = size*sizeof(GLushort); | |||
| break; | |||
| case GL_INT: | |||
| ctx->Array.SecondaryColor.StrideB = size*sizeof(GLint); | |||
| break; | |||
| case GL_UNSIGNED_INT: | |||
| ctx->Array.SecondaryColor.StrideB = size*sizeof(GLuint); | |||
| break; | |||
| case GL_FLOAT: | |||
| ctx->Array.SecondaryColor.StrideB = size*sizeof(GLfloat); | |||
| break; | |||
| case GL_DOUBLE: | |||
| ctx->Array.SecondaryColor.StrideB = size*sizeof(GLdouble); | |||
| break; | |||
| default: | |||
| gl_error( ctx, GL_INVALID_ENUM, "glSecondaryColorPointer(type)" ); | |||
| return; | |||
| } | |||
| } | |||
| ctx->Array.SecondaryColor.Size = 3; /* hardwire */ | |||
| ctx->Array.SecondaryColor.Type = type; | |||
| ctx->Array.SecondaryColor.Stride = stride; | |||
| ctx->Array.SecondaryColor.Ptr = (void *) ptr; | |||
| ctx->Array.SecondaryColorFunc = gl_trans_4ub_tab[size][TYPE_IDX(type)]; | |||
| ctx->Array.SecondaryColorEltFunc = gl_trans_elt_4ub_tab[size][TYPE_IDX(type)]; | |||
| ctx->Array.NewArrayState |= VERT_SPEC_RGB; | |||
| ctx->NewState |= NEW_CLIENT_STATE; | |||
| } | |||
| void | |||
| _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) | |||
| @@ -342,32 +441,6 @@ _mesa_EdgeFlagPointer(GLsizei stride, const void *vptr) | |||
| } | |||
| #if 0 | |||
| /* Called only from gl_DrawElements | |||
| */ | |||
| static void gl_CVAEltPointer( GLcontext *ctx, GLenum type, const GLvoid *ptr ) | |||
| { | |||
| switch (type) { | |||
| case GL_UNSIGNED_BYTE: | |||
| ctx->CVA.Elt.StrideB = sizeof(GLubyte); | |||
| break; | |||
| case GL_UNSIGNED_SHORT: | |||
| ctx->CVA.Elt.StrideB = sizeof(GLushort); | |||
| break; | |||
| case GL_UNSIGNED_INT: | |||
| ctx->CVA.Elt.StrideB = sizeof(GLuint); | |||
| break; | |||
| default: | |||
| gl_error( ctx, GL_INVALID_ENUM, "glEltPointer(type)" ); | |||
| return; | |||
| } | |||
| ctx->CVA.Elt.Type = type; | |||
| ctx->CVA.Elt.Stride = 0; | |||
| ctx->CVA.Elt.Ptr = (void *) ptr; | |||
| ctx->CVA.EltFunc = gl_trans_1ui_tab[TYPE_IDX(type)]; | |||
| ctx->Array.NewArrayState |= VERT_ELT; /* ??? */ | |||
| } | |||
| #endif | |||
| @@ -470,6 +543,19 @@ void gl_exec_array_elements( GLcontext *ctx, struct immediate *IM, | |||
| flags, elts, (VERT_ELT|VERT_RGBA), | |||
| start, count); | |||
| if (translate & VERT_SPEC_RGB) | |||
| (ctx->Array.SecondaryColorEltFunc)( IM->SecondaryColor, | |||
| &ctx->Array.SecondaryColor, | |||
| flags, elts, (VERT_ELT|VERT_SPEC_RGB), | |||
| start, count); | |||
| if (translate & VERT_FOG_COORD) | |||
| (ctx->Array.FogCoordEltFunc)( IM->FogCoord, | |||
| &ctx->Array.FogCoord, | |||
| flags, elts, (VERT_ELT|VERT_FOG_COORD), | |||
| start, count); | |||
| if (translate & VERT_INDEX) | |||
| (ctx->Array.IndexEltFunc)( IM->Index, | |||
| &ctx->Array.Index, | |||
| @@ -563,6 +649,8 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count) | |||
| GLint i; | |||
| struct gl_client_array *Normal; | |||
| struct gl_client_array *Color; | |||
| struct gl_client_array *SecondaryColor; | |||
| struct gl_client_array *FogCoord; | |||
| struct gl_client_array *Index; | |||
| struct gl_client_array *TexCoord[MAX_TEXTURE_UNITS]; | |||
| struct gl_client_array *EdgeFlag; | |||
| @@ -603,6 +691,26 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count) | |||
| gl_trans_4ub_tab[4][TYPE_IDX(GL_UNSIGNED_BYTE)]; | |||
| } | |||
| } | |||
| if (required & VERT_SPEC_RGB) | |||
| { | |||
| SecondaryColor = &ctx->Array.SecondaryColor; | |||
| if (fallback & VERT_SPEC_RGB) { | |||
| SecondaryColor = &ctx->Fallback.SecondaryColor; | |||
| ctx->Array.SecondaryColorFunc = | |||
| gl_trans_4ub_tab[4][TYPE_IDX(GL_UNSIGNED_BYTE)]; | |||
| } | |||
| } | |||
| if (required & VERT_FOG_COORD) | |||
| { | |||
| FogCoord = &ctx->Array.FogCoord; | |||
| if (fallback & VERT_FOG_COORD) { | |||
| FogCoord = &ctx->Fallback.FogCoord; | |||
| ctx->Array.FogCoordFunc = | |||
| gl_trans_1f_tab[TYPE_IDX(GL_FLOAT)]; | |||
| } | |||
| } | |||
| if (required & VERT_INDEX) { | |||
| Index = &ctx->Array.Index; | |||
| @@ -694,6 +802,16 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count) | |||
| ctx->Array.ColorFunc( IM->Color + VB_START, | |||
| Color, start, n ); | |||
| } | |||
| if (required & VERT_SPEC_RGB) { | |||
| ctx->Array.SecondaryColorFunc( IM->SecondaryColor + VB_START, | |||
| SecondaryColor, start, n ); | |||
| } | |||
| if (required & VERT_FOG_COORD) { | |||
| ctx->Array.FogCoordFunc( IM->FogCoord + VB_START, | |||
| FogCoord, start, n ); | |||
| } | |||
| if (required & VERT_INDEX) { | |||
| ctx->Array.IndexFunc( IM->Index + VB_START, | |||
| @@ -732,6 +850,8 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count) | |||
| VB->Color[0] = VB->Color[1] = VB->ColorPtr; | |||
| VB->IndexPtr = &IM->v.Index; | |||
| VB->EdgeFlagPtr = &IM->v.EdgeFlag; | |||
| VB->SecondaryColorPtr = &IM->v.SecondaryColor; | |||
| VB->FogCoordPtr = &IM->v.FogCoord; | |||
| for (i = 0; i < MAX_TEXTURE_UNITS; i++) { | |||
| VB->TexCoordPtr[i] = &IM->v.TexCoord[i]; | |||
| } | |||
| @@ -913,10 +1033,6 @@ _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indice | |||
| if (ctx->CompileCVAFlag) | |||
| { | |||
| #if defined(MESA_CVA_PROF) | |||
| force_init_prof(); | |||
| #endif | |||
| /* Treat VERT_ELT like a special client array. | |||
| */ | |||
| ctx->Array.NewArrayState |= VERT_ELT; | |||
| @@ -1246,10 +1362,12 @@ void gl_update_client_state( GLcontext *ctx ) | |||
| ctx->Array.Summary = 0; | |||
| ctx->input->ArrayIncr = 0; | |||
| if (ctx->Array.Normal.Enabled) ctx->Array.Flags |= VERT_NORM; | |||
| if (ctx->Array.Color.Enabled) ctx->Array.Flags |= VERT_RGBA; | |||
| if (ctx->Array.Index.Enabled) ctx->Array.Flags |= VERT_INDEX; | |||
| if (ctx->Array.EdgeFlag.Enabled) ctx->Array.Flags |= VERT_EDGE; | |||
| if (ctx->Array.Normal.Enabled) ctx->Array.Flags |= VERT_NORM; | |||
| if (ctx->Array.Color.Enabled) ctx->Array.Flags |= VERT_RGBA; | |||
| if (ctx->Array.SecondaryColor.Enabled) ctx->Array.Flags |= VERT_SPEC_RGB; | |||
| if (ctx->Array.FogCoord.Enabled) ctx->Array.Flags |= VERT_FOG_COORD; | |||
| if (ctx->Array.Index.Enabled) ctx->Array.Flags |= VERT_INDEX; | |||
| if (ctx->Array.EdgeFlag.Enabled) ctx->Array.Flags |= VERT_EDGE; | |||
| if (ctx->Array.Vertex.Enabled) { | |||
| ctx->Array.Flags |= sz_flags[ctx->Array.Vertex.Size]; | |||
| ctx->input->ArrayIncr = 1; | |||
| @@ -1,4 +1,4 @@ | |||
| /* $Id: varray.h,v 1.7 2000/06/12 15:30:52 brianp Exp $ */ | |||
| /* $Id: varray.h,v 1.8 2000/10/27 16:44:41 keithw Exp $ */ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| @@ -87,7 +87,12 @@ extern void | |||
| _mesa_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr); | |||
| extern void | |||
| _mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr); | |||
| extern void | |||
| _mesa_SecondaryColorPointerEXT(GLint size, GLenum type, | |||
| GLsizei stride, const GLvoid *ptr); | |||
| extern void | |||