From 5ee9bb88dfc8ac2c5eef4a968a9adbc5fdf409f0 Mon Sep 17 00:00:00 2001 From: Recep Aslantas Date: Thu, 20 Feb 2020 17:29:32 +0300 Subject: [PATCH] add notes for versor/quaternion type to describe memory layout --- include/cglm/types.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/cglm/types.h b/include/cglm/types.h index 169d70b..f2bc7c1 100644 --- a/include/cglm/types.h +++ b/include/cglm/types.h @@ -36,10 +36,15 @@ typedef float vec2[2]; typedef float vec3[3]; typedef int ivec3[3]; typedef CGLM_ALIGN_IF(16) float vec4[4]; -typedef vec4 versor; +typedef vec4 versor; /* |x, y, z, w| -> w is the last */ typedef vec3 mat3[3]; typedef CGLM_ALIGN_MAT vec4 mat4[4]; +/* + Important: cglm stores quaternion as [x, y, z, w] in memory since v0.4.0 + it was [w, x, y, z] before v0.4.0 ( v0.3.5 and earlier ). w is real part. +*/ + #define GLM_E 2.71828182845904523536028747135266250 /* e */ #define GLM_LOG2E 1.44269504088896340735992468100189214 /* log2(e) */ #define GLM_LOG10E 0.434294481903251827651128918916605082 /* log10(e) */