cogl/matrix: Relocate and update projection and transform APIs

Ideally, we would use Graphene to do that, however as of now Graphene
lacks these APIs so we still need these helpers. Since we're preparing
to get rid of CoglMatrix, move them to a separate file, and rename them
with the 'cogl_graphene' prefix.

Since I'm already touching the world with this change, I'm also renaming
cogl_matrix_transform_point() to cogl_graphene_matrix_project_point(),
as per XXX comment, to make it consistent with the transform/projection
semantics in place.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
This commit is contained in:
Georges Basile Stavracas Neto
2020-09-11 15:14:26 -03:00
parent 050053a114
commit cedb5318da
14 changed files with 534 additions and 463 deletions

View File

@ -1289,11 +1289,11 @@ _clutter_actor_transform_local_box_to_stage (ClutterActor *self,
float z = 0.f;
float w = 1.f;
cogl_matrix_transform_point (&transform_to_stage,
&vertices[v].x,
&vertices[v].y,
&z,
&w);
cogl_graphene_matrix_project_point (&transform_to_stage,
&vertices[v].x,
&vertices[v].y,
&z,
&w);
}
return TRUE;
@ -2873,7 +2873,11 @@ clutter_actor_apply_relative_transform_to_point (ClutterActor *self,
}
_clutter_actor_get_relative_transformation_matrix (self, ancestor, &matrix);
cogl_matrix_transform_point (&matrix, &vertex->x, &vertex->y, &vertex->z, &w);
cogl_graphene_matrix_project_point (&matrix,
&vertex->x,
&vertex->y,
&vertex->z,
&w);
}
static gboolean

View File

@ -857,11 +857,11 @@ _clutter_paint_volume_transform (ClutterPaintVolume *pv,
{
gfloat w = 1;
/* Just transform the origin */
cogl_matrix_transform_point (matrix,
&pv->vertices[0].x,
&pv->vertices[0].y,
&pv->vertices[0].z,
&w);
cogl_graphene_matrix_project_point (matrix,
&pv->vertices[0].x,
&pv->vertices[0].y,
&pv->vertices[0].z,
&w);
return;
}
@ -876,13 +876,13 @@ _clutter_paint_volume_transform (ClutterPaintVolume *pv,
else
transform_count = 8;
cogl_matrix_transform_points (matrix,
3,
sizeof (graphene_point3d_t),
pv->vertices,
sizeof (graphene_point3d_t),
pv->vertices,
transform_count);
cogl_graphene_matrix_transform_points (matrix,
3,
sizeof (graphene_point3d_t),
pv->vertices,
sizeof (graphene_point3d_t),
pv->vertices,
transform_count);
pv->is_axis_aligned = FALSE;
}

View File

@ -725,13 +725,13 @@ _cogl_util_get_eye_planes_for_screen_poly (float *polygon,
#undef CLIP_X
#undef CLIP_Y
cogl_matrix_project_points (inverse_project,
4,
sizeof (Vector4),
tmp_poly,
sizeof (Vector4),
tmp_poly,
n_vertices * 2);
cogl_graphene_matrix_project_points (inverse_project,
4,
sizeof (Vector4),
tmp_poly,
sizeof (Vector4),
tmp_poly,
n_vertices * 2);
/* XXX: It's quite ugly that we end up with these casts between
* Vector4 types and CoglVector3s, it might be better if the

View File

@ -77,31 +77,31 @@ _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
cogl_matrix_multiply (&modelview_projection,
projection,
modelview);
cogl_matrix_project_points (&modelview_projection,
3,
sizeof (graphene_point3d_t),
vertices_in,
sizeof (ClutterVertex4),
vertices_tmp,
n_vertices);
cogl_graphene_matrix_project_points (&modelview_projection,
3,
sizeof (graphene_point3d_t),
vertices_in,
sizeof (ClutterVertex4),
vertices_tmp,
n_vertices);
}
else
{
cogl_matrix_transform_points (modelview,
3,
sizeof (graphene_point3d_t),
vertices_in,
sizeof (ClutterVertex4),
vertices_tmp,
n_vertices);
cogl_graphene_matrix_transform_points (modelview,
3,
sizeof (graphene_point3d_t),
vertices_in,
sizeof (ClutterVertex4),
vertices_tmp,
n_vertices);
cogl_matrix_project_points (projection,
3,
sizeof (ClutterVertex4),
vertices_tmp,
sizeof (ClutterVertex4),
vertices_tmp,
n_vertices);
cogl_graphene_matrix_project_points (projection,
3,
sizeof (ClutterVertex4),
vertices_tmp,
sizeof (ClutterVertex4),
vertices_tmp,
n_vertices);
}
for (i = 0; i < n_vertices; i++)