move mods to ext

This commit is contained in:
Marcin
2025-01-18 16:47:07 +00:00
parent 35af0c04fe
commit 0483362f5c
4 changed files with 53 additions and 37 deletions

View File

@@ -27,6 +27,7 @@
CGLM_INLINE void glm_vec3_abs(vec3 v, vec3 dest);
CGLM_INLINE void glm_vec3_fract(vec3 v, vec3 dest);
CGLM_INLINE void glm_vec3_floor(vec3 v, vec3 dest);
CGLM_INLINE float glm_vec3_mods(vec3 v, float s, vec3 dest);
CGLM_INLINE float glm_vec3_hadd(vec3 v);
CGLM_INLINE void glm_vec3_sqrt(vec3 v, vec3 dest);
*/
@@ -265,6 +266,21 @@ glm_vec3_floor(vec3 x, vec3 dest) {
dest[2] = floorf(x[2]);
}
/*!
* @brief mod of each vector item, result is written to dest (dest = v % s)
*
* @param[in] v vector
* @param[in] s scalar
* @param[out] dest destination vector
*/
CGLM_INLINE
void
glm_vec3_mods(vec3 x, float y, vec3 dest) {
dest[0] = fmodf(x[0], y);
dest[1] = fmodf(x[1], y);
dest[2] = fmodf(x[2], y);
}
/*!
* @brief vector reduction by summation
* @warning could overflow