summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2000-06-29 04:56:30 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2000-06-29 04:56:30 +0000
commitc535ba5a10d068a77615bdf74a40d7b6b1f054d4 (patch)
tree8d258ade4a0fd1e69919e40c6a9ab469b05720d3
parentae41a955fbafba1481264f27b11e5ad9ded384b3 (diff)
don't add light's ambient color to BaseColor in gl_update_lighting()
-rw-r--r--src/mesa/main/light.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index 3e7b5a3781..6f2eb16fd2 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -1,4 +1,4 @@
-/* $Id: light.c,v 1.14 2000/06/26 23:37:46 brianp Exp $ */
+/* $Id: light.c,v 1.15 2000/06/29 04:56:30 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1258,13 +1258,12 @@ void gl_update_lighting( GLcontext *ctx )
/* Precompute some shading values.
*/
- if (ctx->Visual->RGBAflag)
- {
+ if (ctx->Visual->RGBAflag) {
GLuint sides = ((ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE) ? 2 : 1);
GLuint side;
for (side=0; side < sides; side++) {
struct gl_material *mat = &ctx->Light.Material[side];
-
+
COPY_3V(ctx->Light.BaseColor[side], mat->Emission);
ACC_SCALE_3V(ctx->Light.BaseColor[side],
ctx->Light.Model.Ambient,
@@ -1276,12 +1275,10 @@ void gl_update_lighting( GLcontext *ctx )
foreach (light, &ctx->Light.EnabledList) {
for (side=0; side< sides; side++) {
- struct gl_material *mat = &ctx->Light.Material[side];
- SCALE_3V( light->MatDiffuse[side], light->Diffuse, mat->Diffuse );
- SCALE_3V( light->MatAmbient[side], light->Ambient, mat->Ambient );
- ACC_3V( ctx->Light.BaseColor[side], light->MatAmbient[side] );
- if (light->Flags & LIGHT_SPECULAR)
- {
+ const struct gl_material *mat = &ctx->Light.Material[side];
+ SCALE_3V( light->MatDiffuse[side], light->Diffuse, mat->Diffuse );
+ SCALE_3V( light->MatAmbient[side], light->Ambient, mat->Ambient );
+ if (light->Flags & LIGHT_SPECULAR) {
SCALE_3V( light->MatSpecular[side], light->Specular,
mat->Specular);
light->IsMatSpecular[side] =
@@ -1292,10 +1289,8 @@ void gl_update_lighting( GLcontext *ctx )
}
}
}
- else
- {
- static GLfloat ci[3] = { .30, .59, .11 };
-
+ else {
+ static const GLfloat ci[3] = { .30, .59, .11 };
foreach(light, &ctx->Light.EnabledList) {
light->dli = DOT3(ci, light->Diffuse);
light->sli = DOT3(ci, light->Specular);
@@ -1303,6 +1298,8 @@ void gl_update_lighting( GLcontext *ctx )
}
}
+
+
/* Need to seriously restrict the circumstances under which these
* calc's are performed.
*/