summaryrefslogtreecommitdiff
path: root/src/mesa/main/mtypes.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/mtypes.h')
-rw-r--r--src/mesa/main/mtypes.h83
1 files changed, 54 insertions, 29 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 27b01eee08..5c321d0d99 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -233,26 +233,58 @@ struct gl_color_table {
* \name Bit flags used for updating material values.
*/
/*@{*/
-#define FRONT_AMBIENT_BIT 0x1
-#define BACK_AMBIENT_BIT 0x2
-#define FRONT_DIFFUSE_BIT 0x4
-#define BACK_DIFFUSE_BIT 0x8
-#define FRONT_SPECULAR_BIT 0x10
-#define BACK_SPECULAR_BIT 0x20
-#define FRONT_EMISSION_BIT 0x40
-#define BACK_EMISSION_BIT 0x80
-#define FRONT_SHININESS_BIT 0x100
-#define BACK_SHININESS_BIT 0x200
-#define FRONT_INDEXES_BIT 0x400
-#define BACK_INDEXES_BIT 0x800
-
-#define FRONT_MATERIAL_BITS (FRONT_EMISSION_BIT | FRONT_AMBIENT_BIT | \
- FRONT_DIFFUSE_BIT | FRONT_SPECULAR_BIT | \
- FRONT_SHININESS_BIT | FRONT_INDEXES_BIT)
-
-#define BACK_MATERIAL_BITS (BACK_EMISSION_BIT | BACK_AMBIENT_BIT | \
- BACK_DIFFUSE_BIT | BACK_SPECULAR_BIT | \
- BACK_SHININESS_BIT | BACK_INDEXES_BIT)
+#define MAT_ATTRIB_FRONT_AMBIENT 0
+#define MAT_ATTRIB_BACK_AMBIENT 1
+#define MAT_ATTRIB_FRONT_DIFFUSE 2
+#define MAT_ATTRIB_BACK_DIFFUSE 3
+#define MAT_ATTRIB_FRONT_SPECULAR 4
+#define MAT_ATTRIB_BACK_SPECULAR 5
+#define MAT_ATTRIB_FRONT_EMISSION 6
+#define MAT_ATTRIB_BACK_EMISSION 7
+#define MAT_ATTRIB_FRONT_SHININESS 8
+#define MAT_ATTRIB_BACK_SHININESS 9
+#define MAT_ATTRIB_FRONT_INDEXES 10
+#define MAT_ATTRIB_BACK_INDEXES 11
+#define MAT_ATTRIB_MAX 12
+
+#define MAT_ATTRIB_AMBIENT(f) (MAT_ATTRIB_FRONT_AMBIENT+(f))
+#define MAT_ATTRIB_DIFFUSE(f) (MAT_ATTRIB_FRONT_DIFFUSE+(f))
+#define MAT_ATTRIB_SPECULAR(f) (MAT_ATTRIB_FRONT_SPECULAR+(f))
+#define MAT_ATTRIB_EMISSION(f) (MAT_ATTRIB_FRONT_EMISSION+(f))
+#define MAT_ATTRIB_SHININESS(f)(MAT_ATTRIB_FRONT_SHININESS+(f))
+#define MAT_ATTRIB_INDEXES(f) (MAT_ATTRIB_FRONT_INDEXES+(f))
+
+#define MAT_INDEX_AMBIENT 0
+#define MAT_INDEX_DIFFUSE 1
+#define MAT_INDEX_SPECULAR 2
+
+#define MAT_BIT_FRONT_AMBIENT (1<<MAT_ATTRIB_FRONT_AMBIENT)
+#define MAT_BIT_BACK_AMBIENT (1<<MAT_ATTRIB_BACK_AMBIENT)
+#define MAT_BIT_FRONT_DIFFUSE (1<<MAT_ATTRIB_FRONT_DIFFUSE)
+#define MAT_BIT_BACK_DIFFUSE (1<<MAT_ATTRIB_BACK_DIFFUSE)
+#define MAT_BIT_FRONT_SPECULAR (1<<MAT_ATTRIB_FRONT_SPECULAR)
+#define MAT_BIT_BACK_SPECULAR (1<<MAT_ATTRIB_BACK_SPECULAR)
+#define MAT_BIT_FRONT_EMISSION (1<<MAT_ATTRIB_FRONT_EMISSION)
+#define MAT_BIT_BACK_EMISSION (1<<MAT_ATTRIB_BACK_EMISSION)
+#define MAT_BIT_FRONT_SHININESS (1<<MAT_ATTRIB_FRONT_SHININESS)
+#define MAT_BIT_BACK_SHININESS (1<<MAT_ATTRIB_BACK_SHININESS)
+#define MAT_BIT_FRONT_INDEXES (1<<MAT_ATTRIB_FRONT_INDEXES)
+#define MAT_BIT_BACK_INDEXES (1<<MAT_ATTRIB_BACK_INDEXES)
+
+
+#define FRONT_MATERIAL_BITS (MAT_BIT_FRONT_EMISSION | \
+ MAT_BIT_FRONT_AMBIENT | \
+ MAT_BIT_FRONT_DIFFUSE | \
+ MAT_BIT_FRONT_SPECULAR | \
+ MAT_BIT_FRONT_SHININESS | \
+ MAT_BIT_FRONT_INDEXES)
+
+#define BACK_MATERIAL_BITS (MAT_BIT_BACK_EMISSION | \
+ MAT_BIT_BACK_AMBIENT | \
+ MAT_BIT_BACK_DIFFUSE | \
+ MAT_BIT_BACK_SPECULAR | \
+ MAT_BIT_BACK_SHININESS | \
+ MAT_BIT_BACK_INDEXES)
#define ALL_MATERIAL_BITS (FRONT_MATERIAL_BITS | BACK_MATERIAL_BITS)
/*@}*/
@@ -331,14 +363,7 @@ struct gl_lightmodel {
*/
struct gl_material
{
- GLfloat Ambient[4];
- GLfloat Diffuse[4];
- GLfloat Specular[4];
- GLfloat Emission[4];
- GLfloat Shininess;
- GLfloat AmbientIndex; /**< for color index lighting */
- GLfloat DiffuseIndex; /**< for color index lighting */
- GLfloat SpecularIndex; /**< for color index lighting */
+ GLfloat Attrib[MAT_ATTRIB_MAX][4];
};
@@ -664,7 +689,7 @@ struct gl_light_attrib {
* Must flush FLUSH_VERTICES before referencing:
*/
/*@{*/
- struct gl_material Material[2]; /**< Material 0=front, 1=back */
+ struct gl_material Material; /**< Includes front & back values */
/*@}*/
GLboolean Enabled; /**< Lighting enabled flag */