From 8e2658a6015aef512e8d5c2792810e15621244b2 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Wed, 27 Feb 2019 16:13:53 -0300 Subject: [PATCH] cogl/matrix: Init translation matrix using Graphene --- cogl/cogl/cogl-matrix.c | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) 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); }