mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
clutter/stage: Remove ability to set custom perspective
Unused, and complicates things, so drop it. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1175
This commit is contained in:
parent
3f068d1138
commit
08431a127a
@ -146,7 +146,6 @@ struct _ClutterStagePrivate
|
|||||||
guint throttle_motion_events : 1;
|
guint throttle_motion_events : 1;
|
||||||
guint min_size_changed : 1;
|
guint min_size_changed : 1;
|
||||||
guint motion_events_enabled : 1;
|
guint motion_events_enabled : 1;
|
||||||
guint has_custom_perspective : 1;
|
|
||||||
guint stage_was_relayout : 1;
|
guint stage_was_relayout : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1843,10 +1842,6 @@ clutter_stage_set_property (GObject *object,
|
|||||||
clutter_value_get_color (value));
|
clutter_value_get_color (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_PERSPECTIVE:
|
|
||||||
clutter_stage_set_perspective (stage, g_value_get_boxed (value));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PROP_TITLE:
|
case PROP_TITLE:
|
||||||
clutter_stage_set_title (stage, g_value_get_string (value));
|
clutter_stage_set_title (stage, g_value_get_string (value));
|
||||||
break;
|
break;
|
||||||
@ -2026,7 +2021,7 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
|||||||
P_("Perspective"),
|
P_("Perspective"),
|
||||||
P_("Perspective projection parameters"),
|
P_("Perspective projection parameters"),
|
||||||
CLUTTER_TYPE_PERSPECTIVE,
|
CLUTTER_TYPE_PERSPECTIVE,
|
||||||
CLUTTER_PARAM_READWRITE);
|
CLUTTER_PARAM_READABLE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterStage:title:
|
* ClutterStage:title:
|
||||||
@ -2355,7 +2350,7 @@ clutter_stage_get_color (ClutterStage *stage,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_set_perspective_internal (ClutterStage *stage,
|
clutter_stage_set_perspective (ClutterStage *stage,
|
||||||
ClutterPerspective *perspective)
|
ClutterPerspective *perspective)
|
||||||
{
|
{
|
||||||
ClutterStagePrivate *priv = stage->priv;
|
ClutterStagePrivate *priv = stage->priv;
|
||||||
@ -2381,36 +2376,6 @@ clutter_stage_set_perspective_internal (ClutterStage *stage,
|
|||||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_stage_set_perspective:
|
|
||||||
* @stage: A #ClutterStage
|
|
||||||
* @perspective: A #ClutterPerspective
|
|
||||||
*
|
|
||||||
* Sets the stage perspective. Using this function is not recommended
|
|
||||||
* because it will disable Clutter's attempts to generate an
|
|
||||||
* appropriate perspective based on the size of the stage.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
clutter_stage_set_perspective (ClutterStage *stage,
|
|
||||||
ClutterPerspective *perspective)
|
|
||||||
{
|
|
||||||
ClutterStagePrivate *priv;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
|
||||||
g_return_if_fail (perspective != NULL);
|
|
||||||
g_return_if_fail (perspective->z_far - perspective->z_near != 0);
|
|
||||||
|
|
||||||
priv = stage->priv;
|
|
||||||
|
|
||||||
/* If the application ever calls this function then we'll stop
|
|
||||||
automatically updating the perspective when the stage changes
|
|
||||||
size */
|
|
||||||
priv->has_custom_perspective = TRUE;
|
|
||||||
|
|
||||||
clutter_stage_set_perspective_internal (stage, perspective);
|
|
||||||
clutter_stage_update_view_perspective (stage);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_stage_get_perspective:
|
* clutter_stage_get_perspective:
|
||||||
* @stage: A #ClutterStage
|
* @stage: A #ClutterStage
|
||||||
@ -2437,7 +2402,7 @@ clutter_stage_get_perspective (ClutterStage *stage,
|
|||||||
* @stage.
|
* @stage.
|
||||||
*
|
*
|
||||||
* Retrieves the @stage's projection matrix. This is derived from the
|
* Retrieves the @stage's projection matrix. This is derived from the
|
||||||
* current perspective set using clutter_stage_set_perspective().
|
* current perspective.
|
||||||
*
|
*
|
||||||
* Since: 1.6
|
* Since: 1.6
|
||||||
*/
|
*/
|
||||||
@ -3152,11 +3117,6 @@ clutter_stage_update_view_perspective (ClutterStage *stage)
|
|||||||
|
|
||||||
perspective = priv->perspective;
|
perspective = priv->perspective;
|
||||||
|
|
||||||
/* Ideally we want to regenerate the perspective matrix whenever
|
|
||||||
* the size changes but if the user has provided a custom matrix
|
|
||||||
* then we don't want to override it */
|
|
||||||
if (!priv->has_custom_perspective)
|
|
||||||
{
|
|
||||||
perspective.fovy = 60.0; /* 60 Degrees */
|
perspective.fovy = 60.0; /* 60 Degrees */
|
||||||
perspective.z_near = 0.1;
|
perspective.z_near = 0.1;
|
||||||
perspective.aspect = priv->viewport[2] / priv->viewport[3];
|
perspective.aspect = priv->viewport[2] / priv->viewport[3];
|
||||||
@ -3170,12 +3130,7 @@ clutter_stage_update_view_perspective (ClutterStage *stage)
|
|||||||
perspective.z_far = z_2d +
|
perspective.z_far = z_2d +
|
||||||
tanf (_DEG_TO_RAD (perspective.fovy / 2.0f)) * z_2d * 20.0f;
|
tanf (_DEG_TO_RAD (perspective.fovy / 2.0f)) * z_2d * 20.0f;
|
||||||
|
|
||||||
clutter_stage_set_perspective_internal (stage, &perspective);
|
clutter_stage_set_perspective (stage, &perspective);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
z_2d = calculate_z_translation (perspective.z_near);
|
|
||||||
}
|
|
||||||
|
|
||||||
cogl_matrix_init_identity (&priv->view);
|
cogl_matrix_init_identity (&priv->view);
|
||||||
cogl_matrix_view_2d_in_perspective (&priv->view,
|
cogl_matrix_view_2d_in_perspective (&priv->view,
|
||||||
|
@ -103,8 +103,7 @@ struct _ClutterStageClass
|
|||||||
* @z_far: the distance from the viewer to the far clipping
|
* @z_far: the distance from the viewer to the far clipping
|
||||||
* plane (always positive)
|
* plane (always positive)
|
||||||
*
|
*
|
||||||
* Stage perspective definition. #ClutterPerspective is only used by
|
* Stage perspective definition.
|
||||||
* the fixed point version of clutter_stage_set_perspective().
|
|
||||||
*
|
*
|
||||||
* Since: 0.4
|
* Since: 0.4
|
||||||
*/
|
*/
|
||||||
@ -140,9 +139,6 @@ GType clutter_stage_get_type (void) G_GNUC_CONST;
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterActor * clutter_stage_new (void);
|
ClutterActor * clutter_stage_new (void);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_stage_set_perspective (ClutterStage *stage,
|
|
||||||
ClutterPerspective *perspective);
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_stage_get_perspective (ClutterStage *stage,
|
void clutter_stage_get_perspective (ClutterStage *stage,
|
||||||
ClutterPerspective *perspective);
|
ClutterPerspective *perspective);
|
||||||
|
Loading…
Reference in New Issue
Block a user