mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
actor: review use of _apply_modelview_transform_recursive
On reviewing the clutter-actor.c code using _apply_modelview_transform_recursive I noticed various comments stating that it will never call the stage's ->apply_transform vfunc to transform into eye coordinates, but actually looking at the implementation that's not true. The comments probably got out of sync with an earlier implementation that had that constraint. This removes the miss-leading comments and also updates various uses of the api where we were manually applying the stage->apply_transform.
This commit is contained in:
parent
ddc9eb5fa5
commit
1720b77d29
@ -2039,10 +2039,6 @@ _clutter_actor_fully_transform_vertices (ClutterActor *self,
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
|
||||
|
||||
/* NB: _clutter_actor_apply_modelview_transform_recursive will never
|
||||
* include the transformation between stage coordinates and OpenGL
|
||||
* eye coordinates, we have to explicitly use the
|
||||
* stage->apply_transform to get that... */
|
||||
stage = _clutter_actor_get_stage_internal (self);
|
||||
|
||||
/* We really can't do anything meaningful in this case so don't try
|
||||
@ -2050,10 +2046,10 @@ _clutter_actor_fully_transform_vertices (ClutterActor *self,
|
||||
if (stage == NULL)
|
||||
return FALSE;
|
||||
|
||||
/* Setup the modelview */
|
||||
cogl_matrix_init_identity (&modelview);
|
||||
_clutter_actor_apply_modelview_transform (stage, &modelview);
|
||||
_clutter_actor_apply_modelview_transform_recursive (self, stage, &modelview);
|
||||
/* Note: we pass NULL as the ancestor because we don't just want the modelview
|
||||
* that gets us to stage coordinates, we want to go all the way to eye
|
||||
* coordinates */
|
||||
_clutter_actor_apply_modelview_transform_recursive (self, NULL, &modelview);
|
||||
|
||||
/* Fetch the projection and viewport */
|
||||
_clutter_stage_get_projection_matrix (CLUTTER_STAGE (stage), &projection);
|
||||
@ -2098,21 +2094,7 @@ clutter_actor_apply_transform_to_point (ClutterActor *self,
|
||||
/* _clutter_actor_get_relative_modelview:
|
||||
*
|
||||
* Retrieves the modelview transformation relative to some ancestor
|
||||
* actor, or the stage if NULL is given for the ancestor.
|
||||
*
|
||||
* Note: This will never include the transformations from
|
||||
* stage::apply_transform since that would give you a modelview
|
||||
* transform relative to the OpenGL window coordinate space that the
|
||||
* stage lies within.
|
||||
*
|
||||
* If you need to do a full modelview + projective transform and get
|
||||
* to window coordinates then you should explicitly apply the stage
|
||||
* transform to an identity matrix and use
|
||||
* _clutter_actor_apply_modelview_transform like:
|
||||
*
|
||||
* cogl_matrix_init_identity (&mtx);
|
||||
* stage = _clutter_actor_get_stage_internal (self);
|
||||
* _clutter_actor_apply_modelview_transform (stage, &mtx);
|
||||
* actor, or eye coordinates if NULL is given for the ancestor.
|
||||
*/
|
||||
/* FIXME: We should be caching the stage relative modelview along with the
|
||||
* actor itself */
|
||||
@ -2121,8 +2103,6 @@ _clutter_actor_get_relative_modelview (ClutterActor *self,
|
||||
ClutterActor *ancestor,
|
||||
CoglMatrix *matrix)
|
||||
{
|
||||
g_return_if_fail (ancestor != NULL);
|
||||
|
||||
cogl_matrix_init_identity (matrix);
|
||||
|
||||
_clutter_actor_apply_modelview_transform_recursive (self, ancestor, matrix);
|
||||
|
@ -1004,21 +1004,12 @@ _clutter_paint_volume_get_stage_paint_box (ClutterPaintVolume *pv,
|
||||
|
||||
_clutter_paint_volume_copy_static (pv, &projected_pv);
|
||||
|
||||
/* NB: _clutter_actor_apply_modelview_transform_recursive will never
|
||||
* include the transformation between stage coordinates and OpenGL
|
||||
* eye coordinates, we have to explicitly use the
|
||||
* stage->apply_transform to get that... */
|
||||
cogl_matrix_init_identity (&modelview);
|
||||
|
||||
/* If the paint volume isn't already in eye coordinates... */
|
||||
if (pv->actor)
|
||||
{
|
||||
ClutterActor *stage_actor = CLUTTER_ACTOR (stage);
|
||||
_clutter_actor_apply_modelview_transform (stage_actor, &modelview);
|
||||
_clutter_actor_apply_modelview_transform_recursive (pv->actor,
|
||||
stage_actor,
|
||||
&modelview);
|
||||
}
|
||||
_clutter_actor_apply_modelview_transform_recursive (pv->actor, NULL,
|
||||
&modelview);
|
||||
|
||||
_clutter_stage_get_projection_matrix (stage, &projection);
|
||||
_clutter_stage_get_viewport (stage,
|
||||
@ -1052,25 +1043,6 @@ _clutter_paint_volume_transform_relative (ClutterPaintVolume *pv,
|
||||
_clutter_paint_volume_set_reference_actor (pv, relative_to_ancestor);
|
||||
|
||||
cogl_matrix_init_identity (&matrix);
|
||||
|
||||
if (relative_to_ancestor == NULL)
|
||||
{
|
||||
/* NB: _clutter_actor_apply_modelview_transform_recursive will never
|
||||
* include the transformation between stage coordinates and OpenGL
|
||||
* eye coordinates, we have to explicitly use the
|
||||
* stage->apply_transform to get that... */
|
||||
ClutterActor *stage = _clutter_actor_get_stage_internal (actor);
|
||||
|
||||
/* We really can't do anything meaningful in this case so don't try
|
||||
* to do any transform */
|
||||
if (G_UNLIKELY (stage == NULL))
|
||||
return;
|
||||
|
||||
_clutter_actor_apply_modelview_transform (stage, &matrix);
|
||||
|
||||
relative_to_ancestor = stage;
|
||||
}
|
||||
|
||||
_clutter_actor_apply_modelview_transform_recursive (actor,
|
||||
relative_to_ancestor,
|
||||
&matrix);
|
||||
|
@ -530,15 +530,7 @@ update_fbo (ClutterActor *self)
|
||||
if ((source_parent = clutter_actor_get_parent (priv->fbo_source)))
|
||||
{
|
||||
CoglMatrix modelview;
|
||||
|
||||
/* NB: _clutter_actor_apply_modelview_transform_recursive
|
||||
* will never include the transformation between stage
|
||||
* coordinates and OpenGL window coordinates, we have to
|
||||
* explicitly use the stage->apply_transform to get that...
|
||||
*/
|
||||
|
||||
cogl_matrix_init_identity (&modelview);
|
||||
_clutter_actor_apply_modelview_transform (stage, &modelview);
|
||||
_clutter_actor_apply_modelview_transform_recursive (source_parent,
|
||||
NULL,
|
||||
&modelview);
|
||||
|
Loading…
Reference in New Issue
Block a user