[mutter/gbsneto/graphene2: 1/45] Remove fog support



commit c829fd33746362edd25cbc653344c5d88b3f10d3
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Feb 19 22:01:06 2019 -0300

    Remove fog support
    
    Fog is explicitly deprecated in favour of CoglSnippet API,
    and in nowhere we are using this deprecated feature, which
    means we can simply drop it without any sort of replacement.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/458

 clutter/clutter/clutter-stage.c                  | 210 -----------------------
 clutter/clutter/clutter-stage.h                  |  22 ---
 clutter/clutter/clutter-types.h                  |   2 -
 clutter/clutter/deprecated/clutter-stage.h       |  14 --
 clutter/tests/interactive/test-texture-quality.c |   3 -
 cogl/cogl/cogl-context-private.h                 |   2 -
 cogl/cogl/cogl-context.c                         |   2 -
 cogl/cogl/cogl-pipeline-private.h                |  19 --
 cogl/cogl/cogl-pipeline-state-private.h          |  12 --
 cogl/cogl/cogl-pipeline-state.c                  |  70 --------
 cogl/cogl/cogl-pipeline.c                        |  38 +---
 cogl/cogl/cogl-types.h                           |  35 ----
 cogl/cogl/cogl.c                                 |  31 ----
 cogl/cogl/cogl.symbols                           |   5 -
 cogl/cogl/cogl1-context.h                        |  50 +-----
 cogl/cogl/gl-prototypes/cogl-fixed-functions.h   |   4 -
 16 files changed, 2 insertions(+), 517 deletions(-)
---
diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c
index 1eea5b305..a6b1c1c87 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -114,8 +114,6 @@ struct _ClutterStagePrivate
   CoglMatrix view;
   float viewport[4];
 
-  ClutterFog fog;
-
   gchar *title;
   ClutterActor *key_focused_actor;
 
@@ -154,7 +152,6 @@ struct _ClutterStagePrivate
   guint is_fullscreen          : 1;
   guint is_cursor_visible      : 1;
   guint is_user_resizable      : 1;
-  guint use_fog                : 1;
   guint throttle_motion_events : 1;
   guint use_alpha              : 1;
   guint min_size_changed       : 1;
@@ -175,8 +172,6 @@ enum
   PROP_PERSPECTIVE,
   PROP_TITLE,
   PROP_USER_RESIZABLE,
-  PROP_USE_FOG,
-  PROP_FOG,
   PROP_USE_ALPHA,
   PROP_KEY_FOCUS,
   PROP_NO_CLEAR_HINT,
@@ -1727,14 +1722,6 @@ clutter_stage_set_property (GObject      *object,
       clutter_stage_set_user_resizable (stage, g_value_get_boolean (value));
       break;
 
-    case PROP_USE_FOG:
-      clutter_stage_set_use_fog (stage, g_value_get_boolean (value));
-      break;
-
-    case PROP_FOG:
-      clutter_stage_set_fog (stage, g_value_get_boxed (value));
-      break;
-
     case PROP_USE_ALPHA:
       clutter_stage_set_use_alpha (stage, g_value_get_boolean (value));
       break;
@@ -1801,14 +1788,6 @@ clutter_stage_get_property (GObject    *gobject,
       g_value_set_boolean (value, priv->is_user_resizable);
       break;
 
-    case PROP_USE_FOG:
-      g_value_set_boolean (value, priv->use_fog);
-      break;
-
-    case PROP_FOG:
-      g_value_set_boxed (value, &priv->fog);
-      break;
-
     case PROP_USE_ALPHA:
       g_value_set_boolean (value, priv->use_alpha);
       break;
@@ -2035,41 +2014,6 @@ clutter_stage_class_init (ClutterStageClass *klass)
                                CLUTTER_PARAM_READWRITE);
   g_object_class_install_property (gobject_class, PROP_TITLE, pspec);
 
-  /**
-   * ClutterStage:use-fog:
-   *
-   * Whether the stage should use a linear GL "fog" in creating the
-   * depth-cueing effect, to enhance the perception of depth by fading
-   * actors farther from the viewpoint.
-   *
-   * Since: 0.6
-   *
-   * Deprecated: 1.10: This property does not do anything.
-   */
-  pspec = g_param_spec_boolean ("use-fog",
-                                P_("Use Fog"),
-                                P_("Whether to enable depth cueing"),
-                                FALSE,
-                                CLUTTER_PARAM_READWRITE | G_PARAM_DEPRECATED);
-  g_object_class_install_property (gobject_class, PROP_USE_FOG, pspec);
-
-  /**
-   * ClutterStage:fog:
-   *
-   * The settings for the GL "fog", used only if #ClutterStage:use-fog
-   * is set to %TRUE
-   *
-   * Since: 1.0
-   *
-   * Deprecated: 1.10: This property does not do anything.
-   */
-  pspec = g_param_spec_boxed ("fog",
-                              P_("Fog"),
-                              P_("Settings for the depth cueing"),
-                              CLUTTER_TYPE_FOG,
-                              CLUTTER_PARAM_READWRITE | G_PARAM_DEPRECATED);
-  g_object_class_install_property (gobject_class, PROP_FOG, pspec);
-
   /**
    * ClutterStage:use-alpha:
    *
@@ -2322,7 +2266,6 @@ clutter_stage_init (ClutterStage *self)
   priv->is_fullscreen = FALSE;
   priv->is_user_resizable = FALSE;
   priv->is_cursor_visible = TRUE;
-  priv->use_fog = FALSE;
   priv->throttle_motion_events = TRUE;
   priv->min_size_changed = FALSE;
   priv->sync_delay = -1;
@@ -2360,11 +2303,6 @@ clutter_stage_init (ClutterStage *self)
                                       geom.width,
                                       geom.height);
 
-
-  /* FIXME - remove for 2.0 */
-  priv->fog.z_near = 1.0;
-  priv->fog.z_far  = 2.0;
-
   priv->relayout_pending = TRUE;
 
   clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE);
