[mutter/gbsneto/graphene2: 23/45] cogl/matrix: Init translation matrix using Graphene
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gbsneto/graphene2: 23/45] cogl/matrix: Init translation matrix using Graphene
- Date: Sat, 7 Sep 2019 11:19:10 +0000 (UTC)
commit 8e2658a6015aef512e8d5c2792810e15621244b2
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Feb 27 16:13:53 2019 -0300
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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]