new abs functions for vec2, ivec2, ivec3, ivec4

This commit is contained in:
duarm
2022-11-18 14:28:39 -03:00
parent 8cfc98d283
commit a0f01c5ed1
17 changed files with 177 additions and 1 deletions

View File

@@ -22,6 +22,7 @@ FUNCTIONS:
CGLM_INLINE void glm_ivec3_maxv(ivec3 a, ivec3 b, ivec3 dest)
CGLM_INLINE void glm_ivec3_minv(ivec3 a, ivec3 b, ivec3 dest)
CGLM_INLINE void glm_ivec3_clamp(ivec3 v, int minVal, int maxVal)
CGLM_INLINE void glm_ivec3_abs(ivec3 v, ivec3 dest)
*/
#ifndef cglm_ivec3_h
@@ -255,4 +256,18 @@ glm_ivec3_clamp(ivec3 v, int minVal, int maxVal) {
v[2] = maxVal;
}
/*!
* @brief absolute value of v
*
* @param[in] v vector
* @param[out] dest destination
*/
CGLM_INLINE
void
glm_ivec3_abs(ivec3 v, ivec3 dest) {
dest[0] = abs(v[0]);
dest[1] = abs(v[1]);
dest[2] = abs(v[2]);
}
#endif /* cglm_ivec3_h */