@@ -3257,136 +3195,6 @@ clutter_stage_get_key_focus (ClutterStage *stage)
   return CLUTTER_ACTOR (stage);
 }
 
-/**
- * clutter_stage_get_use_fog:
- * @stage: the #ClutterStage
- *
- * Gets whether the depth cueing effect is enabled on @stage.
- *
- * Return value: %TRUE if the depth cueing effect is enabled
- *
- * Since: 0.6
- *
- * Deprecated: 1.10: This function will always return %FALSE
- */
-gboolean
-clutter_stage_get_use_fog (ClutterStage *stage)
-{
-  g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
-
-  return stage->priv->use_fog;
-}
-
-/**
- * clutter_stage_set_use_fog:
- * @stage: the #ClutterStage
- * @fog: %TRUE for enabling the depth cueing effect
- *
- * Sets whether the depth cueing effect on the stage should be enabled
- * or not.
- *
- * Depth cueing is a 3D effect that makes actors farther away from the
- * viewing point less opaque, by fading them with the stage color.
-
- * The parameters of the GL fog used can be changed using the
- * clutter_stage_set_fog() function.
- *
- * Since: 0.6
- *
- * Deprecated: 1.10: Calling this function produces no visible effect
- */
-void
-clutter_stage_set_use_fog (ClutterStage *stage,
-                           gboolean      fog)
-{
-}
-
-/**
- * clutter_stage_set_fog:
- * @stage: the #ClutterStage
- * @fog: a #ClutterFog structure
- *
- * Sets the fog (also known as "depth cueing") settings for the @stage.
- *
- * A #ClutterStage will only use a linear fog progression, which
- * depends solely on the distance from the viewer. The cogl_set_fog()
- * function in COGL exposes more of the underlying implementation,
- * and allows changing the for progression function. It can be directly
- * used by disabling the #ClutterStage:use-fog property and connecting
- * a signal handler to the #ClutterActor::paint signal on the @stage,
- * like:
- *
- * |[
- *   clutter_stage_set_use_fog (stage, FALSE);
- *   g_signal_connect (stage, "paint", G_CALLBACK (on_stage_paint), NULL);
- * ]|
- *
- * The paint signal handler will call cogl_set_fog() with the
- * desired settings:
- *
- * |[
- *   static void
- *   on_stage_paint (ClutterActor *actor)
- *   {
- *     ClutterColor stage_color = { 0, };
- *     CoglColor fog_color = { 0, };
- *
- *     // set the fog color to the stage background color
- *     clutter_stage_get_color (CLUTTER_STAGE (actor), &stage_color);
- *     cogl_color_init_from_4ub (&fog_color,
- *                               stage_color.red,
- *                               stage_color.green,
- *                               stage_color.blue,
- *                               stage_color.alpha);
- *
- *     // enable fog //
- *     cogl_set_fog (&fog_color,
- *                   COGL_FOG_MODE_EXPONENTIAL, // mode
- *                   0.5,                       // density
- *                   5.0, 30.0);                // z_near and z_far
- *   }
- * ]|
- *
- * The fogging functions only work correctly when the visible actors use
- * unmultiplied alpha colors. By default Cogl will premultiply textures and
- * cogl_set_source_color() will premultiply colors, so unless you explicitly
- * load your textures requesting an unmultiplied internal format and use
- * cogl_material_set_color() you can only use fogging with fully opaque actors.
- * Support for premultiplied colors will improve in the future when we can
- * depend on fragment shaders.
- *
- * Since: 0.6
- *
- * Deprecated: 1.10: Fog settings are ignored.
- */
-void
-clutter_stage_set_fog (ClutterStage *stage,
-                       ClutterFog   *fog)
-{
-}
-
-/**
- * clutter_stage_get_fog:
- * @stage: the #ClutterStage
- * @fog: (out): return location for a #ClutterFog structure
- *
- * Retrieves the current depth cueing settings from the stage.
- *
- * Since: 0.6
- *
- * Deprecated: 1.10: This function will always return the default
- *   values of #ClutterFog
- */
-void
-clutter_stage_get_fog (ClutterStage *stage,
-                        ClutterFog   *fog)
-{
-  g_return_if_fail (CLUTTER_IS_STAGE (stage));
-  g_return_if_fail (fog != NULL);
-
-  *fog = stage->priv->fog;
-}
-
 /*** Perspective boxed type ******/
 
 static gpointer
