From 070b7b78b15dd33fc3b5571c570d278452575f76 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 17 May 2016 18:12:43 +0200 Subject: [PATCH] Create matrix_4x4_copy --- libretro-common/gfx/math/matrix_4x4.c | 9 +++++++++ libretro-common/include/gfx/math/matrix_4x4.h | 1 + 2 files changed, 10 insertions(+) diff --git a/libretro-common/gfx/math/matrix_4x4.c b/libretro-common/gfx/math/matrix_4x4.c index b8dcfce3a6..2ff6198bd7 100644 --- a/libretro-common/gfx/math/matrix_4x4.c +++ b/libretro-common/gfx/math/matrix_4x4.c @@ -25,6 +25,15 @@ #include +void matrix_4x4_copy(math_matrix_4x4 *dst, const math_matrix_4x4 *src) +{ + unsigned i, j; + + for (i = 0; i < 4; i++) + for (j = 0; j < 4; j++) + MAT_ELEM_4X4(*dst, i, j) = MAT_ELEM_4X4(*src, i, j); +} + /* * Sets mat to an identity matrix */ diff --git a/libretro-common/include/gfx/math/matrix_4x4.h b/libretro-common/include/gfx/math/matrix_4x4.h index 59620830e4..ab6f16e838 100644 --- a/libretro-common/include/gfx/math/matrix_4x4.h +++ b/libretro-common/include/gfx/math/matrix_4x4.h @@ -35,6 +35,7 @@ typedef struct math_matrix_4x4 #define MAT_ELEM_4X4(mat, r, c) ((mat).data[4 * (c) + (r)]) +void matrix_4x4_copy(math_matrix_4x4 *dst, const math_matrix_4x4 *src); void matrix_4x4_identity(math_matrix_4x4 *mat); void matrix_4x4_transpose(math_matrix_4x4 *out, const math_matrix_4x4 *in);