return;
FLUSH_VERTICES(ctx, _NEW_FOG);
ctx->Fog.Enabled = state;
+ ctx->Fog._PackedEnabledMode = state ? ctx->Fog._PackedMode : FOG_NONE;
break;
case GL_LIGHT0:
case GL_LIGHT1:
m = (GLenum) (GLint) *params;
switch (m) {
case GL_LINEAR:
+ ctx->Fog._PackedMode = FOG_LINEAR;
+ break;
case GL_EXP:
+ ctx->Fog._PackedMode = FOG_EXP;
+ break;
case GL_EXP2:
+ ctx->Fog._PackedMode = FOG_EXP2;
break;
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glFog" );
return;
FLUSH_VERTICES(ctx, _NEW_FOG);
ctx->Fog.Mode = m;
+ ctx->Fog._PackedEnabledMode = ctx->Fog.Enabled ?
+ ctx->Fog._PackedMode : FOG_NONE;
break;
case GL_FOG_DENSITY:
if (*params<0.0F) {
/* Fog group */
ctx->Fog.Enabled = GL_FALSE;
ctx->Fog.Mode = GL_EXP;
+ ctx->Fog._PackedMode = FOG_EXP;
+ ctx->Fog._PackedEnabledMode = FOG_NONE;
ASSIGN_4V( ctx->Fog.Color, 0.0, 0.0, 0.0, 0.0 );
ASSIGN_4V( ctx->Fog.ColorUnclamped, 0.0, 0.0, 0.0, 0.0 );
ctx->Fog.Index = 0.0;
};
+/**
+ * Compressed fog mode.
+ */
+enum gl_fog_mode
+{
+ FOG_NONE,
+ FOG_LINEAR,
+ FOG_EXP,
+ FOG_EXP2,
+};
+
+
/**
* Fog attribute group (GL_FOG_BIT).
*/
{
GLboolean Enabled; /**< Fog enabled flag */
GLboolean ColorSumEnabled;
+ uint8_t _PackedMode; /**< Fog mode as 2 bits */
+ uint8_t _PackedEnabledMode; /**< Masked CompressedMode */
GLfloat ColorUnclamped[4]; /**< Fog color */
GLfloat Color[4]; /**< Fog color */
GLfloat Density; /**< Density >= 0.0 */