summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2001-07-28 19:28:49 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2001-07-28 19:28:49 +0000
commit46af1f87c897ef03470d205e9fd147e93911cbce (patch)
treeed9efc16aa63fdf47e886f2c9083f3d0f38f8ad8 /src/mesa
parent616f470629487f303979c7e878062d66658ac812 (diff)
Remove _BaseAlpha, fix reflect lighting bug.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/light.c9
-rw-r--r--src/mesa/main/mtypes.h3
-rw-r--r--src/mesa/main/rastpos.c5
-rw-r--r--src/mesa/swrast/s_context.c9
-rw-r--r--src/mesa/tnl/t_vb_lighttmp.h45
-rw-r--r--src/mesa/x86/gen_matypes.c3
6 files changed, 40 insertions, 34 deletions
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index 6a0619c62c..8f4c607af5 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -1,4 +1,4 @@
-/* $Id: light.c,v 1.44 2001/05/09 12:24:51 keithw Exp $ */
+/* $Id: light.c,v 1.45 2001/07/28 19:28:49 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -664,7 +664,6 @@ void _mesa_update_material( GLcontext *ctx,
foreach (light, list) {
SCALE_3V( light->_MatDiffuse[0], light->Diffuse, mat->Diffuse );
}
- ctx->Light._BaseAlpha[0] = CLAMP( mat->Diffuse[3], 0.0, 1.0 );
}
if (bitmask & BACK_DIFFUSE_BIT) {
struct gl_material *mat = &ctx->Light.Material[1];
@@ -672,7 +671,6 @@ void _mesa_update_material( GLcontext *ctx,
foreach (light, list) {
SCALE_3V( light->_MatDiffuse[1], light->Diffuse, mat->Diffuse );
}
- ctx->Light._BaseAlpha[1] = CLAMP( mat->Diffuse[3], 0.0, 1.0 );
}
/* update material specular values */
@@ -801,7 +799,6 @@ void _mesa_update_color_material( GLcontext *ctx,
foreach (light, list) {
SCALE_3V( light->_MatDiffuse[0], light->Diffuse, mat->Diffuse );
}
- ctx->Light._BaseAlpha[0] = CLAMP( mat->Diffuse[3], 0.0, 1.0 );
}
if (bitmask & BACK_DIFFUSE_BIT) {
@@ -810,7 +807,6 @@ void _mesa_update_color_material( GLcontext *ctx,
foreach (light, list) {
SCALE_3V( light->_MatDiffuse[1], light->Diffuse, mat->Diffuse );
}
- ctx->Light._BaseAlpha[1] = CLAMP( mat->Diffuse[3], 0.0, 1.0 );
}
/* update light->_MatSpecular = light's specular * material's specular */
@@ -1216,9 +1212,6 @@ _mesa_update_lighting( GLcontext *ctx )
ACC_SCALE_3V(ctx->Light._BaseColor[side],
ctx->Light.Model.Ambient,
mat->Ambient);
-
- ctx->Light._BaseAlpha[side] =
- CLAMP( ctx->Light.Material[side].Diffuse[3], 0.0, 1.0 );
}
foreach (light, &ctx->Light.EnabledList) {
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 9bf185f7f3..9325934a07 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1,4 +1,4 @@
-/* $Id: mtypes.h,v 1.49 2001/07/13 20:07:37 brianp Exp $ */
+/* $Id: mtypes.h,v 1.50 2001/07/28 19:28:49 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -496,7 +496,6 @@ struct gl_light_attrib {
GLboolean _NeedVertices; /* Use fast shader? */
GLuint _Flags; /* LIGHT_* flags, see below */
GLfloat _BaseColor[2][3];
- GLfloat _BaseAlpha[2];
};
diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c
index 83f8468314..841e539a6a 100644
--- a/src/mesa/main/rastpos.c
+++ b/src/mesa/main/rastpos.c
@@ -1,4 +1,4 @@
-/* $Id: rastpos.c,v 1.29 2001/07/05 15:31:21 brianp Exp $ */
+/* $Id: rastpos.c,v 1.30 2001/07/28 19:28:49 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -126,7 +126,6 @@ shade_rastpos(GLcontext *ctx,
GLuint *Rindex)
{
GLfloat (*base)[3] = ctx->Light._BaseColor;
- const GLfloat *sumA = ctx->Light._BaseAlpha;
struct gl_light *light;
GLfloat diffuseColor[4], specularColor[4];
GLfloat diffuse = 0, specular = 0;
@@ -135,7 +134,7 @@ shade_rastpos(GLcontext *ctx,
_mesa_validate_all_lighting_tables( ctx );
COPY_3V(diffuseColor, base[0]);
- diffuseColor[3] = sumA[0];
+ diffuseColor[3] = CLAMP( ctx->Light.Material[0].Diffuse[3], 0.0, 1.0 );
ASSIGN_4V(specularColor, 0.0, 0.0, 0.0, 0.0);
foreach (light, &ctx->Light.EnabledList) {
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index 76be114f0a..4191dee2cf 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -1,4 +1,4 @@
-/* $Id: s_context.c,v 1.24 2001/07/17 19:39:32 keithw Exp $ */
+/* $Id: s_context.c,v 1.25 2001/07/28 19:28:49 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -541,9 +541,10 @@ _swrast_print_vertex( GLcontext *ctx, const SWvertex *v )
v->win[0], v->win[1], v->win[2], v->win[3]);
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
- fprintf(stderr, "texcoord[%d] %f %f %f %f\n", i,
- v->texcoord[i][0], v->texcoord[i][1],
- v->texcoord[i][2], v->texcoord[i][3]);
+ if (ctx->Texture.Unit[i]._ReallyEnabled)
+ fprintf(stderr, "texcoord[%d] %f %f %f %f\n", i,
+ v->texcoord[i][0], v->texcoord[i][1],
+ v->texcoord[i][2], v->texcoord[i][3]);
#if CHAN_TYPE == GL_FLOAT
fprintf(stderr, "color %f %f %f %f\n",
diff --git a/src/mesa/tnl/t_vb_lighttmp.h b/src/mesa/tnl/t_vb_lighttmp.h
index 87e00ddf08..ff3dead13e 100644
--- a/src/mesa/tnl/t_vb_lighttmp.h
+++ b/src/mesa/tnl/t_vb_lighttmp.h
@@ -1,4 +1,4 @@
-/* $Id: t_vb_lighttmp.h,v 1.13 2001/07/17 19:39:32 keithw Exp $ */
+/* $Id: t_vb_lighttmp.h,v 1.14 2001/07/28 19:28:49 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -116,8 +116,6 @@ static void TAG(light_rgba_spec)( GLcontext *ctx,
(void) vstride;
- UNCLAMPED_FLOAT_TO_CHAN(sumA[0], ctx->Light._BaseAlpha[0]);
- UNCLAMPED_FLOAT_TO_CHAN(sumA[1], ctx->Light._BaseAlpha[1]);
/* fprintf(stderr, "%s\n", __FUNCTION__ ); */
@@ -134,10 +132,12 @@ static void TAG(light_rgba_spec)( GLcontext *ctx,
VB->ColorPtr[0] = &store->LitColor[0];
VB->SecondaryColorPtr[0] = &store->LitSecondary[0];
+ UNCLAMPED_FLOAT_TO_CHAN(sumA[0], ctx->Light.Material[0].Diffuse[3]);
if (IDX & LIGHT_TWOSIDE) {
VB->ColorPtr[1] = &store->LitColor[1];
VB->SecondaryColorPtr[1] = &store->LitSecondary[1];
+ UNCLAMPED_FLOAT_TO_CHAN(sumA[1], ctx->Light.Material[1].Diffuse[3]);
}
/* Side-effects done, can we finish now?
@@ -158,8 +158,12 @@ static void TAG(light_rgba_spec)( GLcontext *ctx,
if ( CHECK_MATERIAL(j) )
_mesa_update_material( ctx, new_material[j], new_material_mask[j] );
- if ( CHECK_VALIDATE(j) )
+ if ( CHECK_VALIDATE(j) ) {
_mesa_validate_all_lighting_tables( ctx );
+ UNCLAMPED_FLOAT_TO_CHAN(sumA[0], ctx->Light.Material[0].Diffuse[3]);
+ if (IDX & LIGHT_TWOSIDE)
+ UNCLAMPED_FLOAT_TO_CHAN(sumA[1], ctx->Light.Material[1].Diffuse[3]);
+ }
COPY_3V(sum[0], base[0]);
ZERO_3V(spec[0]);
@@ -331,9 +335,6 @@ static void TAG(light_rgba)( GLcontext *ctx,
color[0] = Fcolor;
color[1] = Bcolor;
- UNCLAMPED_FLOAT_TO_CHAN(sumA[0], ctx->Light._BaseAlpha[0]);
- UNCLAMPED_FLOAT_TO_CHAN(sumA[1], ctx->Light._BaseAlpha[1]);
-
if (IDX & LIGHT_COLORMATERIAL) {
if (VB->ColorPtr[0]->Type != GL_FLOAT)
import_color_material( ctx, stage );
@@ -343,8 +344,12 @@ static void TAG(light_rgba)( GLcontext *ctx,
}
VB->ColorPtr[0] = &store->LitColor[0];
- if (IDX & LIGHT_TWOSIDE)
+ UNCLAMPED_FLOAT_TO_CHAN(sumA[0], ctx->Light.Material[0].Diffuse[3]);
+
+ if (IDX & LIGHT_TWOSIDE) {
VB->ColorPtr[1] = &store->LitColor[1];
+ UNCLAMPED_FLOAT_TO_CHAN(sumA[1], ctx->Light.Material[1].Diffuse[3]);
+ }
if (stage->changed_inputs == 0)
return;
@@ -362,8 +367,12 @@ static void TAG(light_rgba)( GLcontext *ctx,
if ( CHECK_MATERIAL(j) )
_mesa_update_material( ctx, new_material[j], new_material_mask[j] );
- if ( CHECK_VALIDATE(j) )
+ if ( CHECK_VALIDATE(j) ) {
_mesa_validate_all_lighting_tables( ctx );
+ UNCLAMPED_FLOAT_TO_CHAN(sumA[0], ctx->Light.Material[0].Diffuse[3]);
+ if (IDX & LIGHT_TWOSIDE)
+ UNCLAMPED_FLOAT_TO_CHAN(sumA[1], ctx->Light.Material[1].Diffuse[3]);
+ }
COPY_3V(sum[0], base[0]);
@@ -565,13 +574,15 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx,
COPY_3V(base[0], light->_MatAmbient[0]);
ACC_3V(base[0], ctx->Light._BaseColor[0] );
UNCLAMPED_FLOAT_TO_RGB_CHAN( basechan[0], base[0] );
- UNCLAMPED_FLOAT_TO_CHAN(basechan[0][3], ctx->Light._BaseAlpha[0]);
+ UNCLAMPED_FLOAT_TO_CHAN(basechan[0][3],
+ ctx->Light.Material[0].Diffuse[3]);
if (IDX & LIGHT_TWOSIDE) {
COPY_3V(base[1], light->_MatAmbient[1]);
ACC_3V(base[1], ctx->Light._BaseColor[1]);
UNCLAMPED_FLOAT_TO_RGB_CHAN( basechan[1], base[1]);
- UNCLAMPED_FLOAT_TO_CHAN(basechan[1][3], ctx->Light._BaseAlpha[1]);
+ UNCLAMPED_FLOAT_TO_CHAN(basechan[1][3],
+ ctx->Light.Material[1].Diffuse[3]);
}
do {
@@ -652,8 +663,8 @@ static void TAG(light_fast_rgba)( GLcontext *ctx,
(void) nr;
(void) nstride;
- UNCLAMPED_FLOAT_TO_CHAN(sumA[0], ctx->Light._BaseAlpha[0]);
- UNCLAMPED_FLOAT_TO_CHAN(sumA[1], ctx->Light._BaseAlpha[1]);
+ UNCLAMPED_FLOAT_TO_CHAN(sumA[0], ctx->Light.Material[0].Diffuse[3]);
+ UNCLAMPED_FLOAT_TO_CHAN(sumA[1], ctx->Light.Material[1].Diffuse[3]);
if (IDX & LIGHT_COLORMATERIAL) {
if (VB->ColorPtr[0]->Type != GL_FLOAT)
@@ -680,9 +691,13 @@ static void TAG(light_fast_rgba)( GLcontext *ctx,
if ( CHECK_MATERIAL(j) )
_mesa_update_material( ctx, new_material[j], new_material_mask[j] );
- if ( CHECK_VALIDATE(j) )
+ if ( CHECK_VALIDATE(j) ) {
_mesa_validate_all_lighting_tables( ctx );
-
+ UNCLAMPED_FLOAT_TO_CHAN(sumA[0], ctx->Light.Material[0].Diffuse[3]);
+ if (IDX & LIGHT_TWOSIDE)
+ UNCLAMPED_FLOAT_TO_CHAN(sumA[1],
+ ctx->Light.Material[1].Diffuse[3]);
+ }
COPY_3V(sum[0], ctx->Light._BaseColor[0]);
if (IDX & LIGHT_TWOSIDE)
diff --git a/src/mesa/x86/gen_matypes.c b/src/mesa/x86/gen_matypes.c
index d92a54f4d8..f2403c8c02 100644
--- a/src/mesa/x86/gen_matypes.c
+++ b/src/mesa/x86/gen_matypes.c
@@ -1,4 +1,4 @@
-/* $Id: gen_matypes.c,v 1.2 2001/03/29 03:41:40 gareth Exp $ */
+/* $Id: gen_matypes.c,v 1.3 2001/07/28 19:28:49 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -106,7 +106,6 @@ int main( int argc, char **argv )
OFFSET( "CTX_LIGHT_NEED_VERTS ", GLcontext, Light._NeedVertices );
OFFSET( "CTX_LIGHT_FLAGS ", GLcontext, Light._Flags );
OFFSET( "CTX_LIGHT_BASE_COLOR ", GLcontext, Light._BaseColor );
- OFFSET( "CTX_LIGHT_BASE_ALPHA ", GLcontext, Light._BaseAlpha );
/* struct vertex_buffer offsets: