cogl/matrix: Transpose using graphene matrices
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
This commit is contained in:
parent
0dbd6d3a80
commit
dad710adaa
@ -1584,30 +1584,6 @@ cogl_matrix_init_from_euler (CoglMatrix *matrix,
|
|||||||
matrix->flags = (MAT_FLAG_GENERAL | MAT_DIRTY_ALL);
|
matrix->flags = (MAT_FLAG_GENERAL | MAT_DIRTY_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Transpose a float matrix.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
_cogl_matrix_util_transposef (float to[16], const float from[16])
|
|
||||||
{
|
|
||||||
to[0] = from[0];
|
|
||||||
to[1] = from[4];
|
|
||||||
to[2] = from[8];
|
|
||||||
to[3] = from[12];
|
|
||||||
to[4] = from[1];
|
|
||||||
to[5] = from[5];
|
|
||||||
to[6] = from[9];
|
|
||||||
to[7] = from[13];
|
|
||||||
to[8] = from[2];
|
|
||||||
to[9] = from[6];
|
|
||||||
to[10] = from[10];
|
|
||||||
to[11] = from[14];
|
|
||||||
to[12] = from[3];
|
|
||||||
to[13] = from[7];
|
|
||||||
to[14] = from[11];
|
|
||||||
to[15] = from[15];
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_matrix_view_2d_in_frustum (CoglMatrix *matrix,
|
cogl_matrix_view_2d_in_frustum (CoglMatrix *matrix,
|
||||||
float left,
|
float left,
|
||||||
@ -1967,16 +1943,16 @@ cogl_matrix_look_at (CoglMatrix *matrix,
|
|||||||
void
|
void
|
||||||
cogl_matrix_transpose (CoglMatrix *matrix)
|
cogl_matrix_transpose (CoglMatrix *matrix)
|
||||||
{
|
{
|
||||||
float new_values[16];
|
graphene_matrix_t m;
|
||||||
|
|
||||||
|
cogl_matrix_to_graphene_matrix (matrix, &m);
|
||||||
|
|
||||||
/* We don't need to do anything if the matrix is the identity matrix */
|
/* We don't need to do anything if the matrix is the identity matrix */
|
||||||
if (!(matrix->flags & MAT_DIRTY_TYPE) &&
|
if (graphene_matrix_is_identity (&m))
|
||||||
matrix->type == COGL_MATRIX_TYPE_IDENTITY)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_cogl_matrix_util_transposef (new_values, cogl_matrix_get_array (matrix));
|
graphene_matrix_transpose (&m, &m);
|
||||||
|
graphene_matrix_to_cogl_matrix (&m, matrix);
|
||||||
cogl_matrix_init_from_array (matrix, new_values);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GType
|
GType
|
||||||
|
Loading…
x
Reference in New Issue
Block a user