From f5140ea00504bc388f61965bc9f9676047cbae20 Mon Sep 17 00:00:00 2001 From: Recep Aslantas Date: Sat, 7 Apr 2018 13:47:20 +0300 Subject: [PATCH] quat: mat4_mul_quat helper * the quaternion is used as right matrix --- include/cglm/mat4.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/cglm/mat4.h b/include/cglm/mat4.h index 02fde18..eddfe6b 100644 --- a/include/cglm/mat4.h +++ b/include/cglm/mat4.h @@ -45,6 +45,7 @@ #define cglm_mat_h #include "common.h" +#include "quat.h" #ifdef CGLM_SSE_FP # include "simd/sse2/mat4.h" @@ -318,6 +319,21 @@ glm_mat4_mulv(mat4 m, vec4 v, vec4 dest) { #endif } +/*! + * @brief multiply mat4 with quaternion and store in dest vector + * + * @param[in] m left matrix + * @param[in] q quaternion as right matrix + * @param[out] dest destination matrix + */ +CGLM_INLINE +void +glm_mat4_mulq(mat4 m, versor q, mat4 dest) { + mat4 rot; + glm_quat_mat4(q, rot); + glm_mat4_mul(m, rot, dest); +} + /*! * @brief multiply vector with mat4's mat3 part(rotation) *