diff --git a/cogl/cogl/cogl-matrix.c b/cogl/cogl/cogl-matrix.c index b000a8b00..225cd82aa 100644 --- a/cogl/cogl/cogl-matrix.c +++ b/cogl/cogl/cogl-matrix.c @@ -1627,37 +1627,20 @@ cogl_matrix_init_identity (CoglMatrix *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 cogl_matrix_init_translation (CoglMatrix *matrix, float tx, float ty, 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); }