@@ -3409,24 +3217,6 @@ G_DEFINE_BOXED_TYPE (ClutterPerspective, clutter_perspective,
                      clutter_perspective_copy,
                      clutter_perspective_free);
 
-static gpointer
-clutter_fog_copy (gpointer data)
-{
-  if (G_LIKELY (data))
-    return g_slice_dup (ClutterFog, data);
-
-  return NULL;
-}
-
-static void
-clutter_fog_free (gpointer data)
-{
-  if (G_LIKELY (data))
-    g_slice_free (ClutterFog, data);
-}
-
-G_DEFINE_BOXED_TYPE (ClutterFog, clutter_fog, clutter_fog_copy, clutter_fog_free);
-
 /**
  * clutter_stage_new:
  *
diff --git a/clutter/clutter/clutter-stage.h b/clutter/clutter/clutter-stage.h
index 5730af7bd..83c6514fc 100644
--- a/clutter/clutter/clutter-stage.h
+++ b/clutter/clutter/clutter-stage.h
@@ -115,26 +115,6 @@ struct _ClutterPerspective
   gfloat z_far;
 };
 
-/**
- * ClutterFog:
- * @z_near: starting distance from the viewer to the near clipping
- *   plane (always positive)
- * @z_far: final distance from the viewer to the far clipping
- *   plane (always positive)
- *
- * Fog settings used to create the depth cueing effect.
- *
- * Since: 0.6
- *
- * Deprecated: 1.10: The fog-related API in #ClutterStage has been
- *   deprecated as well.
- */
-struct _ClutterFog
-{
-  gfloat z_near;
-  gfloat z_far;
-};
-
 /**
  * ClutterFrameInfo: (skip)
  */
@@ -153,8 +133,6 @@ typedef struct _ClutterCapture
 
 CLUTTER_EXPORT
 GType clutter_perspective_get_type (void) G_GNUC_CONST;
-CLUTTER_DEPRECATED
-GType clutter_fog_get_type (void) G_GNUC_CONST;
 CLUTTER_EXPORT
 GType clutter_stage_get_type (void) G_GNUC_CONST;
 
diff --git a/clutter/clutter/clutter-types.h b/clutter/clutter/clutter-types.h
index 0f0fb1c2a..d9f7cd4b8 100644
--- a/clutter/clutter/clutter-types.h
+++ b/clutter/clutter/clutter-types.h
@@ -36,7 +36,6 @@
 G_BEGIN_DECLS
 
 #define CLUTTER_TYPE_ACTOR_BOX          (clutter_actor_box_get_type ())
-#define CLUTTER_TYPE_FOG                (clutter_fog_get_type ())
 #define CLUTTER_TYPE_GEOMETRY           (clutter_geometry_get_type ())
 #define CLUTTER_TYPE_KNOT               (clutter_knot_get_type ())
 #define CLUTTER_TYPE_MARGIN             (clutter_margin_get_type ())
@@ -113,7 +112,6 @@ typedef union _ClutterEvent                     ClutterEvent;
  */
 typedef struct _ClutterEventSequence            ClutterEventSequence;
 
-typedef struct _ClutterFog                      ClutterFog; /* deprecated */
 typedef struct _ClutterBehaviour                ClutterBehaviour; /* deprecated */
 typedef struct _ClutterShader                   ClutterShader; /* deprecated */
 
diff --git a/clutter/clutter/deprecated/clutter-stage.h b/clutter/clutter/deprecated/clutter-stage.h
index 4395f9439..20b103cf0 100644
--- a/clutter/clutter/deprecated/clutter-stage.h
+++ b/clutter/clutter/deprecated/clutter-stage.h
@@ -74,20 +74,6 @@ gboolean        clutter_stage_is_default        (ClutterStage       *stage);
 CLUTTER_DEPRECATED_FOR(clutter_actor_queue_redraw)
 void            clutter_stage_queue_redraw      (ClutterStage       *stage);
 
