vec: rename glm_vec_ to glm_vec3_ (continue)

* add missing functions to vec4
* update docs
This commit is contained in:
Recep Aslantas
2018-11-29 09:07:48 +03:00
parent 0b8c63a90e
commit b4bf8f3537
18 changed files with 214 additions and 221 deletions

View File

@@ -4,7 +4,7 @@
[![Documentation Status](https://readthedocs.org/projects/cglm/badge/?version=latest)](http://cglm.readthedocs.io/en/latest/?badge=latest) [![Documentation Status](https://readthedocs.org/projects/cglm/badge/?version=latest)](http://cglm.readthedocs.io/en/latest/?badge=latest)
[![Coverage Status](https://coveralls.io/repos/github/recp/cglm/badge.svg?branch=master)](https://coveralls.io/github/recp/cglm?branch=master) [![Coverage Status](https://coveralls.io/repos/github/recp/cglm/badge.svg?branch=master)](https://coveralls.io/github/recp/cglm?branch=master)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/6a62b37d5f214f178ebef269dc4a6bf1)](https://www.codacy.com/app/recp/cglm?utm_source=github.com&utm_medium=referral&utm_content=recp/cglm&utm_campaign=Badge_Grade) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/6a62b37d5f214f178ebef269dc4a6bf1)](https://www.codacy.com/app/recp/cglm?utm_source=github.com&utm_medium=referral&utm_content=recp/cglm&utm_campaign=Badge_Grade)
[![Backers on Open Collective](https://opencollective.com/cglm/backers/badge.svg)](#backers) [![Backers on Open Collective](https://opencollective.com/cglm/backers/badge.svg)](#backers)
[![Sponsors on Open Collective](https://opencollective.com/cglm/sponsors/badge.svg)](#sponsors) [![Sponsors on Open Collective](https://opencollective.com/cglm/sponsors/badge.svg)](#sponsors)
The original glm library is for C++ only (templates, namespaces, classes...), this library targeted to C99 but currently you can use it for C89 safely by language extensions e.g `__restrict` The original glm library is for C++ only (templates, namespaces, classes...), this library targeted to C99 but currently you can use it for C89 safely by language extensions e.g `__restrict`
@@ -19,7 +19,7 @@ Complete documentation: http://cglm.readthedocs.io
- _dup (duplicate) is changed to _copy. For instance `glm_vec_dup -> glm_vec3_copy` - _dup (duplicate) is changed to _copy. For instance `glm_vec_dup -> glm_vec3_copy`
- OpenGL related functions are dropped to make this lib platform/third-party independent - OpenGL related functions are dropped to make this lib platform/third-party independent
- make sure you have latest version and feel free to report bugs, troubles - make sure you have latest version and feel free to report bugs, troubles
- **[bugfix]** euler angles was implemented in reverse order (extrinsic) it was fixed, now they are intrinsic. Make sure that - **[bugfix]** euler angles was implemented in reverse order (extrinsic) it was fixed, now they are intrinsic. Make sure that
you have the latest version you have the latest version
- **[major change]** by starting v0.4.0, quaternions are stored as [x, y, z, w], it was [w, x, y, z] in v0.3.5 and earlier versions - **[major change]** by starting v0.4.0, quaternions are stored as [x, y, z, w], it was [w, x, y, z] in v0.3.5 and earlier versions
- **[api rename]** by starting v0.4.5, **glm_simd** functions are renamed to **glmm_** - **[api rename]** by starting v0.4.5, **glm_simd** functions are renamed to **glmm_**

View File

@@ -5,14 +5,14 @@ Some functions may exist twice,
once for their namespace and once for global namespace once for their namespace and once for global namespace
to make easier to write very common functions to make easier to write very common functions
For instance, in general we use :code:`glm_vec_dot` to get dot product For instance, in general we use :code:`glm_vec3_dot` to get dot product
of two **vec3**. Now we can also do this with :code:`glm_dot`, of two **vec3**. Now we can also do this with :code:`glm_dot`,
same for *_cross* and so on... same for *_cross* and so on...
The original function stays where it is, the function in global namespace The original function stays where it is, the function in global namespace
of same name is just an alias, so there is no call version of those functions. of same name is just an alias, so there is no call version of those functions.
e.g there is no func like :code:`glmc_dot` because *glm_dot* is just alias for e.g there is no func like :code:`glmc_dot` because *glm_dot* is just alias for
:code:`glm_vec_dot` :code:`glm_vec3_dot`
By including **cglm/cglm.h** header you will include all inline version By including **cglm/cglm.h** header you will include all inline version
of functions. Since functions in this header[s] are inline you don't need to of functions. Since functions in this header[s] are inline you don't need to

View File

@@ -9,7 +9,7 @@ There are many convenient functions for camera. For instance :c:func:`glm_look`
is just wrapper for :c:func:`glm_lookat`. Sometimes you only have direction is just wrapper for :c:func:`glm_lookat`. Sometimes you only have direction
instead of target, so that makes easy to build view matrix using direction. instead of target, so that makes easy to build view matrix using direction.
There is also :c:func:`glm_look_anyup` function which can help build view matrix There is also :c:func:`glm_look_anyup` function which can help build view matrix
without providing UP axis. It uses :c:func:`glm_vec_ortho` to get a UP axis and without providing UP axis. It uses :c:func:`glm_vec3_ortho` to get a UP axis and
builds view matrix. builds view matrix.
You can also *_default* versions of ortho and perspective to build projection You can also *_default* versions of ortho and perspective to build projection

View File

@@ -127,7 +127,7 @@ Functions documentation
.. code-block:: c .. code-block:: c
for (j = 0; j < 4; j++) { for (j = 0; j < 4; j++) {
glm_vec_center(corners[i], corners[i + 4], centerCorners[i]); glm_vec3_center(corners[i], corners[i + 4], centerCorners[i]);
} }
corners[i + 4] is far of corners[i] point. corners[i + 4] is far of corners[i] point.

View File

@@ -62,7 +62,7 @@ Wrong Results:
Again, you may used wrong function. Again, you may used wrong function.
For instance if you use **glm_normalize()** or **glm_vec_normalize()** for **vec4**, For instance if you use **glm_normalize()** or **glm_vec3_normalize()** for **vec4**,
it will assume that passed param is **vec3** and will normalize it for **vec3**. it will assume that passed param is **vec3** and will normalize it for **vec3**.
Since you need to **vec4** to be normalized in your case, you will get wrong results. Since you need to **vec4** to be normalized in your case, you will get wrong results.

View File

@@ -14,25 +14,25 @@ Table of contents (click to go):
Functions: Functions:
1. :c:func:`glm_vec_mulv` 1. :c:func:`glm_vec3_mulv`
#. :c:func:`glm_vec_broadcast` #. :c:func:`glm_vec3_broadcast`
#. :c:func:`glm_vec_eq` #. :c:func:`glm_vec3_eq`
#. :c:func:`glm_vec_eq_eps` #. :c:func:`glm_vec3_eq_eps`
#. :c:func:`glm_vec_eq_all` #. :c:func:`glm_vec3_eq_all`
#. :c:func:`glm_vec_eqv` #. :c:func:`glm_vec3_eqv`
#. :c:func:`glm_vec_eqv_eps` #. :c:func:`glm_vec3_eqv_eps`
#. :c:func:`glm_vec_max` #. :c:func:`glm_vec3_max`
#. :c:func:`glm_vec_min` #. :c:func:`glm_vec3_min`
#. :c:func:`glm_vec_isnan` #. :c:func:`glm_vec3_isnan`
#. :c:func:`glm_vec_isinf` #. :c:func:`glm_vec3_isinf`
#. :c:func:`glm_vec_isvalid` #. :c:func:`glm_vec3_isvalid`
#. :c:func:`glm_vec_sign` #. :c:func:`glm_vec3_sign`
#. :c:func:`glm_vec_sqrt` #. :c:func:`glm_vec3_sqrt`
Functions documentation Functions documentation
~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~
.. c:function:: void glm_vec_mulv(vec3 a, vec3 b, vec3 d) .. c:function:: void glm_vec3_mulv(vec3 a, vec3 b, vec3 d)
multiplies individual items multiplies individual items
@@ -41,7 +41,7 @@ Functions documentation
| *[in]* **b** vec2 | *[in]* **b** vec2
| *[out]* **d** destination (v1[0] * v2[0], v1[1] * v2[1], v1[2] * v2[2]) | *[out]* **d** destination (v1[0] * v2[0], v1[1] * v2[1], v1[2] * v2[2])
.. c:function:: void glm_vec_broadcast(float val, vec3 d) .. c:function:: void glm_vec3_broadcast(float val, vec3 d)
fill a vector with specified value fill a vector with specified value
@@ -49,7 +49,7 @@ Functions documentation
| *[in]* **val** value | *[in]* **val** value
| *[out]* **dest** destination | *[out]* **dest** destination
.. c:function:: bool glm_vec_eq(vec3 v, float val) .. c:function:: bool glm_vec3_eq(vec3 v, float val)
check if vector is equal to value (without epsilon) check if vector is equal to value (without epsilon)
@@ -57,7 +57,7 @@ Functions documentation
| *[in]* **v** vector | *[in]* **v** vector
| *[in]* **val** value | *[in]* **val** value
.. c:function:: bool glm_vec_eq_eps(vec3 v, float val) .. c:function:: bool glm_vec3_eq_eps(vec3 v, float val)
check if vector is equal to value (with epsilon) check if vector is equal to value (with epsilon)
@@ -65,14 +65,14 @@ Functions documentation
| *[in]* **v** vector | *[in]* **v** vector
| *[in]* **val** value | *[in]* **val** value
.. c:function:: bool glm_vec_eq_all(vec3 v) .. c:function:: bool glm_vec3_eq_all(vec3 v)
check if vectors members are equal (without epsilon) check if vectors members are equal (without epsilon)
Parameters: Parameters:
| *[in]* **v** vector | *[in]* **v** vector
.. c:function:: bool glm_vec_eqv(vec3 v1, vec3 v2) .. c:function:: bool glm_vec3_eqv(vec3 v1, vec3 v2)
check if vector is equal to another (without epsilon) vector check if vector is equal to another (without epsilon) vector
@@ -80,7 +80,7 @@ Functions documentation
| *[in]* **vec** vector 1 | *[in]* **vec** vector 1
| *[in]* **vec** vector 2 | *[in]* **vec** vector 2
.. c:function:: bool glm_vec_eqv_eps(vec3 v1, vec3 v2) .. c:function:: bool glm_vec3_eqv_eps(vec3 v1, vec3 v2)
check if vector is equal to another (with epsilon) check if vector is equal to another (with epsilon)
@@ -88,21 +88,21 @@ Functions documentation
| *[in]* **v1** vector1 | *[in]* **v1** vector1
| *[in]* **v2** vector2 | *[in]* **v2** vector2
.. c:function:: float glm_vec_max(vec3 v) .. c:function:: float glm_vec3_max(vec3 v)
max value of vector max value of vector
Parameters: Parameters:
| *[in]* **v** vector | *[in]* **v** vector
.. c:function:: float glm_vec_min(vec3 v) .. c:function:: float glm_vec3_min(vec3 v)
min value of vector min value of vector
Parameters: Parameters:
| *[in]* **v** vector | *[in]* **v** vector
.. c:function:: bool glm_vec_isnan(vec3 v) .. c:function:: bool glm_vec3_isnan(vec3 v)
| check if one of items is NaN (not a number) | check if one of items is NaN (not a number)
| you should only use this in DEBUG mode or very critical asserts | you should only use this in DEBUG mode or very critical asserts
@@ -110,7 +110,7 @@ Functions documentation
Parameters: Parameters:
| *[in]* **v** vector | *[in]* **v** vector
.. c:function:: bool glm_vec_isinf(vec3 v) .. c:function:: bool glm_vec3_isinf(vec3 v)
| check if one of items is INFINITY | check if one of items is INFINITY
| you should only use this in DEBUG mode or very critical asserts | you should only use this in DEBUG mode or very critical asserts
@@ -118,7 +118,7 @@ Functions documentation
Parameters: Parameters:
| *[in]* **v** vector | *[in]* **v** vector
.. c:function:: bool glm_vec_isvalid(vec3 v) .. c:function:: bool glm_vec3_isvalid(vec3 v)
| check if all items are valid number | check if all items are valid number
| you should only use this in DEBUG mode or very critical asserts | you should only use this in DEBUG mode or very critical asserts
@@ -126,7 +126,7 @@ Functions documentation
Parameters: Parameters:
| *[in]* **v** vector | *[in]* **v** vector
.. c:function:: void glm_vec_sign(vec3 v, vec3 dest) .. c:function:: void glm_vec3_sign(vec3 v, vec3 dest)
get sign of 32 bit float as +1, -1, 0 get sign of 32 bit float as +1, -1, 0
@@ -134,7 +134,7 @@ Functions documentation
| *[in]* **v** vector | *[in]* **v** vector
| *[out]* **dest** sign vector (only keeps signs as -1, 0, -1) | *[out]* **dest** sign vector (only keeps signs as -1, 0, -1)
.. c:function:: void glm_vec_sqrt(vec3 v, vec3 dest) .. c:function:: void glm_vec3_sqrt(vec3 v, vec3 dest)
square root of each vector item square root of each vector item

View File

@@ -5,9 +5,14 @@ vec3
Header: cglm/vec3.h Header: cglm/vec3.h
**Important:** *cglm* was used **glm_vec_** namespace for vec3 functions until
**v0.5.0**, since **v0.5.0** cglm uses **glm_vec3_** namespace for vec3.
Also `glm_vec3_flipsign` has been renamed to `glm_vec3_negate`
We mostly use vectors in graphics math, to make writing code faster We mostly use vectors in graphics math, to make writing code faster
and easy to read, some *vec3* functions are aliased in global namespace. and easy to read, some *vec3* functions are aliased in global namespace.
For instance :c:func:`glm_dot` is alias of :c:func:`glm_vec_dot`, For instance :c:func:`glm_dot` is alias of :c:func:`glm_vec3_dot`,
alias means inline wrapper here. There is no call verison of alias functions alias means inline wrapper here. There is no call verison of alias functions
There are also functions for rotating *vec3* vector. **_m4**, **_m3** prefixes There are also functions for rotating *vec3* vector. **_m4**, **_m3** prefixes
@@ -18,7 +23,7 @@ Table of contents (click to go):
Macros: Macros:
1. glm_vec_dup(v, dest) 1. glm_vec3_dup(v, dest)
#. GLM_VEC3_ONE_INIT #. GLM_VEC3_ONE_INIT
#. GLM_VEC3_ZERO_INIT #. GLM_VEC3_ZERO_INIT
#. GLM_VEC3_ONE #. GLM_VEC3_ONE
@@ -30,47 +35,47 @@ Macros:
Functions: Functions:
1. :c:func:`glm_vec3` 1. :c:func:`glm_vec3`
#. :c:func:`glm_vec_copy` #. :c:func:`glm_vec3_copy`
#. :c:func:`glm_vec_zero` #. :c:func:`glm_vec3_zero`
#. :c:func:`glm_vec_one` #. :c:func:`glm_vec3_one`
#. :c:func:`glm_vec_dot` #. :c:func:`glm_vec3_dot`
#. :c:func:`glm_vec_cross` #. :c:func:`glm_vec3_cross`
#. :c:func:`glm_vec_norm2` #. :c:func:`glm_vec3_norm2`
#. :c:func:`glm_vec_norm` #. :c:func:`glm_vec3_norm`
#. :c:func:`glm_vec_add` #. :c:func:`glm_vec3_add`
#. :c:func:`glm_vec_adds` #. :c:func:`glm_vec3_adds`
#. :c:func:`glm_vec_sub` #. :c:func:`glm_vec3_sub`
#. :c:func:`glm_vec_subs` #. :c:func:`glm_vec3_subs`
#. :c:func:`glm_vec_mul` #. :c:func:`glm_vec3_mul`
#. :c:func:`glm_vec_scale` #. :c:func:`glm_vec3_scale`
#. :c:func:`glm_vec_scale_as` #. :c:func:`glm_vec3_scale_as`
#. :c:func:`glm_vec_div` #. :c:func:`glm_vec3_div`
#. :c:func:`glm_vec_divs` #. :c:func:`glm_vec3_divs`
#. :c:func:`glm_vec_addadd` #. :c:func:`glm_vec3_addadd`
#. :c:func:`glm_vec_subadd` #. :c:func:`glm_vec3_subadd`
#. :c:func:`glm_vec_muladd` #. :c:func:`glm_vec3_muladd`
#. :c:func:`glm_vec_muladds` #. :c:func:`glm_vec3_muladds`
#. :c:func:`glm_vec_flipsign` #. :c:func:`glm_vec3_flipsign`
#. :c:func:`glm_vec_flipsign_to` #. :c:func:`glm_vec3_flipsign_to`
#. :c:func:`glm_vec_negate` #. :c:func:`glm_vec3_negate`
#. :c:func:`glm_vec_negate_to` #. :c:func:`glm_vec3_negate_to`
#. :c:func:`glm_vec_inv` #. :c:func:`glm_vec3_inv`
#. :c:func:`glm_vec_inv_to` #. :c:func:`glm_vec3_inv_to`
#. :c:func:`glm_vec_normalize` #. :c:func:`glm_vec3_normalize`
#. :c:func:`glm_vec_normalize_to` #. :c:func:`glm_vec3_normalize_to`
#. :c:func:`glm_vec_distance2` #. :c:func:`glm_vec3_distance2`
#. :c:func:`glm_vec_distance` #. :c:func:`glm_vec3_distance`
#. :c:func:`glm_vec_angle` #. :c:func:`glm_vec3_angle`
#. :c:func:`glm_vec_rotate` #. :c:func:`glm_vec3_rotate`
#. :c:func:`glm_vec_rotate_m4` #. :c:func:`glm_vec3_rotate_m4`
#. :c:func:`glm_vec_rotate_m3` #. :c:func:`glm_vec3_rotate_m3`
#. :c:func:`glm_vec_proj` #. :c:func:`glm_vec3_proj`
#. :c:func:`glm_vec_center` #. :c:func:`glm_vec3_center`
#. :c:func:`glm_vec_maxv` #. :c:func:`glm_vec3_maxv`
#. :c:func:`glm_vec_minv` #. :c:func:`glm_vec3_minv`
#. :c:func:`glm_vec_ortho` #. :c:func:`glm_vec3_ortho`
#. :c:func:`glm_vec_clamp` #. :c:func:`glm_vec3_clamp`
#. :c:func:`glm_vec_lerp` #. :c:func:`glm_vec3_lerp`
Functions documentation Functions documentation
~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~
@@ -83,7 +88,7 @@ Functions documentation
| *[in]* **v4** vector4 | *[in]* **v4** vector4
| *[out]* **dest** destination | *[out]* **dest** destination
.. c:function:: void glm_vec_copy(vec3 a, vec3 dest) .. c:function:: void glm_vec3_copy(vec3 a, vec3 dest)
copy all members of [a] to [dest] copy all members of [a] to [dest]
@@ -91,21 +96,21 @@ Functions documentation
| *[in]* **a** source | *[in]* **a** source
| *[out]* **dest** destination | *[out]* **dest** destination
.. c:function:: void glm_vec_zero(vec3 v) .. c:function:: void glm_vec3_zero(vec3 v)
makes all members 0.0f (zero) makes all members 0.0f (zero)
Parameters: Parameters:
| *[in, out]* **v** vector | *[in, out]* **v** vector
.. c:function:: void glm_vec_one(vec3 v) .. c:function:: void glm_vec3_one(vec3 v)
makes all members 1.0f (one) makes all members 1.0f (one)
Parameters: Parameters:
| *[in, out]* **v** vector | *[in, out]* **v** vector
.. c:function:: float glm_vec_dot(vec3 a, vec3 b) .. c:function:: float glm_vec3_dot(vec3 a, vec3 b)
dot product of vec3 dot product of vec3
@@ -116,7 +121,7 @@ Functions documentation
Returns: Returns:
dot product dot product
.. c:function:: void glm_vec_cross(vec3 a, vec3 b, vec3 d) .. c:function:: void glm_vec3_cross(vec3 a, vec3 b, vec3 d)
cross product cross product
@@ -125,7 +130,7 @@ Functions documentation
| *[in]* **b** source 2 | *[in]* **b** source 2
| *[out]* **d** destination | *[out]* **d** destination
.. c:function:: float glm_vec_norm2(vec3 v) .. c:function:: float glm_vec3_norm2(vec3 v)
norm * norm (magnitude) of vector norm * norm (magnitude) of vector
@@ -139,14 +144,14 @@ Functions documentation
Returns: Returns:
square of norm / magnitude square of norm / magnitude
.. c:function:: float glm_vec_norm(vec3 vec) .. c:function:: float glm_vec3_norm(vec3 vec)
norm (magnitude) of vec3 norm (magnitude) of vec3
Parameters: Parameters:
| *[in]* **vec** vector | *[in]* **vec** vector
.. c:function:: void glm_vec_add(vec3 a, vec3 b, vec3 dest) .. c:function:: void glm_vec3_add(vec3 a, vec3 b, vec3 dest)
add a vector to b vector store result in dest add a vector to b vector store result in dest
@@ -155,7 +160,7 @@ Functions documentation
| *[in]* **b** vector2 | *[in]* **b** vector2
| *[out]* **dest** destination vector | *[out]* **dest** destination vector
.. c:function:: void glm_vec_adds(vec3 a, float s, vec3 dest) .. c:function:: void glm_vec3_adds(vec3 a, float s, vec3 dest)
add scalar to v vector store result in dest (d = v + vec(s)) add scalar to v vector store result in dest (d = v + vec(s))
@@ -164,7 +169,7 @@ Functions documentation
| *[in]* **s** scalar | *[in]* **s** scalar
| *[out]* **dest** destination vector | *[out]* **dest** destination vector
.. c:function:: void glm_vec_sub(vec3 v1, vec3 v2, vec3 dest) .. c:function:: void glm_vec3_sub(vec3 v1, vec3 v2, vec3 dest)
subtract b vector from a vector store result in dest (d = v1 - v2) subtract b vector from a vector store result in dest (d = v1 - v2)
@@ -173,7 +178,7 @@ Functions documentation
| *[in]* **b** vector2 | *[in]* **b** vector2
| *[out]* **dest** destination vector | *[out]* **dest** destination vector
.. c:function:: void glm_vec_subs(vec3 v, float s, vec3 dest) .. c:function:: void glm_vec3_subs(vec3 v, float s, vec3 dest)
subtract scalar from v vector store result in dest (d = v - vec(s)) subtract scalar from v vector store result in dest (d = v - vec(s))
@@ -182,7 +187,7 @@ Functions documentation
| *[in]* **s** scalar | *[in]* **s** scalar
| *[out]* **dest** destination vector | *[out]* **dest** destination vector
.. c:function:: void glm_vec_mul(vec3 a, vec3 b, vec3 d) .. c:function:: void glm_vec3_mul(vec3 a, vec3 b, vec3 d)
multiply two vector (component-wise multiplication) multiply two vector (component-wise multiplication)
@@ -191,7 +196,7 @@ Functions documentation
| *[in]* **b** scalar | *[in]* **b** scalar
| *[out]* **d** result = (a[0] * b[0], a[1] * b[1], a[2] * b[2]) | *[out]* **d** result = (a[0] * b[0], a[1] * b[1], a[2] * b[2])
.. c:function:: void glm_vec_scale(vec3 v, float s, vec3 dest) .. c:function:: void glm_vec3_scale(vec3 v, float s, vec3 dest)
multiply/scale vec3 vector with scalar: result = v * s multiply/scale vec3 vector with scalar: result = v * s
@@ -201,7 +206,7 @@ Functions documentation
| *[in]* **s** scalar | *[in]* **s** scalar
| *[out]* **dest** destination vector | *[out]* **dest** destination vector
.. c:function:: void glm_vec_scale_as(vec3 v, float s, vec3 dest) .. c:function:: void glm_vec3_scale_as(vec3 v, float s, vec3 dest)
make vec3 vector scale as specified: result = unit(v) * s make vec3 vector scale as specified: result = unit(v) * s
@@ -210,7 +215,7 @@ Functions documentation
| *[in]* **s** scalar | *[in]* **s** scalar
| *[out]* **dest** destination vector | *[out]* **dest** destination vector
.. c:function:: void glm_vec_div(vec3 a, vec3 b, vec3 dest) .. c:function:: void glm_vec3_div(vec3 a, vec3 b, vec3 dest)
div vector with another component-wise division: d = a / b div vector with another component-wise division: d = a / b
@@ -219,7 +224,7 @@ Functions documentation
| *[in]* **b** vector 2 | *[in]* **b** vector 2
| *[out]* **dest** result = (a[0] / b[0], a[1] / b[1], a[2] / b[2]) | *[out]* **dest** result = (a[0] / b[0], a[1] / b[1], a[2] / b[2])
.. c:function:: void glm_vec_divs(vec3 v, float s, vec3 dest) .. c:function:: void glm_vec3_divs(vec3 v, float s, vec3 dest)
div vector with scalar: d = v / s div vector with scalar: d = v / s
@@ -228,7 +233,7 @@ Functions documentation
| *[in]* **s** scalar | *[in]* **s** scalar
| *[out]* **dest** result = (a[0] / s, a[1] / s, a[2] / s]) | *[out]* **dest** result = (a[0] / s, a[1] / s, a[2] / s])
.. c:function:: void glm_vec_addadd(vec3 a, vec3 b, vec3 dest) .. c:function:: void glm_vec3_addadd(vec3 a, vec3 b, vec3 dest)
| add two vectors and add result to sum | add two vectors and add result to sum
| it applies += operator so dest must be initialized | it applies += operator so dest must be initialized
@@ -238,7 +243,7 @@ Functions documentation
| *[in]* **b** vector 2 | *[in]* **b** vector 2
| *[out]* **dest** dest += (a + b) | *[out]* **dest** dest += (a + b)
.. c:function:: void glm_vec_subadd(vec3 a, vec3 b, vec3 dest) .. c:function:: void glm_vec3_subadd(vec3 a, vec3 b, vec3 dest)
| sub two vectors and add result to sum | sub two vectors and add result to sum
| it applies += operator so dest must be initialized | it applies += operator so dest must be initialized
@@ -248,7 +253,7 @@ Functions documentation
| *[in]* **b** vector 2 | *[in]* **b** vector 2
| *[out]* **dest** dest += (a - b) | *[out]* **dest** dest += (a - b)
.. c:function:: void glm_vec_muladd(vec3 a, vec3 b, vec3 dest) .. c:function:: void glm_vec3_muladd(vec3 a, vec3 b, vec3 dest)
| mul two vectors and add result to sum | mul two vectors and add result to sum
| it applies += operator so dest must be initialized | it applies += operator so dest must be initialized
@@ -258,7 +263,7 @@ Functions documentation
| *[in]* **b** vector 2 | *[in]* **b** vector 2
| *[out]* **dest** dest += (a * b) | *[out]* **dest** dest += (a * b)
.. c:function:: void glm_vec_muladds(vec3 a, float s, vec3 dest) .. c:function:: void glm_vec3_muladds(vec3 a, float s, vec3 dest)
| mul vector with scalar and add result to sum | mul vector with scalar and add result to sum
| it applies += operator so dest must be initialized | it applies += operator so dest must be initialized
@@ -268,29 +273,33 @@ Functions documentation
| *[in]* **s** scalar | *[in]* **s** scalar
| *[out]* **dest** dest += (a * b) | *[out]* **dest** dest += (a * b)
.. c:function:: void glm_vec_flipsign(vec3 v) .. c:function:: void glm_vec3_flipsign(vec3 v)
flip sign of all vec3 members **DEPRACATED!**
use :c:func:`glm_vec3_negate`
Parameters: Parameters:
| *[in, out]* **v** vector | *[in, out]* **v** vector
.. c:function:: void glm_vec_flipsign_to(vec3 v, vec3 dest) .. c:function:: void glm_vec3_flipsign_to(vec3 v, vec3 dest)
flip sign of all vec3 members and store result in dest **DEPRACATED!**
use :c:func:`glm_vec3_negate_to`
Parameters: Parameters:
| *[in]* **v** vector | *[in]* **v** vector
| *[out]* **dest** negated vector | *[out]* **dest** negated vector
.. c:function:: void glm_vec_negate(vec3 v) .. c:function:: void glm_vec3_negate(vec3 v)
negate vector components negate vector components
Parameters: Parameters:
| *[in, out]* **v** vector | *[in, out]* **v** vector
.. c:function:: void glm_vec_negate_to(vec3 v, vec3 dest) .. c:function:: void glm_vec3_negate_to(vec3 v, vec3 dest)
negate vector components and store result in dest negate vector components and store result in dest
@@ -298,14 +307,14 @@ Functions documentation
| *[in]* **v** vector | *[in]* **v** vector
| *[out]* **dest** negated vector | *[out]* **dest** negated vector
.. c:function:: void glm_vec_inv(vec3 v) .. c:function:: void glm_vec3_inv(vec3 v)
make vector as inverse/opposite of itself make vector as inverse/opposite of itself
Parameters: Parameters:
| *[in, out]* **v** vector | *[in, out]* **v** vector
.. c:function:: void glm_vec_inv_to(vec3 v, vec3 dest) .. c:function:: void glm_vec3_inv_to(vec3 v, vec3 dest)
inverse/opposite vector inverse/opposite vector
@@ -313,14 +322,14 @@ Functions documentation
| *[in]* **v** source | *[in]* **v** source
| *[out]* **dest** destination | *[out]* **dest** destination
.. c:function:: void glm_vec_normalize(vec3 v) .. c:function:: void glm_vec3_normalize(vec3 v)
normalize vec3 and store result in same vec normalize vec3 and store result in same vec
Parameters: Parameters:
| *[in, out]* **v** vector | *[in, out]* **v** vector
.. c:function:: void glm_vec_normalize_to(vec3 vec, vec3 dest) .. c:function:: void glm_vec3_normalize_to(vec3 vec, vec3 dest)
normalize vec3 to dest normalize vec3 to dest
@@ -328,7 +337,7 @@ Functions documentation
| *[in]* **vec** source | *[in]* **vec** source
| *[out]* **dest** destination | *[out]* **dest** destination
.. c:function:: float glm_vec_angle(vec3 v1, vec3 v2) .. c:function:: float glm_vec3_angle(vec3 v1, vec3 v2)
angle betwen two vector angle betwen two vector
@@ -339,7 +348,7 @@ Functions documentation
Return: Return:
| angle as radians | angle as radians
.. c:function:: void glm_vec_rotate(vec3 v, float angle, vec3 axis) .. c:function:: void glm_vec3_rotate(vec3 v, float angle, vec3 axis)
rotate vec3 around axis by angle using Rodrigues' rotation formula rotate vec3 around axis by angle using Rodrigues' rotation formula
@@ -348,7 +357,7 @@ Functions documentation
| *[in]* **axis** axis vector (will be normalized) | *[in]* **axis** axis vector (will be normalized)
| *[out]* **angle** angle (radians) | *[out]* **angle** angle (radians)
.. c:function:: void glm_vec_rotate_m4(mat4 m, vec3 v, vec3 dest) .. c:function:: void glm_vec3_rotate_m4(mat4 m, vec3 v, vec3 dest)
apply rotation matrix to vector apply rotation matrix to vector
@@ -357,7 +366,7 @@ Functions documentation
| *[in]* **v** vector | *[in]* **v** vector
| *[out]* **dest** rotated vector | *[out]* **dest** rotated vector
.. c:function:: void glm_vec_rotate_m3(mat3 m, vec3 v, vec3 dest) .. c:function:: void glm_vec3_rotate_m3(mat3 m, vec3 v, vec3 dest)
apply rotation matrix to vector apply rotation matrix to vector
@@ -366,7 +375,7 @@ Functions documentation
| *[in]* **v** vector | *[in]* **v** vector
| *[out]* **dest** rotated vector | *[out]* **dest** rotated vector
.. c:function:: void glm_vec_proj(vec3 a, vec3 b, vec3 dest) .. c:function:: void glm_vec3_proj(vec3 a, vec3 b, vec3 dest)
project a vector onto b vector project a vector onto b vector
@@ -375,7 +384,7 @@ Functions documentation
| *[in]* **b** vector2 | *[in]* **b** vector2
| *[out]* **dest** projected vector | *[out]* **dest** projected vector
.. c:function:: void glm_vec_center(vec3 v1, vec3 v2, vec3 dest) .. c:function:: void glm_vec3_center(vec3 v1, vec3 v2, vec3 dest)
find center point of two vector find center point of two vector
@@ -384,7 +393,7 @@ Functions documentation
| *[in]* **v2** vector2 | *[in]* **v2** vector2
| *[out]* **dest** center point | *[out]* **dest** center point
.. c:function:: float glm_vec_distance2(vec3 v1, vec3 v2) .. c:function:: float glm_vec3_distance2(vec3 v1, vec3 v2)
squared distance between two vectors squared distance between two vectors
@@ -395,7 +404,7 @@ Functions documentation
Returns: Returns:
| squared distance (distance * distance) | squared distance (distance * distance)
.. c:function:: float glm_vec_distance(vec3 v1, vec3 v2) .. c:function:: float glm_vec3_distance(vec3 v1, vec3 v2)
distance between two vectors distance between two vectors
@@ -406,7 +415,7 @@ Functions documentation
Returns: Returns:
| distance | distance
.. c:function:: void glm_vec_maxv(vec3 v1, vec3 v2, vec3 dest) .. c:function:: void glm_vec3_maxv(vec3 v1, vec3 v2, vec3 dest)
max values of vectors max values of vectors
@@ -415,7 +424,7 @@ Functions documentation
| *[in]* **v2** vector2 | *[in]* **v2** vector2
| *[out]* **dest** destination | *[out]* **dest** destination
.. c:function:: void glm_vec_minv(vec3 v1, vec3 v2, vec3 dest) .. c:function:: void glm_vec3_minv(vec3 v1, vec3 v2, vec3 dest)
min values of vectors min values of vectors
@@ -424,7 +433,7 @@ Functions documentation
| *[in]* **v2** vector2 | *[in]* **v2** vector2
| *[out]* **dest** destination | *[out]* **dest** destination
.. c:function:: void glm_vec_ortho(vec3 v, vec3 dest) .. c:function:: void glm_vec3_ortho(vec3 v, vec3 dest)
possible orthogonal/perpendicular vector possible orthogonal/perpendicular vector
@@ -432,7 +441,7 @@ Functions documentation
| *[in]* **mat** vector | *[in]* **mat** vector
| *[out]* **dest** orthogonal/perpendicular vector | *[out]* **dest** orthogonal/perpendicular vector
.. c:function:: void glm_vec_clamp(vec3 v, float minVal, float maxVal) .. c:function:: void glm_vec3_clamp(vec3 v, float minVal, float maxVal)
constrain a value to lie between two further values constrain a value to lie between two further values
@@ -441,7 +450,7 @@ Functions documentation
| *[in]* **minVal** minimum value | *[in]* **minVal** minimum value
| *[in]* **maxVal** maximum value | *[in]* **maxVal** maximum value
.. c:function:: void glm_vec_lerp(vec3 from, vec3 to, float t, vec3 dest) .. c:function:: void glm_vec3_lerp(vec3 from, vec3 to, float t, vec3 dest)
linear interpolation between two vector linear interpolation between two vector

View File

@@ -44,7 +44,9 @@ Functions:
#. :c:func:`glm_vec4_muladd` #. :c:func:`glm_vec4_muladd`
#. :c:func:`glm_vec4_muladds` #. :c:func:`glm_vec4_muladds`
#. :c:func:`glm_vec4_flipsign` #. :c:func:`glm_vec4_flipsign`
#. :c:func:`glm_vec_flipsign_to` #. :c:func:`glm_vec4_flipsign_to`
#. :c:func:`glm_vec4_negate`
#. :c:func:`glm_vec4_negate_to`
#. :c:func:`glm_vec4_inv` #. :c:func:`glm_vec4_inv`
#. :c:func:`glm_vec4_inv_to` #. :c:func:`glm_vec4_inv_to`
#. :c:func:`glm_vec4_normalize` #. :c:func:`glm_vec4_normalize`
@@ -262,14 +264,33 @@ Functions documentation
.. c:function:: void glm_vec4_flipsign(vec4 v) .. c:function:: void glm_vec4_flipsign(vec4 v)
flip sign of all vec4 members **DEPRACATED!**
use :c:func:`glm_vec4_negate`
Parameters: Parameters:
| *[in, out]* **v** vector | *[in, out]* **v** vector
.. c:function:: void glm_vec4_flipsign_to(vec4 v, vec4 dest) .. c:function:: void glm_vec4_flipsign_to(vec4 v, vec4 dest)
flip sign of all vec4 members and store result in dest **DEPRACATED!**
use :c:func:`glm_vec4_negate_TO`
Parameters:
| *[in]* **v** vector
| *[out]* **dest** negated vector
.. c:function:: void glm_vec4_negate(vec4 v)
negate vector components
Parameters:
| *[in, out]* **v** vector
.. c:function:: void glm_vec4_negate_to(vec4 v, vec4 dest)
negate vector components and store result in dest
Parameters: Parameters:
| *[in]* **v** vector | *[in]* **v** vector

View File

@@ -464,9 +464,9 @@ glm_decompose_rs(mat4 m, mat4 r, vec3 s) {
is -1, then negate the matrix and the scaling factors. */ is -1, then negate the matrix and the scaling factors. */
glm_vec3_cross(m[0], m[1], v); glm_vec3_cross(m[0], m[1], v);
if (glm_vec3_dot(v, m[2]) < 0.0f) { if (glm_vec3_dot(v, m[2]) < 0.0f) {
glm_vec4_flipsign(r[0]); glm_vec4_negate(r[0]);
glm_vec4_flipsign(r[1]); glm_vec4_negate(r[1]);
glm_vec4_flipsign(r[2]); glm_vec4_negate(r[2]);
glm_vec3_negate(s); glm_vec3_negate(s);
} }
} }

View File

@@ -13,6 +13,11 @@ extern "C" {
#include "../cglm.h" #include "../cglm.h"
/* DEPRECATED! use _copy, _ucopy versions */
#define glmc_vec_dup(v, dest) glmc_vec3_copy(v, dest)
#define glmc_vec3_flipsign(v) glmc_vec3_negate(v)
#define glmc_vec3_flipsign_to(v, dest) glmc_vec3_negate_to(v, dest)
CGLM_EXPORT CGLM_EXPORT
void void
glmc_vec3(vec4 v4, vec3 dest); glmc_vec3(vec4 v4, vec3 dest);

View File

@@ -14,8 +14,10 @@ extern "C" {
#include "../cglm.h" #include "../cglm.h"
/* DEPRECATED! use _copy, _ucopy versions */ /* DEPRECATED! use _copy, _ucopy versions */
#define glmc_vec4_dup3(v, dest) glmc_vec4_copy3(v, dest) #define glmc_vec4_dup3(v, dest) glmc_vec4_copy3(v, dest)
#define glmc_vec4_dup(v, dest) glmc_vec4_copy(v, dest) #define glmc_vec4_dup(v, dest) glmc_vec4_copy(v, dest)
#define glmc_vec4_flipsign(v) glmc_vec4_negate(v)
#define glmc_vec4_flipsign_to(v, dest) glmc_vec4_negate_to(v, dest)
CGLM_EXPORT CGLM_EXPORT
void void
@@ -115,11 +117,11 @@ glmc_vec4_muladds(vec4 a, float s, vec4 dest);
CGLM_EXPORT CGLM_EXPORT
void void
glmc_vec4_flipsign(vec4 v); glmc_vec4_negate(vec4 v);
CGLM_EXPORT CGLM_EXPORT
void void
glmc_vec4_flipsign_to(vec4 v, vec4 dest); glmc_vec4_negate_to(vec4 v, vec4 dest);
CGLM_EXPORT CGLM_EXPORT
void void

View File

@@ -16,8 +16,6 @@
GLM_MAT4_ZERO_INIT GLM_MAT4_ZERO_INIT
GLM_MAT4_IDENTITY GLM_MAT4_IDENTITY
GLM_MAT4_ZERO GLM_MAT4_ZERO
glm_mat4_udup(mat, dest)
glm_mat4_dup(mat, dest)
Functions: Functions:
CGLM_INLINE void glm_mat4_ucopy(mat4 mat, mat4 dest); CGLM_INLINE void glm_mat4_ucopy(mat4 mat, mat4 dest);

View File

@@ -273,7 +273,7 @@ glm_quat_dot(versor p, versor q) {
CGLM_INLINE CGLM_INLINE
void void
glm_quat_conjugate(versor q, versor dest) { glm_quat_conjugate(versor q, versor dest) {
glm_vec4_flipsign_to(q, dest); glm_vec4_negate_to(q, dest);
dest[3] = -dest[3]; dest[3] = -dest[3];
} }
@@ -634,7 +634,7 @@ glm_quat_slerp(versor from, versor to, float t, versor dest) {
} }
if (cosTheta < 0.0f) { if (cosTheta < 0.0f) {
glm_vec4_flipsign(q1); glm_vec4_negate(q1);
cosTheta = -cosTheta; cosTheta = -cosTheta;
} }

View File

@@ -7,7 +7,7 @@
/* /*
Macros: Macros:
glm_vec_dup(v, dest) glm_vec3_dup(v, dest)
GLM_VEC3_ONE_INIT GLM_VEC3_ONE_INIT
GLM_VEC3_ZERO_INIT GLM_VEC3_ZERO_INIT
GLM_VEC3_ONE GLM_VEC3_ONE
@@ -67,7 +67,7 @@
CGLM_INLINE void glm_normalize_to(vec3 v, vec3 dest); CGLM_INLINE void glm_normalize_to(vec3 v, vec3 dest);
DEPRECATED: DEPRECATED:
glm_vec_dup glm_vec3_dup
glm_vec3_flipsign glm_vec3_flipsign
glm_vec3_flipsign_to glm_vec3_flipsign_to
*/ */
@@ -81,7 +81,9 @@
#include "util.h" #include "util.h"
/* DEPRECATED! use _copy, _ucopy versions */ /* DEPRECATED! use _copy, _ucopy versions */
#define glm_vec_dup(v, dest) glm_vec3_copy(v, dest) #define glm_vec3_dup(v, dest) glm_vec3_copy(v, dest)
#define glm_vec3_flipsign(v) glm_vec3_negate(v)
#define glm_vec3_flipsign_to(v, dest) glm_vec3_negate_to(v, dest)
#define GLM_VEC3_ONE_INIT {1.0f, 1.0f, 1.0f} #define GLM_VEC3_ONE_INIT {1.0f, 1.0f, 1.0f}
#define GLM_VEC3_ZERO_INIT {0.0f, 0.0f, 0.0f} #define GLM_VEC3_ZERO_INIT {0.0f, 0.0f, 0.0f}
@@ -412,37 +414,6 @@ glm_vec3_muladds(vec3 a, float s, vec3 dest) {
dest[2] += a[2] * s; dest[2] += a[2] * s;
} }
/*!
* DEPRECATED! use glm_vec3_negate and friends
*
* @brief negate vector components
*
* @param[in, out] v vector
*/
CGLM_INLINE
void
glm_vec3_flipsign(vec3 v) {
v[0] = -v[0];
v[1] = -v[1];
v[2] = -v[2];
}
/*!
* DEPRECATED! use glm_vec3_negate and friends
*
* @brief negate vector components and store result in dest
*
* @param[in] v vector
* @param[out] dest result vector
*/
CGLM_INLINE
void
glm_vec3_flipsign_to(vec3 v, vec3 dest) {
dest[0] = -v[0];
dest[1] = -v[1];
dest[2] = -v[2];
}
/*! /*!
* @brief negate vector components and store result in dest * @brief negate vector components and store result in dest
* *

View File

@@ -11,20 +11,20 @@
/* /*
Functions: Functions:
CGLM_INLINE void glm_vec4_mulv(vec4 a, vec4 b, vec4 d); CGLM_INLINE void glm_vec4_mulv(vec4 a, vec4 b, vec4 d);
CGLM_INLINE void glm_vec4_broadcast(float val, vec4 d); CGLM_INLINE void glm_vec4_broadcast(float val, vec4 d);
CGLM_INLINE bool glm_vec4_eq(vec4 v, float val); CGLM_INLINE bool glm_vec4_eq(vec4 v, float val);
CGLM_INLINE bool glm_vec4_eq_eps(vec4 v, float val); CGLM_INLINE bool glm_vec4_eq_eps(vec4 v, float val);
CGLM_INLINE bool glm_vec4_eq_all(vec4 v); CGLM_INLINE bool glm_vec4_eq_all(vec4 v);
CGLM_INLINE bool glm_vec4_eqv(vec4 v1, vec4 v2); CGLM_INLINE bool glm_vec4_eqv(vec4 v1, vec4 v2);
CGLM_INLINE bool glm_vec4_eqv_eps(vec4 v1, vec4 v2); CGLM_INLINE bool glm_vec4_eqv_eps(vec4 v1, vec4 v2);
CGLM_INLINE float glm_vec4_max(vec4 v); CGLM_INLINE float glm_vec4_max(vec4 v);
CGLM_INLINE float glm_vec4_min(vec4 v); CGLM_INLINE float glm_vec4_min(vec4 v);
CGLM_INLINE bool glm_vec4_isnan(vec4 v); CGLM_INLINE bool glm_vec4_isnan(vec4 v);
CGLM_INLINE bool glm_vec4_isinf(vec4 v); CGLM_INLINE bool glm_vec4_isinf(vec4 v);
CGLM_INLINE bool glm_vec4_isvalid(vec4 v); CGLM_INLINE bool glm_vec4_isvalid(vec4 v);
CGLM_INLINE void glm_vec4_sign(vec4 v, vec4 dest); CGLM_INLINE void glm_vec4_sign(vec4 v, vec4 dest);
CGLM_INLINE void glm_vec4_sqrt(vec4 v, vec4 dest); CGLM_INLINE void glm_vec4_sqrt(vec4 v, vec4 dest);
*/ */
#ifndef cglm_vec4_ext_h #ifndef cglm_vec4_ext_h

View File

@@ -36,7 +36,7 @@
CGLM_INLINE void glm_vec4_addadd(vec4 a, vec4 b, vec4 dest); CGLM_INLINE void glm_vec4_addadd(vec4 a, vec4 b, vec4 dest);
CGLM_INLINE void glm_vec4_subadd(vec4 a, vec4 b, vec4 dest); CGLM_INLINE void glm_vec4_subadd(vec4 a, vec4 b, vec4 dest);
CGLM_INLINE void glm_vec4_muladd(vec4 a, vec4 b, vec4 dest); CGLM_INLINE void glm_vec4_muladd(vec4 a, vec4 b, vec4 dest);
CGLM_INLINE void glm_vec4_flipsign(vec4 v); CGLM_INLINE void glm_vec4_negate(vec4 v);
CGLM_INLINE void glm_vec4_inv(vec4 v); CGLM_INLINE void glm_vec4_inv(vec4 v);
CGLM_INLINE void glm_vec4_inv_to(vec4 v, vec4 dest); CGLM_INLINE void glm_vec4_inv_to(vec4 v, vec4 dest);
CGLM_INLINE void glm_vec4_normalize(vec4 v); CGLM_INLINE void glm_vec4_normalize(vec4 v);
@@ -46,6 +46,12 @@
CGLM_INLINE void glm_vec4_minv(vec4 v1, vec4 v2, vec4 dest); CGLM_INLINE void glm_vec4_minv(vec4 v1, vec4 v2, vec4 dest);
CGLM_INLINE void glm_vec4_clamp(vec4 v, float minVal, float maxVal); CGLM_INLINE void glm_vec4_clamp(vec4 v, float minVal, float maxVal);
CGLM_INLINE void glm_vec4_lerp(vec4 from, vec4 to, float t, vec4 dest) CGLM_INLINE void glm_vec4_lerp(vec4 from, vec4 to, float t, vec4 dest)
DEPRECATED:
glm_vec4_dup
glm_vec4_flipsign
glm_vec4_flipsign_to
*/ */
#ifndef cglm_vec4_h #ifndef cglm_vec4_h
@@ -510,32 +516,14 @@ glm_vec4_muladds(vec4 a, float s, vec4 dest) {
} }
/*! /*!
* @brief flip sign of all vec4 members * @brief negate vector components and store result in dest
*
* @param[in, out] v vector
*/
CGLM_INLINE
void
glm_vec4_flipsign(vec4 v) {
#if defined( __SSE__ ) || defined( __SSE2__ )
glmm_store(v, _mm_xor_ps(glmm_load(v), _mm_set1_ps(-0.0f)));
#else
v[0] = -v[0];
v[1] = -v[1];
v[2] = -v[2];
v[3] = -v[3];
#endif
}
/*!
* @brief flip sign of all vec4 members and store result in dest
* *
* @param[in] v vector * @param[in] v vector
* @param[out] dest vector * @param[out] dest result vector
*/ */
CGLM_INLINE CGLM_INLINE
void void
glm_vec4_flipsign_to(vec4 v, vec4 dest) { glm_vec4_negate_to(vec4 v, vec4 dest) {
#if defined( __SSE__ ) || defined( __SSE2__ ) #if defined( __SSE__ ) || defined( __SSE2__ )
glmm_store(dest, _mm_xor_ps(glmm_load(v), _mm_set1_ps(-0.0f))); glmm_store(dest, _mm_xor_ps(glmm_load(v), _mm_set1_ps(-0.0f)));
#else #else
@@ -546,6 +534,17 @@ glm_vec4_flipsign_to(vec4 v, vec4 dest) {
#endif #endif
} }
/*!
* @brief flip sign of all vec4 members
*
* @param[in, out] v vector
*/
CGLM_INLINE
void
glm_vec4_negate(vec4 v) {
glm_vec4_negate_to(v, v);
}
/*! /*!
* @brief make vector as inverse/opposite of itself * @brief make vector as inverse/opposite of itself
* *
@@ -554,7 +553,7 @@ glm_vec4_flipsign_to(vec4 v, vec4 dest) {
CGLM_INLINE CGLM_INLINE
void void
glm_vec4_inv(vec4 v) { glm_vec4_inv(vec4 v) {
glm_vec4_flipsign(v); glm_vec4_negate(v);
} }
/*! /*!
@@ -567,7 +566,7 @@ CGLM_INLINE
void void
glm_vec4_inv_to(vec4 v, vec4 dest) { glm_vec4_inv_to(vec4 v, vec4 dest) {
glm_vec4_copy(v, dest); glm_vec4_copy(v, dest);
glm_vec4_flipsign(dest); glm_vec4_negate(dest);
} }
/*! /*!

View File

@@ -146,18 +146,6 @@ glmc_vec3_muladds(vec3 a, float s, vec3 dest) {
glm_vec3_muladds(a, s, dest); glm_vec3_muladds(a, s, dest);
} }
CGLM_EXPORT
void
glmc_vec3_flipsign(vec3 v) {
glm_vec3_flipsign(v);
}
CGLM_EXPORT
void
glmc_vec3_flipsign_to(vec3 v, vec3 dest) {
glm_vec3_flipsign_to(v, dest);
}
CGLM_EXPORT CGLM_EXPORT
void void
glmc_vec3_negate(vec3 v) { glmc_vec3_negate(vec3 v) {

View File

@@ -154,14 +154,14 @@ glmc_vec4_muladds(vec4 a, float s, vec4 dest) {
CGLM_EXPORT CGLM_EXPORT
void void
glmc_vec4_flipsign(vec4 v) { glmc_vec4_negate(vec4 v) {
glm_vec4_flipsign(v); glm_vec4_negate(v);
} }
CGLM_EXPORT CGLM_EXPORT
void void
glmc_vec4_flipsign_to(vec4 v, vec4 dest) { glmc_vec4_negate_to(vec4 v, vec4 dest) {
glm_vec4_flipsign_to(v, dest); glm_vec4_negate_to(v, dest);
} }
CGLM_EXPORT CGLM_EXPORT