mirror of
https://github.com/recp/cglm.git
synced 2025-10-04 09:08:53 +00:00
mat2: add new function glm_mat2_make
Function takes in a 4 element float array and converts it into a mat2 matrix. Signed-off-by: Vincent Davis Jr <vince@underview.tech>
This commit is contained in:
@@ -73,6 +73,10 @@ CGLM_EXPORT
|
||||
float
|
||||
glmc_mat2_rmc(vec2 r, mat2 m, vec2 c);
|
||||
|
||||
CGLM_EXPORT
|
||||
void
|
||||
glmc_mat2_make(float * __restrict src, mat2 dest);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -28,6 +28,7 @@
|
||||
CGLM_INLINE void glm_mat2_swap_col(mat2 mat, int col1, int col2)
|
||||
CGLM_INLINE void glm_mat2_swap_row(mat2 mat, int row1, int row2)
|
||||
CGLM_INLINE float glm_mat2_rmc(vec2 r, mat2 m, vec2 c)
|
||||
CGLM_INLINE void glm_mat2_make(float * restrict src, mat2 dest)
|
||||
*/
|
||||
|
||||
#ifndef cglm_mat2_h
|
||||
@@ -345,4 +346,19 @@ glm_mat2_rmc(vec2 r, mat2 m, vec2 c) {
|
||||
return glm_vec2_dot(r, tmp);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Create mat2 matrix from pointer
|
||||
*
|
||||
* @param[in] src pointer to an array of floats
|
||||
* @param[out] dest matrix
|
||||
*/
|
||||
CGLM_INLINE
|
||||
void
|
||||
glm_mat2_make(float * __restrict src, mat2 dest) {
|
||||
dest[0][0] = src[0];
|
||||
dest[0][1] = src[1];
|
||||
dest[1][0] = src[2];
|
||||
dest[1][1] = src[3];
|
||||
}
|
||||
|
||||
#endif /* cglm_mat2_h */
|
||||
|
@@ -258,4 +258,17 @@ glms_mat2_(rmc)(vec2s r, mat2s m, vec2s c) {
|
||||
return glm_mat2_rmc(r.raw, m.raw, c.raw);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Create mat2 matrix from pointer
|
||||
*
|
||||
* @param[in] src pointer to an array of floats
|
||||
* @param[out] dest matrix
|
||||
*/
|
||||
CGLM_INLINE
|
||||
mat2s
|
||||
glms_mat2_(make)(float * __restrict src, mat2s dest) {
|
||||
glm_mat2_make(src, dest.raw);
|
||||
return dest;
|
||||
}
|
||||
|
||||
#endif /* cglms_mat2_h */
|
||||
|
Reference in New Issue
Block a user