-CLUTTER_DEPRECATED
-void            clutter_stage_set_use_fog       (ClutterStage       *stage,
-                                                 gboolean            fog);
-
-CLUTTER_DEPRECATED
-gboolean        clutter_stage_get_use_fog       (ClutterStage       *stage);
-
-CLUTTER_DEPRECATED
-void            clutter_stage_set_fog           (ClutterStage       *stage,
-                                                 ClutterFog         *fog);
-
-CLUTTER_DEPRECATED
-void            clutter_stage_get_fog           (ClutterStage       *stage,
-                                                 ClutterFog         *fog);
 
 CLUTTER_DEPRECATED_FOR(clutter_actor_set_background_color)
 void            clutter_stage_set_color         (ClutterStage       *stage,
diff --git a/clutter/tests/interactive/test-texture-quality.c 
b/clutter/tests/interactive/test-texture-quality.c
index 91c0f0dc6..749112c65 100644
--- a/clutter/tests/interactive/test-texture-quality.c
+++ b/clutter/tests/interactive/test-texture-quality.c
@@ -54,7 +54,6 @@ test_texture_quality_main (int argc, char *argv[])
   ClutterActor     *stage;
   ClutterActor     *image;
   ClutterColor      stage_color = { 0x12, 0x34, 0x56, 0xff };
-  ClutterFog        stage_fog = { 10.0, -50.0 };
   GError           *error;
   gchar            *file;
 
@@ -63,8 +62,6 @@ test_texture_quality_main (int argc, char *argv[])
 
   stage = clutter_stage_new ();
   clutter_actor_set_background_color (stage, &stage_color);
-  clutter_stage_set_use_fog (CLUTTER_STAGE (stage), TRUE);
-  clutter_stage_set_fog (CLUTTER_STAGE (stage), &stage_fog);
   g_signal_connect (stage,
                     "destroy", G_CALLBACK (clutter_main_quit),
                     NULL);
diff --git a/cogl/cogl/cogl-context-private.h b/cogl/cogl/cogl-context-private.h
index 9fd5b57d4..27fea3bf0 100644
--- a/cogl/cogl/cogl-context-private.h
+++ b/cogl/cogl/cogl-context-private.h
@@ -152,8 +152,6 @@ struct _CoglContext
   GArray           *texture_units;
   int               active_texture_unit;
 
-  CoglPipelineFogState legacy_fog_state;
-
   /* Pipelines */
   CoglPipeline     *opaque_color_pipeline; /* used for set_source_color */
   CoglPipeline     *blended_color_pipeline; /* used for set_source_color */
diff --git a/cogl/cogl/cogl-context.c b/cogl/cogl/cogl-context.c
index aac25f2d2..4f22a06d6 100644
--- a/cogl/cogl/cogl-context.c
+++ b/cogl/cogl/cogl-context.c
@@ -310,8 +310,6 @@ cogl_context_new (CoglDisplay *display,
       GE (context, glActiveTexture (GL_TEXTURE1));
     }
 
-  context->legacy_fog_state.enabled = FALSE;
-
   context->opaque_color_pipeline = cogl_pipeline_new (context);
   context->blended_color_pipeline = cogl_pipeline_new (context);
   context->texture_pipeline = cogl_pipeline_new (context);
diff --git a/cogl/cogl/cogl-pipeline-private.h b/cogl/cogl/cogl-pipeline-private.h
index 030ad5d5e..12c25d20d 100644
--- a/cogl/cogl/cogl-pipeline-private.h
+++ b/cogl/cogl/cogl-pipeline-private.h
@@ -83,7 +83,6 @@ typedef enum
   COGL_PIPELINE_STATE_BLEND_INDEX,
   COGL_PIPELINE_STATE_USER_SHADER_INDEX,
   COGL_PIPELINE_STATE_DEPTH_INDEX,
-  COGL_PIPELINE_STATE_FOG_INDEX,
   COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE_INDEX,
   COGL_PIPELINE_STATE_POINT_SIZE_INDEX,
   COGL_PIPELINE_STATE_PER_VERTEX_POINT_SIZE_INDEX,
@@ -132,8 +131,6 @@ typedef enum _CoglPipelineState
     1L<<COGL_PIPELINE_STATE_USER_SHADER_INDEX,
   COGL_PIPELINE_STATE_DEPTH =
     1L<<COGL_PIPELINE_STATE_DEPTH_INDEX,
-  COGL_PIPELINE_STATE_FOG =
-    1L<<COGL_PIPELINE_STATE_FOG_INDEX,
   COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE =
     1L<<COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE_INDEX,
   COGL_PIPELINE_STATE_POINT_SIZE =
@@ -184,7 +181,6 @@ typedef enum _CoglPipelineState
    COGL_PIPELINE_STATE_BLEND | \
    COGL_PIPELINE_STATE_USER_SHADER | \
    COGL_PIPELINE_STATE_DEPTH | \
-   COGL_PIPELINE_STATE_FOG | \
    COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE | \
    COGL_PIPELINE_STATE_POINT_SIZE | \
    COGL_PIPELINE_STATE_PER_VERTEX_POINT_SIZE | \
@@ -199,7 +195,6 @@ typedef enum _CoglPipelineState
    COGL_PIPELINE_STATE_LIGHTING | \
    COGL_PIPELINE_STATE_BLEND | \
    COGL_PIPELINE_STATE_DEPTH | \
-   COGL_PIPELINE_STATE_FOG | \
    COGL_PIPELINE_STATE_LOGIC_OPS | \
    COGL_PIPELINE_STATE_CULL_FACE | \
    COGL_PIPELINE_STATE_UNIFORMS | \
@@ -255,16 +250,6 @@ typedef struct
   GLint     blend_dst_factor_rgb;
 } CoglPipelineBlendState;
 
