clutter/util: Replace ClutterVertex4 with graphene_vec4_t in public API

Soon, ClutterVertex4 will be internal to clutter-util.c, and only for the
_clutter_util_fully_transform_vertices() function, so remove it from all
public API.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
This commit is contained in:
Georges Basile Stavracas Neto 2020-09-09 19:42:12 -03:00
parent fe0a325e9f
commit eed3c62751
3 changed files with 47 additions and 39 deletions

View File

@ -41,17 +41,17 @@ cogl_matrix_progress (const GValue *a,
float shear1[3] = { 0.f, 0.f, 0.f };
graphene_point3d_t rotate1 = GRAPHENE_POINT3D_INIT_ZERO;
graphene_point3d_t translate1 = GRAPHENE_POINT3D_INIT_ZERO;
ClutterVertex4 perspective1 = { 0.f, 0.f, 0.f, 0.f };
graphene_vec4_t perspective1;
graphene_point3d_t scale2 = GRAPHENE_POINT3D_INIT (1.f, 1.f, 1.f);
float shear2[3] = { 0.f, 0.f, 0.f };
graphene_point3d_t rotate2 = GRAPHENE_POINT3D_INIT_ZERO;
graphene_point3d_t translate2 = GRAPHENE_POINT3D_INIT_ZERO;
ClutterVertex4 perspective2 = { 0.f, 0.f, 0.f, 0.f };
graphene_vec4_t perspective2;
graphene_point3d_t scale_res = GRAPHENE_POINT3D_INIT (1.f, 1.f, 1.f);
float shear_res = 0.f;
graphene_point3d_t rotate_res = GRAPHENE_POINT3D_INIT_ZERO;
graphene_point3d_t translate_res = GRAPHENE_POINT3D_INIT_ZERO;
ClutterVertex4 perspective_res = { 0.f, 0.f, 0.f, 0.f };
graphene_vec4_t perspective_res;
CoglMatrix res;
cogl_matrix_init_identity (&res);
@ -64,11 +64,11 @@ cogl_matrix_progress (const GValue *a,
&perspective2);
/* perspective */
_clutter_util_vertex4_interpolate (&perspective1, &perspective2, progress, &perspective_res);
res.wx = perspective_res.x;
res.wy = perspective_res.y;
res.wz = perspective_res.z;
res.ww = perspective_res.w;
graphene_vec4_interpolate (&perspective1, &perspective2, progress, &perspective_res);
res.wx = graphene_vec4_get_x (&perspective_res);
res.wy = graphene_vec4_get_y (&perspective_res);
res.wz = graphene_vec4_get_z (&perspective_res);
res.ww = graphene_vec4_get_w (&perspective_res);
/* translation */
graphene_point3d_interpolate (&translate1, &translate2, progress, &translate_res);

View File

@ -262,7 +262,7 @@ gboolean _clutter_util_matrix_decompose (const CoglMatrix *src,
float shear_p[3],
graphene_point3d_t *rotate_p,
graphene_point3d_t *translate_p,
ClutterVertex4 *perspective_p);
graphene_vec4_t *perspective_p);
CLUTTER_EXPORT
PangoDirection _clutter_pango_unichar_direction (gunichar ch);

View File

@ -261,28 +261,38 @@ _clutter_util_matrix_determinant (const CoglMatrix *matrix)
static void
_clutter_util_matrix_transpose_vector4_transform (const CoglMatrix *matrix,
const ClutterVertex4 *point,
ClutterVertex4 *res)
const graphene_vec4_t *point,
graphene_vec4_t *res)
{
res->x = matrix->xx * point->x
+ matrix->xy * point->y
+ matrix->xz * point->z
+ matrix->xw * point->w;
float point_x, point_y, point_z, point_w;
float x, y, z, w;
res->y = matrix->yx * point->x
+ matrix->yy * point->y
+ matrix->yz * point->z
+ matrix->yw * point->w;
point_x = graphene_vec4_get_x (point);
point_y = graphene_vec4_get_y (point);
point_z = graphene_vec4_get_z (point);
point_w = graphene_vec4_get_w (point);
res->z = matrix->zx * point->x
+ matrix->zy * point->y
+ matrix->zz * point->z
+ matrix->zw * point->w;
x = matrix->xx * point_x
+ matrix->xy * point_y
+ matrix->xz * point_z
+ matrix->xw * point_w;
res->w = matrix->wz * point->x
+ matrix->wy * point->w
+ matrix->wz * point->z
+ matrix->ww * point->w;
y = matrix->yx * point_x
+ matrix->yy * point_y
+ matrix->yz * point_z
+ matrix->yw * point_w;
z = matrix->zx * point_x
+ matrix->zy * point_y
+ matrix->zz * point_z
+ matrix->zw * point_w;
w = matrix->wz * point_x
+ matrix->wy * point_w
+ matrix->wz * point_z
+ matrix->ww * point_w;
graphene_vec4_init (res, x, y, z, w);
}
static void
@ -342,11 +352,11 @@ _clutter_util_matrix_decompose (const CoglMatrix *src,
float shear_p[3],
graphene_point3d_t *rotate_p,
graphene_point3d_t *translate_p,
ClutterVertex4 *perspective_p)
graphene_vec4_t *perspective_p)
{
CoglMatrix matrix = *src;
CoglMatrix perspective;
ClutterVertex4 vertex_tmp;
graphene_vec4_t vertex_tmp;
graphene_point3d_t row[3], pdum;
int i, j;
@ -386,12 +396,13 @@ _clutter_util_matrix_decompose (const CoglMatrix *src,
MAT (&matrix, 3, 2) != 0.f)
{
CoglMatrix perspective_inv;
ClutterVertex4 p;
graphene_vec4_t p;
vertex_tmp.x = MAT (&matrix, 3, 0);
vertex_tmp.y = MAT (&matrix, 3, 1);
vertex_tmp.z = MAT (&matrix, 3, 2);
vertex_tmp.w = MAT (&matrix, 3, 3);
graphene_vec4_init (&vertex_tmp,
MAT (&matrix, 3, 0),
MAT (&matrix, 3, 1),
MAT (&matrix, 3, 2),
MAT (&matrix, 3, 3));
/* solve the equation by inverting perspective... */
cogl_matrix_get_inverse (&perspective, &perspective_inv);
@ -412,10 +423,7 @@ _clutter_util_matrix_decompose (const CoglMatrix *src,
else
{
/* no perspective */
perspective_p->x = 0.0f;
perspective_p->y = 0.0f;
perspective_p->z = 0.0f;
perspective_p->w = 1.0f;
graphene_vec4_init_from_vec4 (perspective_p, graphene_vec4_zero ());
}
/* translation */