From b0991342a65ce15f7e67e667ec2214837b64509a Mon Sep 17 00:00:00 2001 From: Recep Aslantas Date: Mon, 2 Apr 2018 12:08:08 +0300 Subject: [PATCH] aabb printer function --- include/cglm/io.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/include/cglm/io.h b/include/cglm/io.h index 2ee8ee8..f38fad7 100644 --- a/include/cglm/io.h +++ b/include/cglm/io.h @@ -171,4 +171,33 @@ glm_versor_print(versor vec, #undef m } +CGLM_INLINE +void +glm_aabb_print(vec3 bbox[2], + const char * __restrict tag, + FILE * __restrict ostream) { + int i, j; + +#define m 3 + + fprintf(ostream, "AABB (%s):\n", tag ? tag: "float"); + + for (i = 0; i < 2; i++) { + fprintf(ostream, "\t|"); + + for (j = 0; j < m; j++) { + fprintf(ostream, "%0.4f", bbox[i][j]); + + if (j != m - 1) + fprintf(ostream, "\t"); + } + + fprintf(ostream, "|\n"); + } + + fprintf(ostream, "\n"); + +#undef m +} + #endif /* cglm_io_h */