-typedef struct
-{
-  gboolean        enabled;
-  CoglColor       color;
-  CoglFogMode     mode;
-  float           density;
-  float           z_near;
-  float           z_far;
-} CoglPipelineFogState;
-
 typedef struct
 {
   CoglColorMask color_mask;
@@ -297,7 +282,6 @@ typedef struct
   CoglPipelineBlendState blend_state;
   CoglHandle user_program;
   CoglDepthState depth_state;
-  CoglPipelineFogState fog_state;
   float point_size;
   unsigned int non_zero_point_size : 1;
   unsigned int per_vertex_point_size : 1;
@@ -868,9 +852,6 @@ void
 _cogl_pipeline_set_blend_enabled (CoglPipeline *pipeline,
                                   CoglPipelineBlendEnable enable);
 
-gboolean
-_cogl_pipeline_get_fog_enabled (CoglPipeline *pipeline);
-
 #ifdef COGL_DEBUG_ENABLED
 void
 _cogl_pipeline_set_static_breadcrumb (CoglPipeline *pipeline,
diff --git a/cogl/cogl/cogl-pipeline-state-private.h b/cogl/cogl/cogl-pipeline-state-private.h
index c105d1c62..a1de37d42 100644
--- a/cogl/cogl/cogl-pipeline-state-private.h
+++ b/cogl/cogl/cogl-pipeline-state-private.h
@@ -49,10 +49,6 @@ _cogl_pipeline_has_non_layer_vertex_snippets (CoglPipeline *pipeline);
 gboolean
 _cogl_pipeline_has_non_layer_fragment_snippets (CoglPipeline *pipeline);
 
-void
-_cogl_pipeline_set_fog_state (CoglPipeline *pipeline,
-                              const CoglPipelineFogState *fog_state);
-
 gboolean
 _cogl_pipeline_color_equal (CoglPipeline *authority0,
                             CoglPipeline *authority1);
@@ -77,10 +73,6 @@ gboolean
 _cogl_pipeline_depth_state_equal (CoglPipeline *authority0,
                                   CoglPipeline *authority1);
 
-gboolean
-_cogl_pipeline_fog_state_equal (CoglPipeline *authority0,
-                                CoglPipeline *authority1);
-
 gboolean
 _cogl_pipeline_non_zero_point_size_equal (CoglPipeline *authority0,
                                           CoglPipeline *authority1);
@@ -152,10 +144,6 @@ void
 _cogl_pipeline_hash_depth_state (CoglPipeline *authority,
                                  CoglPipelineHashState *state);
 
-void
-_cogl_pipeline_hash_fog_state (CoglPipeline *authority,
-                               CoglPipelineHashState *state);
-
 void
 _cogl_pipeline_hash_non_zero_point_size_state (CoglPipeline *authority,
                                                CoglPipelineHashState *state);
diff --git a/cogl/cogl/cogl-pipeline-state.c b/cogl/cogl/cogl-pipeline-state.c
index d27b0a03f..bb024d080 100644
--- a/cogl/cogl/cogl-pipeline-state.c
+++ b/cogl/cogl/cogl-pipeline-state.c
@@ -177,24 +177,6 @@ _cogl_pipeline_depth_state_equal (CoglPipeline *authority0,
     }
 }
 
-gboolean
-_cogl_pipeline_fog_state_equal (CoglPipeline *authority0,
-                                CoglPipeline *authority1)
-{
-  CoglPipelineFogState *fog_state0 = &authority0->big_state->fog_state;
-  CoglPipelineFogState *fog_state1 = &authority1->big_state->fog_state;
-
-  if (fog_state0->enabled == fog_state1->enabled &&
-      cogl_color_equal (&fog_state0->color, &fog_state1->color) &&
-      fog_state0->mode == fog_state1->mode &&
-      fog_state0->density == fog_state1->density &&
-      fog_state0->z_near == fog_state1->z_near &&
-      fog_state0->z_far == fog_state1->z_far)
-    return TRUE;
-  else
-    return FALSE;
-}
-
 gboolean
 _cogl_pipeline_non_zero_point_size_equal (CoglPipeline *authority0,
                                           CoglPipeline *authority1)
@@ -1246,41 +1228,6 @@ cogl_pipeline_set_color_mask (CoglPipeline *pipeline,
                                    _cogl_pipeline_logic_ops_state_equal);
 }
 
