Create matrix_4x4_copy

This commit is contained in:
twinaphex 2016-05-17 18:12:43 +02:00
parent 8b915bbc22
commit 070b7b78b1
2 changed files with 10 additions and 0 deletions

View File

@ -25,6 +25,15 @@
#include <gfx/math/matrix_4x4.h>
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
*/

View File

@ -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);