summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/rastpos.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/rastpos.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/rastpos.c')
-rw-r--r--src/mesa/main/rastpos.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c
index 8184a25b975..218e4f7ed2e 100644
--- a/src/mesa/main/rastpos.c
+++ b/src/mesa/main/rastpos.c
@@ -140,7 +140,8 @@ shade_rastpos(GLcontext *ctx,
_mesa_validate_all_lighting_tables( ctx );
COPY_3V(diffuseColor, base[0]);
- diffuseColor[3] = CLAMP( ctx->Light.Material[0].Diffuse[3], 0.0F, 1.0F );
+ diffuseColor[3] = CLAMP(
+ ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3], 0.0F, 1.0F );
ASSIGN_4V(specularColor, 0.0, 0.0, 0.0, 0.0);
foreach (light, &ctx->Light.EnabledList) {
@@ -223,9 +224,9 @@ shade_rastpos(GLcontext *ctx,
n_dot_h = DOT3(normal, h);
if (n_dot_h > 0.0F) {
- const struct gl_material *mat = &ctx->Light.Material[0];
+ GLfloat (*mat)[4] = ctx->Light.Material.Attrib;
GLfloat spec_coef;
- GLfloat shininess = mat->Shininess;
+ GLfloat shininess = mat[MAT_ATTRIB_FRONT_SHININESS][0];
if (!normalized) {
n_dot_h *= n_dot_h;
@@ -264,16 +265,16 @@ shade_rastpos(GLcontext *ctx,
Rspec[3] = CLAMP(specularColor[3], 0.0F, 1.0F);
}
else {
- struct gl_material *mat = &ctx->Light.Material[0];
- GLfloat d_a = mat->DiffuseIndex - mat->AmbientIndex;
- GLfloat s_a = mat->SpecularIndex - mat->AmbientIndex;
- GLfloat ind = mat->AmbientIndex
- + diffuse * (1.0F-specular) * d_a
- + specular * s_a;
- if (ind > mat->SpecularIndex) {
- ind = mat->SpecularIndex;
+ GLfloat *ind = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_INDEXES];
+ GLfloat d_a = ind[MAT_INDEX_DIFFUSE] - ind[MAT_INDEX_AMBIENT];
+ GLfloat s_a = ind[MAT_INDEX_SPECULAR] - ind[MAT_INDEX_AMBIENT];
+ GLfloat i = (ind[MAT_INDEX_AMBIENT]
+ + diffuse * (1.0F-specular) * d_a
+ + specular * s_a);
+ if (i > ind[MAT_INDEX_SPECULAR]) {
+ i = ind[MAT_INDEX_SPECULAR];
}
- *Rindex = (GLuint) (GLint) ind;
+ *Rindex = (GLuint) (GLint) i;
}
}