mirror of
https://github.com/recp/cglm.git
synced 2026-02-17 03:39:05 +00:00
Compare commits
28 Commits
suppress-s
...
werror
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d6267e623b | ||
|
|
93cdc897a5 | ||
|
|
0962f7d2e7 | ||
|
|
487b18e326 | ||
|
|
8e2074c274 | ||
|
|
0ab1f21816 | ||
|
|
b8d565c6b6 | ||
|
|
c5c997ca13 | ||
|
|
924d92ae3f | ||
|
|
d673f3d765 | ||
|
|
5833d1bf44 | ||
|
|
aeeeac4c5a | ||
|
|
b3de85a14e | ||
|
|
5e798a94e3 | ||
|
|
49dd24eaf2 | ||
|
|
bfe5ea6ab7 | ||
|
|
6d39ef0026 | ||
|
|
87ae96b847 | ||
|
|
9cf4190c9b | ||
|
|
2bbaeb8db9 | ||
|
|
a7cda7f969 | ||
|
|
c4d4c48518 | ||
|
|
702bed8173 | ||
|
|
e9aa249a73 | ||
|
|
adec2ee8e6 | ||
|
|
5cd16194c8 | ||
|
|
02b9dc067a | ||
|
|
a447365bc5 |
2
.github/workflows/cmake-wasm.yml
vendored
2
.github/workflows/cmake-wasm.yml
vendored
@@ -66,7 +66,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Setup emsdk
|
- name: Setup emsdk
|
||||||
uses: mymindstorm/setup-emsdk@v11
|
uses: mymindstorm/setup-emsdk@v12
|
||||||
|
|
||||||
- name: Verify emsdk
|
- name: Verify emsdk
|
||||||
run: emcc -v
|
run: emcc -v
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ if(MSVC)
|
|||||||
string(REGEX REPLACE "/RTC(su|[1su])" "" ${flag_var} "${${flag_var}}")
|
string(REGEX REPLACE "/RTC(su|[1su])" "" ${flag_var} "${${flag_var}}")
|
||||||
endforeach(flag_var)
|
endforeach(flag_var)
|
||||||
else()
|
else()
|
||||||
add_compile_options(-Wall -Werror -O3)
|
add_compile_options(-Wall -O3)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
get_directory_property(hasParent PARENT_DIRECTORY)
|
get_directory_property(hasParent PARENT_DIRECTORY)
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ AM_CFLAGS = -Wall \
|
|||||||
-std=gnu11 \
|
-std=gnu11 \
|
||||||
-O3 \
|
-O3 \
|
||||||
-Wstrict-aliasing=2 \
|
-Wstrict-aliasing=2 \
|
||||||
-fstrict-aliasing \
|
-fstrict-aliasing
|
||||||
-Werror=strict-prototypes
|
|
||||||
|
|
||||||
lib_LTLIBRARIES = libcglm.la
|
lib_LTLIBRARIES = libcglm.la
|
||||||
libcglm_la_LDFLAGS = -no-undefined -version-info 0:1:0
|
libcglm_la_LDFLAGS = -no-undefined -version-info 0:1:0
|
||||||
@@ -163,6 +162,7 @@ cglm_struct_HEADERS = include/cglm/struct/mat4.h \
|
|||||||
include/cglm/struct/mat2.h \
|
include/cglm/struct/mat2.h \
|
||||||
include/cglm/struct/affine-pre.h \
|
include/cglm/struct/affine-pre.h \
|
||||||
include/cglm/struct/affine-post.h \
|
include/cglm/struct/affine-post.h \
|
||||||
|
include/cglm/struct/affine-mat.h \
|
||||||
include/cglm/struct/affine.h \
|
include/cglm/struct/affine.h \
|
||||||
include/cglm/struct/affine2d.h \
|
include/cglm/struct/affine2d.h \
|
||||||
include/cglm/struct/vec2.h \
|
include/cglm/struct/vec2.h \
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
AC_PREREQ([2.69])
|
AC_PREREQ([2.69])
|
||||||
AC_INIT([cglm], [0.9.1], [info@recp.me])
|
AC_INIT([cglm], [0.9.1], [info@recp.me])
|
||||||
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects serial-tests])
|
AM_INIT_AUTOMAKE([-Wall foreign subdir-objects serial-tests])
|
||||||
|
|
||||||
# Don't use the default cflags (-O2 -g), we set ours manually in Makefile.am.
|
# Don't use the default cflags (-O2 -g), we set ours manually in Makefile.am.
|
||||||
: ${CFLAGS=""}
|
: ${CFLAGS=""}
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ Functions:
|
|||||||
#. :c:func:`glm_quat_rotate`
|
#. :c:func:`glm_quat_rotate`
|
||||||
#. :c:func:`glm_quat_rotate_at`
|
#. :c:func:`glm_quat_rotate_at`
|
||||||
#. :c:func:`glm_quat_rotate_atm`
|
#. :c:func:`glm_quat_rotate_atm`
|
||||||
|
#. :c:func:`glm_quat_make`
|
||||||
|
|
||||||
Functions documentation
|
Functions documentation
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@@ -420,3 +421,13 @@ Functions documentation
|
|||||||
| *[in, out]* **m** existing transform matrix to rotate
|
| *[in, out]* **m** existing transform matrix to rotate
|
||||||
| *[in]* **q** quaternion
|
| *[in]* **q** quaternion
|
||||||
| *[in]* **pivot** pivot
|
| *[in]* **pivot** pivot
|
||||||
|
|
||||||
|
.. c:function:: void glm_quat_make(float * __restrict src, versor dest)
|
||||||
|
|
||||||
|
Create quaternion from pointer
|
||||||
|
|
||||||
|
| NOTE: **@src** must contain at least 4 elements. cglm store quaternions as [x, y, z, w].
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
| *[in]* **src** pointer to an array of floats
|
||||||
|
| *[out]* **dest** destination quaternion
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ Functions:
|
|||||||
#. :c:func:`glm_vec2_minv`
|
#. :c:func:`glm_vec2_minv`
|
||||||
#. :c:func:`glm_vec2_clamp`
|
#. :c:func:`glm_vec2_clamp`
|
||||||
#. :c:func:`glm_vec2_lerp`
|
#. :c:func:`glm_vec2_lerp`
|
||||||
|
#. :c:func:`glm_vec2_make`
|
||||||
|
|
||||||
Functions documentation
|
Functions documentation
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@@ -373,3 +374,12 @@ Functions documentation
|
|||||||
| *[in]* **to** to value
|
| *[in]* **to** to value
|
||||||
| *[in]* **t** interpolant (amount) clamped between 0 and 1
|
| *[in]* **t** interpolant (amount) clamped between 0 and 1
|
||||||
| *[out]* **dest** destination
|
| *[out]* **dest** destination
|
||||||
|
|
||||||
|
.. c:function:: void glm_vec2_make(float * __restrict src, vec2 dest)
|
||||||
|
|
||||||
|
Create two dimensional vector from pointer
|
||||||
|
|
||||||
|
| NOTE: **@src** must contain at least 2 elements.
|
||||||
|
Parameters:
|
||||||
|
| *[in]* **src** pointer to an array of floats
|
||||||
|
| *[out]* **dest** destination vector
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ Functions:
|
|||||||
#. :c:func:`glm_vec3_ortho`
|
#. :c:func:`glm_vec3_ortho`
|
||||||
#. :c:func:`glm_vec3_clamp`
|
#. :c:func:`glm_vec3_clamp`
|
||||||
#. :c:func:`glm_vec3_lerp`
|
#. :c:func:`glm_vec3_lerp`
|
||||||
|
#. :c:func:`glm_vec3_make`
|
||||||
|
|
||||||
Functions documentation
|
Functions documentation
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@@ -501,3 +502,13 @@ Functions documentation
|
|||||||
| *[in]* **to** to value
|
| *[in]* **to** to value
|
||||||
| *[in]* **t** interpolant (amount) clamped between 0 and 1
|
| *[in]* **t** interpolant (amount) clamped between 0 and 1
|
||||||
| *[out]* **dest** destination
|
| *[out]* **dest** destination
|
||||||
|
|
||||||
|
.. c:function:: void glm_vec3_make(float * __restrict src, vec3 dest)
|
||||||
|
|
||||||
|
Create three dimensional vector from pointer
|
||||||
|
|
||||||
|
| NOTE: **@src** must contain at least 3 elements.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
| *[in]* **src** pointer to an array of floats
|
||||||
|
| *[out]* **dest** destination vector
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ Functions:
|
|||||||
#. :c:func:`glm_vec4_clamp`
|
#. :c:func:`glm_vec4_clamp`
|
||||||
#. :c:func:`glm_vec4_lerp`
|
#. :c:func:`glm_vec4_lerp`
|
||||||
#. :c:func:`glm_vec4_cubic`
|
#. :c:func:`glm_vec4_cubic`
|
||||||
|
#. :c:func:`glm_vec4_make`
|
||||||
|
|
||||||
Functions documentation
|
Functions documentation
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@@ -406,3 +407,12 @@ Functions documentation
|
|||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **s** parameter
|
| *[in]* **s** parameter
|
||||||
| *[out]* **dest** destination
|
| *[out]* **dest** destination
|
||||||
|
|
||||||
|
.. c:function:: void glm_vec4_make(float * __restrict src, vec4 dest)
|
||||||
|
|
||||||
|
Create four dimensional vector from pointer
|
||||||
|
|
||||||
|
| NOTE: **@src** must contain at least 4 elements.
|
||||||
|
Parameters:
|
||||||
|
| *[in]* **src** pointer to an array of floats
|
||||||
|
| *[out]* **dest** destination vector
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
/*
|
/*
|
||||||
Functions:
|
Functions:
|
||||||
CGLM_INLINE void glm_mul(mat4 m1, mat4 m2, mat4 dest);
|
CGLM_INLINE void glm_mul(mat4 m1, mat4 m2, mat4 dest);
|
||||||
|
CGLM_INLINE void glm_mul_rot(mat4 m1, mat4 m2, mat4 dest);
|
||||||
CGLM_INLINE void glm_inv_tr(mat4 mat);
|
CGLM_INLINE void glm_inv_tr(mat4 mat);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#define GLM_HERMITE_MAT ((mat4)GLM_HERMITE_MAT_INIT)
|
#define GLM_HERMITE_MAT ((mat4)GLM_HERMITE_MAT_INIT)
|
||||||
|
|
||||||
#define CGLM_DECASTEL_EPS 1e-9f
|
#define CGLM_DECASTEL_EPS 1e-9f
|
||||||
#define CGLM_DECASTEL_MAX 1000.0f
|
#define CGLM_DECASTEL_MAX 1000
|
||||||
#define CGLM_DECASTEL_SMALL 1e-20f
|
#define CGLM_DECASTEL_SMALL 1e-20f
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -161,6 +161,10 @@ CGLM_EXPORT
|
|||||||
void
|
void
|
||||||
glmc_quat_rotate_atm(mat4 m, versor q, vec3 pivot);
|
glmc_quat_rotate_atm(mat4 m, versor q, vec3 pivot);
|
||||||
|
|
||||||
|
CGLM_EXPORT
|
||||||
|
void
|
||||||
|
glmc_quat_make(float * __restrict src, versor dest);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -165,6 +165,10 @@ CGLM_EXPORT
|
|||||||
void
|
void
|
||||||
glmc_vec2_complex_conjugate(vec2 a, vec2 dest);
|
glmc_vec2_complex_conjugate(vec2 a, vec2 dest);
|
||||||
|
|
||||||
|
CGLM_EXPORT
|
||||||
|
void
|
||||||
|
glmc_vec2_make(float * __restrict src, vec2 dest);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -306,6 +306,10 @@ CGLM_EXPORT
|
|||||||
void
|
void
|
||||||
glmc_vec3_sqrt(vec3 v, vec3 dest);
|
glmc_vec3_sqrt(vec3 v, vec3 dest);
|
||||||
|
|
||||||
|
CGLM_EXPORT
|
||||||
|
void
|
||||||
|
glmc_vec3_make(float * __restrict src, vec3 dest);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -283,6 +283,10 @@ CGLM_EXPORT
|
|||||||
void
|
void
|
||||||
glmc_vec4_sqrt(vec4 v, vec4 dest);
|
glmc_vec4_sqrt(vec4 v, vec4 dest);
|
||||||
|
|
||||||
|
CGLM_EXPORT
|
||||||
|
void
|
||||||
|
glmc_vec4_make(float * __restrict src, vec4 dest);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -49,6 +49,7 @@
|
|||||||
versor dest);
|
versor dest);
|
||||||
CGLM_INLINE void glm_quat_rotatev(versor q, vec3 v, vec3 dest);
|
CGLM_INLINE void glm_quat_rotatev(versor q, vec3 v, vec3 dest);
|
||||||
CGLM_INLINE void glm_quat_rotate(mat4 m, versor q, mat4 dest);
|
CGLM_INLINE void glm_quat_rotate(mat4 m, versor q, mat4 dest);
|
||||||
|
CGLM_INLINE void glm_quat_make(float * restrict src, versor dest);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef cglm_quat_h
|
#ifndef cglm_quat_h
|
||||||
@@ -885,4 +886,17 @@ glm_quat_rotate_atm(mat4 m, versor q, vec3 pivot) {
|
|||||||
glm_translate(m, pivotInv);
|
glm_translate(m, pivotInv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Create quaternion from pointer
|
||||||
|
*
|
||||||
|
* @param[in] src pointer to an array of floats
|
||||||
|
* @param[out] dest quaternion
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
void
|
||||||
|
glm_quat_make(float * __restrict src, versor dest) {
|
||||||
|
dest[0] = src[0]; dest[1] = src[1];
|
||||||
|
dest[2] = src[2]; dest[3] = src[3];
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* cglm_quat_h */
|
#endif /* cglm_quat_h */
|
||||||
|
|||||||
90
include/cglm/struct/affine-mat.h
Normal file
90
include/cglm/struct/affine-mat.h
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c), Recep Aslantas.
|
||||||
|
*
|
||||||
|
* MIT License (MIT), http://opensource.org/licenses/MIT
|
||||||
|
* Full license can be found in the LICENSE file
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Functions:
|
||||||
|
CGLM_INLINE mat4s glms_mul(mat4 m1, mat4 m2);
|
||||||
|
CGLM_INLINE mat4s glms_mul_rot(mat4 m1, mat4 m2);
|
||||||
|
CGLM_INLINE mat4s glms_inv_tr();
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef cglms_affine_mat_h
|
||||||
|
#define cglms_affine_mat_h
|
||||||
|
|
||||||
|
#include "../common.h"
|
||||||
|
#include "../types-struct.h"
|
||||||
|
#include "../affine-mat.h"
|
||||||
|
#include "vec3.h"
|
||||||
|
#include "vec4.h"
|
||||||
|
#include "mat4.h"
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief this is similar to glms_mat4_mul but specialized to affine transform
|
||||||
|
*
|
||||||
|
* Matrix format should be:
|
||||||
|
* R R R X
|
||||||
|
* R R R Y
|
||||||
|
* R R R Z
|
||||||
|
* 0 0 0 W
|
||||||
|
*
|
||||||
|
* this reduces some multiplications. It should be faster than mat4_mul.
|
||||||
|
* if you are not sure about matrix format then DON'T use this! use mat4_mul
|
||||||
|
*
|
||||||
|
* @param[in] m1 affine matrix 1
|
||||||
|
* @param[in] m2 affine matrix 2
|
||||||
|
* @returns destination matrix
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
mat4s
|
||||||
|
glms_mul(mat4s m1, mat4s m2){
|
||||||
|
mat4s r;
|
||||||
|
glm_mul(m1.raw, m2.raw, r.raw);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief this is similar to glm_mat4_mul but specialized to affine transform
|
||||||
|
*
|
||||||
|
* Right Matrix format should be:
|
||||||
|
* R R R 0
|
||||||
|
* R R R 0
|
||||||
|
* R R R 0
|
||||||
|
* 0 0 0 1
|
||||||
|
*
|
||||||
|
* this reduces some multiplications. It should be faster than mat4_mul.
|
||||||
|
* if you are not sure about matrix format then DON'T use this! use mat4_mul
|
||||||
|
*
|
||||||
|
* @param[in] m1 affine matrix 1
|
||||||
|
* @param[in] m2 affine matrix 2
|
||||||
|
* @returns destination matrix
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
mat4s
|
||||||
|
glms_mul_rot(mat4s m1, mat4s m2){
|
||||||
|
mat4s r;
|
||||||
|
glm_mul_rot(m1.raw, m2.raw, r.raw);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief inverse orthonormal rotation + translation matrix (ridig-body)
|
||||||
|
*
|
||||||
|
* @code
|
||||||
|
* X = | R T | X' = | R' -R'T |
|
||||||
|
* | 0 1 | | 0 1 |
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* @param[in] m matrix
|
||||||
|
* @returns destination matrix
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
mat4s
|
||||||
|
glms_inv_tr(mat4s m){
|
||||||
|
glm_inv_tr(m.raw);
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
#endif /* cglms_affine_mat_h */
|
||||||
@@ -39,6 +39,7 @@
|
|||||||
#include "vec3.h"
|
#include "vec3.h"
|
||||||
#include "vec4.h"
|
#include "vec4.h"
|
||||||
#include "mat4.h"
|
#include "mat4.h"
|
||||||
|
#include "affine-mat.h"
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief creates NEW translate transform matrix by v vector
|
* @brief creates NEW translate transform matrix by v vector
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ glms_aabb_(transform)(vec3s box[2], mat4s m, vec3s dest[2]) {
|
|||||||
|
|
||||||
glms_vec3_(unpack)(rawBox, box, 2);
|
glms_vec3_(unpack)(rawBox, box, 2);
|
||||||
glm_aabb_transform(rawBox, m.raw, rawDest);
|
glm_aabb_transform(rawBox, m.raw, rawDest);
|
||||||
glms_vec3_pack(dest, rawDest, 2);
|
glms_vec3_(pack)(dest, rawDest, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
CGLM_INLINE mat4s glms_quat_rotate(mat4s m, versors q)
|
CGLM_INLINE mat4s glms_quat_rotate(mat4s m, versors q)
|
||||||
CGLM_INLINE mat4s glms_quat_rotate_at(mat4s m, versors q, vec3s pivot)
|
CGLM_INLINE mat4s glms_quat_rotate_at(mat4s m, versors q, vec3s pivot)
|
||||||
CGLM_INLINE mat4s glms_quat_rotate_atm(versors q, vec3s pivot)
|
CGLM_INLINE mat4s glms_quat_rotate_atm(versors q, vec3s pivot)
|
||||||
|
CGLM_INLINE versors glms_quat_make(float * restrict src)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef cglms_quat_h
|
#ifndef cglms_quat_h
|
||||||
@@ -565,4 +566,18 @@ glms_quat_(rotate_atm)(versors q, vec3s pivot) {
|
|||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Create CGLM quaternion from pointer
|
||||||
|
*
|
||||||
|
* @param[in] src pointer to an array of floats
|
||||||
|
* @returns constructed quaternion from raw pointer
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
versors
|
||||||
|
glms_quat_(make)(float * __restrict src) {
|
||||||
|
versors dest;
|
||||||
|
glm_quat_make(src, dest.raw);
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* cglms_quat_h */
|
#endif /* cglms_quat_h */
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ glms_vec2_(eq_eps)(vec2s v, float val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief check if vectors members are equal (without epsilon)
|
* @brief check if vector members are equal (without epsilon)
|
||||||
*
|
*
|
||||||
* @param[in] v vector
|
* @param[in] v vector
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -46,6 +46,7 @@
|
|||||||
CGLM_INLINE vec2s glms_vec2_minv(vec2s a, vec2s b)
|
CGLM_INLINE vec2s glms_vec2_minv(vec2s a, vec2s b)
|
||||||
CGLM_INLINE vec2s glms_vec2_clamp(vec2s v, float minVal, float maxVal)
|
CGLM_INLINE vec2s glms_vec2_clamp(vec2s v, float minVal, float maxVal)
|
||||||
CGLM_INLINE vec2s glms_vec2_lerp(vec2s from, vec2s to, float t)
|
CGLM_INLINE vec2s glms_vec2_lerp(vec2s from, vec2s to, float t)
|
||||||
|
CGLM_INLINE vec2s glms_vec2_make(float * restrict src)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef cglms_vec2s_h
|
#ifndef cglms_vec2s_h
|
||||||
@@ -258,11 +259,11 @@ glms_vec2_(subs)(vec2s a, float s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply two vector (component-wise multiplication)
|
* @brief multiply two vectors (component-wise multiplication)
|
||||||
*
|
*
|
||||||
* @param a vector1
|
* @param a vector1
|
||||||
* @param b vector2
|
* @param b vector2
|
||||||
* @returns v3 = (a[0] * b[0], a[1] * b[1], a[2] * b[2])
|
* @returns result = (a[0] * b[0], a[1] * b[1])
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
vec2s
|
vec2s
|
||||||
@@ -307,7 +308,7 @@ glms_vec2_(scale_as)(vec2s v, float s) {
|
|||||||
*
|
*
|
||||||
* @param[in] a vector 1
|
* @param[in] a vector 1
|
||||||
* @param[in] b vector 2
|
* @param[in] b vector 2
|
||||||
* @returns result = (a[0]/b[0], a[1]/b[1], a[2]/b[2])
|
* @returns result = (a[0]/b[0], a[1]/b[1])
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
vec2s
|
vec2s
|
||||||
@@ -322,7 +323,7 @@ glms_vec2_(div)(vec2s a, vec2s b) {
|
|||||||
*
|
*
|
||||||
* @param[in] a vector
|
* @param[in] a vector
|
||||||
* @param[in] s scalar
|
* @param[in] s scalar
|
||||||
* @returns result = (a[0]/s, a[1]/s, a[2]/s)
|
* @returns result = (a[0]/s, a[1]/s)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
vec2s
|
vec2s
|
||||||
@@ -397,7 +398,7 @@ glms_vec2_(muladds)(vec2s a, float s, vec2s dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief add max of two vector to result/dest
|
* @brief add max of two vectors to result/dest
|
||||||
*
|
*
|
||||||
* it applies += operator so dest must be initialized
|
* it applies += operator so dest must be initialized
|
||||||
*
|
*
|
||||||
@@ -413,7 +414,7 @@ glms_vec2_(maxadd)(vec2s a, vec2s b, vec2s dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief add min of two vector to result/dest
|
* @brief add min of two vectors to result/dest
|
||||||
*
|
*
|
||||||
* it applies += operator so dest must be initialized
|
* it applies += operator so dest must be initialized
|
||||||
*
|
*
|
||||||
@@ -558,4 +559,18 @@ glms_vec2_(lerp)(vec2s from, vec2s to, float t) {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Create two dimensional vector from pointer
|
||||||
|
*
|
||||||
|
* @param[in] src pointer to an array of floats
|
||||||
|
* @returns constructed 2D vector from raw pointer
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
vec2s
|
||||||
|
glms_vec2_(make)(float * __restrict src) {
|
||||||
|
vec2s dest;
|
||||||
|
glm_vec2_make(src, dest.raw);
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* cglms_vec2s_h */
|
#endif /* cglms_vec2s_h */
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ glms_vec3_(eq_eps)(vec3s v, float val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief check if vectors members are equal (without epsilon)
|
* @brief check if vector members are equal (without epsilon)
|
||||||
*
|
*
|
||||||
* @param[in] v vector
|
* @param[in] v vector
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -70,6 +70,7 @@
|
|||||||
CGLM_INLINE vec3s glms_vec3_smoothinterp(vec3s from, vec3s to, float t);
|
CGLM_INLINE vec3s glms_vec3_smoothinterp(vec3s from, vec3s to, float t);
|
||||||
CGLM_INLINE vec3s glms_vec3_smoothinterpc(vec3s from, vec3s to, float t);
|
CGLM_INLINE vec3s glms_vec3_smoothinterpc(vec3s from, vec3s to, float t);
|
||||||
CGLM_INLINE vec3s glms_vec3_swizzle(vec3s v, int mask);
|
CGLM_INLINE vec3s glms_vec3_swizzle(vec3s v, int mask);
|
||||||
|
CGLM_INLINE vec3s glms_vec3_make(float * restrict src);
|
||||||
|
|
||||||
Convenient:
|
Convenient:
|
||||||
CGLM_INLINE vec3s glms_cross(vec3s a, vec3s b);
|
CGLM_INLINE vec3s glms_cross(vec3s a, vec3s b);
|
||||||
@@ -314,7 +315,7 @@ glms_vec3_(subs)(vec3s a, float s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply two vector (component-wise multiplication)
|
* @brief multiply two vectors (component-wise multiplication)
|
||||||
*
|
*
|
||||||
* @param a vector1
|
* @param a vector1
|
||||||
* @param b vector2
|
* @param b vector2
|
||||||
@@ -453,7 +454,7 @@ glms_vec3_(muladds)(vec3s a, float s, vec3s dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief add max of two vector to result/dest
|
* @brief add max of two vectors to result/dest
|
||||||
*
|
*
|
||||||
* it applies += operator so dest must be initialized
|
* it applies += operator so dest must be initialized
|
||||||
*
|
*
|
||||||
@@ -469,7 +470,7 @@ glms_vec3_(maxadd)(vec3s a, vec3s b, vec3s dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief add min of two vector to result/dest
|
* @brief add min of two vectors to result/dest
|
||||||
*
|
*
|
||||||
* it applies += operator so dest must be initialized
|
* it applies += operator so dest must be initialized
|
||||||
*
|
*
|
||||||
@@ -967,4 +968,18 @@ glms_vec3_(swizzle)(vec3s v, int mask) {
|
|||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Create three dimensional vector from pointer
|
||||||
|
*
|
||||||
|
* @param[in] src pointer to an array of floats
|
||||||
|
* @returns constructed 3D vector from raw pointer
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
vec3s
|
||||||
|
glms_vec3_(make)(float * __restrict src) {
|
||||||
|
vec3s dest;
|
||||||
|
glm_vec3_make(src, dest.raw);
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* cglms_vec3s_h */
|
#endif /* cglms_vec3s_h */
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ glms_vec4_(eq_eps)(vec4s v, float val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief check if vectors members are equal (without epsilon)
|
* @brief check if vector members are equal (without epsilon)
|
||||||
*
|
*
|
||||||
* @param v vector
|
* @param v vector
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -61,6 +61,7 @@
|
|||||||
CGLM_INLINE vec4s glms_vec4_smoothinterpc(vec4s from, vec4s to, float t);
|
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_cubic(float s);
|
||||||
CGLM_INLINE vec4s glms_vec4_swizzle(vec4s v, int mask);
|
CGLM_INLINE vec4s glms_vec4_swizzle(vec4s v, int mask);
|
||||||
|
CGLM_INLINE vec4s glms_vec4_make(float * restrict src);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef cglms_vec4s_h
|
#ifndef cglms_vec4s_h
|
||||||
@@ -343,7 +344,7 @@ glms_vec4_(subs)(vec4s v, float s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply two vector (component-wise multiplication)
|
* @brief multiply two vectors (component-wise multiplication)
|
||||||
*
|
*
|
||||||
* @param a vector1
|
* @param a vector1
|
||||||
* @param b vector2
|
* @param b vector2
|
||||||
@@ -482,7 +483,7 @@ glms_vec4_(muladds)(vec4s a, float s, vec4s dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief add max of two vector to result/dest
|
* @brief add max of two vectors to result/dest
|
||||||
*
|
*
|
||||||
* it applies += operator so dest must be initialized
|
* it applies += operator so dest must be initialized
|
||||||
*
|
*
|
||||||
@@ -498,7 +499,7 @@ glms_vec4_(maxadd)(vec4s a, vec4s b, vec4s dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief add min of two vector to result/dest
|
* @brief add min of two vectors to result/dest
|
||||||
*
|
*
|
||||||
* it applies += operator so dest must be initialized
|
* it applies += operator so dest must be initialized
|
||||||
*
|
*
|
||||||
@@ -811,4 +812,18 @@ glms_vec4_(swizzle)(vec4s v, int mask) {
|
|||||||
return dest;
|
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 */
|
#endif /* cglms_vec4s_h */
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ glm_vec2_eq_eps(vec2 v, float val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief check if vectors members are equal (without epsilon)
|
* @brief check if vector members are equal (without epsilon)
|
||||||
*
|
*
|
||||||
* @param[in] v vector
|
* @param[in] v vector
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
CGLM_INLINE void glm_vec2_minv(vec2 v1, vec2 v2, vec2 dest)
|
CGLM_INLINE void glm_vec2_minv(vec2 v1, vec2 v2, vec2 dest)
|
||||||
CGLM_INLINE void glm_vec2_clamp(vec2 v, float minVal, float maxVal)
|
CGLM_INLINE void glm_vec2_clamp(vec2 v, float minVal, float maxVal)
|
||||||
CGLM_INLINE void glm_vec2_lerp(vec2 from, vec2 to, float t, vec2 dest)
|
CGLM_INLINE void glm_vec2_lerp(vec2 from, vec2 to, float t, vec2 dest)
|
||||||
|
CGLM_INLINE void glm_vec2_make(float * restrict src, vec2 dest)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -229,7 +230,7 @@ glm_vec2_subs(vec2 v, float s, vec2 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply two vector (component-wise multiplication)
|
* @brief multiply two vectors (component-wise multiplication)
|
||||||
*
|
*
|
||||||
* @param a v1
|
* @param a v1
|
||||||
* @param b v2
|
* @param b v2
|
||||||
@@ -370,7 +371,7 @@ glm_vec2_muladds(vec2 a, float s, vec2 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief add max of two vector to result/dest
|
* @brief add max of two vectors to result/dest
|
||||||
*
|
*
|
||||||
* it applies += operator so dest must be initialized
|
* it applies += operator so dest must be initialized
|
||||||
*
|
*
|
||||||
@@ -386,7 +387,7 @@ glm_vec2_maxadd(vec2 a, vec2 b, vec2 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief add min of two vector to result/dest
|
* @brief add min of two vectors to result/dest
|
||||||
*
|
*
|
||||||
* it applies += operator so dest must be initialized
|
* it applies += operator so dest must be initialized
|
||||||
*
|
*
|
||||||
@@ -582,4 +583,16 @@ glm_vec2_lerp(vec2 from, vec2 to, float t, vec2 dest) {
|
|||||||
glm_vec2_add(from, v, dest);
|
glm_vec2_add(from, v, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Create two dimensional vector from pointer
|
||||||
|
*
|
||||||
|
* @param[in] src pointer to an array of floats
|
||||||
|
* @param[out] dest destination vector
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
void
|
||||||
|
glm_vec2_make(float * __restrict src, vec2 dest) {
|
||||||
|
dest[0] = src[0]; dest[1] = src[1];
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* cglm_vec2_h */
|
#endif /* cglm_vec2_h */
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ glm_vec3_eq_eps(vec3 v, float val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief check if vectors members are equal (without epsilon)
|
* @brief check if vector members are equal (without epsilon)
|
||||||
*
|
*
|
||||||
* @param[in] v vector
|
* @param[in] v vector
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -73,6 +73,7 @@
|
|||||||
CGLM_INLINE void glm_vec3_smoothinterp(vec3 from, vec3 to, float t, vec3 dest);
|
CGLM_INLINE void glm_vec3_smoothinterp(vec3 from, vec3 to, float t, vec3 dest);
|
||||||
CGLM_INLINE void glm_vec3_smoothinterpc(vec3 from, vec3 to, float t, vec3 dest);
|
CGLM_INLINE void glm_vec3_smoothinterpc(vec3 from, vec3 to, float t, vec3 dest);
|
||||||
CGLM_INLINE void glm_vec3_swizzle(vec3 v, int mask, vec3 dest);
|
CGLM_INLINE void glm_vec3_swizzle(vec3 v, int mask, vec3 dest);
|
||||||
|
CGLM_INLINE void glm_vec3_make(float * restrict src, vec3 dest);
|
||||||
|
|
||||||
Convenient:
|
Convenient:
|
||||||
CGLM_INLINE void glm_cross(vec3 a, vec3 b, vec3 d);
|
CGLM_INLINE void glm_cross(vec3 a, vec3 b, vec3 d);
|
||||||
@@ -320,7 +321,7 @@ glm_vec3_subs(vec3 v, float s, vec3 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply two vector (component-wise multiplication)
|
* @brief multiply two vectors (component-wise multiplication)
|
||||||
*
|
*
|
||||||
* @param a vector1
|
* @param a vector1
|
||||||
* @param b vector2
|
* @param b vector2
|
||||||
@@ -469,7 +470,7 @@ glm_vec3_muladds(vec3 a, float s, vec3 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief add max of two vector to result/dest
|
* @brief add max of two vectors to result/dest
|
||||||
*
|
*
|
||||||
* it applies += operator so dest must be initialized
|
* it applies += operator so dest must be initialized
|
||||||
*
|
*
|
||||||
@@ -486,7 +487,7 @@ glm_vec3_maxadd(vec3 a, vec3 b, vec3 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief add min of two vector to result/dest
|
* @brief add min of two vectors to result/dest
|
||||||
*
|
*
|
||||||
* it applies += operator so dest must be initialized
|
* it applies += operator so dest must be initialized
|
||||||
*
|
*
|
||||||
@@ -1079,4 +1080,18 @@ glm_normalize_to(vec3 v, vec3 dest) {
|
|||||||
glm_vec3_normalize_to(v, dest);
|
glm_vec3_normalize_to(v, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Create three dimensional vector from pointer
|
||||||
|
*
|
||||||
|
* @param[in] src pointer to an array of floats
|
||||||
|
* @param[out] dest destination vector
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
void
|
||||||
|
glm_vec3_make(float * __restrict src, vec3 dest) {
|
||||||
|
dest[0] = src[0];
|
||||||
|
dest[1] = src[1];
|
||||||
|
dest[2] = src[2];
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* cglm_vec3_h */
|
#endif /* cglm_vec3_h */
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ glm_vec4_eq_eps(vec4 v, float val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief check if vectors members are equal (without epsilon)
|
* @brief check if vector members are equal (without epsilon)
|
||||||
*
|
*
|
||||||
* @param v vector
|
* @param v vector
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -58,6 +58,7 @@
|
|||||||
CGLM_INLINE void glm_vec4_smoothinterp(vec4 from, vec4 to, float t, vec4 dest);
|
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_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_swizzle(vec4 v, int mask, vec4 dest);
|
||||||
|
CGLM_INLINE void glm_vec4_make(float * restrict src, vec4 dest);
|
||||||
|
|
||||||
DEPRECATED:
|
DEPRECATED:
|
||||||
glm_vec4_dup
|
glm_vec4_dup
|
||||||
@@ -418,7 +419,7 @@ glm_vec4_subs(vec4 v, float s, vec4 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply two vector (component-wise multiplication)
|
* @brief multiply two vectors (component-wise multiplication)
|
||||||
*
|
*
|
||||||
* @param a vector1
|
* @param a vector1
|
||||||
* @param b vector2
|
* @param b vector2
|
||||||
@@ -634,7 +635,7 @@ glm_vec4_muladds(vec4 a, float s, vec4 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief add max of two vector to result/dest
|
* @brief add max of two vectors to result/dest
|
||||||
*
|
*
|
||||||
* it applies += operator so dest must be initialized
|
* it applies += operator so dest must be initialized
|
||||||
*
|
*
|
||||||
@@ -666,7 +667,7 @@ glm_vec4_maxadd(vec4 a, vec4 b, vec4 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief add min of two vector to result/dest
|
* @brief add min of two vectors to result/dest
|
||||||
*
|
*
|
||||||
* it applies += operator so dest must be initialized
|
* it applies += operator so dest must be initialized
|
||||||
*
|
*
|
||||||
@@ -1133,4 +1134,17 @@ glm_vec4_swizzle(vec4 v, int mask, vec4 dest) {
|
|||||||
glm_vec4_copy(t, 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 */
|
#endif /* cglm_vec4_h */
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ project('cglm', 'c',
|
|||||||
license : 'mit',
|
license : 'mit',
|
||||||
default_options : [
|
default_options : [
|
||||||
'c_std=c11',
|
'c_std=c11',
|
||||||
'werror=true',
|
|
||||||
'warning_level=2',
|
'warning_level=2',
|
||||||
'buildtype=release'
|
'buildtype=release'
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -229,3 +229,9 @@ void
|
|||||||
glmc_quat_rotate_atm(mat4 m, versor q, vec3 pivot) {
|
glmc_quat_rotate_atm(mat4 m, versor q, vec3 pivot) {
|
||||||
glm_quat_rotate_atm(m, q, pivot);
|
glm_quat_rotate_atm(m, q, pivot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CGLM_EXPORT
|
||||||
|
void
|
||||||
|
glmc_quat_make(float * __restrict src, versor dest) {
|
||||||
|
glm_quat_make(src, dest);
|
||||||
|
}
|
||||||
|
|||||||
@@ -235,3 +235,9 @@ void
|
|||||||
glmc_vec2_complex_conjugate(vec2 a, vec2 dest) {
|
glmc_vec2_complex_conjugate(vec2 a, vec2 dest) {
|
||||||
glm_vec2_complex_conjugate(a, dest);
|
glm_vec2_complex_conjugate(a, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CGLM_EXPORT
|
||||||
|
void
|
||||||
|
glmc_vec2_make(float * __restrict src, vec2 dest) {
|
||||||
|
glm_vec2_make(src, dest);
|
||||||
|
}
|
||||||
|
|||||||
@@ -417,3 +417,9 @@ void
|
|||||||
glmc_vec3_sqrt(vec3 v, vec3 dest) {
|
glmc_vec3_sqrt(vec3 v, vec3 dest) {
|
||||||
glm_vec3_sqrt(v, dest);
|
glm_vec3_sqrt(v, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CGLM_EXPORT
|
||||||
|
void
|
||||||
|
glmc_vec3_make(float * __restrict src, vec3 dest) {
|
||||||
|
glm_vec3_make(src, dest);
|
||||||
|
}
|
||||||
|
|||||||
@@ -381,3 +381,9 @@ void
|
|||||||
glmc_vec4_sqrt(vec4 v, vec4 dest) {
|
glmc_vec4_sqrt(vec4 v, vec4 dest) {
|
||||||
glm_vec4_sqrt(v, dest);
|
glm_vec4_sqrt(v, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CGLM_EXPORT
|
||||||
|
void
|
||||||
|
glmc_vec4_make(float * __restrict src, vec4 dest) {
|
||||||
|
glm_vec4_make(src, dest);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1084,3 +1084,25 @@ TEST_IMPL(GLM_PREFIX, quat_rotate_atm) {
|
|||||||
|
|
||||||
TEST_SUCCESS
|
TEST_SUCCESS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_IMPL(GLM_PREFIX, quat_make) {
|
||||||
|
versor dest[3];
|
||||||
|
float src[12] = {
|
||||||
|
7.2f, 1.0f, 2.5f, 6.1f,
|
||||||
|
0.2f, 2.8f, 17.3f, 5.1f,
|
||||||
|
4.2f, 7.3f, 6.6f, 8.8f
|
||||||
|
};
|
||||||
|
|
||||||
|
float *srcp = src;
|
||||||
|
unsigned int i, j;
|
||||||
|
|
||||||
|
for (i = 0, j = 0; i < sizeof(src) / sizeof(float); i+=4,j++) {
|
||||||
|
GLM(quat_make)(srcp + i, dest[j]);
|
||||||
|
ASSERT(test_eq(src[ i ], dest[j][0]));
|
||||||
|
ASSERT(test_eq(src[i+1], dest[j][1]));
|
||||||
|
ASSERT(test_eq(src[i+2], dest[j][2]));
|
||||||
|
ASSERT(test_eq(src[i+3], dest[j][3]));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_SUCCESS
|
||||||
|
}
|
||||||
|
|||||||
@@ -637,3 +637,23 @@ TEST_IMPL(GLM_PREFIX, vec2_complex_div) {
|
|||||||
|
|
||||||
TEST_SUCCESS
|
TEST_SUCCESS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_IMPL(GLM_PREFIX, vec2_make) {
|
||||||
|
float src[6] = {
|
||||||
|
7.2f, 1.0f,
|
||||||
|
2.5f, 6.1f,
|
||||||
|
17.7f, 4.3f
|
||||||
|
};
|
||||||
|
vec2 dest[3];
|
||||||
|
|
||||||
|
float *srcp = src;
|
||||||
|
unsigned int i, j;
|
||||||
|
|
||||||
|
for (i = 0, j = 0; i < sizeof(src) / sizeof(float); i+=2,j++) {
|
||||||
|
GLM(vec2_make)(srcp + i, dest[j]);
|
||||||
|
ASSERT(test_eq(src[ i ], dest[j][0]));
|
||||||
|
ASSERT(test_eq(src[i+1], dest[j][1]));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_SUCCESS
|
||||||
|
}
|
||||||
|
|||||||
@@ -1729,3 +1729,24 @@ TEST_IMPL(GLM_PREFIX, vec3_sqrt) {
|
|||||||
|
|
||||||
TEST_SUCCESS
|
TEST_SUCCESS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_IMPL(GLM_PREFIX, vec3_make) {
|
||||||
|
float src[9] = {
|
||||||
|
7.2f, 1.0f, 5.8f,
|
||||||
|
2.5f, 6.1f, 9.9f,
|
||||||
|
17.7f, 4.3f, 3.2f
|
||||||
|
};
|
||||||
|
vec3 dest[3];
|
||||||
|
|
||||||
|
float *srcp = src;
|
||||||
|
unsigned int i, j;
|
||||||
|
|
||||||
|
for (i = 0, j = 0; i < sizeof(src) / sizeof(float); i+=3,j++) {
|
||||||
|
GLM(vec3_make)(srcp + i, dest[j]);
|
||||||
|
ASSERT(test_eq(src[ i ], dest[j][0]));
|
||||||
|
ASSERT(test_eq(src[i+1], dest[j][1]));
|
||||||
|
ASSERT(test_eq(src[i+2], dest[j][2]));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_SUCCESS
|
||||||
|
}
|
||||||
|
|||||||
@@ -1418,3 +1418,25 @@ TEST_IMPL(GLM_PREFIX, vec4_sqrt) {
|
|||||||
|
|
||||||
TEST_SUCCESS
|
TEST_SUCCESS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_IMPL(GLM_PREFIX, vec4_make) {
|
||||||
|
float src[12] = {
|
||||||
|
7.2f, 1.0f, 5.8f, 0.0f,
|
||||||
|
2.5f, 6.1f, 9.9f, 1.0f,
|
||||||
|
17.7f, 4.3f, 3.2f, 1.0f
|
||||||
|
};
|
||||||
|
vec4 dest[3];
|
||||||
|
|
||||||
|
float *srcp = src;
|
||||||
|
unsigned int i, j;
|
||||||
|
|
||||||
|
for (i = 0, j = 0; i < sizeof(src) / sizeof(float); i+=4,j++) {
|
||||||
|
GLM(vec4_make)(srcp + i, dest[j]);
|
||||||
|
ASSERT(test_eq(src[ i ], dest[j][0]));
|
||||||
|
ASSERT(test_eq(src[i+1], dest[j][1]));
|
||||||
|
ASSERT(test_eq(src[i+2], dest[j][2]));
|
||||||
|
ASSERT(test_eq(src[i+3], dest[j][3]));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_SUCCESS
|
||||||
|
}
|
||||||
|
|||||||
16
test/tests.h
16
test/tests.h
@@ -311,6 +311,7 @@ TEST_DECLARE(glm_quat_rotate)
|
|||||||
TEST_DECLARE(glm_quat_rotate_at)
|
TEST_DECLARE(glm_quat_rotate_at)
|
||||||
TEST_DECLARE(glm_quat_rotate_atm)
|
TEST_DECLARE(glm_quat_rotate_atm)
|
||||||
TEST_DECLARE(glm_quat_from_vecs)
|
TEST_DECLARE(glm_quat_from_vecs)
|
||||||
|
TEST_DECLARE(glm_quat_make)
|
||||||
|
|
||||||
TEST_DECLARE(glmc_quat_identity)
|
TEST_DECLARE(glmc_quat_identity)
|
||||||
TEST_DECLARE(glmc_quat_identity_array)
|
TEST_DECLARE(glmc_quat_identity_array)
|
||||||
@@ -349,6 +350,7 @@ TEST_DECLARE(glmc_quat_rotate)
|
|||||||
TEST_DECLARE(glmc_quat_rotate_at)
|
TEST_DECLARE(glmc_quat_rotate_at)
|
||||||
TEST_DECLARE(glmc_quat_rotate_atm)
|
TEST_DECLARE(glmc_quat_rotate_atm)
|
||||||
TEST_DECLARE(glmc_quat_from_vecs)
|
TEST_DECLARE(glmc_quat_from_vecs)
|
||||||
|
TEST_DECLARE(glmc_quat_make)
|
||||||
|
|
||||||
/* bezier */
|
/* bezier */
|
||||||
TEST_DECLARE(bezier)
|
TEST_DECLARE(bezier)
|
||||||
@@ -396,6 +398,7 @@ TEST_DECLARE(glm_vec2_abs)
|
|||||||
TEST_DECLARE(glm_vec2_lerp)
|
TEST_DECLARE(glm_vec2_lerp)
|
||||||
TEST_DECLARE(glm_vec2_complex_mul)
|
TEST_DECLARE(glm_vec2_complex_mul)
|
||||||
TEST_DECLARE(glm_vec2_complex_div)
|
TEST_DECLARE(glm_vec2_complex_div)
|
||||||
|
TEST_DECLARE(glm_vec2_make)
|
||||||
|
|
||||||
TEST_DECLARE(glmc_vec2)
|
TEST_DECLARE(glmc_vec2)
|
||||||
TEST_DECLARE(glmc_vec2_copy)
|
TEST_DECLARE(glmc_vec2_copy)
|
||||||
@@ -434,6 +437,7 @@ TEST_DECLARE(glmc_vec2_abs)
|
|||||||
TEST_DECLARE(glmc_vec2_lerp)
|
TEST_DECLARE(glmc_vec2_lerp)
|
||||||
TEST_DECLARE(glmc_vec2_complex_mul)
|
TEST_DECLARE(glmc_vec2_complex_mul)
|
||||||
TEST_DECLARE(glmc_vec2_complex_div)
|
TEST_DECLARE(glmc_vec2_complex_div)
|
||||||
|
TEST_DECLARE(glmc_vec2_make)
|
||||||
|
|
||||||
/* vec3 */
|
/* vec3 */
|
||||||
TEST_DECLARE(MACRO_GLM_VEC3_ONE_INIT)
|
TEST_DECLARE(MACRO_GLM_VEC3_ONE_INIT)
|
||||||
@@ -529,6 +533,7 @@ TEST_DECLARE(glm_vec3_abs)
|
|||||||
TEST_DECLARE(glm_vec3_fract)
|
TEST_DECLARE(glm_vec3_fract)
|
||||||
TEST_DECLARE(glm_vec3_hadd)
|
TEST_DECLARE(glm_vec3_hadd)
|
||||||
TEST_DECLARE(glm_vec3_sqrt)
|
TEST_DECLARE(glm_vec3_sqrt)
|
||||||
|
TEST_DECLARE(glm_vec3_make)
|
||||||
|
|
||||||
TEST_DECLARE(glmc_vec3)
|
TEST_DECLARE(glmc_vec3)
|
||||||
TEST_DECLARE(glmc_vec3_copy)
|
TEST_DECLARE(glmc_vec3_copy)
|
||||||
@@ -598,6 +603,7 @@ TEST_DECLARE(glmc_vec3_abs)
|
|||||||
TEST_DECLARE(glmc_vec3_fract)
|
TEST_DECLARE(glmc_vec3_fract)
|
||||||
TEST_DECLARE(glmc_vec3_hadd)
|
TEST_DECLARE(glmc_vec3_hadd)
|
||||||
TEST_DECLARE(glmc_vec3_sqrt)
|
TEST_DECLARE(glmc_vec3_sqrt)
|
||||||
|
TEST_DECLARE(glmc_vec3_make)
|
||||||
|
|
||||||
/* vec4 */
|
/* vec4 */
|
||||||
TEST_DECLARE(MACRO_GLM_VEC4_ONE_INIT)
|
TEST_DECLARE(MACRO_GLM_VEC4_ONE_INIT)
|
||||||
@@ -679,6 +685,7 @@ TEST_DECLARE(glm_vec4_abs)
|
|||||||
TEST_DECLARE(glm_vec4_fract)
|
TEST_DECLARE(glm_vec4_fract)
|
||||||
TEST_DECLARE(glm_vec4_hadd)
|
TEST_DECLARE(glm_vec4_hadd)
|
||||||
TEST_DECLARE(glm_vec4_sqrt)
|
TEST_DECLARE(glm_vec4_sqrt)
|
||||||
|
TEST_DECLARE(glm_vec4_make)
|
||||||
|
|
||||||
TEST_DECLARE(glmc_vec4)
|
TEST_DECLARE(glmc_vec4)
|
||||||
TEST_DECLARE(glmc_vec4_copy3)
|
TEST_DECLARE(glmc_vec4_copy3)
|
||||||
@@ -744,6 +751,7 @@ TEST_DECLARE(glmc_vec4_abs)
|
|||||||
TEST_DECLARE(glmc_vec4_fract)
|
TEST_DECLARE(glmc_vec4_fract)
|
||||||
TEST_DECLARE(glmc_vec4_hadd)
|
TEST_DECLARE(glmc_vec4_hadd)
|
||||||
TEST_DECLARE(glmc_vec4_sqrt)
|
TEST_DECLARE(glmc_vec4_sqrt)
|
||||||
|
TEST_DECLARE(glmc_vec4_make)
|
||||||
|
|
||||||
/* ivec2 */
|
/* ivec2 */
|
||||||
TEST_DECLARE(glm_ivec2)
|
TEST_DECLARE(glm_ivec2)
|
||||||
@@ -1158,6 +1166,7 @@ TEST_LIST {
|
|||||||
TEST_ENTRY(glm_quat_rotate_at)
|
TEST_ENTRY(glm_quat_rotate_at)
|
||||||
TEST_ENTRY(glm_quat_rotate_atm)
|
TEST_ENTRY(glm_quat_rotate_atm)
|
||||||
TEST_ENTRY(glm_quat_from_vecs)
|
TEST_ENTRY(glm_quat_from_vecs)
|
||||||
|
TEST_ENTRY(glm_quat_make)
|
||||||
|
|
||||||
TEST_ENTRY(glmc_quat_identity)
|
TEST_ENTRY(glmc_quat_identity)
|
||||||
TEST_ENTRY(glmc_quat_identity_array)
|
TEST_ENTRY(glmc_quat_identity_array)
|
||||||
@@ -1196,6 +1205,7 @@ TEST_LIST {
|
|||||||
TEST_ENTRY(glmc_quat_rotate_at)
|
TEST_ENTRY(glmc_quat_rotate_at)
|
||||||
TEST_ENTRY(glmc_quat_rotate_atm)
|
TEST_ENTRY(glmc_quat_rotate_atm)
|
||||||
TEST_ENTRY(glmc_quat_from_vecs)
|
TEST_ENTRY(glmc_quat_from_vecs)
|
||||||
|
TEST_ENTRY(glmc_quat_make)
|
||||||
|
|
||||||
/* bezier */
|
/* bezier */
|
||||||
TEST_ENTRY(bezier)
|
TEST_ENTRY(bezier)
|
||||||
@@ -1242,6 +1252,7 @@ TEST_LIST {
|
|||||||
TEST_ENTRY(glm_vec2_lerp)
|
TEST_ENTRY(glm_vec2_lerp)
|
||||||
TEST_ENTRY(glm_vec2_complex_mul)
|
TEST_ENTRY(glm_vec2_complex_mul)
|
||||||
TEST_ENTRY(glm_vec2_complex_div)
|
TEST_ENTRY(glm_vec2_complex_div)
|
||||||
|
TEST_ENTRY(glm_vec2_make)
|
||||||
|
|
||||||
TEST_ENTRY(glmc_vec2)
|
TEST_ENTRY(glmc_vec2)
|
||||||
TEST_ENTRY(glmc_vec2_copy)
|
TEST_ENTRY(glmc_vec2_copy)
|
||||||
@@ -1280,6 +1291,7 @@ TEST_LIST {
|
|||||||
TEST_ENTRY(glmc_vec2_lerp)
|
TEST_ENTRY(glmc_vec2_lerp)
|
||||||
TEST_ENTRY(glmc_vec2_complex_mul)
|
TEST_ENTRY(glmc_vec2_complex_mul)
|
||||||
TEST_ENTRY(glmc_vec2_complex_div)
|
TEST_ENTRY(glmc_vec2_complex_div)
|
||||||
|
TEST_ENTRY(glmc_vec2_make)
|
||||||
|
|
||||||
/* vec3 */
|
/* vec3 */
|
||||||
TEST_ENTRY(MACRO_GLM_VEC3_ONE_INIT)
|
TEST_ENTRY(MACRO_GLM_VEC3_ONE_INIT)
|
||||||
@@ -1374,6 +1386,7 @@ TEST_LIST {
|
|||||||
TEST_ENTRY(glm_vec3_fract)
|
TEST_ENTRY(glm_vec3_fract)
|
||||||
TEST_ENTRY(glm_vec3_hadd)
|
TEST_ENTRY(glm_vec3_hadd)
|
||||||
TEST_ENTRY(glm_vec3_sqrt)
|
TEST_ENTRY(glm_vec3_sqrt)
|
||||||
|
TEST_ENTRY(glm_vec3_make)
|
||||||
|
|
||||||
TEST_ENTRY(glmc_vec3)
|
TEST_ENTRY(glmc_vec3)
|
||||||
TEST_ENTRY(glmc_vec3_copy)
|
TEST_ENTRY(glmc_vec3_copy)
|
||||||
@@ -1443,6 +1456,7 @@ TEST_LIST {
|
|||||||
TEST_ENTRY(glmc_vec3_fract)
|
TEST_ENTRY(glmc_vec3_fract)
|
||||||
TEST_ENTRY(glmc_vec3_hadd)
|
TEST_ENTRY(glmc_vec3_hadd)
|
||||||
TEST_ENTRY(glmc_vec3_sqrt)
|
TEST_ENTRY(glmc_vec3_sqrt)
|
||||||
|
TEST_ENTRY(glmc_vec3_make)
|
||||||
|
|
||||||
/* vec4 */
|
/* vec4 */
|
||||||
TEST_ENTRY(MACRO_GLM_VEC4_ONE_INIT)
|
TEST_ENTRY(MACRO_GLM_VEC4_ONE_INIT)
|
||||||
@@ -1524,6 +1538,7 @@ TEST_LIST {
|
|||||||
TEST_ENTRY(glm_vec4_fract)
|
TEST_ENTRY(glm_vec4_fract)
|
||||||
TEST_ENTRY(glm_vec4_hadd)
|
TEST_ENTRY(glm_vec4_hadd)
|
||||||
TEST_ENTRY(glm_vec4_sqrt)
|
TEST_ENTRY(glm_vec4_sqrt)
|
||||||
|
TEST_ENTRY(glm_vec4_make)
|
||||||
|
|
||||||
TEST_ENTRY(glmc_vec4)
|
TEST_ENTRY(glmc_vec4)
|
||||||
TEST_ENTRY(glmc_vec4_copy3)
|
TEST_ENTRY(glmc_vec4_copy3)
|
||||||
@@ -1589,6 +1604,7 @@ TEST_LIST {
|
|||||||
TEST_ENTRY(glmc_vec4_fract)
|
TEST_ENTRY(glmc_vec4_fract)
|
||||||
TEST_ENTRY(glmc_vec4_hadd)
|
TEST_ENTRY(glmc_vec4_hadd)
|
||||||
TEST_ENTRY(glmc_vec4_sqrt)
|
TEST_ENTRY(glmc_vec4_sqrt)
|
||||||
|
TEST_ENTRY(glmc_vec4_make)
|
||||||
|
|
||||||
/* ivec2 */
|
/* ivec2 */
|
||||||
TEST_ENTRY(glm_ivec2)
|
TEST_ENTRY(glm_ivec2)
|
||||||
|
|||||||
@@ -184,6 +184,7 @@
|
|||||||
<ClInclude Include="..\include\cglm\struct.h" />
|
<ClInclude Include="..\include\cglm\struct.h" />
|
||||||
<ClInclude Include="..\include\cglm\struct\affine-post.h" />
|
<ClInclude Include="..\include\cglm\struct\affine-post.h" />
|
||||||
<ClInclude Include="..\include\cglm\struct\affine-pre.h" />
|
<ClInclude Include="..\include\cglm\struct\affine-pre.h" />
|
||||||
|
<ClInclude Include="..\include\cglm\struct\affine-mat.h" />
|
||||||
<ClInclude Include="..\include\cglm\struct\affine.h" />
|
<ClInclude Include="..\include\cglm\struct\affine.h" />
|
||||||
<ClInclude Include="..\include\cglm\struct\affine2d.h" />
|
<ClInclude Include="..\include\cglm\struct\affine2d.h" />
|
||||||
<ClInclude Include="..\include\cglm\struct\box.h" />
|
<ClInclude Include="..\include\cglm\struct\box.h" />
|
||||||
|
|||||||
@@ -603,5 +603,8 @@
|
|||||||
<ClInclude Include="..\include\cglm\struct\affine-pre.h">
|
<ClInclude Include="..\include\cglm\struct\affine-pre.h">
|
||||||
<Filter>include\cglm\struct</Filter>
|
<Filter>include\cglm\struct</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\cglm\struct\affine-mat.h">
|
||||||
|
<Filter>include\cglm\struct</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
Reference in New Issue
Block a user