From 5825c24e8feba1f27749c878bc57d3372f4303f9 Mon Sep 17 00:00:00 2001 From: Recep Aslantas Date: Tue, 13 Sep 2016 18:18:35 +0300 Subject: [PATCH] print fn for vectors --- include/cglm-util.h | 54 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/include/cglm-util.h b/include/cglm-util.h index c181186..9e07d66 100644 --- a/include/cglm-util.h +++ b/include/cglm-util.h @@ -37,4 +37,58 @@ glm_mat4_print(mat4 matrix, #undef n } +CGLM_INLINE +void +glm_vec4_print(vec4 vec, + FILE * __restrict ostream) { + int i; + +#define m 4 + + fprintf(ostream, "Vector (%d):\n", m); + + for (i = 0; i < m; i++) + fprintf(ostream, "\t%0.2f,", vec[i]);; + + fprintf(ostream, "\n"); + +#undef m +} + +CGLM_INLINE +void +glm_vec3_print(vec3 vec, + FILE * __restrict ostream) { + int i; + +#define m 3 + + fprintf(ostream, "Vector (%d):\n", m); + + for (i = 0; i < m; i++) + fprintf(ostream, "\t%0.2f,", vec[i]);; + + fprintf(ostream, "\n"); + +#undef m +} + +CGLM_INLINE +void +glm_versor_print(versor vec, + FILE * __restrict ostream) { + int i; + +#define m 4 + + fprintf(ostream, "Versor (%d):\n", m); + + for (i = 0; i < m; i++) + fprintf(ostream, "\t%0.2f,", vec[i]);; + + fprintf(ostream, "\n"); + +#undef m +} + #endif /* cglm_util_h */