aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/api_noop.c
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2003-08-05 18:55:49 +0000
committerKeith Whitwell <[email protected]>2003-08-05 18:55:49 +0000
commitff56908e09c0351179478deb19677cf56eec1f64 (patch)
treeca51e376173869a8cb44304a0105b237f1dafce9 /src/mesa/main/api_noop.c
parente6dea091c0a1fe9ad9720c07ddf7164e5fc45ac6 (diff)
Store material attributes in an Attrib[] style array. This is a
first step to reviving/rescuing the 'vtx' rework from the old mesa tree.
Diffstat (limited to 'src/mesa/main/api_noop.c')
-rw-r--r--src/mesa/main/api_noop.c58
1 files changed, 15 insertions, 43 deletions
diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c
index a1f689d6f95..bab333dca8a 100644
--- a/src/mesa/main/api_noop.c
+++ b/src/mesa/main/api_noop.c
@@ -98,56 +98,28 @@ void _mesa_noop_Normal3fv( const GLfloat *v )
void _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
{
GET_CURRENT_CONTEXT(ctx);
- struct gl_material mat[2];
+ GLint i, nr;
+ struct gl_material *mat = &ctx->Light.Material;
GLuint bitmask = _mesa_material_bitmask( ctx, face, pname, ~0,
"_mesa_noop_Materialfv" );
+
+ if (ctx->Light.ColorMaterialEnabled)
+ bitmask &= ~ctx->Light.ColorMaterialBitmask;
+
if (bitmask == 0)
return;
- if (bitmask & FRONT_AMBIENT_BIT) {
- COPY_4FV( mat[0].Ambient, params );
- }
- if (bitmask & BACK_AMBIENT_BIT) {
- COPY_4FV( mat[1].Ambient, params );
- }
- if (bitmask & FRONT_DIFFUSE_BIT) {
- COPY_4FV( mat[0].Diffuse, params );
- }
- if (bitmask & BACK_DIFFUSE_BIT) {
- COPY_4FV( mat[1].Diffuse, params );
- }
- if (bitmask & FRONT_SPECULAR_BIT) {
- COPY_4FV( mat[0].Specular, params );
- }
- if (bitmask & BACK_SPECULAR_BIT) {
- COPY_4FV( mat[1].Specular, params );
- }
- if (bitmask & FRONT_EMISSION_BIT) {
- COPY_4FV( mat[0].Emission, params );
- }
- if (bitmask & BACK_EMISSION_BIT) {
- COPY_4FV( mat[1].Emission, params );
- }
- if (bitmask & FRONT_SHININESS_BIT) {
- GLfloat shininess = CLAMP( params[0], 0.0F, ctx->Const.MaxShininess );
- mat[0].Shininess = shininess;
- }
- if (bitmask & BACK_SHININESS_BIT) {
- GLfloat shininess = CLAMP( params[0], 0.0F, ctx->Const.MaxShininess );
- mat[1].Shininess = shininess;
- }
- if (bitmask & FRONT_INDEXES_BIT) {
- mat[0].AmbientIndex = params[0];
- mat[0].DiffuseIndex = params[1];
- mat[0].SpecularIndex = params[2];
- }
- if (bitmask & BACK_INDEXES_BIT) {
- mat[1].AmbientIndex = params[0];
- mat[1].DiffuseIndex = params[1];
- mat[1].SpecularIndex = params[2];
+ switch (face) {
+ case GL_SHININESS: nr = 1; break;
+ case GL_COLOR_INDEXES: nr = 3; break;
+ default: nr = 4 ; break;
}
- _mesa_update_material( ctx, mat, bitmask );
+ for (i = 0 ; i < MAT_ATTRIB_MAX ; i++)
+ if (bitmask & (1<<i))
+ COPY_SZ_4V( mat->Attrib[i], nr, params );
+
+ _mesa_update_material( ctx, bitmask );
}
void _mesa_noop_Color4ub( GLubyte a, GLubyte b, GLubyte c, GLubyte d )