-void
-_cogl_pipeline_set_fog_state (CoglPipeline *pipeline,
-                              const CoglPipelineFogState *fog_state)
-{
-  CoglPipelineState state = COGL_PIPELINE_STATE_FOG;
-  CoglPipeline *authority;
-  CoglPipelineFogState *current_fog_state;
-
-  _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
-
-  authority = _cogl_pipeline_get_authority (pipeline, state);
-
-  current_fog_state = &authority->big_state->fog_state;
-
-  if (current_fog_state->enabled == fog_state->enabled &&
-      cogl_color_equal (&current_fog_state->color, &fog_state->color) &&
-      current_fog_state->mode == fog_state->mode &&
-      current_fog_state->density == fog_state->density &&
-      current_fog_state->z_near == fog_state->z_near &&
-      current_fog_state->z_far == fog_state->z_far)
-    return;
-
-  /* - Flush journal primitives referencing the current state.
-   * - Make sure the pipeline has no dependants so it may be modified.
-   * - If the pipeline isn't currently an authority for the state being
-   *   changed, then initialize that state from the current authority.
-   */
-  _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE);
-
-  pipeline->big_state->fog_state = *fog_state;
-
-  _cogl_pipeline_update_authority (pipeline, authority, state,
-                                   _cogl_pipeline_fog_state_equal);
-}
-
 void
 cogl_pipeline_set_cull_face_mode (CoglPipeline *pipeline,
                                   CoglPipelineCullFaceMode cull_face_mode)
@@ -1904,23 +1851,6 @@ _cogl_pipeline_hash_depth_state (CoglPipeline *authority,
   state->hash = hash;
 }
 
-void
-_cogl_pipeline_hash_fog_state (CoglPipeline *authority,
-                               CoglPipelineHashState *state)
-{
-  CoglPipelineFogState *fog_state = &authority->big_state->fog_state;
-  unsigned long hash = state->hash;
-
-  if (!fog_state->enabled)
-    hash = _cogl_util_one_at_a_time_hash (hash, &fog_state->enabled,
-                                          sizeof (fog_state->enabled));
-  else
-    hash = _cogl_util_one_at_a_time_hash (hash, &fog_state,
-                                          sizeof (CoglPipelineFogState));
-
-  state->hash = hash;
-}
-
 void
 _cogl_pipeline_hash_non_zero_point_size_state (CoglPipeline *authority,
                                                CoglPipelineHashState *state)
diff --git a/cogl/cogl/cogl-pipeline.c b/cogl/cogl/cogl-pipeline.c
index 16af79ada..4645b9d8f 100644
--- a/cogl/cogl/cogl-pipeline.c
+++ b/cogl/cogl/cogl-pipeline.c
@@ -1014,13 +1014,6 @@ _cogl_pipeline_copy_differences (CoglPipeline *dest,
               sizeof (CoglDepthState));
     }
 
-  if (differences & COGL_PIPELINE_STATE_FOG)
-    {
-      memcpy (&big_state->fog_state,
-              &src->big_state->fog_state,
-              sizeof (CoglPipelineFogState));
-    }
-
   if (differences & COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE)
     big_state->non_zero_point_size = src->big_state->non_zero_point_size;
 
@@ -1143,13 +1136,6 @@ _cogl_pipeline_init_multi_property_sparse_state (CoglPipeline *pipeline,
                 sizeof (CoglDepthState));
         break;
       }
-    case COGL_PIPELINE_STATE_FOG:
-      {
-        memcpy (&pipeline->big_state->fog_state,
-                &authority->big_state->fog_state,
-                sizeof (CoglPipelineFogState));
-        break;
-      }
     case COGL_PIPELINE_STATE_LOGIC_OPS:
       {
         memcpy (&pipeline->big_state->logic_ops_state,
@@ -2298,11 +2284,6 @@ _cogl_pipeline_equal (CoglPipeline *pipeline0,
                                                  authorities1[bit]))
             goto done;
           break;
-        case COGL_PIPELINE_STATE_FOG_INDEX:
-          if (!_cogl_pipeline_fog_state_equal (authorities0[bit],
-                                               authorities1[bit]))
-            goto done;
-          break;
         case COGL_PIPELINE_STATE_CULL_FACE_INDEX:
           if (!_cogl_pipeline_cull_face_state_equal (authorities0[bit],
                                                      authorities1[bit]))
@@ -2441,18 +2422,6 @@ _cogl_pipeline_update_authority (CoglPipeline *pipeline,
     }
 }
 
-gboolean
-_cogl_pipeline_get_fog_enabled (CoglPipeline *pipeline)
-{
-  CoglPipeline *authority;
-
-  _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE);
-
-  authority =
-    _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_FOG);
-  return authority->big_state->fog_state.enabled;
-}
-
 unsigned long
 _cogl_pipeline_get_age (CoglPipeline *pipeline)
 {
@@ -2614,9 +2583,6 @@ _cogl_pipeline_apply_legacy_state (CoglPipeline *pipeline)
       cogl_pipeline_set_depth_state (pipeline, &depth_state, NULL);
     }
 
