mirror of
https://github.com/brl/mutter.git
synced 2024-11-28 11:00:54 -05:00
cogl/matrix: Init translation matrix using Graphene
This commit is contained in:
parent
3e02a89c2a
commit
8e2658a601
@ -1627,37 +1627,20 @@ cogl_matrix_init_identity (CoglMatrix *matrix)
|
|||||||
_COGL_MATRIX_DEBUG_PRINT (matrix);
|
_COGL_MATRIX_DEBUG_PRINT (matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Set a matrix to the (tx, ty, tz) translation matrix.
|
|
||||||
*
|
|
||||||
* @matix matrix.
|
|
||||||
* @tx x coordinate of the translation vector
|
|
||||||
* @ty y coordinate of the translation vector
|
|
||||||
* @tz z coordinate of the translation vector
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
_cogl_matrix_init_translation (CoglMatrix *matrix,
|
|
||||||
float tx,
|
|
||||||
float ty,
|
|
||||||
float tz)
|
|
||||||
{
|
|
||||||
memcpy (matrix, identity, 16 * sizeof (float));
|
|
||||||
|
|
||||||
matrix->xw = tx;
|
|
||||||
matrix->yw = ty;
|
|
||||||
matrix->zw = tz;
|
|
||||||
|
|
||||||
matrix->type = COGL_MATRIX_TYPE_3D;
|
|
||||||
matrix->flags = MAT_FLAG_TRANSLATION | MAT_DIRTY_INVERSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_matrix_init_translation (CoglMatrix *matrix,
|
cogl_matrix_init_translation (CoglMatrix *matrix,
|
||||||
float tx,
|
float tx,
|
||||||
float ty,
|
float ty,
|
||||||
float tz)
|
float tz)
|
||||||
{
|
{
|
||||||
_cogl_matrix_init_translation (matrix, tx, ty, tz);
|
graphene_matrix_t m;
|
||||||
|
|
||||||
|
graphene_matrix_init_translate (&m, &GRAPHENE_POINT3D_INIT (tx, ty, tz));
|
||||||
|
graphene_matrix_to_cogl_matrix (&m, matrix);
|
||||||
|
|
||||||
|
matrix->type = COGL_MATRIX_TYPE_3D;
|
||||||
|
matrix->flags = MAT_FLAG_TRANSLATION | MAT_DIRTY_INVERSE;
|
||||||
|
|
||||||
_COGL_MATRIX_DEBUG_PRINT (matrix);
|
_COGL_MATRIX_DEBUG_PRINT (matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user