diff --git a/configure.ac b/configure.ac index 99b8051..e6d602d 100644 --- a/configure.ac +++ b/configure.ac @@ -7,7 +7,7 @@ #***************************************************************************** AC_PREREQ([2.69]) -AC_INIT([cglm], [0.4.8], [info@recp.me]) +AC_INIT([cglm], [0.4.9], [info@recp.me]) AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects]) AC_CONFIG_MACRO_DIR([m4]) diff --git a/docs/source/conf.py b/docs/source/conf.py index af518fa..704d24e 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -62,9 +62,9 @@ author = u'Recep Aslantas' # built documents. # # The short X.Y version. -version = u'0.4.8' +version = u'0.4.9' # The full version, including alpha/beta/rc tags. -release = u'0.4.8' +release = u'0.4.9' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/source/mat3.rst b/docs/source/mat3.rst index b9f56ee..5d590d9 100644 --- a/docs/source/mat3.rst +++ b/docs/source/mat3.rst @@ -20,6 +20,7 @@ Functions: 1. :c:func:`glm_mat3_copy` #. :c:func:`glm_mat3_identity` +#. :c:func:`glm_mat3_identity_array` #. :c:func:`glm_mat3_mul` #. :c:func:`glm_mat3_transpose_to` #. :c:func:`glm_mat3_transpose` @@ -49,6 +50,14 @@ Functions documentation Parameters: | *[out]* **mat** matrix +.. c:function:: void glm_mat3_identity_array(mat3 * __restrict mat, size_t count) + + make given matrix array's each element identity matrix + + Parameters: + | *[in,out]* **mat** matrix array (must be aligned (16/32) if alignment is not disabled) + | *[in]* **count** count of matrices + .. c:function:: void glm_mat3_mul(mat3 m1, mat3 m2, mat3 dest) multiply m1 and m2 to dest diff --git a/docs/source/mat4.rst b/docs/source/mat4.rst index 7fb0857..ae37147 100644 --- a/docs/source/mat4.rst +++ b/docs/source/mat4.rst @@ -25,6 +25,7 @@ Functions: 1. :c:func:`glm_mat4_ucopy` #. :c:func:`glm_mat4_copy` #. :c:func:`glm_mat4_identity` +#. :c:func:`glm_mat4_identity_array` #. :c:func:`glm_mat4_pick3` #. :c:func:`glm_mat4_pick3t` #. :c:func:`glm_mat4_ins3` @@ -69,6 +70,14 @@ Functions documentation Parameters: | *[out]* **mat** matrix +.. c:function:: void glm_mat4_identity_array(mat4 * __restrict mat, size_t count) + + make given matrix array's each element identity matrix + + Parameters: + | *[in,out]* **mat** matrix array (must be aligned (16/32) if alignment is not disabled) + | *[in]* **count** count of matrices + .. c:function:: void glm_mat4_pick3(mat4 mat, mat3 dest) copy upper-left of mat4 to mat3 diff --git a/docs/source/quat.rst b/docs/source/quat.rst index d9b4680..caac1bf 100644 --- a/docs/source/quat.rst +++ b/docs/source/quat.rst @@ -27,6 +27,7 @@ Macros: Functions: 1. :c:func:`glm_quat_identity` +#. :c:func:`glm_quat_identity_array` #. :c:func:`glm_quat_init` #. :c:func:`glm_quat` #. :c:func:`glm_quatv` @@ -70,6 +71,14 @@ Functions documentation Parameters: | *[in, out]* **q** quaternion +.. c:function:: void glm_quat_identity_array(versor * __restrict q, size_t count) + + | make given quaternion array's each element identity quaternion + + Parameters: + | *[in, out]* **q** quat array (must be aligned (16) if alignment is not disabled) + | *[in]* **count** count of quaternions + .. c:function:: void glm_quat_init(versor q, float x, float y, float z, float w) | inits quaternion with given values diff --git a/include/cglm/call/mat3.h b/include/cglm/call/mat3.h index 1a92de4..9270113 100644 --- a/include/cglm/call/mat3.h +++ b/include/cglm/call/mat3.h @@ -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); diff --git a/include/cglm/call/mat4.h b/include/cglm/call/mat4.h index ef86682..daa7b7e 100644 --- a/include/cglm/call/mat4.h +++ b/include/cglm/call/mat4.h @@ -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); diff --git a/include/cglm/call/quat.h b/include/cglm/call/quat.h index ae4c9ef..2778a58 100644 --- a/include/cglm/call/quat.h +++ b/include/cglm/call/quat.h @@ -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); diff --git a/include/cglm/mat3.h b/include/cglm/mat3.h index d0135a4..5d0d6ac 100644 --- a/include/cglm/mat3.h +++ b/include/cglm/mat3.h @@ -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 * diff --git a/include/cglm/mat4.h b/include/cglm/mat4.h index 4162cd1..dc8ef88 100644 --- a/include/cglm/mat4.h +++ b/include/cglm/mat4.h @@ -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 * diff --git a/include/cglm/quat.h b/include/cglm/quat.h index e97e922..289b0ad 100644 --- a/include/cglm/quat.h +++ b/include/cglm/quat.h @@ -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 * diff --git a/include/cglm/simd/sse2/mat4.h b/include/cglm/simd/sse2/mat4.h index c2acb9f..7c87eb5 100644 --- a/include/cglm/simd/sse2/mat4.h +++ b/include/cglm/simd/sse2/mat4.h @@ -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]); diff --git a/include/cglm/version.h b/include/cglm/version.h index 87515f5..7ec929b 100644 --- a/include/cglm/version.h +++ b/include/cglm/version.h @@ -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 */ diff --git a/src/mat3.c b/src/mat3.c index 4455b0f..be603e8 100644 --- a/src/mat3.c +++ b/src/mat3.c @@ -20,6 +20,12 @@ glmc_mat3_identity(mat3 mat) { glm_mat3_identity(mat); } +CGLM_EXPORT +void +glmc_mat3_identity_array(mat3 * __restrict mat, size_t count) { + glm_mat3_identity_array(mat, count); +} + CGLM_EXPORT void glmc_mat3_mul(mat3 m1, mat3 m2, mat3 dest) { diff --git a/src/mat4.c b/src/mat4.c index 4bca6f7..7bb99e2 100644 --- a/src/mat4.c +++ b/src/mat4.c @@ -26,6 +26,12 @@ glmc_mat4_identity(mat4 mat) { glm_mat4_identity(mat); } +CGLM_EXPORT +void +glmc_mat4_identity_array(mat4 * __restrict mat, size_t count) { + glm_mat4_identity_array(mat, count); +} + CGLM_EXPORT void glmc_mat4_pick3(mat4 mat, mat3 dest) { diff --git a/src/quat.c b/src/quat.c index c47761d..32674a7 100644 --- a/src/quat.c +++ b/src/quat.c @@ -8,13 +8,18 @@ #include "../include/cglm/cglm.h" #include "../include/cglm/call.h" - CGLM_EXPORT void glmc_quat_identity(versor q) { glm_quat_identity(q); } +CGLM_EXPORT +void +glmc_quat_identity_array(versor * __restrict q, size_t count) { + glm_quat_identity_array(q, count); +} + CGLM_EXPORT void glmc_quat_init(versor q, float x, float y, float z, float w) {