From f09238a6aa7b7c78980d53c3cfb1f813458e1131 Mon Sep 17 00:00:00 2001 From: Recep Aslantas Date: Sun, 11 Sep 2016 13:07:47 +0300 Subject: [PATCH] print mat4 --- include/cglm-util.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 include/cglm-util.h diff --git a/include/cglm-util.h b/include/cglm-util.h new file mode 100644 index 0000000..e76281f --- /dev/null +++ b/include/cglm-util.h @@ -0,0 +1,40 @@ +/* + * Copyright (c), Recep Aslantas. + * + * MIT License (MIT), http://opensource.org/licenses/MIT + * Full license can be found in the LICENSE file + */ + +#ifndef cglm_util_h +#define cglm_util_h + +#include "cglm.h" +#include +#include + +CGLM_INLINE +void +glm_mat4_print(mat4 matrix, + FILE * __restrict ostream) { + int i; + int j; + +#define m 4 +#define n 4 + + fprintf(ostream, "Matrix (%dx%d):\n", m, n); + + for (i = 0; i < m; i++) { + for (j = 0; j < n; j++) + fprintf(ostream, "\t%0.2f,", matrix[i][j]);; + + fprintf(ostream, "\n"); + } + + fprintf(ostream, "\n"); + +#undef m +#undef n +} + +#endif /* cglm_util_h */