mirror of
https://github.com/recp/cglm.git
synced 2025-10-04 01:00:46 +00:00
vec4: add new function glm_vec4_make
Function takes in a float array. Array must be at least of size 4 and converts it into a 4D vector. Signed-off-by: Vincent Davis Jr <vince@underview.tech>
This commit is contained in:
@@ -283,6 +283,10 @@ CGLM_EXPORT
|
||||
void
|
||||
glmc_vec4_sqrt(vec4 v, vec4 dest);
|
||||
|
||||
CGLM_EXPORT
|
||||
void
|
||||
glmc_vec4_make(float * __restrict src, vec4 dest);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -61,6 +61,7 @@
|
||||
CGLM_INLINE vec4s glms_vec4_smoothinterpc(vec4s from, vec4s to, float t);
|
||||
CGLM_INLINE vec4s glms_vec4_cubic(float s);
|
||||
CGLM_INLINE vec4s glms_vec4_swizzle(vec4s v, int mask);
|
||||
CGLM_INLINE vec4s glms_vec4_make(float * restrict src);
|
||||
*/
|
||||
|
||||
#ifndef cglms_vec4s_h
|
||||
@@ -811,4 +812,18 @@ glms_vec4_(swizzle)(vec4s v, int mask) {
|
||||
return dest;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Create four dimensional vector from pointer
|
||||
*
|
||||
* @param[in] src pointer to an array of floats
|
||||
* @returns constructed 4D vector from raw pointer
|
||||
*/
|
||||
CGLM_INLINE
|
||||
vec4s
|
||||
glms_vec4_(make)(float * __restrict src) {
|
||||
vec4s dest;
|
||||
glm_vec4_make(src, dest.raw);
|
||||
return dest;
|
||||
}
|
||||
|
||||
#endif /* cglms_vec4s_h */
|
||||
|
@@ -58,6 +58,7 @@
|
||||
CGLM_INLINE void glm_vec4_smoothinterp(vec4 from, vec4 to, float t, vec4 dest);
|
||||
CGLM_INLINE void glm_vec4_smoothinterpc(vec4 from, vec4 to, float t, vec4 dest);
|
||||
CGLM_INLINE void glm_vec4_swizzle(vec4 v, int mask, vec4 dest);
|
||||
CGLM_INLINE void glm_vec4_make(float * restrict src, vec4 dest);
|
||||
|
||||
DEPRECATED:
|
||||
glm_vec4_dup
|
||||
@@ -1133,4 +1134,17 @@ glm_vec4_swizzle(vec4 v, int mask, vec4 dest) {
|
||||
glm_vec4_copy(t, dest);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Create four dimensional vector from pointer
|
||||
*
|
||||
* @param[in] src pointer to an array of floats
|
||||
* @param[out] dest destination vector
|
||||
*/
|
||||
CGLM_INLINE
|
||||
void
|
||||
glm_vec4_make(float * __restrict src, vec4 dest) {
|
||||
dest[0] = src[0]; dest[1] = src[1];
|
||||
dest[2] = src[2]; dest[3] = src[3];
|
||||
}
|
||||
|
||||
#endif /* cglm_vec4_h */
|
||||
|
Reference in New Issue
Block a user