[mutter/gbsneto/graphene2: 38/45] cogl/matrix: Translate using Graphene
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gbsneto/graphene2: 38/45] cogl/matrix: Translate using Graphene
- Date: Sat, 7 Sep 2019 11:20:26 +0000 (UTC)
commit 2ed596088f31878d3018af63d0b144b8ab7e7cf5
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Fri Mar 1 13:28:13 2019 -0300
cogl/matrix: Translate using Graphene
cogl/cogl/cogl-matrix.c | 24 ++++++------------------
1 file changed, 6 insertions(+), 18 deletions(-)
---
diff --git a/cogl/cogl/cogl-matrix.c b/cogl/cogl/cogl-matrix.c
index 282ed48e4..1e427bbb8 100644
--- a/cogl/cogl/cogl-matrix.c
+++ b/cogl/cogl/cogl-matrix.c
@@ -276,30 +276,18 @@ cogl_matrix_scale (CoglMatrix *matrix,
_COGL_MATRIX_DEBUG_PRINT (matrix);
}
-/*
- * Multiply a matrix with a translation matrix.
- *
- * Adds the translation coordinates to the elements of matrix in-place. Marks
- * the MAT_FLAG_TRANSLATION flag, and the MAT_DIRTY_TYPE and MAT_DIRTY_INVERSE
- * dirty flags.
- */
-static void
-_cogl_matrix_translate (CoglMatrix *matrix, float x, float y, float z)
-{
- float *m = (float *)matrix;
- m[12] = m[0] * x + m[4] * y + m[8] * z + m[12];
- m[13] = m[1] * x + m[5] * y + m[9] * z + m[13];
- m[14] = m[2] * x + m[6] * y + m[10] * z + m[14];
- m[15] = m[3] * x + m[7] * y + m[11] * z + m[15];
-}
-
void
cogl_matrix_translate (CoglMatrix *matrix,
float x,
float y,
float z)
{
- _cogl_matrix_translate (matrix, x, y, z);
+ graphene_matrix_t m;
+
+ cogl_matrix_to_graphene_matrix (matrix, &m);
+ graphene_matrix_translate (&m, &GRAPHENE_POINT3D_INIT (x, y, z));
+ graphene_matrix_to_cogl_matrix (&m, matrix);
+
_COGL_MATRIX_DEBUG_PRINT (matrix);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]