mirror of
https://github.com/recp/cglm.git
synced 2025-12-25 12:55:04 +00:00
identiy helper for arrays (matrix/quaternion)
this helpers makes all array elements identity
This commit is contained in:
@@ -24,6 +24,10 @@ CGLM_EXPORT
|
||||
void
|
||||
glmc_mat3_identity(mat3 mat);
|
||||
|
||||
CGLM_EXPORT
|
||||
void
|
||||
glmc_mat3_identity_array(mat3 * __restrict mat, size_t count);
|
||||
|
||||
CGLM_EXPORT
|
||||
void
|
||||
glmc_mat3_mul(mat3 m1, mat3 m2, mat3 dest);
|
||||
|
||||
@@ -29,6 +29,10 @@ CGLM_EXPORT
|
||||
void
|
||||
glmc_mat4_identity(mat4 mat);
|
||||
|
||||
CGLM_EXPORT
|
||||
void
|
||||
glmc_mat4_identity_array(mat4 * __restrict mat, size_t count);
|
||||
|
||||
CGLM_EXPORT
|
||||
void
|
||||
glmc_mat4_pick3(mat4 mat, mat3 dest);
|
||||
|
||||
@@ -17,6 +17,10 @@ CGLM_EXPORT
|
||||
void
|
||||
glmc_quat_identity(versor q);
|
||||
|
||||
CGLM_EXPORT
|
||||
void
|
||||
glmc_quat_identity_array(versor * __restrict q, size_t count);
|
||||
|
||||
CGLM_EXPORT
|
||||
void
|
||||
glmc_quat_init(versor q, float x, float y, float z, float w);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
Functions:
|
||||
CGLM_INLINE void glm_mat3_copy(mat3 mat, mat3 dest);
|
||||
CGLM_INLINE void glm_mat3_identity(mat3 mat);
|
||||
CGLM_INLINE void glm_mat3_identity_array(mat3 * restrict mat, size_t count);
|
||||
CGLM_INLINE void glm_mat3_mul(mat3 m1, mat3 m2, mat3 dest);
|
||||
CGLM_INLINE void glm_mat3_transpose_to(mat3 m, mat3 dest);
|
||||
CGLM_INLINE void glm_mat3_transpose(mat3 m);
|
||||
@@ -85,6 +86,25 @@ glm_mat3_identity(mat3 mat) {
|
||||
glm_mat3_copy(t, mat);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief make given matrix array's each element identity matrix
|
||||
*
|
||||
* @param[in, out] mat matrix array (must be aligned (16/32)
|
||||
* if alignment is not disabled)
|
||||
*
|
||||
* @param[in] count count of matrices
|
||||
*/
|
||||
CGLM_INLINE
|
||||
void
|
||||
glm_mat3_identity_array(mat3 * __restrict mat, size_t count) {
|
||||
CGLM_ALIGN_MAT mat3 t = GLM_MAT3_IDENTITY_INIT;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
glm_mat3_copy(t, mat[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief multiply m1 and m2 to dest
|
||||
*
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
CGLM_INLINE void glm_mat4_ucopy(mat4 mat, mat4 dest);
|
||||
CGLM_INLINE void glm_mat4_copy(mat4 mat, mat4 dest);
|
||||
CGLM_INLINE void glm_mat4_identity(mat4 mat);
|
||||
CGLM_INLINE void glm_mat4_identity_array(mat4 * restrict mat, size_t count);
|
||||
CGLM_INLINE void glm_mat4_pick3(mat4 mat, mat3 dest);
|
||||
CGLM_INLINE void glm_mat4_pick3t(mat4 mat, mat3 dest);
|
||||
CGLM_INLINE void glm_mat4_ins3(mat3 mat, mat4 dest);
|
||||
@@ -143,6 +144,25 @@ glm_mat4_identity(mat4 mat) {
|
||||
glm_mat4_copy(t, mat);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief make given matrix array's each element identity matrix
|
||||
*
|
||||
* @param[in, out] mat matrix array (must be aligned (16/32)
|
||||
* if alignment is not disabled)
|
||||
*
|
||||
* @param[in] count count of matrices
|
||||
*/
|
||||
CGLM_INLINE
|
||||
void
|
||||
glm_mat4_identity_array(mat4 * __restrict mat, size_t count) {
|
||||
CGLM_ALIGN_MAT mat4 t = GLM_MAT4_IDENTITY_INIT;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
glm_mat4_copy(t, mat[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief copy upper-left of mat4 to mat3
|
||||
*
|
||||
|
||||
@@ -103,6 +103,25 @@ glm_quat_identity(versor q) {
|
||||
glm_vec4_copy(v, q);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief make given quaternion array's each element identity quaternion
|
||||
*
|
||||
* @param[in, out] q quat array (must be aligned (16)
|
||||
* if alignment is not disabled)
|
||||
*
|
||||
* @param[in] count count of quaternions
|
||||
*/
|
||||
CGLM_INLINE
|
||||
void
|
||||
glm_quat_identity_array(versor * __restrict q, size_t count) {
|
||||
CGLM_ALIGN(16) versor v = GLM_QUAT_IDENTITY_INIT;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
glm_vec4_copy(v, q[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief inits quaterion with raw values
|
||||
*
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
CGLM_INLINE
|
||||
void
|
||||
glm_mat4_scale_sse2(mat4 m, float s){
|
||||
glm_mat4_scale_sse2(mat4 m, float s) {
|
||||
__m128 x0;
|
||||
x0 = _mm_set1_ps(s);
|
||||
|
||||
@@ -28,7 +28,7 @@ glm_mat4_scale_sse2(mat4 m, float s){
|
||||
|
||||
CGLM_INLINE
|
||||
void
|
||||
glm_mat4_transp_sse2(mat4 m, mat4 dest){
|
||||
glm_mat4_transp_sse2(mat4 m, mat4 dest) {
|
||||
__m128 r0, r1, r2, r3;
|
||||
|
||||
r0 = glmm_load(m[0]);
|
||||
|
||||
@@ -10,6 +10,6 @@
|
||||
|
||||
#define CGLM_VERSION_MAJOR 0
|
||||
#define CGLM_VERSION_MINOR 4
|
||||
#define CGLM_VERSION_PATCH 8
|
||||
#define CGLM_VERSION_PATCH 9
|
||||
|
||||
#endif /* cglm_version_h */
|
||||
|
||||
Reference in New Issue
Block a user