aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2001-02-15 01:33:52 +0000
committerKeith Whitwell <[email protected]>2001-02-15 01:33:52 +0000
commitc6b2a92613a5110dbf387721af8ec505744183b9 (patch)
tree00358af747ddad95ba79c8649b39329e48b2cfd1 /src/mesa/main
parent4e52e192b2507a001817c8172713016cef69206b (diff)
Fix propogation of material values in VB's that don't reach the lighting
stage. (Materials now treated more like colors, etc.). Continue whipping the dd templates into shape. Remove old NormalLength code; may come back as a driver helper, but not useful for, eg. hardware t&l drivers.
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/dd.h11
-rw-r--r--src/mesa/main/light.c66
-rw-r--r--src/mesa/main/light.h6
3 files changed, 68 insertions, 15 deletions
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 4d4264978f3..818a6143f2d 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -1,4 +1,4 @@
-/* $Id: dd.h,v 1.51 2001/02/06 21:42:48 brianp Exp $ */
+/* $Id: dd.h,v 1.52 2001/02/15 01:33:52 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -815,6 +815,15 @@ struct dd_function_table {
void (*EdgeFlagPointer)(GLcontext *ctx, GLsizei stride, const GLvoid *ptr);
+ /***
+ *** TNL Pipeline
+ ***/
+
+ void (*PipelineStart)(GLcontext *ctx);
+ void (*PipelineFinish)(GLcontext *ctx);
+ /* Called before and after all pipeline stages.
+ * These are a suitable place for grabbing/releasing hardware locks.
+ */
/***
*** Rendering
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index 50bd041f190..155792af52b 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -1,4 +1,4 @@
-/* $Id: light.c,v 1.36 2001/02/13 23:55:30 brianp Exp $ */
+/* $Id: light.c,v 1.37 2001/02/15 01:33:52 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -535,6 +535,54 @@ GLuint gl_material_bitmask( GLcontext *ctx, GLenum face, GLenum pname,
}
+/* Perform a straight copy between pairs of materials.
+ */
+void gl_copy_material_pairs( struct gl_material dst[2],
+ const struct gl_material src[2],
+ GLuint bitmask )
+{
+ if (bitmask & FRONT_EMISSION_BIT) {
+ COPY_4FV( dst[0].Emission, src[0].Emission );
+ }
+ if (bitmask & BACK_EMISSION_BIT) {
+ COPY_4FV( dst[1].Emission, src[1].Emission );
+ }
+ if (bitmask & FRONT_AMBIENT_BIT) {
+ COPY_4FV( dst[0].Ambient, src[0].Ambient );
+ }
+ if (bitmask & BACK_AMBIENT_BIT) {
+ COPY_4FV( dst[1].Ambient, src[1].Ambient );
+ }
+ if (bitmask & FRONT_DIFFUSE_BIT) {
+ COPY_4FV( dst[0].Diffuse, src[0].Diffuse );
+ }
+ if (bitmask & BACK_DIFFUSE_BIT) {
+ COPY_4FV( dst[1].Diffuse, src[1].Diffuse );
+ }
+ if (bitmask & FRONT_SPECULAR_BIT) {
+ COPY_4FV( dst[0].Specular, src[0].Specular );
+ }
+ if (bitmask & BACK_SPECULAR_BIT) {
+ COPY_4FV( dst[1].Specular, src[1].Specular );
+ }
+ if (bitmask & FRONT_SHININESS_BIT) {
+ dst[0].Shininess = src[0].Shininess;
+ }
+ if (bitmask & BACK_SHININESS_BIT) {
+ dst[1].Shininess = src[1].Shininess;
+ }
+ if (bitmask & FRONT_INDEXES_BIT) {
+ dst[0].AmbientIndex = src[0].AmbientIndex;
+ dst[0].DiffuseIndex = src[0].DiffuseIndex;
+ dst[0].SpecularIndex = src[0].SpecularIndex;
+ }
+ if (bitmask & BACK_INDEXES_BIT) {
+ dst[1].AmbientIndex = src[1].AmbientIndex;
+ dst[1].DiffuseIndex = src[1].DiffuseIndex;
+ dst[1].SpecularIndex = src[1].SpecularIndex;
+ }
+}
+
/*
* Check if the global material has to be updated with info that was
@@ -545,11 +593,7 @@ GLuint gl_material_bitmask( GLcontext *ctx, GLenum face, GLenum pname,
*
* src[0] is front material, src[1] is back material
*
- * KW: Added code here to keep the precomputed variables uptodate.
- * This means we can use the faster shade functions when using
- * GL_COLOR_MATERIAL, and we can also now use the precomputed
- * values in the slower shading functions, which further offsets
- * the cost of doing this here.
+ * Additionally keeps the precomputed lighting state uptodate.
*/
void gl_update_material( GLcontext *ctx,
const struct gl_material src[2],
@@ -610,9 +654,6 @@ void gl_update_material( GLcontext *ctx,
if (bitmask & FRONT_DIFFUSE_BIT) {
struct gl_material *mat = &ctx->Light.Material[0];
COPY_4FV( mat->Diffuse, src[0].Diffuse );
-/* fprintf(stderr, "FRONT_DIFFUSE %f %f %f %f\n", */
-/* mat->Diffuse[0], mat->Diffuse[1], */
-/* mat->Diffuse[2], mat->Diffuse[3]); */
foreach (light, list) {
SCALE_3V( light->_MatDiffuse[0], light->Diffuse, mat->Diffuse );
}
@@ -621,9 +662,6 @@ void gl_update_material( GLcontext *ctx,
if (bitmask & BACK_DIFFUSE_BIT) {
struct gl_material *mat = &ctx->Light.Material[1];
COPY_4FV( mat->Diffuse, src[1].Diffuse );
-/* fprintf(stderr, "BACK_DIFFUSE %f %f %f %f\n", */
-/* mat->Diffuse[0], mat->Diffuse[1], */
-/* mat->Diffuse[2], mat->Diffuse[3]); */
foreach (light, list) {
SCALE_3V( light->_MatDiffuse[1], light->Diffuse, mat->Diffuse );
}
@@ -647,7 +685,6 @@ void gl_update_material( GLcontext *ctx,
}
if (bitmask & FRONT_SHININESS_BIT) {
-/* fprintf(stderr, "FRONT_SHININESS_BIT %f\n", src[0].Shininess); */
ctx->Light.Material[0].Shininess = src[0].Shininess;
gl_invalidate_shine_table( ctx, 0 );
}
@@ -692,6 +729,9 @@ void gl_update_material( GLcontext *ctx,
+
+
+
/*
* Update the current materials from the given rgba color
* according to the bitmask in ColorMaterialBitmask, which is
diff --git a/src/mesa/main/light.h b/src/mesa/main/light.h
index b39aa002d87..38ca33815f8 100644
--- a/src/mesa/main/light.h
+++ b/src/mesa/main/light.h
@@ -1,4 +1,4 @@
-/* $Id: light.h,v 1.9 2001/02/06 04:06:35 keithw Exp $ */
+/* $Id: light.h,v 1.10 2001/02/15 01:33:52 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -114,6 +114,10 @@ extern void gl_update_material( GLcontext *ctx,
const struct gl_material src[2],
GLuint bitmask );
+extern void gl_copy_material_pairs( struct gl_material dst[2],
+ const struct gl_material src[2],
+ GLuint bitmask );
+
extern void gl_update_color_material( GLcontext *ctx, const GLchan rgba[4] );