-  if (ctx->legacy_fog_state.enabled)
-    _cogl_pipeline_set_fog_state (pipeline, &ctx->legacy_fog_state);
-
   if (ctx->legacy_backface_culling_enabled)
     cogl_pipeline_set_cull_face_mode (pipeline,
                                       COGL_PIPELINE_CULL_FACE_MODE_BACK);
@@ -2766,8 +2732,6 @@ _cogl_pipeline_init_state_hash_functions (void)
     _cogl_pipeline_hash_user_shader_state;
   state_hash_functions[COGL_PIPELINE_STATE_DEPTH_INDEX] =
     _cogl_pipeline_hash_depth_state;
-  state_hash_functions[COGL_PIPELINE_STATE_FOG_INDEX] =
-    _cogl_pipeline_hash_fog_state;
   state_hash_functions[COGL_PIPELINE_STATE_CULL_FACE_INDEX] =
     _cogl_pipeline_hash_cull_face_state;
   state_hash_functions[COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE_INDEX] =
@@ -2787,7 +2751,7 @@ _cogl_pipeline_init_state_hash_functions (void)
 
   {
   /* So we get a big error if we forget to update this code! */
-  _COGL_STATIC_ASSERT (COGL_PIPELINE_STATE_SPARSE_COUNT == 18,
+  _COGL_STATIC_ASSERT (COGL_PIPELINE_STATE_SPARSE_COUNT == 17,
                        "Make sure to install a hash function for "
                        "newly added pipeline state and update assert "
                        "in _cogl_pipeline_init_state_hash_functions");
diff --git a/cogl/cogl/cogl-types.h b/cogl/cogl/cogl-types.h
index 690daa16a..655d2882e 100644
--- a/cogl/cogl/cogl-types.h
+++ b/cogl/cogl/cogl-types.h
@@ -476,41 +476,6 @@ typedef enum
   COGL_TEXTURE_NO_ATLAS       = 1 << 2
 } CoglTextureFlags;
 
-/**
- * CoglFogMode:
- * @COGL_FOG_MODE_LINEAR: Calculates the fog blend factor as:
- * |[
- *   f = end - eye_distance / end - start
- * ]|
- * @COGL_FOG_MODE_EXPONENTIAL: Calculates the fog blend factor as:
- * |[
- *   f = e ^ -(density * eye_distance)
- * ]|
- * @COGL_FOG_MODE_EXPONENTIAL_SQUARED: Calculates the fog blend factor as:
- * |[
- *   f = e ^ -(density * eye_distance)^2
- * ]|
- *
- * The fog mode determines the equation used to calculate the fogging blend
- * factor while fogging is enabled. The simplest %COGL_FOG_MODE_LINEAR mode
- * determines f as:
- *
- * |[
- *   f = end - eye_distance / end - start
- * ]|
- *
- * Where eye_distance is the distance of the current fragment in eye
- * coordinates from the origin.
- *
- * Since: 1.0
- */
-typedef enum
-{
-  COGL_FOG_MODE_LINEAR,
-  COGL_FOG_MODE_EXPONENTIAL,
-  COGL_FOG_MODE_EXPONENTIAL_SQUARED
-} CoglFogMode;
-
 /**
  * COGL_BLEND_STRING_ERROR:
  *
diff --git a/cogl/cogl/cogl.c b/cogl/cogl/cogl.c
index e2f9e0ff9..d5ceaa4fd 100644
--- a/cogl/cogl/cogl.c
+++ b/cogl/cogl/cogl.c
@@ -279,37 +279,6 @@ cogl_get_bitmasks (int *red,
     *alpha = cogl_framebuffer_get_alpha_bits (framebuffer);
 }
 
-void
-cogl_set_fog (const CoglColor *fog_color,
-              CoglFogMode      mode,
-              float            density,
-              float            z_near,
-              float            z_far)
-{
-  _COGL_GET_CONTEXT (ctx, NO_RETVAL);
-
-  if (ctx->legacy_fog_state.enabled == FALSE)
-    ctx->legacy_state_set++;
-
-  ctx->legacy_fog_state.enabled = TRUE;
-  ctx->legacy_fog_state.color = *fog_color;
-  ctx->legacy_fog_state.mode = mode;
-  ctx->legacy_fog_state.density = density;
-  ctx->legacy_fog_state.z_near = z_near;
-  ctx->legacy_fog_state.z_far = z_far;
-}
-
-void
-cogl_disable_fog (void)
-{
-  _COGL_GET_CONTEXT (ctx, NO_RETVAL);
-
-  if (ctx->legacy_fog_state.enabled == TRUE)
-    ctx->legacy_state_set--;
-
-  ctx->legacy_fog_state.enabled = FALSE;
-}
-
 void
 cogl_flush (void)
 {
diff --git a/cogl/cogl/cogl.symbols b/cogl/cogl/cogl.symbols
index 68a624f4a..6036e2eda 100644
--- a/cogl/cogl/cogl.symbols
+++ b/cogl/cogl/cogl.symbols
@@ -187,8 +187,6 @@ cogl_depth_state_set_range
 cogl_depth_state_set_write_enabled
 cogl_depth_test_function_get_type
 
-cogl_disable_fog
-
 #ifdef COGL_HAS_GTYPE_SUPPORT
 cogl_display_get_gtype
 #endif
@@ -232,8 +230,6 @@ cogl_fixed_sin
 cogl_fixed_sqrt
 cogl_fixed_tan
 
-cogl_fog_mode_get_type
-
 cogl_foreach_feature
 
 cogl_flush
@@ -825,7 +821,6 @@ cogl_set_depth_test_enabled
 #ifndef COGL_DISABLE_DEPRECATED
 cogl_set_draw_buffer
 #endif
-cogl_set_fog
 #ifdef COGL_HAS_SDL_SUPPORT
 cogl_sdl_context_new
 cogl_sdl_handle_event
diff --git a/cogl/cogl/cogl1-context.h b/cogl/cogl/cogl1-context.h
index bef2ded1c..c419a6d4f 100644
--- a/cogl/cogl/cogl1-context.h
+++ b/cogl/cogl/cogl1-context.h
@@ -496,53 +496,6 @@ COGL_DEPRECATED_FOR (cogl_pipeline_get_cull_face_mode)
 gboolean
 cogl_get_backface_culling_enabled (void);
 
-/**
- * cogl_set_fog:
- * @fog_color: The color of the fog
- * @mode: A #CoglFogMode that determines the equation used to calculate the
- *   fogging blend factor.
- * @density: Used by %COGL_FOG_MODE_EXPONENTIAL and by
- *   %COGL_FOG_MODE_EXPONENTIAL_SQUARED equations.
- * @z_near: Position along Z axis where no fogging should be applied
- * @z_far: Position along Z axis where full fogging should be applied
- *
- * Enables fogging. Fogging causes vertices that are further away from the eye
- * to be rendered with a different color. The color is determined according to
- * the chosen fog mode; at it's simplest the color is linearly interpolated so
- * that vertices at @z_near are drawn fully with their original color and
- * vertices at @z_far are drawn fully with @fog_color. Fogging will remain
- * enabled until you call cogl_disable_fog().
- *
- * <note>The fogging functions only work correctly when primitives use
- * unmultiplied alpha colors. By default Cogl will premultiply textures
- * and cogl_set_source_color() will premultiply colors, so unless you
- * explicitly load your textures requesting an unmultiplied internal format
- * and use cogl_material_set_color() you can only use fogging with fully
- * opaque primitives. This might improve in the future when we can depend
- * on fragment shaders.</note>
- *
- * Deprecated: 1.16: Use #CoglSnippet shader api for fog
- */
-COGL_DEPRECATED_FOR (cogl_snippet_API)
-void
-cogl_set_fog (const CoglColor *fog_color,
-              CoglFogMode mode,
-              float density,
-              float z_near,
-              float z_far);
-
-/**
- * cogl_disable_fog:
- *
- * This function disables fogging, so primitives drawn afterwards will not be
- * blended with any previously set fog color.
- *
- * Deprecated: 1.16: Use #CoglSnippet shader api for fog
- */
-COGL_DEPRECATED_FOR (cogl_snippet_API)
-void
-cogl_disable_fog (void);
-
 /**
  * cogl_clear:
  * @color: Background color to clear to
@@ -819,8 +772,7 @@ cogl_flush (void);
  *
  * The result is that the OpenGL modelview matrix will be setup; the state
  * corresponding to the current source material will be set up and other world
- * state such as backface culling, depth and fogging enabledness will be sent
- * to OpenGL.
+ * state such as backface culling and depth enabledness will be sent to OpenGL.
  *
  * <note>No special material state is flushed, so if you want Cogl to setup a
  * simplified material state it is your responsibility to set a simple source
diff --git a/cogl/cogl/gl-prototypes/cogl-fixed-functions.h b/cogl/cogl/gl-prototypes/cogl-fixed-functions.h
index 5c11fedf4..b153d2c9b 100644
--- a/cogl/cogl/gl-prototypes/cogl-fixed-functions.h
+++ b/cogl/cogl/gl-prototypes/cogl-fixed-functions.h
@@ -65,10 +65,6 @@ COGL_EXT_BEGIN (fixed_function_core,
                 "\0")
 COGL_EXT_FUNCTION (void, glAlphaFunc,
                    (GLenum func, GLclampf ref))
-COGL_EXT_FUNCTION (void, glFogf,
-                   (GLenum pname, GLfloat param))
-COGL_EXT_FUNCTION (void, glFogfv,
-                   (GLenum pname, const GLfloat *params))
 COGL_EXT_FUNCTION (void, glLoadMatrixf,
                    (const GLfloat *m))
 COGL_EXT_FUNCTION (void, glMaterialfv,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]