-/* $Id: config.h,v 1.9 2000/04/07 00:19:41 brianp Exp $ */
+/* $Id: config.h,v 1.10 2000/04/08 18:57:45 brianp Exp $ */
/*
* Mesa 3-D graphics library
/* Maximum texture matrix stack depth: */
#define MAX_TEXTURE_STACK_DEPTH 10
+/* Maximum color matrix stack depth: */
+#define MAX_COLOR_STACK_DEPTH 4
+
/* Maximum attribute stack depth: */
#define MAX_ATTRIB_STACK_DEPTH 16
-/* $Id: context.c,v 1.55 2000/04/07 16:27:26 brianp Exp $ */
+/* $Id: context.c,v 1.56 2000/04/08 18:57:45 brianp Exp $ */
/*
* Mesa 3-D graphics library
}
}
+ /* Color matrix */
+ gl_matrix_ctr(&ctx->ColorMatrix);
+ ctx->ColorStackDepth = 0;
+ for (j = 0; j < MAX_COLOR_STACK_DEPTH - 1; j++) {
+ gl_matrix_ctr(&ctx->ColorStack[j]);
+ }
+
/* Accumulate buffer group */
ASSIGN_4V( ctx->Accum.ClearColor, 0.0, 0.0, 0.0, 0.0 );
ctx->Pixel.PixelTextureEnabled = GL_FALSE;
ctx->Pixel.FragmentRgbSource = GL_PIXEL_GROUP_COLOR_SGIS;
ctx->Pixel.FragmentAlphaSource = GL_PIXEL_GROUP_COLOR_SGIS;
+ ctx->Pixel.PostColorMatrixRedBias = 0.0;
+ ctx->Pixel.PostColorMatrixRedScale = 1.0;
+ ctx->Pixel.PostColorMatrixGreenBias = 0.0;
+ ctx->Pixel.PostColorMatrixGreenScale = 1.0;
+ ctx->Pixel.PostColorMatrixBlueBias = 0.0;
+ ctx->Pixel.PostColorMatrixBlueScale = 1.0;
+ ctx->Pixel.PostColorMatrixAlphaBias = 0.0;
+ ctx->Pixel.PostColorMatrixAlphaScale = 1.0;
/* Point group */
ctx->Point.SmoothFlag = GL_FALSE;
-/* $Id: drawpix.c,v 1.17 2000/04/07 16:27:26 brianp Exp $ */
+/* $Id: drawpix.c,v 1.18 2000/04/08 18:57:45 brianp Exp $ */
/*
* Mesa 3-D graphics library
return GL_TRUE;
}
- if (ctx->NewState) {
- gl_update_state(ctx);
- }
-
if ((ctx->RasterMask&(~(SCISSOR_BIT|WINCLIP_BIT)))==0
- && ctx->Pixel.RedBias==0.0 && ctx->Pixel.RedScale==1.0
- && ctx->Pixel.GreenBias==0.0 && ctx->Pixel.GreenScale==1.0
- && ctx->Pixel.BlueBias==0.0 && ctx->Pixel.BlueScale==1.0
- && ctx->Pixel.AlphaBias==0.0 && ctx->Pixel.AlphaScale==1.0
+ && !ctx->Pixel.ScaleOrBiasRGBA
+ && !ctx->Pixel.ScaleOrBiasRGBApcm
+ && ctx->ColorMatrix.type == MATRIX_IDENTITY
&& ctx->Pixel.IndexShift==0 && ctx->Pixel.IndexOffset==0
&& ctx->Pixel.MapColorFlag==0
&& ctx->Texture.ReallyEnabled == 0
return;
}
+ if (ctx->NewState) {
+ gl_update_state(ctx);
+ }
+
x = (GLint) (ctx->Current.RasterPos[0] + 0.5F);
y = (GLint) (ctx->Current.RasterPos[1] + 0.5F);
-/* $Id: extensions.c,v 1.22 2000/04/07 16:27:26 brianp Exp $ */
+/* $Id: extensions.c,v 1.23 2000/04/08 18:57:45 brianp Exp $ */
/*
* Mesa 3-D graphics library
static struct { int enabled; const char *name; } default_extensions[] = {
+ { DEFAULT_OFF, "GL_ARB_imaging" },
+ { DEFAULT_ON, "GL_ARB_multitexture" },
+ { ALWAYS_ENABLED, "GL_ARB_tranpose_matrix" },
+ { ALWAYS_ENABLED, "GL_EXT_abgr" },
{ DEFAULT_ON, "GL_EXT_blend_color" },
- { DEFAULT_OFF, "ARB_imaging" },
- { DEFAULT_ON, "GL_EXT_blend_minmax" },
{ DEFAULT_ON, "GL_EXT_blend_logic_op" },
+ { DEFAULT_ON, "GL_EXT_blend_minmax" },
{ DEFAULT_ON, "GL_EXT_blend_subtract" },
+ { DEFAULT_ON, "GL_EXT_clip_volume_hint" },
+ { DEFAULT_ON, "GL_EXT_compiled_vertex_array" },
{ DEFAULT_ON, "GL_EXT_paletted_texture" },
{ DEFAULT_ON, "GL_EXT_point_parameters" },
{ ALWAYS_ENABLED, "GL_EXT_polygon_offset" },
- { ALWAYS_ENABLED, "GL_EXT_vertex_array" },
- { ALWAYS_ENABLED, "GL_EXT_texture_object" },
- { DEFAULT_ON, "GL_EXT_texture3D" },
- { ALWAYS_ENABLED, "GL_MESA_window_pos" },
- { ALWAYS_ENABLED, "GL_MESA_resize_buffers" },
- { DEFAULT_ON, "GL_EXT_shared_texture_palette" },
{ ALWAYS_ENABLED, "GL_EXT_rescale_normal" },
- { ALWAYS_ENABLED, "GL_EXT_abgr" },
- { ALWAYS_ENABLED, "GL_SGIS_texture_edge_clamp" },
+ { DEFAULT_ON, "GL_EXT_shared_texture_palette" },
{ ALWAYS_ENABLED, "GL_EXT_stencil_wrap" },
- { DEFAULT_ON, "GL_INGR_blend_func_separate" },
- { DEFAULT_ON, "GL_ARB_multitexture" },
- { ALWAYS_ENABLED, "GL_NV_texgen_reflection" },
- { DEFAULT_ON, "GL_PGI_misc_hints" },
- { DEFAULT_ON, "GL_EXT_compiled_vertex_array" },
- { DEFAULT_ON, "GL_EXT_clip_volume_hint" },
- { DEFAULT_ON, "GL_EXT_texture_env_add" },
- { ALWAYS_ENABLED, "GL_ARB_tranpose_matrix" },
- { DEFAULT_OFF, "GL_EXT_vertex_array_set" },
+ { DEFAULT_ON, "GL_EXT_texture3D" },
{ DEFAULT_OFF, "GL_EXT_texture_env" },
+ { DEFAULT_ON, "GL_EXT_texture_env_add" },
+ { ALWAYS_ENABLED, "GL_EXT_texture_object" },
{ DEFAULT_ON, "GL_EXT_texture_lod_bias" },
+ { ALWAYS_ENABLED, "GL_EXT_vertex_array" },
+ { DEFAULT_OFF, "GL_EXT_vertex_array_set" },
{ DEFAULT_OFF, "GL_HP_occlusion_test" },
+ { DEFAULT_ON, "GL_INGR_blend_func_separate" },
+ { ALWAYS_ENABLED, "GL_MESA_window_pos" },
+ { ALWAYS_ENABLED, "GL_MESA_resize_buffers" },
+ { ALWAYS_ENABLED, "GL_NV_texgen_reflection" },
+ { DEFAULT_ON, "GL_PGI_misc_hints" },
+ { DEFAULT_ON, "GL_SGI_color_matrix" },
{ DEFAULT_ON, "GL_SGIS_pixel_texture" },
+ { DEFAULT_ON, "GL_SGIS_texture_edge_clamp" },
{ DEFAULT_ON, "GL_SGIX_pixel_texture" }
};
-/* $Id: get.c,v 1.18 2000/04/07 16:27:26 brianp Exp $ */
+/* $Id: get.c,v 1.19 2000/04/08 18:57:45 brianp Exp $ */
/*
* Mesa 3-D graphics library
*params = (GLboolean) pixel_texgen_mode(ctx);
break;
+ /* GL_SGI_color_matrix (also in 1.2 imaging) */
+ case GL_COLOR_MATRIX_SGI:
+ for (i=0;i<16;i++) {
+ params[i] = FLOAT_TO_BOOL(ctx->ColorMatrix.m[i]);
+ }
+ break;
+ case GL_COLOR_MATRIX_STACK_DEPTH_SGI:
+ *params = INT_TO_BOOL(ctx->ColorStackDepth + 1);
+ break;
+ case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI:
+ *params = FLOAT_TO_BOOL(MAX_COLOR_STACK_DEPTH);
+ break;
+ case GL_POST_COLOR_MATRIX_RED_SCALE_SGI:
+ *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixRedScale);
+ break;
+ case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI:
+ *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixGreenScale);
+ break;
+ case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI:
+ *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixBlueScale);
+ break;
+ case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI:
+ *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixAlphaScale);
+ break;
+ case GL_POST_COLOR_MATRIX_RED_BIAS_SGI:
+ *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixRedBias);
+ break;
+ case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI:
+ *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixGreenBias);
+ break;
+ case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI:
+ *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixBlueBias);
+ break;
+ case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI:
+ *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixAlphaBias);
+ break;
+
default:
gl_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" );
}
*params = (GLdouble) pixel_texgen_mode(ctx);
break;
+ /* GL_SGI_color_matrix (also in 1.2 imaging) */
+ case GL_COLOR_MATRIX_SGI:
+ for (i=0;i<16;i++) {
+ params[i] = (GLdouble) ctx->ColorMatrix.m[i];
+ }
+ break;
+ case GL_COLOR_MATRIX_STACK_DEPTH_SGI:
+ *params = (GLdouble) (ctx->ColorStackDepth + 1);
+ break;
+ case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI:
+ *params = (GLdouble) MAX_COLOR_STACK_DEPTH;
+ break;
+ case GL_POST_COLOR_MATRIX_RED_SCALE_SGI:
+ *params = (GLdouble) ctx->Pixel.PostColorMatrixRedScale;
+ break;
+ case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI:
+ *params = (GLdouble) ctx->Pixel.PostColorMatrixGreenScale;
+ break;
+ case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI:
+ *params = (GLdouble) ctx->Pixel.PostColorMatrixBlueScale;
+ break;
+ case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI:
+ *params = (GLdouble) ctx->Pixel.PostColorMatrixAlphaScale;
+ break;
+ case GL_POST_COLOR_MATRIX_RED_BIAS_SGI:
+ *params = (GLdouble) ctx->Pixel.PostColorMatrixRedBias;
+ break;
+ case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI:
+ *params = (GLdouble) ctx->Pixel.PostColorMatrixGreenBias;
+ break;
+ case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI:
+ *params = (GLdouble) ctx->Pixel.PostColorMatrixBlueBias;
+ break;
+ case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI:
+ *params = (GLdouble) ctx->Pixel.PostColorMatrixAlphaBias;
+ break;
+
default:
gl_error( ctx, GL_INVALID_ENUM, "glGetDoublev" );
}
*params = (GLfloat) pixel_texgen_mode(ctx);
break;
+ /* GL_SGI_color_matrix (also in 1.2 imaging) */
+ case GL_COLOR_MATRIX_SGI:
+ for (i=0;i<16;i++) {
+ params[i] = ctx->ColorMatrix.m[i];
+ }
+ break;
+ case GL_COLOR_MATRIX_STACK_DEPTH_SGI:
+ *params = (GLfloat) (ctx->ColorStackDepth + 1);
+ break;
+ case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI:
+ *params = (GLfloat) MAX_COLOR_STACK_DEPTH;
+ break;
+ case GL_POST_COLOR_MATRIX_RED_SCALE_SGI:
+ *params = ctx->Pixel.PostColorMatrixRedScale;
+ break;
+ case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI:
+ *params = ctx->Pixel.PostColorMatrixGreenScale;
+ break;
+ case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI:
+ *params = ctx->Pixel.PostColorMatrixBlueScale;
+ break;
+ case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI:
+ *params = ctx->Pixel.PostColorMatrixAlphaScale;
+ break;
+ case GL_POST_COLOR_MATRIX_RED_BIAS_SGI:
+ *params = ctx->Pixel.PostColorMatrixRedBias;
+ break;
+ case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI:
+ *params = ctx->Pixel.PostColorMatrixGreenBias;
+ break;
+ case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI:
+ *params = ctx->Pixel.PostColorMatrixBlueBias;
+ break;
+ case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI:
+ *params = ctx->Pixel.PostColorMatrixAlphaBias;
+ break;
+
default:
gl_error( ctx, GL_INVALID_ENUM, "glGetFloatv" );
}
*params = (GLint) pixel_texgen_mode(ctx);
break;
+ /* GL_SGI_color_matrix (also in 1.2 imaging) */
+ case GL_COLOR_MATRIX_SGI:
+ for (i=0;i<16;i++) {
+ params[i] = (GLint) ctx->ColorMatrix.m[i];
+ }
+ break;
+ case GL_COLOR_MATRIX_STACK_DEPTH_SGI:
+ *params = ctx->ColorStackDepth + 1;
+ break;
+ case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI:
+ *params = MAX_COLOR_STACK_DEPTH;
+ break;
+ case GL_POST_COLOR_MATRIX_RED_SCALE_SGI:
+ *params = (GLint) ctx->Pixel.PostColorMatrixRedScale;
+ break;
+ case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI:
+ *params = (GLint) ctx->Pixel.PostColorMatrixGreenScale;
+ break;
+ case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI:
+ *params = (GLint) ctx->Pixel.PostColorMatrixBlueScale;
+ break;
+ case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI:
+ *params = (GLint) ctx->Pixel.PostColorMatrixAlphaScale;
+ break;
+ case GL_POST_COLOR_MATRIX_RED_BIAS_SGI:
+ *params = (GLint) ctx->Pixel.PostColorMatrixRedBias;
+ break;
+ case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI:
+ *params = (GLint) ctx->Pixel.PostColorMatrixGreenBias;
+ break;
+ case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI:
+ *params = (GLint) ctx->Pixel.PostColorMatrixBlueBias;
+ break;
+ case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI:
+ *params = (GLint) ctx->Pixel.PostColorMatrixAlphaBias;
+ break;
+
default:
gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" );
}
-/* $Id: image.c,v 1.24 2000/03/29 15:56:53 brianp Exp $ */
+/* $Id: image.c,v 1.25 2000/04/08 18:57:45 brianp Exp $ */
/*
* Mesa 3-D graphics library
srcType == GL_UNSIGNED_INT_10_10_10_2 ||
srcType == GL_UNSIGNED_INT_2_10_10_10_REV);
- /* this is intended for RGBA mode */
+ /* this is intended for RGBA mode only */
assert(ctx->Visual->RGBAflag);
applyTransferOps &= (ctx->Pixel.ScaleOrBiasRGBA ||
ctx->Pixel.MapColorFlag ||
- ctx->Pixel.MapColorFlag);
+ ctx->ColorMatrix.type != MATRIX_IDENTITY ||
+ ctx->Pixel.ScaleOrBiasRGBApcm);
/* Try simple cases first */
if (!applyTransferOps && srcType == GL_UNSIGNED_BYTE) {
if (applyTransferOps) {
/* scale and bias colors */
- gl_scale_and_bias_rgba_float(ctx, n, rgba);
+ _mesa_scale_and_bias_rgba_float(ctx, n, rgba);
/* color table lookup */
if (ctx->Pixel.MapColorFlag) {
- gl_map_rgba_float(ctx, n, rgba);
+ _mesa_map_rgba_float(ctx, n, rgba);
+ }
+
+ if (ctx->ColorMatrix.type != MATRIX_IDENTITY ||
+ ctx->Pixel.ScaleOrBiasRGBApcm) {
+ _mesa_transform_rgba(ctx, n, rgba);
}
}
}
-/* $Id: matrix.c,v 1.16 2000/03/03 17:47:39 brianp Exp $ */
+/* $Id: matrix.c,v 1.17 2000/04/08 18:57:45 brianp Exp $ */
/*
* Mesa 3-D graphics library
mat = &ctx->TextureMatrix[ctx->Texture.CurrentTransformUnit]; \
flags |= NEW_TEXTURE_MATRIX; \
break; \
+ case GL_COLOR: \
+ mat = &ctx->ColorMatrix; \
+ flags |= NEW_COLOR_MATRIX; \
+ break; \
default: \
gl_problem(ctx, where); \
} \
case GL_MODELVIEW:
case GL_PROJECTION:
case GL_TEXTURE:
+ case GL_COLOR:
ctx->Transform.MatrixMode = mode;
break;
default:
&ctx->TextureMatrix[t] );
}
break;
+ case GL_COLOR:
+ if (ctx->ColorStackDepth >= MAX_COLOR_STACK_DEPTH - 1) {
+ gl_error( ctx, GL_STACK_OVERFLOW, "glPushMatrix");
+ return;
+ }
+ gl_matrix_copy( &ctx->ColorStack[ctx->ColorStackDepth++],
+ &ctx->ColorMatrix );
+ break;
default:
gl_problem(ctx, "Bad matrix mode in gl_PushMatrix");
}
&ctx->TextureStack[t][--ctx->TextureStackDepth[t]]);
}
break;
+ case GL_COLOR:
+ if (ctx->ColorStackDepth==0) {
+ gl_error( ctx, GL_STACK_UNDERFLOW, "glPopMatrix");
+ return;
+ }
+ gl_matrix_copy(&ctx->ColorMatrix,
+ &ctx->ColorStack[--ctx->ColorStackDepth]);
+ break;
default:
gl_problem(ctx, "Bad matrix mode in gl_PopMatrix");
}
-/* $Id: pixel.c,v 1.5 1999/11/11 01:22:27 brianp Exp $ */
+/* $Id: pixel.c,v 1.6 2000/04/08 18:57:45 brianp Exp $ */
/*
* Mesa 3-D graphics library
case GL_DEPTH_BIAS:
ctx->Pixel.DepthBias = param;
break;
+ case GL_POST_COLOR_MATRIX_RED_SCALE:
+ ctx->Pixel.PostColorMatrixRedScale = param;
+ break;
+ case GL_POST_COLOR_MATRIX_RED_BIAS:
+ ctx->Pixel.PostColorMatrixRedBias = param;
+ break;
+ case GL_POST_COLOR_MATRIX_GREEN_SCALE:
+ ctx->Pixel.PostColorMatrixGreenScale = param;
+ break;
+ case GL_POST_COLOR_MATRIX_GREEN_BIAS:
+ ctx->Pixel.PostColorMatrixGreenBias = param;
+ break;
+ case GL_POST_COLOR_MATRIX_BLUE_SCALE:
+ ctx->Pixel.PostColorMatrixBlueScale = param;
+ break;
+ case GL_POST_COLOR_MATRIX_BLUE_BIAS:
+ ctx->Pixel.PostColorMatrixBlueBias = param;
+ break;
+ case GL_POST_COLOR_MATRIX_ALPHA_SCALE:
+ ctx->Pixel.PostColorMatrixAlphaScale = param;
+ break;
+ case GL_POST_COLOR_MATRIX_ALPHA_BIAS:
+ ctx->Pixel.PostColorMatrixAlphaBias = param;
+ break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glPixelTransfer(pname)" );
return;
else {
ctx->Pixel.ScaleOrBiasRGBA = GL_FALSE;
}
+
+ if (ctx->Pixel.PostColorMatrixRedScale!=1.0F ||
+ ctx->Pixel.PostColorMatrixRedBias!=0.0F ||
+ ctx->Pixel.PostColorMatrixGreenScale!=1.0F ||
+ ctx->Pixel.PostColorMatrixGreenBias!=0.0F ||
+ ctx->Pixel.PostColorMatrixBlueScale!=1.0F ||
+ ctx->Pixel.PostColorMatrixBlueBias!=0.0F ||
+ ctx->Pixel.PostColorMatrixAlphaScale!=1.0F ||
+ ctx->Pixel.PostColorMatrixAlphaBias!=0.0F) {
+ ctx->Pixel.ScaleOrBiasRGBApcm = GL_TRUE;
+ }
+ else {
+ ctx->Pixel.ScaleOrBiasRGBApcm = GL_FALSE;
+ }
}
/*
* Apply scale and bias factors to an array of RGBA pixels.
*/
-void gl_scale_and_bias_rgba_float( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] )
+void
+_mesa_scale_and_bias_rgba_float(const GLcontext *ctx, GLuint n,
+ GLfloat rgba[][4])
{
if (ctx->Pixel.RedScale != 1.0 || ctx->Pixel.RedBias != 0.0) {
const GLfloat scale = ctx->Pixel.RedScale;
/*
* Apply pixel mapping to an array of floating point RGBA pixels.
*/
-void gl_map_rgba_float( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] )
+void
+_mesa_map_rgba_float( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] )
{
const GLfloat rscale = ctx->Pixel.MapRtoRsize - 1;
const GLfloat gscale = ctx->Pixel.MapGtoGsize - 1;
}
+/*
+ * Apply the color matrix and post color matrix scaling and biasing.
+ */
+void
+_mesa_transform_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4])
+{
+ const GLfloat rs = ctx->Pixel.PostColorMatrixRedScale;
+ const GLfloat rb = ctx->Pixel.PostColorMatrixRedBias;
+ const GLfloat gs = ctx->Pixel.PostColorMatrixGreenScale;
+ const GLfloat gb = ctx->Pixel.PostColorMatrixGreenBias;
+ const GLfloat bs = ctx->Pixel.PostColorMatrixBlueScale;
+ const GLfloat bb = ctx->Pixel.PostColorMatrixBlueBias;
+ const GLfloat as = ctx->Pixel.PostColorMatrixAlphaScale;
+ const GLfloat ab = ctx->Pixel.PostColorMatrixAlphaBias;
+ const GLfloat *m = ctx->ColorMatrix.m;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ const GLfloat r = rgba[i][RCOMP];
+ const GLfloat g = rgba[i][GCOMP];
+ const GLfloat b = rgba[i][BCOMP];
+ const GLfloat a = rgba[i][ACOMP];
+ rgba[i][RCOMP] = (m[0] * r + m[4] * g + m[ 8] * b + m[12] * a) * rs + rb;
+ rgba[i][GCOMP] = (m[1] * r + m[5] * g + m[ 9] * b + m[13] * a) * gs + gb;
+ rgba[i][BCOMP] = (m[2] * r + m[6] * g + m[10] * b + m[14] * a) * bs + bb;
+ rgba[i][ACOMP] = (m[3] * r + m[7] * g + m[11] * b + m[15] * a) * as + ab;
+ }
+}
+
+
+
/*
* Apply pixel mapping to an array of RGBA pixels.
*/
-/* $Id: pixel.h,v 1.3 1999/11/11 01:22:27 brianp Exp $ */
+/* $Id: pixel.h,v 1.4 2000/04/08 18:57:45 brianp Exp $ */
/*
* Mesa 3-D graphics library
GLubyte rgba[][4] );
-extern void gl_scale_and_bias_rgba_float( const GLcontext *ctx, GLuint n,
- GLfloat rgba[][4] );
+extern void
+_mesa_scale_and_bias_rgba_float( const GLcontext *ctx, GLuint n,
+ GLfloat rgba[][4] );
extern void gl_map_rgba( const GLcontext *ctx, GLuint n, GLubyte rgba[][4] );
-extern void gl_map_rgba_float( const GLcontext *ctx, GLuint n,
- GLfloat rgba[][4] );
+extern void
+_mesa_map_rgba_float( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] );
+
+
+extern void
+_mesa_transform_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]);
extern void gl_map_color( const GLcontext *ctx, GLuint n,
-/* $Id: state.c,v 1.7 2000/04/07 16:27:26 brianp Exp $ */
+/* $Id: state.c,v 1.8 2000/04/08 18:57:45 brianp Exp $ */
/*
* Mesa 3-D graphics library
ctx->ModelProjectWinMatrixUptodate = 0;
}
+ if (ctx->NewState & NEW_COLOR_MATRIX) {
+ gl_matrix_analyze( &ctx->ColorMatrix );
+ printf("analyze color matrix %x %x\n", ctx->ColorMatrix.flags, ctx->ColorMatrix.type);
+ }
+
/* Figure out whether we can light in object space or not. If we
* can, find the current positions of the lights in object space
*/