mirror of
https://github.com/recp/cglm.git
synced 2026-02-17 03:39:05 +00:00
Fix typos.
This commit is contained in:
@@ -66,7 +66,7 @@ you have the latest version
|
|||||||
- **[major change]** by starting v0.5.0, vec3 functions use **glm_vec3_** namespace, it was **glm_vec_** until v0.5.0
|
- **[major change]** by starting v0.5.0, vec3 functions use **glm_vec3_** namespace, it was **glm_vec_** until v0.5.0
|
||||||
- **[major change]** by starting v0.5.1, built-in alignment is removed from **vec3** and **mat3** types
|
- **[major change]** by starting v0.5.1, built-in alignment is removed from **vec3** and **mat3** types
|
||||||
- **[major change]** by starting v0.7.3, inline print functions are disabled in release/production mode to eliminate print costs (see options in documentation). Print output also improved. You can disable colors if you need (see documentation)
|
- **[major change]** by starting v0.7.3, inline print functions are disabled in release/production mode to eliminate print costs (see options in documentation). Print output also improved. You can disable colors if you need (see documentation)
|
||||||
- **[major change]** by starting v0.8.3, **cglm** supports alternative clipspace configuations e.g. Left Handed, Zero-to-One (_zo)... `CGLM_FORCE_DEPTH_ZERO_TO_ONE` and `CGLM_FORCE_LEFT_HANDED` is provided to control clipspace. You should be able to use **cglm** with Vulkan, DirectX and Metal now... see https://cglm.readthedocs.io/en/latest/opt.html#clipspace-option-s
|
- **[major change]** by starting v0.8.3, **cglm** supports alternative clipspace configurations e.g. Left Handed, Zero-to-One (_zo)... `CGLM_FORCE_DEPTH_ZERO_TO_ONE` and `CGLM_FORCE_LEFT_HANDED` is provided to control clipspace. You should be able to use **cglm** with Vulkan, DirectX and Metal now... see https://cglm.readthedocs.io/en/latest/opt.html#clipspace-option-s
|
||||||
|
|
||||||
#### 📌 Note for C++ developers:
|
#### 📌 Note for C++ developers:
|
||||||
If you are not aware of the original GLM library yet, you may also want to look at:
|
If you are not aware of the original GLM library yet, you may also want to look at:
|
||||||
@@ -108,7 +108,7 @@ https://github.com/g-truc/glm
|
|||||||
|
|
||||||
## 🚀 Features
|
## 🚀 Features
|
||||||
- **scalar** and **simd** (sse, avx, neon...) optimizations
|
- **scalar** and **simd** (sse, avx, neon...) optimizations
|
||||||
- option to use different clipspaces e.g. Left Handed, Zero-to-One... (currrently right handed negative-one is default)
|
- option to use different clipspaces e.g. Left Handed, Zero-to-One... (currently right handed negative-one is default)
|
||||||
- array api and struct api, you can use arrays or structs.
|
- array api and struct api, you can use arrays or structs.
|
||||||
- general purpose matrix operations (mat4, mat3)
|
- general purpose matrix operations (mat4, mat3)
|
||||||
- chain matrix multiplication (square only)
|
- chain matrix multiplication (square only)
|
||||||
@@ -148,7 +148,7 @@ To call pre-compiled versions, just use `glmc_` (c stands for 'call') instead of
|
|||||||
glm_mul(trans, rot, rt); /* inline */
|
glm_mul(trans, rot, rt); /* inline */
|
||||||
glmc_mul(trans, rot, rt); /* call from library */
|
glmc_mul(trans, rot, rt); /* call from library */
|
||||||
```
|
```
|
||||||
Most of math functions are optimized manualy with SSE2 if available, if not? Dont worry there are non-sse versions of all operations
|
Most of math functions are optimized manually with SSE2 if available, if not? Dont worry there are non-sse versions of all operations
|
||||||
|
|
||||||
You can pass matrices and vectors as array to functions rather than get address.
|
You can pass matrices and vectors as array to functions rather than get address.
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ Functions documentation
|
|||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **aabb** bounding box
|
| *[in]* **aabb** bounding box
|
||||||
| *[in]* **cropAabb** crop box
|
| *[in]* **cropAabb** crop box
|
||||||
| *[in]* **clampAabb** miniumum box
|
| *[in]* **clampAabb** minimum box
|
||||||
| *[out]* **dest** cropped bounding box
|
| *[out]* **dest** cropped bounding box
|
||||||
|
|
||||||
.. c:function:: void glm_aabb2d_invalidate(vec2 aabb[2])
|
.. c:function:: void glm_aabb2d_invalidate(vec2 aabb[2])
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
3D Affine Transforms (common)
|
3D Affine Transforms (common)
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
Common transfrom functions.
|
Common transform functions.
|
||||||
|
|
||||||
Table of contents (click to go):
|
Table of contents (click to go):
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@@ -30,7 +30,7 @@ Functions documentation
|
|||||||
creates NEW translate transform matrix by *v* vector.
|
creates NEW translate transform matrix by *v* vector.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transfrom
|
| *[in, out]* **m** affine transform
|
||||||
| *[in]* **v** translate vector [x, y, z]
|
| *[in]* **v** translate vector [x, y, z]
|
||||||
|
|
||||||
.. c:function:: void glm_scale_to(mat4 m, vec3 v, mat4 dest)
|
.. c:function:: void glm_scale_to(mat4 m, vec3 v, mat4 dest)
|
||||||
@@ -38,7 +38,7 @@ Functions documentation
|
|||||||
scale existing transform matrix by *v* vector and store result in dest
|
scale existing transform matrix by *v* vector and store result in dest
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m** affine transfrom
|
| *[in]* **m** affine transform
|
||||||
| *[in]* **v** scale vector [x, y, z]
|
| *[in]* **v** scale vector [x, y, z]
|
||||||
| *[out]* **dest** scaled matrix
|
| *[out]* **dest** scaled matrix
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ Functions documentation
|
|||||||
creates NEW scale matrix by v vector
|
creates NEW scale matrix by v vector
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[out]* **m** affine transfrom
|
| *[out]* **m** affine transform
|
||||||
| *[in]* **v** scale vector [x, y, z]
|
| *[in]* **v** scale vector [x, y, z]
|
||||||
|
|
||||||
.. c:function:: void glm_scale(mat4 m, vec3 v)
|
.. c:function:: void glm_scale(mat4 m, vec3 v)
|
||||||
@@ -56,7 +56,7 @@ Functions documentation
|
|||||||
and stores result in same matrix
|
and stores result in same matrix
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transfrom
|
| *[in, out]* **m** affine transform
|
||||||
| *[in]* **v** scale vector [x, y, z]
|
| *[in]* **v** scale vector [x, y, z]
|
||||||
|
|
||||||
.. c:function:: void glm_scale_uni(mat4 m, float s)
|
.. c:function:: void glm_scale_uni(mat4 m, float s)
|
||||||
@@ -65,7 +65,7 @@ Functions documentation
|
|||||||
and stores result in same matrix
|
and stores result in same matrix
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transfrom
|
| *[in, out]* **m** affine transform
|
||||||
| *[in]* **v** scale factor
|
| *[in]* **v** scale factor
|
||||||
|
|
||||||
.. c:function:: void glm_rotate_make(mat4 m, float angle, vec3 axis)
|
.. c:function:: void glm_rotate_make(mat4 m, float angle, vec3 axis)
|
||||||
@@ -74,7 +74,7 @@ Functions documentation
|
|||||||
axis will be normalized so you don't need to normalize it
|
axis will be normalized so you don't need to normalize it
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[out]* **m** affine transfrom
|
| *[out]* **m** affine transform
|
||||||
| *[in]* **axis** angle (radians)
|
| *[in]* **axis** angle (radians)
|
||||||
| *[in]* **axis** axis
|
| *[in]* **axis** axis
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ Functions documentation
|
|||||||
| this should work faster than glm_rotate_at because it reduces one glm_translate.
|
| this should work faster than glm_rotate_at because it reduces one glm_translate.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transfrom
|
| *[in, out]* **m** affine transform
|
||||||
| *[in]* **pivot** pivot, anchor point, rotation center
|
| *[in]* **pivot** pivot, anchor point, rotation center
|
||||||
| *[in]* **angle** angle (radians)
|
| *[in]* **angle** angle (radians)
|
||||||
| *[in]* **axis** axis
|
| *[in]* **axis** axis
|
||||||
@@ -123,7 +123,7 @@ Functions documentation
|
|||||||
DON'T pass projected matrix here
|
DON'T pass projected matrix here
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m** affine transfrom
|
| *[in]* **m** affine transform
|
||||||
| *[out]* **t** translation vector
|
| *[out]* **t** translation vector
|
||||||
| *[out]* **r** rotation matrix (mat4)
|
| *[out]* **r** rotation matrix (mat4)
|
||||||
| *[out]* **s** scaling vector [X, Y, Z]
|
| *[out]* **s** scaling vector [X, Y, Z]
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ You cannot use :c:func:`glm_mul` anymore.
|
|||||||
Same is also true for :c:func:`glm_inv_tr` if you only have rotation and
|
Same is also true for :c:func:`glm_inv_tr` if you only have rotation and
|
||||||
translation then it will work as expected, otherwise you cannot use that.
|
translation then it will work as expected, otherwise you cannot use that.
|
||||||
|
|
||||||
In the future it may accept scale factors too but currectly it does not.
|
In the future it may accept scale factors too but currently it does not.
|
||||||
|
|
||||||
Table of contents (click func go):
|
Table of contents (click func go):
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|||||||
@@ -3,10 +3,8 @@
|
|||||||
3D Affine Transforms (post)
|
3D Affine Transforms (post)
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
Post transfrom functions are similar to pre transform functions except order of application is reversed.
|
Post transform functions are similar to pre transform functions except order of application is reversed.
|
||||||
Post transform functions are applied after the object is transformed with given (model matrix) transfrom.
|
Post transform functions are applied after the object is transformed with given (model matrix) transform.
|
||||||
|
|
||||||
Ther are named af
|
|
||||||
|
|
||||||
Table of contents (click to go):
|
Table of contents (click to go):
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@@ -33,7 +31,7 @@ Functions documentation
|
|||||||
translate existing transform matrix by *v* vector and store result in dest
|
translate existing transform matrix by *v* vector and store result in dest
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m** affine transfrom
|
| *[in]* **m** affine transform
|
||||||
| *[in]* **v** translate vector [x, y, z]
|
| *[in]* **v** translate vector [x, y, z]
|
||||||
| *[out]* **dest** translated matrix
|
| *[out]* **dest** translated matrix
|
||||||
|
|
||||||
@@ -43,7 +41,7 @@ Functions documentation
|
|||||||
and stores result in same matrix
|
and stores result in same matrix
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transfrom
|
| *[in, out]* **m** affine transform
|
||||||
| *[in]* **v** translate vector [x, y, z]
|
| *[in]* **v** translate vector [x, y, z]
|
||||||
|
|
||||||
.. c:function:: void glm_translated_x(mat4 m, float x)
|
.. c:function:: void glm_translated_x(mat4 m, float x)
|
||||||
@@ -51,7 +49,7 @@ Functions documentation
|
|||||||
translate existing transform matrix by x factor
|
translate existing transform matrix by x factor
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transfrom
|
| *[in, out]* **m** affine transform
|
||||||
| *[in]* **v** x factor
|
| *[in]* **v** x factor
|
||||||
|
|
||||||
.. c:function:: void glm_translated_y(mat4 m, float y)
|
.. c:function:: void glm_translated_y(mat4 m, float y)
|
||||||
@@ -59,7 +57,7 @@ Functions documentation
|
|||||||
translate existing transform matrix by *y* factor
|
translate existing transform matrix by *y* factor
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transfrom
|
| *[in, out]* **m** affine transform
|
||||||
| *[in]* **v** y factor
|
| *[in]* **v** y factor
|
||||||
|
|
||||||
.. c:function:: void glm_translated_z(mat4 m, float z)
|
.. c:function:: void glm_translated_z(mat4 m, float z)
|
||||||
@@ -67,7 +65,7 @@ Functions documentation
|
|||||||
translate existing transform matrix by *z* factor
|
translate existing transform matrix by *z* factor
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transfrom
|
| *[in, out]* **m** affine transform
|
||||||
| *[in]* **v** z factor
|
| *[in]* **v** z factor
|
||||||
|
|
||||||
.. c:function:: void glm_rotated_x(mat4 m, float angle, mat4 dest)
|
.. c:function:: void glm_rotated_x(mat4 m, float angle, mat4 dest)
|
||||||
@@ -76,7 +74,7 @@ Functions documentation
|
|||||||
and store result in dest
|
and store result in dest
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m** affine transfrom
|
| *[in]* **m** affine transform
|
||||||
| *[in]* **angle** angle (radians)
|
| *[in]* **angle** angle (radians)
|
||||||
| *[out]* **dest** rotated matrix
|
| *[out]* **dest** rotated matrix
|
||||||
|
|
||||||
@@ -86,7 +84,7 @@ Functions documentation
|
|||||||
and store result in dest
|
and store result in dest
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m** affine transfrom
|
| *[in]* **m** affine transform
|
||||||
| *[in]* **angle** angle (radians)
|
| *[in]* **angle** angle (radians)
|
||||||
| *[out]* **dest** rotated matrix
|
| *[out]* **dest** rotated matrix
|
||||||
|
|
||||||
@@ -96,7 +94,7 @@ Functions documentation
|
|||||||
and store result in dest
|
and store result in dest
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m** affine transfrom
|
| *[in]* **m** affine transform
|
||||||
| *[in]* **angle** angle (radians)
|
| *[in]* **angle** angle (radians)
|
||||||
| *[out]* **dest** rotated matrix
|
| *[out]* **dest** rotated matrix
|
||||||
|
|
||||||
@@ -105,7 +103,7 @@ Functions documentation
|
|||||||
rotate existing transform matrix around Z axis by angle and axis
|
rotate existing transform matrix around Z axis by angle and axis
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transfrom
|
| *[in, out]* **m** affine transform
|
||||||
| *[in]* **angle** angle (radians)
|
| *[in]* **angle** angle (radians)
|
||||||
| *[in]* **axis** axis
|
| *[in]* **axis** axis
|
||||||
|
|
||||||
@@ -114,7 +112,7 @@ Functions documentation
|
|||||||
rotate existing transform around given axis by angle at given pivot point (rotation center)
|
rotate existing transform around given axis by angle at given pivot point (rotation center)
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transfrom
|
| *[in, out]* **m** affine transform
|
||||||
| *[in]* **pivot** pivot, anchor point, rotation center
|
| *[in]* **pivot** pivot, anchor point, rotation center
|
||||||
| *[in]* **angle** angle (radians)
|
| *[in]* **angle** angle (radians)
|
||||||
| *[in]* **axis** axis
|
| *[in]* **axis** axis
|
||||||
@@ -124,6 +122,6 @@ Functions documentation
|
|||||||
| rotate existing transform matrix around given axis by angle around self (doesn't affected by position)
|
| rotate existing transform matrix around given axis by angle around self (doesn't affected by position)
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transfrom
|
| *[in, out]* **m** affine transform
|
||||||
| *[in]* **angle** angle (radians)
|
| *[in]* **angle** angle (radians)
|
||||||
| *[in]* **axis** axis
|
| *[in]* **axis** axis
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
3D Affine Transforms (pre)
|
3D Affine Transforms (pre)
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
Pre transfrom functions which are regular transfrom functions.
|
Pre transform functions which are regular transform functions.
|
||||||
|
|
||||||
Table of contents (click to go):
|
Table of contents (click to go):
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@@ -41,7 +41,7 @@ Functions documentation
|
|||||||
translate existing transform matrix by *v* vector and store result in dest
|
translate existing transform matrix by *v* vector and store result in dest
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m** affine transfrom
|
| *[in]* **m** affine transform
|
||||||
| *[in]* **v** translate vector [x, y, z]
|
| *[in]* **v** translate vector [x, y, z]
|
||||||
| *[out]* **dest** translated matrix
|
| *[out]* **dest** translated matrix
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ Functions documentation
|
|||||||
and stores result in same matrix
|
and stores result in same matrix
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transfrom
|
| *[in, out]* **m** affine transform
|
||||||
| *[in]* **v** translate vector [x, y, z]
|
| *[in]* **v** translate vector [x, y, z]
|
||||||
|
|
||||||
.. c:function:: void glm_translate_x(mat4 m, float x)
|
.. c:function:: void glm_translate_x(mat4 m, float x)
|
||||||
@@ -59,7 +59,7 @@ Functions documentation
|
|||||||
translate existing transform matrix by x factor
|
translate existing transform matrix by x factor
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transfrom
|
| *[in, out]* **m** affine transform
|
||||||
| *[in]* **v** x factor
|
| *[in]* **v** x factor
|
||||||
|
|
||||||
.. c:function:: void glm_translate_y(mat4 m, float y)
|
.. c:function:: void glm_translate_y(mat4 m, float y)
|
||||||
@@ -67,7 +67,7 @@ Functions documentation
|
|||||||
translate existing transform matrix by *y* factor
|
translate existing transform matrix by *y* factor
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transfrom
|
| *[in, out]* **m** affine transform
|
||||||
| *[in]* **v** y factor
|
| *[in]* **v** y factor
|
||||||
|
|
||||||
.. c:function:: void glm_translate_z(mat4 m, float z)
|
.. c:function:: void glm_translate_z(mat4 m, float z)
|
||||||
@@ -75,7 +75,7 @@ Functions documentation
|
|||||||
translate existing transform matrix by *z* factor
|
translate existing transform matrix by *z* factor
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transfrom
|
| *[in, out]* **m** affine transform
|
||||||
| *[in]* **v** z factor
|
| *[in]* **v** z factor
|
||||||
|
|
||||||
.. c:function:: void glm_translate_make(mat4 m, vec3 v)
|
.. c:function:: void glm_translate_make(mat4 m, vec3 v)
|
||||||
@@ -83,7 +83,7 @@ Functions documentation
|
|||||||
creates NEW translate transform matrix by *v* vector.
|
creates NEW translate transform matrix by *v* vector.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transfrom
|
| *[in, out]* **m** affine transform
|
||||||
| *[in]* **v** translate vector [x, y, z]
|
| *[in]* **v** translate vector [x, y, z]
|
||||||
|
|
||||||
.. c:function:: void glm_scale_to(mat4 m, vec3 v, mat4 dest)
|
.. c:function:: void glm_scale_to(mat4 m, vec3 v, mat4 dest)
|
||||||
@@ -91,7 +91,7 @@ Functions documentation
|
|||||||
scale existing transform matrix by *v* vector and store result in dest
|
scale existing transform matrix by *v* vector and store result in dest
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m** affine transfrom
|
| *[in]* **m** affine transform
|
||||||
| *[in]* **v** scale vector [x, y, z]
|
| *[in]* **v** scale vector [x, y, z]
|
||||||
| *[out]* **dest** scaled matrix
|
| *[out]* **dest** scaled matrix
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ Functions documentation
|
|||||||
creates NEW scale matrix by v vector
|
creates NEW scale matrix by v vector
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[out]* **m** affine transfrom
|
| *[out]* **m** affine transform
|
||||||
| *[in]* **v** scale vector [x, y, z]
|
| *[in]* **v** scale vector [x, y, z]
|
||||||
|
|
||||||
.. c:function:: void glm_scale(mat4 m, vec3 v)
|
.. c:function:: void glm_scale(mat4 m, vec3 v)
|
||||||
@@ -109,7 +109,7 @@ Functions documentation
|
|||||||
and stores result in same matrix
|
and stores result in same matrix
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transfrom
|
| *[in, out]* **m** affine transform
|
||||||
| *[in]* **v** scale vector [x, y, z]
|
| *[in]* **v** scale vector [x, y, z]
|
||||||
|
|
||||||
.. c:function:: void glm_scale_uni(mat4 m, float s)
|
.. c:function:: void glm_scale_uni(mat4 m, float s)
|
||||||
@@ -118,7 +118,7 @@ Functions documentation
|
|||||||
and stores result in same matrix
|
and stores result in same matrix
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transfrom
|
| *[in, out]* **m** affine transform
|
||||||
| *[in]* **v** scale factor
|
| *[in]* **v** scale factor
|
||||||
|
|
||||||
.. c:function:: void glm_rotate_x(mat4 m, float angle, mat4 dest)
|
.. c:function:: void glm_rotate_x(mat4 m, float angle, mat4 dest)
|
||||||
@@ -127,7 +127,7 @@ Functions documentation
|
|||||||
and store result in dest
|
and store result in dest
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m** affine transfrom
|
| *[in]* **m** affine transform
|
||||||
| *[in]* **angle** angle (radians)
|
| *[in]* **angle** angle (radians)
|
||||||
| *[out]* **dest** rotated matrix
|
| *[out]* **dest** rotated matrix
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ Functions documentation
|
|||||||
and store result in dest
|
and store result in dest
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m** affine transfrom
|
| *[in]* **m** affine transform
|
||||||
| *[in]* **angle** angle (radians)
|
| *[in]* **angle** angle (radians)
|
||||||
| *[out]* **dest** rotated matrix
|
| *[out]* **dest** rotated matrix
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ Functions documentation
|
|||||||
and store result in dest
|
and store result in dest
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m** affine transfrom
|
| *[in]* **m** affine transform
|
||||||
| *[in]* **angle** angle (radians)
|
| *[in]* **angle** angle (radians)
|
||||||
| *[out]* **dest** rotated matrix
|
| *[out]* **dest** rotated matrix
|
||||||
|
|
||||||
@@ -157,7 +157,7 @@ Functions documentation
|
|||||||
axis will be normalized so you don't need to normalize it
|
axis will be normalized so you don't need to normalize it
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[out]* **m** affine transfrom
|
| *[out]* **m** affine transform
|
||||||
| *[in]* **axis** angle (radians)
|
| *[in]* **axis** angle (radians)
|
||||||
| *[in]* **axis** axis
|
| *[in]* **axis** axis
|
||||||
|
|
||||||
@@ -166,7 +166,7 @@ Functions documentation
|
|||||||
rotate existing transform matrix around Z axis by angle and axis
|
rotate existing transform matrix around Z axis by angle and axis
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transfrom
|
| *[in, out]* **m** affine transform
|
||||||
| *[in]* **angle** angle (radians)
|
| *[in]* **angle** angle (radians)
|
||||||
| *[in]* **axis** axis
|
| *[in]* **axis** axis
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ Functions documentation
|
|||||||
rotate existing transform around given axis by angle at given pivot point (rotation center)
|
rotate existing transform around given axis by angle at given pivot point (rotation center)
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transfrom
|
| *[in, out]* **m** affine transform
|
||||||
| *[in]* **pivot** pivot, anchor point, rotation center
|
| *[in]* **pivot** pivot, anchor point, rotation center
|
||||||
| *[in]* **angle** angle (radians)
|
| *[in]* **angle** angle (radians)
|
||||||
| *[in]* **axis** axis
|
| *[in]* **axis** axis
|
||||||
@@ -188,7 +188,7 @@ Functions documentation
|
|||||||
| this should work faster than glm_rotate_at because it reduces one glm_translate.
|
| this should work faster than glm_rotate_at because it reduces one glm_translate.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transfrom
|
| *[in, out]* **m** affine transform
|
||||||
| *[in]* **pivot** pivot, anchor point, rotation center
|
| *[in]* **pivot** pivot, anchor point, rotation center
|
||||||
| *[in]* **angle** angle (radians)
|
| *[in]* **angle** angle (radians)
|
||||||
| *[in]* **axis** axis
|
| *[in]* **axis** axis
|
||||||
@@ -225,7 +225,7 @@ Functions documentation
|
|||||||
DON'T pass projected matrix here
|
DON'T pass projected matrix here
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m** affine transfrom
|
| *[in]* **m** affine transform
|
||||||
| *[out]* **t** translation vector
|
| *[out]* **t** translation vector
|
||||||
| *[out]* **r** rotation matrix (mat4)
|
| *[out]* **r** rotation matrix (mat4)
|
||||||
| *[out]* **s** scaling vector [X, Y, Z]
|
| *[out]* **s** scaling vector [X, Y, Z]
|
||||||
@@ -235,6 +235,6 @@ Functions documentation
|
|||||||
| rotate existing transform matrix around given axis by angle around self (doesn't affected by position)
|
| rotate existing transform matrix around given axis by angle around self (doesn't affected by position)
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transfrom
|
| *[in, out]* **m** affine transform
|
||||||
| *[in]* **angle** angle (radians)
|
| *[in]* **angle** angle (radians)
|
||||||
| *[in]* **axis** axis
|
| *[in]* **axis** axis
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ Post functions (`T' = T * Tnew`) are like `glm_translated`, `glm_rotated` which
|
|||||||
`glm_translate`, `glm_rotate` are pre functions and are similar to C++ **glm** which you are familiar with.
|
`glm_translate`, `glm_rotate` are pre functions and are similar to C++ **glm** which you are familiar with.
|
||||||
|
|
||||||
In new versions of **cglm** we added `glm_translated`, `glm_rotated`... which are post functions,
|
In new versions of **cglm** we added `glm_translated`, `glm_rotated`... which are post functions,
|
||||||
they are useful in some cases, e.g. append transform to existing transform (apply/append transform as last transfrom T' = T * Tnew).
|
they are useful in some cases, e.g. append transform to existing transform (apply/append transform as last transform T' = T * Tnew).
|
||||||
|
|
||||||
Post functions are named after pre functions with `ed` suffix, e.g. `glm_translate` -> `glm_translated`. So don't mix them up.
|
Post functions are named after pre functions with `ed` suffix, e.g. `glm_translate` -> `glm_translated`. So don't mix them up.
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ a matrix for you. You don't need to pass identity matrix.
|
|||||||
|
|
||||||
But other functions expect you have a matrix and you want to transform them. If
|
But other functions expect you have a matrix and you want to transform them. If
|
||||||
you didn't have any existing matrix you have to initialize matrix to identity
|
you didn't have any existing matrix you have to initialize matrix to identity
|
||||||
before sending to transfrom functions.
|
before sending to transform functions.
|
||||||
|
|
||||||
There are also functions to decompose transform matrix. These functions can't
|
There are also functions to decompose transform matrix. These functions can't
|
||||||
decompose matrix after projected.
|
decompose matrix after projected.
|
||||||
@@ -35,7 +35,7 @@ Rotation Center
|
|||||||
Rotating functions uses origin as rotation center (pivot/anchor point),
|
Rotating functions uses origin as rotation center (pivot/anchor point),
|
||||||
since scale factors are stored in rotation matrix, same may also true for scalling.
|
since scale factors are stored in rotation matrix, same may also true for scalling.
|
||||||
cglm provides some functions for rotating around at given point e.g.
|
cglm provides some functions for rotating around at given point e.g.
|
||||||
**glm_rotate_at**, **glm_quat_rotate_at**. Use them or follow next section for algorihm ("Rotate or Scale around specific Point (Pivot Point / Anchor Point)").
|
**glm_rotate_at**, **glm_quat_rotate_at**. Use them or follow next section for algorithm ("Rotate or Scale around specific Point (Pivot Point / Anchor Point)").
|
||||||
|
|
||||||
Also **cglm** provides :c:func:`glm_spin` and :c:func:`glm_spinned` functions to rotate around itself. No need to give pivot.
|
Also **cglm** provides :c:func:`glm_spin` and :c:func:`glm_spinned` functions to rotate around itself. No need to give pivot.
|
||||||
These functions are useful for rotating around center of object.
|
These functions are useful for rotating around center of object.
|
||||||
@@ -43,7 +43,7 @@ These functions are useful for rotating around center of object.
|
|||||||
Rotate or Scale around specific Point (Anchor Point)
|
Rotate or Scale around specific Point (Anchor Point)
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
If you want to rotate model around arbibtrary point follow these steps:
|
If you want to rotate model around arbitrary point follow these steps:
|
||||||
|
|
||||||
1. Move model from pivot point to origin: **translate(-pivot.x, -pivot.y, -pivot.z)**
|
1. Move model from pivot point to origin: **translate(-pivot.x, -pivot.y, -pivot.z)**
|
||||||
2. Apply rotation (or scaling maybe)
|
2. Apply rotation (or scaling maybe)
|
||||||
@@ -82,11 +82,11 @@ helpers functions works like this (cglm provides reverse order as `ed` suffix e.
|
|||||||
.. code-block:: c
|
.. code-block:: c
|
||||||
:linenos:
|
:linenos:
|
||||||
|
|
||||||
TransformMatrix = TransformMatrix * TraslateMatrix; // glm_translate()
|
TransformMatrix = TransformMatrix * TranslateMatrix; // glm_translate()
|
||||||
TransformMatrix = TransformMatrix * RotateMatrix; // glm_rotate(), glm_quat_rotate()
|
TransformMatrix = TransformMatrix * RotateMatrix; // glm_rotate(), glm_quat_rotate()
|
||||||
TransformMatrix = TransformMatrix * ScaleMatrix; // glm_scale()
|
TransformMatrix = TransformMatrix * ScaleMatrix; // glm_scale()
|
||||||
|
|
||||||
As you can see it is multipled as right matrix. For instance what will happen if you call `glm_translate` twice?
|
As you can see it is multiplied as right matrix. For instance what will happen if you call `glm_translate` twice?
|
||||||
|
|
||||||
.. code-block:: c
|
.. code-block:: c
|
||||||
:linenos:
|
:linenos:
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ a matrix for you. You don't need to pass identity matrix.
|
|||||||
|
|
||||||
But other functions expect you have a matrix and you want to transform them. If
|
But other functions expect you have a matrix and you want to transform them. If
|
||||||
you didn't have any existing matrix you have to initialize matrix to identity
|
you didn't have any existing matrix you have to initialize matrix to identity
|
||||||
before sending to transfrom functions.
|
before sending to transform functions.
|
||||||
|
|
||||||
Transforms Order
|
Transforms Order
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@@ -45,7 +45,7 @@ Functions:
|
|||||||
translate existing 2d transform matrix by *v* vector and stores result in same matrix
|
translate existing 2d transform matrix by *v* vector and stores result in same matrix
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** 2d affine transfrom
|
| *[in, out]* **m** 2d affine transform
|
||||||
| *[in]* **v** translate vector [x, y]
|
| *[in]* **v** translate vector [x, y]
|
||||||
|
|
||||||
.. c:function:: void glm_translate2d_to(mat3 m, vec2 v, mat3 dest)
|
.. c:function:: void glm_translate2d_to(mat3 m, vec2 v, mat3 dest)
|
||||||
@@ -53,7 +53,7 @@ Functions:
|
|||||||
translate existing 2d transform matrix by *v* vector and store result in dest
|
translate existing 2d transform matrix by *v* vector and store result in dest
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m** 2d affine transfrom
|
| *[in]* **m** 2d affine transform
|
||||||
| *[in]* **v** translate vector [x, y]
|
| *[in]* **v** translate vector [x, y]
|
||||||
| *[out]* **dest** translated matrix
|
| *[out]* **dest** translated matrix
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ Functions:
|
|||||||
translate existing 2d transform matrix by x factor
|
translate existing 2d transform matrix by x factor
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** 2d affine transfrom
|
| *[in, out]* **m** 2d affine transform
|
||||||
| *[in]* **x** x factor
|
| *[in]* **x** x factor
|
||||||
|
|
||||||
.. c:function:: void glm_translate2d_y(mat3 m, float y)
|
.. c:function:: void glm_translate2d_y(mat3 m, float y)
|
||||||
@@ -70,7 +70,7 @@ Functions:
|
|||||||
translate existing 2d transform matrix by y factor
|
translate existing 2d transform matrix by y factor
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** 2d affine transfrom
|
| *[in, out]* **m** 2d affine transform
|
||||||
| *[in]* **y** y factor
|
| *[in]* **y** y factor
|
||||||
|
|
||||||
.. c:function:: void glm_translate2d_make(mat3 m, vec2 v)
|
.. c:function:: void glm_translate2d_make(mat3 m, vec2 v)
|
||||||
@@ -78,7 +78,7 @@ Functions:
|
|||||||
creates NEW translate 2d transform matrix by *v* vector
|
creates NEW translate 2d transform matrix by *v* vector
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transfrom
|
| *[in, out]* **m** affine transform
|
||||||
| *[in]* **v** translate vector [x, y]
|
| *[in]* **v** translate vector [x, y]
|
||||||
|
|
||||||
.. c:function:: void glm_scale2d_to(mat3 m, vec2 v, mat3 dest)
|
.. c:function:: void glm_scale2d_to(mat3 m, vec2 v, mat3 dest)
|
||||||
@@ -86,7 +86,7 @@ Functions:
|
|||||||
scale existing 2d transform matrix by *v* vector and store result in dest
|
scale existing 2d transform matrix by *v* vector and store result in dest
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m** affine transfrom
|
| *[in]* **m** affine transform
|
||||||
| *[in]* **v** scale vector [x, y]
|
| *[in]* **v** scale vector [x, y]
|
||||||
| *[out]* **dest** scaled matrix
|
| *[out]* **dest** scaled matrix
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ Functions:
|
|||||||
creates NEW 2d scale matrix by *v* vector
|
creates NEW 2d scale matrix by *v* vector
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transfrom
|
| *[in, out]* **m** affine transform
|
||||||
| *[in]* **v** scale vector [x, y]
|
| *[in]* **v** scale vector [x, y]
|
||||||
|
|
||||||
.. c:function:: void glm_scale2d(mat3 m, vec2 v)
|
.. c:function:: void glm_scale2d(mat3 m, vec2 v)
|
||||||
@@ -103,7 +103,7 @@ Functions:
|
|||||||
scales existing 2d transform matrix by *v* vector and stores result in same matrix
|
scales existing 2d transform matrix by *v* vector and stores result in same matrix
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transfrom
|
| *[in, out]* **m** affine transform
|
||||||
| *[in]* **v** translate vector [x, y]
|
| *[in]* **v** translate vector [x, y]
|
||||||
|
|
||||||
.. c:function:: void glm_scale2d_uni(mat3 m, float s)
|
.. c:function:: void glm_scale2d_uni(mat3 m, float s)
|
||||||
@@ -111,7 +111,7 @@ Functions:
|
|||||||
applies uniform scale to existing 2d transform matrix v = [s, s] and stores result in same matrix
|
applies uniform scale to existing 2d transform matrix v = [s, s] and stores result in same matrix
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transfrom
|
| *[in, out]* **m** affine transform
|
||||||
| *[in]* **s** scale factor
|
| *[in]* **s** scale factor
|
||||||
|
|
||||||
.. c:function:: void glm_rotate2d_make(mat3 m, float angle)
|
.. c:function:: void glm_rotate2d_make(mat3 m, float angle)
|
||||||
@@ -119,7 +119,7 @@ Functions:
|
|||||||
creates NEW rotation matrix by angle around *Z* axis
|
creates NEW rotation matrix by angle around *Z* axis
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transfrom
|
| *[in, out]* **m** affine transform
|
||||||
| *[in]* **angle** angle (radians)
|
| *[in]* **angle** angle (radians)
|
||||||
|
|
||||||
.. c:function:: void glm_rotate2d(mat3 m, float angle)
|
.. c:function:: void glm_rotate2d(mat3 m, float angle)
|
||||||
@@ -127,7 +127,7 @@ Functions:
|
|||||||
rotate existing 2d transform matrix around *Z* axis by angle and store result in same matrix
|
rotate existing 2d transform matrix around *Z* axis by angle and store result in same matrix
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** affine transfrom
|
| *[in, out]* **m** affine transform
|
||||||
| *[in]* **angle** angle (radians)
|
| *[in]* **angle** angle (radians)
|
||||||
|
|
||||||
.. c:function:: void glm_rotate2d_to(mat3 m, float angle, mat3 dest)
|
.. c:function:: void glm_rotate2d_to(mat3 m, float angle, mat3 dest)
|
||||||
@@ -135,6 +135,6 @@ Functions:
|
|||||||
rotate existing 2d transform matrix around *Z* axis by angle and store result in dest
|
rotate existing 2d transform matrix around *Z* axis by angle and store result in dest
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m** affine transfrom
|
| *[in]* **m** affine transform
|
||||||
| *[in]* **angle** angle (radians)
|
| *[in]* **angle** angle (radians)
|
||||||
| *[out]* **dest** rotated matrix
|
| *[out]* **dest** rotated matrix
|
||||||
@@ -10,7 +10,7 @@ Also struct api `s` suffix to namespace e.g. `glms_vec3_add`, `glms_mat4_mul` et
|
|||||||
|
|
||||||
By starting v0.9.0, struct api namespace is configurable. We can omit **glms_** namespace or
|
By starting v0.9.0, struct api namespace is configurable. We can omit **glms_** namespace or
|
||||||
even change it with custom name to move existing api integrations to **cglm** more easliy...
|
even change it with custom name to move existing api integrations to **cglm** more easliy...
|
||||||
We can also add **s** to functin names if we want e.g. `glms_vec3_add()` -> `vec3_add()` or `vec3s_add()`.
|
We can also add **s** to function names if we want e.g. `glms_vec3_add()` -> `vec3_add()` or `vec3s_add()`.
|
||||||
|
|
||||||
By including **cglm/struct.h** header you will include all struct api. It will also include **cglm/cglm.h** too.
|
By including **cglm/struct.h** header you will include all struct api. It will also include **cglm/cglm.h** too.
|
||||||
Since struct apis are inline you don't need to build or link *cglm* against
|
Since struct apis are inline you don't need to build or link *cglm* against
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ Functions documentation
|
|||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **box** bounding box
|
| *[in]* **box** bounding box
|
||||||
| *[in]* **cropBox** crop box
|
| *[in]* **cropBox** crop box
|
||||||
| *[in]* **clampBox** miniumum box
|
| *[in]* **clampBox** minimum box
|
||||||
| *[out]* **dest** cropped bounding box
|
| *[out]* **dest** cropped bounding box
|
||||||
|
|
||||||
.. c:function:: bool glm_aabb_frustum(vec3 box[2], vec4 planes[6])
|
.. c:function:: bool glm_aabb_frustum(vec3 box[2], vec4 planes[6])
|
||||||
|
|||||||
@@ -3,17 +3,17 @@
|
|||||||
precompiled functions (call)
|
precompiled functions (call)
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
All funcitons in **glm_** namespace are forced to **inline**.
|
All functions in **glm_** namespace are forced to **inline**.
|
||||||
Most functions also have pre-compiled version.
|
Most functions also have pre-compiled version.
|
||||||
|
|
||||||
Precompiled versions are in **glmc_** namespace. *c* in the namespace stands for
|
Precompiled versions are in **glmc_** namespace. *c* in the namespace stands for
|
||||||
"call".
|
"call".
|
||||||
|
|
||||||
Since precompiled functions are just wrapper for inline verisons,
|
Since precompiled functions are just wrapper for inline versions,
|
||||||
these functions are not documented individually.
|
these functions are not documented individually.
|
||||||
It would be duplicate documentation also it
|
It would be duplicate documentation also it
|
||||||
would be hard to sync documentation between inline and call verison for me.
|
would be hard to sync documentation between inline and call version for me.
|
||||||
|
|
||||||
By including **clgm/cglm.h** you include all inline verisons. To get precompiled
|
By including **clgm/cglm.h** you include all inline versions. To get precompiled
|
||||||
versions you need to include **cglm/call.h** header it also includes all
|
versions you need to include **cglm/call.h** header it also includes all
|
||||||
call versions plus *clgm/cglm.h* (inline verisons)
|
call versions plus *clgm/cglm.h* (inline versions)
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ Functions documentation
|
|||||||
.. c:function:: void glm_persp_decomp_y(mat4 proj, float *top, float *bottom)
|
.. c:function:: void glm_persp_decomp_y(mat4 proj, float *top, float *bottom)
|
||||||
|
|
||||||
| decomposes top and bottom values of perspective projection.
|
| decomposes top and bottom values of perspective projection.
|
||||||
| y stands for y axis (top / botom axis)
|
| y stands for y axis (top / bottom axis)
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **proj** perspective projection matrix
|
| *[in]* **proj** perspective projection matrix
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ Features
|
|||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
* **scalar** and **simd** (sse, avx, neon, wasm...) optimizations
|
* **scalar** and **simd** (sse, avx, neon, wasm...) optimizations
|
||||||
* option to use different clipspaces e.g. Left Handed, Zero-to-One... (currrently right handed negative-one is default)
|
* option to use different clipspaces e.g. Left Handed, Zero-to-One... (currently right handed negative-one is default)
|
||||||
* array api and struct api, you can use arrays or structs.
|
* array api and struct api, you can use arrays or structs.
|
||||||
* general purpose matrix operations (mat4, mat3)
|
* general purpose matrix operations (mat4, mat3)
|
||||||
* chain matrix multiplication (square only)
|
* chain matrix multiplication (square only)
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ not **vec3**. If you want to store them to save space you msut convert them
|
|||||||
yourself.
|
yourself.
|
||||||
|
|
||||||
**vec4** is used to speed up functions need to corners. This is why frustum
|
**vec4** is used to speed up functions need to corners. This is why frustum
|
||||||
fucntions use *vec4* instead of *vec3*
|
functions use *vec4* instead of *vec3*
|
||||||
|
|
||||||
Currenty related-functions use [-1, 1] clip space configuration to extract
|
Currently related-functions use [-1, 1] clip space configuration to extract
|
||||||
corners but you can override it by prodiving **GLM_CUSTOM_CLIPSPACE** macro.
|
corners but you can override it by prodiving **GLM_CUSTOM_CLIPSPACE** macro.
|
||||||
If you provide it then you have to all bottom macros as *vec4*
|
If you provide it then you have to all bottom macros as *vec4*
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ Types:
|
|||||||
typedef CGLM_ALIGN_IF(16) vec4 mat4[4];
|
typedef CGLM_ALIGN_IF(16) vec4 mat4[4];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
As you can see types don't store extra informations in favor of space.
|
As you can see types don't store extra information in favor of space.
|
||||||
You can send these values e.g. matrix to OpenGL directly without casting or calling a function like *value_ptr*
|
You can send these values e.g. matrix to OpenGL directly without casting or calling a function like *value_ptr*
|
||||||
|
|
||||||
Alignment Is Required:
|
Alignment Is Required:
|
||||||
@@ -35,7 +35,7 @@ Alignment Is Required:
|
|||||||
|
|
||||||
| Check :doc:`opt` page for more details
|
| Check :doc:`opt` page for more details
|
||||||
|
|
||||||
Also alignment is disabled for older msvc verisons as default. Now alignment is only required in Visual Studio 2017 version 15.6+ if CGLM_ALL_UNALIGNED macro is not defined.
|
Also alignment is disabled for older msvc versions as default. Now alignment is only required in Visual Studio 2017 version 15.6+ if CGLM_ALL_UNALIGNED macro is not defined.
|
||||||
|
|
||||||
Allocations:
|
Allocations:
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ Example to print mat4 matrix:
|
|||||||
cglm may provide precision parameter in the future
|
cglm may provide precision parameter in the future
|
||||||
|
|
||||||
Changes since **v0.7.3**:
|
Changes since **v0.7.3**:
|
||||||
* Now mis-alignment of columns are fixed: larger numbers are printed via %g and others are printed via %f. Column withs are calculated before print.
|
* Now mis-alignment of columns are fixed: larger numbers are printed via %g and others are printed via %f. Column widths are calculated before print.
|
||||||
* Now values are colorful ;)
|
* Now values are colorful ;)
|
||||||
* Some print improvements
|
* Some print improvements
|
||||||
* New options with default values:
|
* New options with default values:
|
||||||
@@ -143,5 +143,5 @@ Functions documentation
|
|||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **vec** aabb (axis-aligned bounding box)
|
| *[in]* **vec** aabb (axis-aligned bounding box)
|
||||||
| *[in]* **tag** tag to find it more easly in logs
|
| *[in]* **tag** tag to find it more easily in logs
|
||||||
| *[in]* **ostream** FILE to write
|
| *[in]* **ostream** FILE to write
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ Functions documentation
|
|||||||
norm * norm (magnitude) of vector
|
norm * norm (magnitude) of vector
|
||||||
|
|
||||||
we can use this func instead of calling norm * norm, because it would call
|
we can use this func instead of calling norm * norm, because it would call
|
||||||
sqrtf fuction twice but with this func we can avoid func call, maybe this is
|
sqrtf function twice but with this func we can avoid func call, maybe this is
|
||||||
not good name for this func
|
not good name for this func
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ Functions documentation
|
|||||||
|
|
||||||
.. c:function:: void glm_mat2_identity(mat2 mat)
|
.. c:function:: void glm_mat2_identity(mat2 mat)
|
||||||
|
|
||||||
copy identity mat2 to mat, or makes mat to identiy
|
copy identity mat2 to mat, or makes mat to identity
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[out]* **mat** matrix
|
| *[out]* **mat** matrix
|
||||||
@@ -94,7 +94,7 @@ Functions documentation
|
|||||||
|
|
||||||
.. c:function:: void glm_mat2_transpose(mat2 m)
|
.. c:function:: void glm_mat2_transpose(mat2 m)
|
||||||
|
|
||||||
tranpose mat2 and store result in same matrix
|
transpose mat2 and store result in same matrix
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **mat** source
|
| *[in]* **mat** source
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ Functions documentation
|
|||||||
|
|
||||||
.. c:function:: void glm_mat3_identity(mat3 mat)
|
.. c:function:: void glm_mat3_identity(mat3 mat)
|
||||||
|
|
||||||
copy identity mat3 to mat, or makes mat to identiy
|
copy identity mat3 to mat, or makes mat to identity
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[out]* **mat** matrix
|
| *[out]* **mat** matrix
|
||||||
@@ -96,7 +96,7 @@ Functions documentation
|
|||||||
|
|
||||||
.. c:function:: void glm_mat3_transpose(mat3 m)
|
.. c:function:: void glm_mat3_transpose(mat3 m)
|
||||||
|
|
||||||
tranpose mat3 and store result in same matrix
|
transpose mat3 and store result in same matrix
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **mat** source
|
| *[in]* **mat** source
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ Functions documentation
|
|||||||
|
|
||||||
.. c:function:: void glm_mat4_identity(mat4 mat)
|
.. c:function:: void glm_mat4_identity(mat4 mat)
|
||||||
|
|
||||||
copy identity mat4 to mat, or makes mat to identiy
|
copy identity mat4 to mat, or makes mat to identity
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[out]* **mat** matrix
|
| *[out]* **mat** matrix
|
||||||
@@ -214,7 +214,7 @@ Functions documentation
|
|||||||
|
|
||||||
.. c:function:: void glm_mat4_transpose(mat4 m)
|
.. c:function:: void glm_mat4_transpose(mat4 m)
|
||||||
|
|
||||||
tranpose mat4 and store result in same matrix
|
transpose mat4 and store result in same matrix
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m** source
|
| *[in]* **m** source
|
||||||
|
|||||||
@@ -43,14 +43,14 @@ array of matrices:
|
|||||||
/* ... */
|
/* ... */
|
||||||
glUniformMatrix4fv(location, count, GL_FALSE, (float *)matrix);
|
glUniformMatrix4fv(location, count, GL_FALSE, (float *)matrix);
|
||||||
|
|
||||||
in this way, passing aray of matrices is same
|
in this way, passing array of matrices is same
|
||||||
|
|
||||||
Passing / Uniforming Vectors to OpenGL:
|
Passing / Uniforming Vectors to OpenGL:
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
You don't need to do extra thing when passing cglm vectors to OpengL or other APIs.
|
You don't need to do extra thing when passing cglm vectors to OpengL or other APIs.
|
||||||
Because a function like **glUniform4fv** accepts vector as pointer. cglm's vectors
|
Because a function like **glUniform4fv** accepts vector as pointer. cglm's vectors
|
||||||
are array of floats. So you can pass it directly ot those functions:
|
are array of floats. So you can pass it directly to those functions:
|
||||||
|
|
||||||
.. code-block:: c
|
.. code-block:: c
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ have to compile cglm with **CGLM_ALL_UNALIGNED** macro.
|
|||||||
if you do not know what you are doing. Because a cglm header included
|
if you do not know what you are doing. Because a cglm header included
|
||||||
via 'project A' may force types to be aligned and another cglm header
|
via 'project A' may force types to be aligned and another cglm header
|
||||||
included via 'project B' may not require alignment. In this case
|
included via 'project B' may not require alignment. In this case
|
||||||
cglm functions will read from and write to **INVALID MEMORY LOCATIONs**.
|
cglm functions will read from and write to **INVALID MEMORY LOCATIONSNs**.
|
||||||
|
|
||||||
ALWAYS USE SAME CONFIGURATION / OPTION for **cglm** if you have multiple projects.
|
ALWAYS USE SAME CONFIGURATION / OPTION for **cglm** if you have multiple projects.
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ By starting **v0.8.3** cglm provides options to switch between clipspace configu
|
|||||||
Clipspace related files are located at `include/cglm/[struct]/clipspace.h` but
|
Clipspace related files are located at `include/cglm/[struct]/clipspace.h` but
|
||||||
these are included in related files like `cam.h`. If you don't want to change your existing
|
these are included in related files like `cam.h`. If you don't want to change your existing
|
||||||
clipspace configuration and want to use different clipspace function like `glm_lookat_zo` or `glm_lookat_lh_zo`...
|
clipspace configuration and want to use different clipspace function like `glm_lookat_zo` or `glm_lookat_lh_zo`...
|
||||||
then you can include individual headers or just define `CGLM_CLIPSPACE_INCLUDE_ALL` which will iclude all headers for you.
|
then you can include individual headers or just define `CGLM_CLIPSPACE_INCLUDE_ALL` which will include all headers for you.
|
||||||
|
|
||||||
1. **CGLM_CLIPSPACE_INCLUDE_ALL**
|
1. **CGLM_CLIPSPACE_INCLUDE_ALL**
|
||||||
2. **CGLM_FORCE_DEPTH_ZERO_TO_ONE**
|
2. **CGLM_FORCE_DEPTH_ZERO_TO_ONE**
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ Header: cglm/sphere.h
|
|||||||
|
|
||||||
Sphere Representation in cglm is *vec4*: **[center.x, center.y, center.z, radii]**
|
Sphere Representation in cglm is *vec4*: **[center.x, center.y, center.z, radii]**
|
||||||
|
|
||||||
You can call any vec3 function by pasing sphere. Because first three elements
|
You can call any vec3 function by passing sphere. Because first three elements
|
||||||
defines center of sphere.
|
defines center of sphere.
|
||||||
|
|
||||||
Table of contents (click to go):
|
Table of contents (click to go):
|
||||||
|
|||||||
@@ -68,14 +68,14 @@ Functions documentation
|
|||||||
|
|
||||||
.. c:function:: void glm_make_rad(float *degm)
|
.. c:function:: void glm_make_rad(float *degm)
|
||||||
|
|
||||||
| convert exsisting degree to radians. this will override degrees value
|
| convert existing degree to radians. this will override degrees value
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **deg** pointer to angle in degrees
|
| *[in, out]* **deg** pointer to angle in degrees
|
||||||
|
|
||||||
.. c:function:: void glm_make_deg(float *rad)
|
.. c:function:: void glm_make_deg(float *rad)
|
||||||
|
|
||||||
| convert exsisting radians to degree. this will override radians value
|
| convert existing radians to degree. this will override radians value
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **rad** pointer to angle in radians
|
| *[in, out]* **rad** pointer to angle in radians
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ Functions documentation
|
|||||||
norm * norm (magnitude) of vector
|
norm * norm (magnitude) of vector
|
||||||
|
|
||||||
we can use this func instead of calling norm * norm, because it would call
|
we can use this func instead of calling norm * norm, because it would call
|
||||||
sqrtf fuction twice but with this func we can avoid func call, maybe this is
|
sqrtf function twice but with this func we can avoid func call, maybe this is
|
||||||
not good name for this func
|
not good name for this func
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ Header: cglm/vec3.h
|
|||||||
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_vec3_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 version 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
|
||||||
rotate *vec3* with matrix.
|
rotate *vec3* with matrix.
|
||||||
@@ -148,7 +148,7 @@ Functions documentation
|
|||||||
norm * norm (magnitude) of vector
|
norm * norm (magnitude) of vector
|
||||||
|
|
||||||
we can use this func instead of calling norm * norm, because it would call
|
we can use this func instead of calling norm * norm, because it would call
|
||||||
sqrtf fuction twice but with this func we can avoid func call, maybe this is
|
sqrtf function twice but with this func we can avoid func call, maybe this is
|
||||||
not good name for this func
|
not good name for this func
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
@@ -309,7 +309,7 @@ Functions documentation
|
|||||||
|
|
||||||
.. c:function:: void glm_vec3_flipsign(vec3 v)
|
.. c:function:: void glm_vec3_flipsign(vec3 v)
|
||||||
|
|
||||||
**DEPRACATED!**
|
**DEPRECATED!**
|
||||||
|
|
||||||
use :c:func:`glm_vec3_negate`
|
use :c:func:`glm_vec3_negate`
|
||||||
|
|
||||||
@@ -318,7 +318,7 @@ Functions documentation
|
|||||||
|
|
||||||
.. c:function:: void glm_vec3_flipsign_to(vec3 v, vec3 dest)
|
.. c:function:: void glm_vec3_flipsign_to(vec3 v, vec3 dest)
|
||||||
|
|
||||||
**DEPRACATED!**
|
**DEPRECATED!**
|
||||||
|
|
||||||
use :c:func:`glm_vec3_negate_to`
|
use :c:func:`glm_vec3_negate_to`
|
||||||
|
|
||||||
@@ -328,7 +328,7 @@ Functions documentation
|
|||||||
|
|
||||||
.. c:function:: void glm_vec3_inv(vec3 v)
|
.. c:function:: void glm_vec3_inv(vec3 v)
|
||||||
|
|
||||||
**DEPRACATED!**
|
**DEPRECATED!**
|
||||||
|
|
||||||
use :c:func:`glm_vec3_negate`
|
use :c:func:`glm_vec3_negate`
|
||||||
|
|
||||||
@@ -337,7 +337,7 @@ Functions documentation
|
|||||||
|
|
||||||
.. c:function:: void glm_vec3_inv_to(vec3 v, vec3 dest)
|
.. c:function:: void glm_vec3_inv_to(vec3 v, vec3 dest)
|
||||||
|
|
||||||
**DEPRACATED!**
|
**DEPRECATED!**
|
||||||
|
|
||||||
use :c:func:`glm_vec3_negate_to`
|
use :c:func:`glm_vec3_negate_to`
|
||||||
|
|
||||||
@@ -377,7 +377,7 @@ Functions documentation
|
|||||||
|
|
||||||
.. c:function:: float glm_vec3_angle(vec3 v1, vec3 v2)
|
.. c:function:: float glm_vec3_angle(vec3 v1, vec3 v2)
|
||||||
|
|
||||||
angle betwen two vector
|
angle between two vector
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **v1** vector1
|
| *[in]* **v1** vector1
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ Functions documentation
|
|||||||
norm * norm (magnitude) of vector
|
norm * norm (magnitude) of vector
|
||||||
|
|
||||||
we can use this func instead of calling norm * norm, because it would call
|
we can use this func instead of calling norm * norm, because it would call
|
||||||
sqrtf fuction twice but with this func we can avoid func call, maybe this is
|
sqrtf function twice but with this func we can avoid func call, maybe this is
|
||||||
not good name for this func
|
not good name for this func
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
@@ -284,7 +284,7 @@ Functions documentation
|
|||||||
|
|
||||||
.. c:function:: void glm_vec4_flipsign(vec4 v)
|
.. c:function:: void glm_vec4_flipsign(vec4 v)
|
||||||
|
|
||||||
**DEPRACATED!**
|
**DEPRECATED!**
|
||||||
|
|
||||||
use :c:func:`glm_vec4_negate`
|
use :c:func:`glm_vec4_negate`
|
||||||
|
|
||||||
@@ -293,7 +293,7 @@ Functions documentation
|
|||||||
|
|
||||||
.. c:function:: void glm_vec4_flipsign_to(vec4 v, vec4 dest)
|
.. c:function:: void glm_vec4_flipsign_to(vec4 v, vec4 dest)
|
||||||
|
|
||||||
**DEPRACATED!**
|
**DEPRECATED!**
|
||||||
|
|
||||||
use :c:func:`glm_vec4_negate_to`
|
use :c:func:`glm_vec4_negate_to`
|
||||||
|
|
||||||
@@ -303,7 +303,7 @@ Functions documentation
|
|||||||
|
|
||||||
.. c:function:: void glm_vec4_inv(vec4 v)
|
.. c:function:: void glm_vec4_inv(vec4 v)
|
||||||
|
|
||||||
**DEPRACATED!**
|
**DEPRECATED!**
|
||||||
|
|
||||||
use :c:func:`glm_vec4_negate`
|
use :c:func:`glm_vec4_negate`
|
||||||
|
|
||||||
@@ -312,7 +312,7 @@ Functions documentation
|
|||||||
|
|
||||||
.. c:function:: void glm_vec4_inv_to(vec4 v, vec4 dest)
|
.. c:function:: void glm_vec4_inv_to(vec4 v, vec4 dest)
|
||||||
|
|
||||||
**DEPRACATED!**
|
**DEPRECATED!**
|
||||||
|
|
||||||
use :c:func:`glm_vec4_negate_to`
|
use :c:func:`glm_vec4_negate_to`
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ glm_aabb2d_crop(vec2 aabb[2], vec2 cropAabb[2], vec2 dest[2]) {
|
|||||||
*
|
*
|
||||||
* @param[in] aabb bounding aabb
|
* @param[in] aabb bounding aabb
|
||||||
* @param[in] cropAabb crop aabb
|
* @param[in] cropAabb crop aabb
|
||||||
* @param[in] clampAabb miniumum aabb
|
* @param[in] clampAabb minimum aabb
|
||||||
* @param[out] dest cropped bounding aabb
|
* @param[out] dest cropped bounding aabb
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
|
|||||||
@@ -34,9 +34,9 @@
|
|||||||
* @brief translate existing transform matrix by v vector
|
* @brief translate existing transform matrix by v vector
|
||||||
* and stores result in same matrix
|
* and stores result in same matrix
|
||||||
*
|
*
|
||||||
* this is POST transform, applies to existing transform as last transfrom
|
* this is POST transform, applies to existing transform as last transform
|
||||||
*
|
*
|
||||||
* @param[in, out] m affine transfrom
|
* @param[in, out] m affine transform
|
||||||
* @param[in] v translate vector [x, y, z]
|
* @param[in] v translate vector [x, y, z]
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
@@ -51,9 +51,9 @@ glm_translated(mat4 m, vec3 v) {
|
|||||||
*
|
*
|
||||||
* source matrix will remain same
|
* source matrix will remain same
|
||||||
*
|
*
|
||||||
* this is POST transform, applies to existing transform as last transfrom
|
* this is POST transform, applies to existing transform as last transform
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] v translate vector [x, y, z]
|
* @param[in] v translate vector [x, y, z]
|
||||||
* @param[out] dest translated matrix
|
* @param[out] dest translated matrix
|
||||||
*/
|
*/
|
||||||
@@ -67,9 +67,9 @@ glm_translated_to(mat4 m, vec3 v, mat4 dest) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief translate existing transform matrix by x factor
|
* @brief translate existing transform matrix by x factor
|
||||||
*
|
*
|
||||||
* this is POST transform, applies to existing transform as last transfrom
|
* this is POST transform, applies to existing transform as last transform
|
||||||
*
|
*
|
||||||
* @param[in, out] m affine transfrom
|
* @param[in, out] m affine transform
|
||||||
* @param[in] x x factor
|
* @param[in] x x factor
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
@@ -81,9 +81,9 @@ glm_translated_x(mat4 m, float x) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief translate existing transform matrix by y factor
|
* @brief translate existing transform matrix by y factor
|
||||||
*
|
*
|
||||||
* this is POST transform, applies to existing transform as last transfrom
|
* this is POST transform, applies to existing transform as last transform
|
||||||
*
|
*
|
||||||
* @param[in, out] m affine transfrom
|
* @param[in, out] m affine transform
|
||||||
* @param[in] y y factor
|
* @param[in] y y factor
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
@@ -95,9 +95,9 @@ glm_translated_y(mat4 m, float y) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief translate existing transform matrix by z factor
|
* @brief translate existing transform matrix by z factor
|
||||||
*
|
*
|
||||||
* this is POST transform, applies to existing transform as last transfrom
|
* this is POST transform, applies to existing transform as last transform
|
||||||
*
|
*
|
||||||
* @param[in, out] m affine transfrom
|
* @param[in, out] m affine transform
|
||||||
* @param[in] z z factor
|
* @param[in] z z factor
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
@@ -110,9 +110,9 @@ glm_translated_z(mat4 m, float z) {
|
|||||||
* @brief rotate existing transform matrix around X axis by angle
|
* @brief rotate existing transform matrix around X axis by angle
|
||||||
* and store result in dest
|
* and store result in dest
|
||||||
*
|
*
|
||||||
* this is POST transform, applies to existing transform as last transfrom
|
* this is POST transform, applies to existing transform as last transform
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @param[out] dest rotated matrix
|
* @param[out] dest rotated matrix
|
||||||
*/
|
*/
|
||||||
@@ -137,9 +137,9 @@ glm_rotated_x(mat4 m, float angle, mat4 dest) {
|
|||||||
* @brief rotate existing transform matrix around Y axis by angle
|
* @brief rotate existing transform matrix around Y axis by angle
|
||||||
* and store result in dest
|
* and store result in dest
|
||||||
*
|
*
|
||||||
* this is POST transform, applies to existing transform as last transfrom
|
* this is POST transform, applies to existing transform as last transform
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @param[out] dest rotated matrix
|
* @param[out] dest rotated matrix
|
||||||
*/
|
*/
|
||||||
@@ -164,9 +164,9 @@ glm_rotated_y(mat4 m, float angle, mat4 dest) {
|
|||||||
* @brief rotate existing transform matrix around Z axis by angle
|
* @brief rotate existing transform matrix around Z axis by angle
|
||||||
* and store result in dest
|
* and store result in dest
|
||||||
*
|
*
|
||||||
* this is POST transform, applies to existing transform as last transfrom
|
* this is POST transform, applies to existing transform as last transform
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @param[out] dest rotated matrix
|
* @param[out] dest rotated matrix
|
||||||
*/
|
*/
|
||||||
@@ -190,9 +190,9 @@ glm_rotated_z(mat4 m, float angle, mat4 dest) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief rotate existing transform matrix around given axis by angle
|
* @brief rotate existing transform matrix around given axis by angle
|
||||||
*
|
*
|
||||||
* this is POST transform, applies to existing transform as last transfrom
|
* this is POST transform, applies to existing transform as last transform
|
||||||
*
|
*
|
||||||
* @param[in, out] m affine transfrom
|
* @param[in, out] m affine transform
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @param[in] axis axis
|
* @param[in] axis axis
|
||||||
*/
|
*/
|
||||||
@@ -208,9 +208,9 @@ glm_rotated(mat4 m, float angle, vec3 axis) {
|
|||||||
* @brief rotate existing transform
|
* @brief rotate existing transform
|
||||||
* around given axis by angle at given pivot point (rotation center)
|
* around given axis by angle at given pivot point (rotation center)
|
||||||
*
|
*
|
||||||
* this is POST transform, applies to existing transform as last transfrom
|
* this is POST transform, applies to existing transform as last transform
|
||||||
*
|
*
|
||||||
* @param[in, out] m affine transfrom
|
* @param[in, out] m affine transform
|
||||||
* @param[in] pivot rotation center
|
* @param[in] pivot rotation center
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @param[in] axis axis
|
* @param[in] axis axis
|
||||||
@@ -230,9 +230,9 @@ glm_rotated_at(mat4 m, vec3 pivot, float angle, vec3 axis) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief rotate existing transform matrix around given axis by angle around self (doesn't affected by position)
|
* @brief rotate existing transform matrix around given axis by angle around self (doesn't affected by position)
|
||||||
*
|
*
|
||||||
* this is POST transform, applies to existing transform as last transfrom
|
* this is POST transform, applies to existing transform as last transform
|
||||||
*
|
*
|
||||||
* @param[in, out] m affine transfrom
|
* @param[in, out] m affine transform
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @param[in] axis axis
|
* @param[in] axis axis
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
* @brief translate existing transform matrix by v vector
|
* @brief translate existing transform matrix by v vector
|
||||||
* and stores result in same matrix
|
* and stores result in same matrix
|
||||||
*
|
*
|
||||||
* @param[in, out] m affine transfrom
|
* @param[in, out] m affine transform
|
||||||
* @param[in] v translate vector [x, y, z]
|
* @param[in] v translate vector [x, y, z]
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
@@ -66,7 +66,7 @@ glm_translate(mat4 m, vec3 v) {
|
|||||||
*
|
*
|
||||||
* source matrix will remain same
|
* source matrix will remain same
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] v translate vector [x, y, z]
|
* @param[in] v translate vector [x, y, z]
|
||||||
* @param[out] dest translated matrix
|
* @param[out] dest translated matrix
|
||||||
*/
|
*/
|
||||||
@@ -80,7 +80,7 @@ glm_translate_to(mat4 m, vec3 v, mat4 dest) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief translate existing transform matrix by x factor
|
* @brief translate existing transform matrix by x factor
|
||||||
*
|
*
|
||||||
* @param[in, out] m affine transfrom
|
* @param[in, out] m affine transform
|
||||||
* @param[in] x x factor
|
* @param[in] x x factor
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
@@ -98,7 +98,7 @@ glm_translate_x(mat4 m, float x) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief translate existing transform matrix by y factor
|
* @brief translate existing transform matrix by y factor
|
||||||
*
|
*
|
||||||
* @param[in, out] m affine transfrom
|
* @param[in, out] m affine transform
|
||||||
* @param[in] y y factor
|
* @param[in] y y factor
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
@@ -116,7 +116,7 @@ glm_translate_y(mat4 m, float y) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief translate existing transform matrix by z factor
|
* @brief translate existing transform matrix by z factor
|
||||||
*
|
*
|
||||||
* @param[in, out] m affine transfrom
|
* @param[in, out] m affine transform
|
||||||
* @param[in] z z factor
|
* @param[in] z z factor
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
@@ -135,7 +135,7 @@ glm_translate_z(mat4 m, float z) {
|
|||||||
* @brief rotate existing transform matrix around X axis by angle
|
* @brief rotate existing transform matrix around X axis by angle
|
||||||
* and store result in dest
|
* and store result in dest
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @param[out] dest rotated matrix
|
* @param[out] dest rotated matrix
|
||||||
*/
|
*/
|
||||||
@@ -160,7 +160,7 @@ glm_rotate_x(mat4 m, float angle, mat4 dest) {
|
|||||||
* @brief rotate existing transform matrix around Y axis by angle
|
* @brief rotate existing transform matrix around Y axis by angle
|
||||||
* and store result in dest
|
* and store result in dest
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @param[out] dest rotated matrix
|
* @param[out] dest rotated matrix
|
||||||
*/
|
*/
|
||||||
@@ -185,7 +185,7 @@ glm_rotate_y(mat4 m, float angle, mat4 dest) {
|
|||||||
* @brief rotate existing transform matrix around Z axis by angle
|
* @brief rotate existing transform matrix around Z axis by angle
|
||||||
* and store result in dest
|
* and store result in dest
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @param[out] dest rotated matrix
|
* @param[out] dest rotated matrix
|
||||||
*/
|
*/
|
||||||
@@ -209,7 +209,7 @@ glm_rotate_z(mat4 m, float angle, mat4 dest) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief rotate existing transform matrix around given axis by angle
|
* @brief rotate existing transform matrix around given axis by angle
|
||||||
*
|
*
|
||||||
* @param[in, out] m affine transfrom
|
* @param[in, out] m affine transform
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @param[in] axis axis
|
* @param[in] axis axis
|
||||||
*/
|
*/
|
||||||
@@ -225,7 +225,7 @@ glm_rotate(mat4 m, float angle, vec3 axis) {
|
|||||||
* @brief rotate existing transform
|
* @brief rotate existing transform
|
||||||
* around given axis by angle at given pivot point (rotation center)
|
* around given axis by angle at given pivot point (rotation center)
|
||||||
*
|
*
|
||||||
* @param[in, out] m affine transfrom
|
* @param[in, out] m affine transform
|
||||||
* @param[in] pivot rotation center
|
* @param[in] pivot rotation center
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @param[in] axis axis
|
* @param[in] axis axis
|
||||||
@@ -250,7 +250,7 @@ glm_rotate_at(mat4 m, vec3 pivot, float angle, vec3 axis) {
|
|||||||
* this should work faster than glm_rotate_at because it reduces
|
* this should work faster than glm_rotate_at because it reduces
|
||||||
* one glm_translate.
|
* one glm_translate.
|
||||||
*
|
*
|
||||||
* @param[out] m affine transfrom
|
* @param[out] m affine transform
|
||||||
* @param[in] pivot rotation center
|
* @param[in] pivot rotation center
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @param[in] axis axis
|
* @param[in] axis axis
|
||||||
@@ -270,7 +270,7 @@ glm_rotate_atm(mat4 m, vec3 pivot, float angle, vec3 axis) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief rotate existing transform matrix around given axis by angle around self (doesn't affected by position)
|
* @brief rotate existing transform matrix around given axis by angle around self (doesn't affected by position)
|
||||||
*
|
*
|
||||||
* @param[in, out] m affine transfrom
|
* @param[in, out] m affine transform
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @param[in] axis axis
|
* @param[in] axis axis
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* @brief creates NEW translate transform matrix by v vector
|
* @brief creates NEW translate transform matrix by v vector
|
||||||
*
|
*
|
||||||
* @param[out] m affine transfrom
|
* @param[out] m affine transform
|
||||||
* @param[in] v translate vector [x, y, z]
|
* @param[in] v translate vector [x, y, z]
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
@@ -58,7 +58,7 @@ glm_translate_make(mat4 m, vec3 v) {
|
|||||||
* @brief scale existing transform matrix by v vector
|
* @brief scale existing transform matrix by v vector
|
||||||
* and store result in dest
|
* and store result in dest
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] v scale vector [x, y, z]
|
* @param[in] v scale vector [x, y, z]
|
||||||
* @param[out] dest scaled matrix
|
* @param[out] dest scaled matrix
|
||||||
*/
|
*/
|
||||||
@@ -75,7 +75,7 @@ glm_scale_to(mat4 m, vec3 v, mat4 dest) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief creates NEW scale matrix by v vector
|
* @brief creates NEW scale matrix by v vector
|
||||||
*
|
*
|
||||||
* @param[out] m affine transfrom
|
* @param[out] m affine transform
|
||||||
* @param[in] v scale vector [x, y, z]
|
* @param[in] v scale vector [x, y, z]
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
@@ -91,7 +91,7 @@ glm_scale_make(mat4 m, vec3 v) {
|
|||||||
* @brief scales existing transform matrix by v vector
|
* @brief scales existing transform matrix by v vector
|
||||||
* and stores result in same matrix
|
* and stores result in same matrix
|
||||||
*
|
*
|
||||||
* @param[in, out] m affine transfrom
|
* @param[in, out] m affine transform
|
||||||
* @param[in] v scale vector [x, y, z]
|
* @param[in] v scale vector [x, y, z]
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
@@ -104,7 +104,7 @@ glm_scale(mat4 m, vec3 v) {
|
|||||||
* @brief applies uniform scale to existing transform matrix v = [s, s, s]
|
* @brief applies uniform scale to existing transform matrix v = [s, s, s]
|
||||||
* and stores result in same matrix
|
* and stores result in same matrix
|
||||||
*
|
*
|
||||||
* @param[in, out] m affine transfrom
|
* @param[in, out] m affine transform
|
||||||
* @param[in] s scale factor
|
* @param[in] s scale factor
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
@@ -119,7 +119,7 @@ glm_scale_uni(mat4 m, float s) {
|
|||||||
*
|
*
|
||||||
* axis will be normalized so you don't need to normalize it
|
* axis will be normalized so you don't need to normalize it
|
||||||
*
|
*
|
||||||
* @param[out] m affine transfrom
|
* @param[out] m affine transform
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @param[in] axis axis
|
* @param[in] axis axis
|
||||||
*/
|
*/
|
||||||
@@ -220,7 +220,7 @@ glm_decompose_rs(mat4 m, mat4 r, vec3 s) {
|
|||||||
* @brief decompose affine transform, TODO: extract shear factors.
|
* @brief decompose affine transform, TODO: extract shear factors.
|
||||||
* DON'T pass projected matrix here
|
* DON'T pass projected matrix here
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[out] t translation vector
|
* @param[out] t translation vector
|
||||||
* @param[out] r rotation matrix (mat4)
|
* @param[out] r rotation matrix (mat4)
|
||||||
* @param[out] s scaling vector [X, Y, Z]
|
* @param[out] s scaling vector [X, Y, Z]
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
* @brief translate existing 2d transform matrix by v vector
|
* @brief translate existing 2d transform matrix by v vector
|
||||||
* and stores result in same matrix
|
* and stores result in same matrix
|
||||||
*
|
*
|
||||||
* @param[in, out] m affine transfrom
|
* @param[in, out] m affine transform
|
||||||
* @param[in] v translate vector [x, y]
|
* @param[in] v translate vector [x, y]
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
@@ -50,7 +50,7 @@ glm_translate2d(mat3 m, vec2 v) {
|
|||||||
*
|
*
|
||||||
* source matrix will remain same
|
* source matrix will remain same
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] v translate vector [x, y]
|
* @param[in] v translate vector [x, y]
|
||||||
* @param[out] dest translated matrix
|
* @param[out] dest translated matrix
|
||||||
*/
|
*/
|
||||||
@@ -64,7 +64,7 @@ glm_translate2d_to(mat3 m, vec2 v, mat3 dest) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief translate existing 2d transform matrix by x factor
|
* @brief translate existing 2d transform matrix by x factor
|
||||||
*
|
*
|
||||||
* @param[in, out] m affine transfrom
|
* @param[in, out] m affine transform
|
||||||
* @param[in] x x factor
|
* @param[in] x x factor
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
@@ -78,7 +78,7 @@ glm_translate2d_x(mat3 m, float x) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief translate existing 2d transform matrix by y factor
|
* @brief translate existing 2d transform matrix by y factor
|
||||||
*
|
*
|
||||||
* @param[in, out] m affine transfrom
|
* @param[in, out] m affine transform
|
||||||
* @param[in] y y factor
|
* @param[in] y y factor
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
@@ -92,7 +92,7 @@ glm_translate2d_y(mat3 m, float y) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief creates NEW translate 2d transform matrix by v vector
|
* @brief creates NEW translate 2d transform matrix by v vector
|
||||||
*
|
*
|
||||||
* @param[out] m affine transfrom
|
* @param[out] m affine transform
|
||||||
* @param[in] v translate vector [x, y]
|
* @param[in] v translate vector [x, y]
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
@@ -107,7 +107,7 @@ glm_translate2d_make(mat3 m, vec2 v) {
|
|||||||
* @brief scale existing 2d transform matrix by v vector
|
* @brief scale existing 2d transform matrix by v vector
|
||||||
* and store result in dest
|
* and store result in dest
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] v scale vector [x, y]
|
* @param[in] v scale vector [x, y]
|
||||||
* @param[out] dest scaled matrix
|
* @param[out] dest scaled matrix
|
||||||
*/
|
*/
|
||||||
@@ -130,7 +130,7 @@ glm_scale2d_to(mat3 m, vec2 v, mat3 dest) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief creates NEW 2d scale matrix by v vector
|
* @brief creates NEW 2d scale matrix by v vector
|
||||||
*
|
*
|
||||||
* @param[out] m affine transfrom
|
* @param[out] m affine transform
|
||||||
* @param[in] v scale vector [x, y]
|
* @param[in] v scale vector [x, y]
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
@@ -145,7 +145,7 @@ glm_scale2d_make(mat3 m, vec2 v) {
|
|||||||
* @brief scales existing 2d transform matrix by v vector
|
* @brief scales existing 2d transform matrix by v vector
|
||||||
* and stores result in same matrix
|
* and stores result in same matrix
|
||||||
*
|
*
|
||||||
* @param[in, out] m affine transfrom
|
* @param[in, out] m affine transform
|
||||||
* @param[in] v scale vector [x, y]
|
* @param[in] v scale vector [x, y]
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
@@ -164,7 +164,7 @@ glm_scale2d(mat3 m, vec2 v) {
|
|||||||
* @brief applies uniform scale to existing 2d transform matrix v = [s, s]
|
* @brief applies uniform scale to existing 2d transform matrix v = [s, s]
|
||||||
* and stores result in same matrix
|
* and stores result in same matrix
|
||||||
*
|
*
|
||||||
* @param[in, out] m affine transfrom
|
* @param[in, out] m affine transform
|
||||||
* @param[in] s scale factor
|
* @param[in] s scale factor
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
@@ -182,7 +182,7 @@ glm_scale2d_uni(mat3 m, float s) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief creates NEW rotation matrix by angle around Z axis
|
* @brief creates NEW rotation matrix by angle around Z axis
|
||||||
*
|
*
|
||||||
* @param[out] m affine transfrom
|
* @param[out] m affine transform
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
@@ -210,7 +210,7 @@ glm_rotate2d_make(mat3 m, float angle) {
|
|||||||
* @brief rotate existing 2d transform matrix around Z axis by angle
|
* @brief rotate existing 2d transform matrix around Z axis by angle
|
||||||
* and store result in same matrix
|
* and store result in same matrix
|
||||||
*
|
*
|
||||||
* @param[in, out] m affine transfrom
|
* @param[in, out] m affine transform
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
@@ -237,7 +237,7 @@ glm_rotate2d(mat3 m, float angle) {
|
|||||||
* @brief rotate existing 2d transform matrix around Z axis by angle
|
* @brief rotate existing 2d transform matrix around Z axis by angle
|
||||||
* and store result in dest
|
* and store result in dest
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @param[out] dest destination
|
* @param[out] dest destination
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ glm_aabb_crop(vec3 box[2], vec3 cropBox[2], vec3 dest[2]) {
|
|||||||
*
|
*
|
||||||
* @param[in] box bounding box
|
* @param[in] box bounding box
|
||||||
* @param[in] cropBox crop box
|
* @param[in] cropBox crop box
|
||||||
* @param[in] clampBox miniumum box
|
* @param[in] clampBox minimum box
|
||||||
* @param[out] dest cropped bounding box
|
* @param[out] dest cropped bounding box
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
|
|||||||
@@ -474,7 +474,7 @@ glm_persp_decomp_x(mat4 proj,
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief decomposes top and bottom values of perspective projection.
|
* @brief decomposes top and bottom values of perspective projection.
|
||||||
* y stands for y axis (top / botom axis)
|
* y stands for y axis (top / bottom axis)
|
||||||
*
|
*
|
||||||
* @param[in] proj perspective projection matrix
|
* @param[in] proj perspective projection matrix
|
||||||
* @param[out] top top
|
* @param[out] top top
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ glm_persp_decomp_x_lh_no(mat4 proj,
|
|||||||
* @brief decomposes top and bottom values of perspective projection
|
* @brief decomposes top and bottom values of perspective projection
|
||||||
* with a left-hand coordinate system and a
|
* with a left-hand coordinate system and a
|
||||||
* clip-space of [-1, 1].
|
* clip-space of [-1, 1].
|
||||||
* y stands for y axis (top / botom axis)
|
* y stands for y axis (top / bottom axis)
|
||||||
*
|
*
|
||||||
* @param[in] proj perspective projection matrix
|
* @param[in] proj perspective projection matrix
|
||||||
* @param[out] top top
|
* @param[out] top top
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ glm_persp_decomp_x_rh_no(mat4 proj,
|
|||||||
* @brief decomposes top and bottom values of perspective projection
|
* @brief decomposes top and bottom values of perspective projection
|
||||||
* with a right-hand coordinate system and a
|
* with a right-hand coordinate system and a
|
||||||
* clip-space of [-1, 1].
|
* clip-space of [-1, 1].
|
||||||
* y stands for y axis (top / botom axis)
|
* y stands for y axis (top / bottom axis)
|
||||||
*
|
*
|
||||||
* @param[in] proj perspective projection matrix
|
* @param[in] proj perspective projection matrix
|
||||||
* @param[out] top top
|
* @param[out] top top
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
NOTE:
|
NOTE:
|
||||||
angles must be passed as [X-Angle, Y-Angle, Z-angle] order
|
angles must be passed as [X-Angle, Y-Angle, Z-angle] order
|
||||||
For instance you don't pass angles as [Z-Angle, X-Angle, Y-angle] to
|
For instance you don't pass angles as [Z-Angle, X-Angle, Y-angle] to
|
||||||
glm_euler_zxy funciton, All RELATED functions accept angles same order
|
glm_euler_zxy function, All RELATED functions accept angles same order
|
||||||
which is [X, Y, Z].
|
which is [X, Y, Z].
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ glm_ivec2_subs(ivec2 v, int s, ivec2 dest) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief multiply vector [a] with vector [b] and store result in [dest]
|
* @brief multiply vector [a] with vector [b] and store result in [dest]
|
||||||
*
|
*
|
||||||
* @param[in] a frist vector
|
* @param[in] a first vector
|
||||||
* @param[in] b second vector
|
* @param[in] b second vector
|
||||||
* @param[out] dest destination
|
* @param[out] dest destination
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ glm_ivec3_dot(ivec3 a, ivec3 b) {
|
|||||||
* @brief norm * norm (magnitude) of vec
|
* @brief norm * norm (magnitude) of vec
|
||||||
*
|
*
|
||||||
* we can use this func instead of calling norm * norm, because it would call
|
* we can use this func instead of calling norm * norm, because it would call
|
||||||
* sqrtf fuction twice but with this func we can avoid func call, maybe this is
|
* sqrtf function twice but with this func we can avoid func call, maybe this is
|
||||||
* not good name for this func
|
* not good name for this func
|
||||||
*
|
*
|
||||||
* @param[in] v vector
|
* @param[in] v vector
|
||||||
@@ -226,7 +226,7 @@ glm_ivec3_subs(ivec3 v, int s, ivec3 dest) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief multiply vector [a] with vector [b] and store result in [dest]
|
* @brief multiply vector [a] with vector [b] and store result in [dest]
|
||||||
*
|
*
|
||||||
* @param[in] a frist vector
|
* @param[in] a first vector
|
||||||
* @param[in] b second vector
|
* @param[in] b second vector
|
||||||
* @param[out] dest destination
|
* @param[out] dest destination
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ glm_ivec4_subs(ivec4 v, int s, ivec4 dest) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief multiply vector [a] with vector [b] and store result in [dest]
|
* @brief multiply vector [a] with vector [b] and store result in [dest]
|
||||||
*
|
*
|
||||||
* @param[in] a frist vector
|
* @param[in] a first vector
|
||||||
* @param[in] b second vector
|
* @param[in] b second vector
|
||||||
* @param[out] dest destination
|
* @param[out] dest destination
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ glm_mat2_transpose_to(mat2 m, mat2 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief tranpose mat2 and store result in same matrix
|
* @brief transpose mat2 and store result in same matrix
|
||||||
*
|
*
|
||||||
* @param[in, out] m source and dest
|
* @param[in, out] m source and dest
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ glm_mat3_transpose_to(mat3 m, mat3 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief tranpose mat3 and store result in same matrix
|
* @brief transpose mat3 and store result in same matrix
|
||||||
*
|
*
|
||||||
* @param[in, out] m source and dest
|
* @param[in, out] m source and dest
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -537,7 +537,7 @@ glm_mat4_transpose_to(mat4 m, mat4 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief tranpose mat4 and store result in same matrix
|
* @brief transpose mat4 and store result in same matrix
|
||||||
*
|
*
|
||||||
* @param[in, out] m source and dest
|
* @param[in, out] m source and dest
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -703,7 +703,7 @@ glm_quat_nlerp(versor from, versor to, float t, versor dest) {
|
|||||||
*
|
*
|
||||||
* @param[in] from from
|
* @param[in] from from
|
||||||
* @param[in] to to
|
* @param[in] to to
|
||||||
* @param[in] t amout
|
* @param[in] t amount
|
||||||
* @param[out] dest result quaternion
|
* @param[out] dest result quaternion
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ glms_aabb2d_(crop)(vec2s aabb[2], vec2s cropAabb[2], vec2s dest[2]) {
|
|||||||
*
|
*
|
||||||
* @param[in] aabb bounding box
|
* @param[in] aabb bounding box
|
||||||
* @param[in] cropAabb crop box
|
* @param[in] cropAabb crop box
|
||||||
* @param[in] clampAabb miniumum box
|
* @param[in] clampAabb minimum box
|
||||||
* @param[out] dest cropped bounding box
|
* @param[out] dest cropped bounding box
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
|
|||||||
@@ -33,9 +33,9 @@
|
|||||||
* @brief translate existing transform matrix by v vector
|
* @brief translate existing transform matrix by v vector
|
||||||
* and stores result in same matrix
|
* and stores result in same matrix
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] v translate vector [x, y, z]
|
* @param[in] v translate vector [x, y, z]
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4s
|
mat4s
|
||||||
@@ -47,9 +47,9 @@ glms_translated(mat4s m, vec3s v) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief translate existing transform matrix by x factor
|
* @brief translate existing transform matrix by x factor
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] x x factor
|
* @param[in] x x factor
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4s
|
mat4s
|
||||||
@@ -61,9 +61,9 @@ glms_translated_x(mat4s m, float x) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief translate existing transform matrix by y factor
|
* @brief translate existing transform matrix by y factor
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] y y factor
|
* @param[in] y y factor
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4s
|
mat4s
|
||||||
@@ -75,9 +75,9 @@ glms_translated_y(mat4s m, float y) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief translate existing transform matrix by z factor
|
* @brief translate existing transform matrix by z factor
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] z z factor
|
* @param[in] z z factor
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4s
|
mat4s
|
||||||
@@ -90,7 +90,7 @@ glms_translated_z(mat4s m, float z) {
|
|||||||
* @brief rotate existing transform matrix around X axis by angle
|
* @brief rotate existing transform matrix around X axis by angle
|
||||||
* and store result in dest
|
* and store result in dest
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @returns rotated matrix
|
* @returns rotated matrix
|
||||||
*/
|
*/
|
||||||
@@ -106,7 +106,7 @@ glms_rotated_x(mat4s m, float angle) {
|
|||||||
* @brief rotate existing transform matrix around Y axis by angle
|
* @brief rotate existing transform matrix around Y axis by angle
|
||||||
* and store result in dest
|
* and store result in dest
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @returns rotated matrix
|
* @returns rotated matrix
|
||||||
*/
|
*/
|
||||||
@@ -122,7 +122,7 @@ glms_rotated_y(mat4s m, float angle) {
|
|||||||
* @brief rotate existing transform matrix around Z axis by angle
|
* @brief rotate existing transform matrix around Z axis by angle
|
||||||
* and store result in dest
|
* and store result in dest
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @returns rotated matrix
|
* @returns rotated matrix
|
||||||
*/
|
*/
|
||||||
@@ -137,10 +137,10 @@ glms_rotated_z(mat4s m, float angle) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief rotate existing transform matrix around given axis by angle
|
* @brief rotate existing transform matrix around given axis by angle
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @param[in] axis axis
|
* @param[in] axis axis
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4s
|
mat4s
|
||||||
@@ -153,11 +153,11 @@ glms_rotated(mat4s m, float angle, vec3s axis) {
|
|||||||
* @brief rotate existing transform
|
* @brief rotate existing transform
|
||||||
* around given axis by angle at given pivot point (rotation center)
|
* around given axis by angle at given pivot point (rotation center)
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] pivot rotation center
|
* @param[in] pivot rotation center
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @param[in] axis axis
|
* @param[in] axis axis
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4s
|
mat4s
|
||||||
@@ -169,10 +169,10 @@ glms_rotated_at(mat4s m, vec3s pivot, float angle, vec3s axis) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief rotate existing transform matrix around given axis by angle around self (doesn't affected by position)
|
* @brief rotate existing transform matrix around given axis by angle around self (doesn't affected by position)
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @param[in] axis axis
|
* @param[in] axis axis
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4s
|
mat4s
|
||||||
|
|||||||
@@ -33,9 +33,9 @@
|
|||||||
* @brief translate existing transform matrix by v vector
|
* @brief translate existing transform matrix by v vector
|
||||||
* and stores result in same matrix
|
* and stores result in same matrix
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] v translate vector [x, y, z]
|
* @param[in] v translate vector [x, y, z]
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4s
|
mat4s
|
||||||
@@ -47,9 +47,9 @@ glms_translate(mat4s m, vec3s v) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief translate existing transform matrix by x factor
|
* @brief translate existing transform matrix by x factor
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] x x factor
|
* @param[in] x x factor
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4s
|
mat4s
|
||||||
@@ -61,9 +61,9 @@ glms_translate_x(mat4s m, float x) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief translate existing transform matrix by y factor
|
* @brief translate existing transform matrix by y factor
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] y y factor
|
* @param[in] y y factor
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4s
|
mat4s
|
||||||
@@ -75,9 +75,9 @@ glms_translate_y(mat4s m, float y) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief translate existing transform matrix by z factor
|
* @brief translate existing transform matrix by z factor
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] z z factor
|
* @param[in] z z factor
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4s
|
mat4s
|
||||||
@@ -90,7 +90,7 @@ glms_translate_z(mat4s m, float z) {
|
|||||||
* @brief rotate existing transform matrix around X axis by angle
|
* @brief rotate existing transform matrix around X axis by angle
|
||||||
* and store result in dest
|
* and store result in dest
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @returns rotated matrix
|
* @returns rotated matrix
|
||||||
*/
|
*/
|
||||||
@@ -106,7 +106,7 @@ glms_rotate_x(mat4s m, float angle) {
|
|||||||
* @brief rotate existing transform matrix around Y axis by angle
|
* @brief rotate existing transform matrix around Y axis by angle
|
||||||
* and store result in dest
|
* and store result in dest
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @returns rotated matrix
|
* @returns rotated matrix
|
||||||
*/
|
*/
|
||||||
@@ -122,7 +122,7 @@ glms_rotate_y(mat4s m, float angle) {
|
|||||||
* @brief rotate existing transform matrix around Z axis by angle
|
* @brief rotate existing transform matrix around Z axis by angle
|
||||||
* and store result in dest
|
* and store result in dest
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @returns rotated matrix
|
* @returns rotated matrix
|
||||||
*/
|
*/
|
||||||
@@ -137,10 +137,10 @@ glms_rotate_z(mat4s m, float angle) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief rotate existing transform matrix around given axis by angle
|
* @brief rotate existing transform matrix around given axis by angle
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @param[in] axis axis
|
* @param[in] axis axis
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4s
|
mat4s
|
||||||
@@ -153,11 +153,11 @@ glms_rotate(mat4s m, float angle, vec3s axis) {
|
|||||||
* @brief rotate existing transform
|
* @brief rotate existing transform
|
||||||
* around given axis by angle at given pivot point (rotation center)
|
* around given axis by angle at given pivot point (rotation center)
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] pivot rotation center
|
* @param[in] pivot rotation center
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @param[in] axis axis
|
* @param[in] axis axis
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4s
|
mat4s
|
||||||
@@ -169,10 +169,10 @@ glms_rotate_at(mat4s m, vec3s pivot, float angle, vec3s axis) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief rotate existing transform matrix around given axis by angle around self (doesn't affected by position)
|
* @brief rotate existing transform matrix around given axis by angle around self (doesn't affected by position)
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @param[in] axis axis
|
* @param[in] axis axis
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4s
|
mat4s
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
* @brief creates NEW translate transform matrix by v vector
|
* @brief creates NEW translate transform matrix by v vector
|
||||||
*
|
*
|
||||||
* @param[in] v translate vector [x, y, z]
|
* @param[in] v translate vector [x, y, z]
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4s
|
mat4s
|
||||||
@@ -59,7 +59,7 @@ glms_translate_make(vec3s v) {
|
|||||||
* @brief creates NEW scale matrix by v vector
|
* @brief creates NEW scale matrix by v vector
|
||||||
*
|
*
|
||||||
* @param[in] v scale vector [x, y, z]
|
* @param[in] v scale vector [x, y, z]
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4s
|
mat4s
|
||||||
@@ -73,9 +73,9 @@ glms_scale_make(vec3s v) {
|
|||||||
* @brief scales existing transform matrix by v vector
|
* @brief scales existing transform matrix by v vector
|
||||||
* and stores result in same matrix
|
* and stores result in same matrix
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] v scale vector [x, y, z]
|
* @param[in] v scale vector [x, y, z]
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4s
|
mat4s
|
||||||
@@ -89,9 +89,9 @@ glms_scale(mat4s m, vec3s v) {
|
|||||||
* @brief applies uniform scale to existing transform matrix v = [s, s, s]
|
* @brief applies uniform scale to existing transform matrix v = [s, s, s]
|
||||||
* and stores result in same matrix
|
* and stores result in same matrix
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] s scale factor
|
* @param[in] s scale factor
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4s
|
mat4s
|
||||||
@@ -107,7 +107,7 @@ glms_scale_uni(mat4s m, float s) {
|
|||||||
*
|
*
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @param[in] axis axis
|
* @param[in] axis axis
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4s
|
mat4s
|
||||||
@@ -128,7 +128,7 @@ glms_rotate_make(float angle, vec3s axis) {
|
|||||||
* @param[in] pivot rotation center
|
* @param[in] pivot rotation center
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @param[in] axis axis
|
* @param[in] axis axis
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4s
|
mat4s
|
||||||
@@ -184,7 +184,7 @@ glms_decompose_rs(mat4s m, mat4s * __restrict r, vec3s * __restrict s) {
|
|||||||
* @brief decompose affine transform, TODO: extract shear factors.
|
* @brief decompose affine transform, TODO: extract shear factors.
|
||||||
* DON'T pass projected matrix here
|
* DON'T pass projected matrix here
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[out] t translation vector
|
* @param[out] t translation vector
|
||||||
* @param[out] r rotation matrix (mat4)
|
* @param[out] r rotation matrix (mat4)
|
||||||
* @param[out] s scaling vector [X, Y, Z]
|
* @param[out] s scaling vector [X, Y, Z]
|
||||||
|
|||||||
@@ -32,9 +32,9 @@
|
|||||||
* @brief translate existing 2d transform matrix by v vector
|
* @brief translate existing 2d transform matrix by v vector
|
||||||
* and stores result in same matrix
|
* and stores result in same matrix
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] v translate vector [x, y]
|
* @param[in] v translate vector [x, y]
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat3s
|
mat3s
|
||||||
@@ -46,9 +46,9 @@ glms_translate2d(mat3s m, vec2s v) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief translate existing 2d transform matrix by x factor
|
* @brief translate existing 2d transform matrix by x factor
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] x x factor
|
* @param[in] x x factor
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat3s
|
mat3s
|
||||||
@@ -60,9 +60,9 @@ glms_translate2d_x(mat3s m, float x) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief translate existing 2d transform matrix by y factor
|
* @brief translate existing 2d transform matrix by y factor
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] y y factor
|
* @param[in] y y factor
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat3s
|
mat3s
|
||||||
@@ -75,7 +75,7 @@ glms_translate2d_y(mat3s m, float y) {
|
|||||||
* @brief creates NEW translate 2d transform matrix by v vector
|
* @brief creates NEW translate 2d transform matrix by v vector
|
||||||
*
|
*
|
||||||
* @param[in] v translate vector [x, y]
|
* @param[in] v translate vector [x, y]
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat3s
|
mat3s
|
||||||
@@ -89,7 +89,7 @@ glms_translate2d_make(vec2s v) {
|
|||||||
* @brief creates NEW 2d scale matrix by v vector
|
* @brief creates NEW 2d scale matrix by v vector
|
||||||
*
|
*
|
||||||
* @param[in] v scale vector [x, y]
|
* @param[in] v scale vector [x, y]
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat3s
|
mat3s
|
||||||
@@ -103,9 +103,9 @@ glms_scale2d_make(vec2s v) {
|
|||||||
* @brief scales existing 2d transform matrix by v vector
|
* @brief scales existing 2d transform matrix by v vector
|
||||||
* and stores result in same matrix
|
* and stores result in same matrix
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] v scale vector [x, y, z]
|
* @param[in] v scale vector [x, y, z]
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat3s
|
mat3s
|
||||||
@@ -119,9 +119,9 @@ glms_scale2d(mat3s m, vec2s v) {
|
|||||||
* @brief applies uniform scale to existing 2d transform matrix v = [s, s, s]
|
* @brief applies uniform scale to existing 2d transform matrix v = [s, s, s]
|
||||||
* and stores result in same matrix
|
* and stores result in same matrix
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] s scale factor
|
* @param[in] s scale factor
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat3s
|
mat3s
|
||||||
@@ -136,7 +136,7 @@ glms_scale2d_uni(mat3s m, float s) {
|
|||||||
* axis will be normalized so you don't need to normalize it
|
* axis will be normalized so you don't need to normalize it
|
||||||
*
|
*
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat3s
|
mat3s
|
||||||
@@ -149,9 +149,9 @@ glms_rotate2d_make(float angle) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief rotate existing 2d transform matrix around given axis by angle
|
* @brief rotate existing 2d transform matrix around given axis by angle
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat3s
|
mat3s
|
||||||
@@ -163,9 +163,9 @@ glms_rotate2d(mat3s m, float angle) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief rotate existing 2d transform matrix around given axis by angle
|
* @brief rotate existing 2d transform matrix around given axis by angle
|
||||||
*
|
*
|
||||||
* @param[in] m affine transfrom
|
* @param[in] m affine transform
|
||||||
* @param[in] angle angle (radians)
|
* @param[in] angle angle (radians)
|
||||||
* @returns affine transfrom
|
* @returns affine transform
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat3s
|
mat3s
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ glms_aabb_(crop)(vec3s box[2], vec3s cropBox[2], vec3s dest[2]) {
|
|||||||
*
|
*
|
||||||
* @param[in] box bounding box
|
* @param[in] box bounding box
|
||||||
* @param[in] cropBox crop box
|
* @param[in] cropBox crop box
|
||||||
* @param[in] clampBox miniumum box
|
* @param[in] clampBox minimum box
|
||||||
* @param[out] dest cropped bounding box
|
* @param[out] dest cropped bounding box
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
|
|||||||
@@ -495,7 +495,7 @@ glms_persp_decomp_x(mat4s proj,
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief decomposes top and bottom values of perspective projection.
|
* @brief decomposes top and bottom values of perspective projection.
|
||||||
* y stands for y axis (top / botom axis)
|
* y stands for y axis (top / bottom axis)
|
||||||
*
|
*
|
||||||
* @param[in] proj perspective projection matrix
|
* @param[in] proj perspective projection matrix
|
||||||
* @param[out] top top
|
* @param[out] top top
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ glms_persp_decomp_x_lh_no(mat4s proj,
|
|||||||
* @brief decomposes top and bottom values of perspective projection
|
* @brief decomposes top and bottom values of perspective projection
|
||||||
* with a left-hand coordinate system and a
|
* with a left-hand coordinate system and a
|
||||||
* clip-space of [-1, 1].
|
* clip-space of [-1, 1].
|
||||||
* y stands for y axis (top / botom axis)
|
* y stands for y axis (top / bottom axis)
|
||||||
*
|
*
|
||||||
* @param[in] proj perspective projection matrix
|
* @param[in] proj perspective projection matrix
|
||||||
* @param[out] top top
|
* @param[out] top top
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ glms_persp_decomp_x_lh_zo(mat4s proj,
|
|||||||
* @brief decomposes top and bottom values of perspective projection
|
* @brief decomposes top and bottom values of perspective projection
|
||||||
* with a left-hand coordinate system and a
|
* with a left-hand coordinate system and a
|
||||||
* clip-space of [0, 1].
|
* clip-space of [0, 1].
|
||||||
* y stands for y axis (top / botom axis)
|
* y stands for y axis (top / bottom axis)
|
||||||
*
|
*
|
||||||
* @param[in] proj perspective projection matrix
|
* @param[in] proj perspective projection matrix
|
||||||
* @param[out] top top
|
* @param[out] top top
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ glms_persp_decomp_x_rh_no(mat4s proj,
|
|||||||
* @brief decomposes top and bottom values of perspective projection
|
* @brief decomposes top and bottom values of perspective projection
|
||||||
* with a right-hand coordinate system and a
|
* with a right-hand coordinate system and a
|
||||||
* clip-space of [-1, 1].
|
* clip-space of [-1, 1].
|
||||||
* y stands for y axis (top / botom axis)
|
* y stands for y axis (top / bottom axis)
|
||||||
*
|
*
|
||||||
* @param[in] proj perspective projection matrix
|
* @param[in] proj perspective projection matrix
|
||||||
* @param[out] top top
|
* @param[out] top top
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ glms_persp_decomp_x_rh_zo(mat4s proj,
|
|||||||
* @brief decomposes top and bottom values of perspective projection
|
* @brief decomposes top and bottom values of perspective projection
|
||||||
* with a right-hand coordinate system and a
|
* with a right-hand coordinate system and a
|
||||||
* clip-space of [0, 1].
|
* clip-space of [0, 1].
|
||||||
* y stands for y axis (top / botom axis)
|
* y stands for y axis (top / bottom axis)
|
||||||
*
|
*
|
||||||
* @param[in] proj perspective projection matrix
|
* @param[in] proj perspective projection matrix
|
||||||
* @param[out] top top
|
* @param[out] top top
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
NOTE:
|
NOTE:
|
||||||
angles must be passed as [X-Angle, Y-Angle, Z-angle] order
|
angles must be passed as [X-Angle, Y-Angle, Z-angle] order
|
||||||
For instance you don't pass angles as [Z-Angle, X-Angle, Y-angle] to
|
For instance you don't pass angles as [Z-Angle, X-Angle, Y-angle] to
|
||||||
glm_euler_zxy funciton, All RELATED functions accept angles same order
|
glm_euler_zxy function, All RELATED functions accept angles same order
|
||||||
which is [X, Y, Z].
|
which is [X, Y, Z].
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ glms_mat3_(mul)(mat3s m1, mat3s m2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief tranpose mat3 and store result in same matrix
|
* @brief transpose mat3 and store result in same matrix
|
||||||
*
|
*
|
||||||
* @param[in, out] m source and dest
|
* @param[in, out] m source and dest
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ glms_mat4_(copy)(mat4s mat) {
|
|||||||
* mat4 mat = GLM_MAT4_IDENTITY_INIT;
|
* mat4 mat = GLM_MAT4_IDENTITY_INIT;
|
||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
* @retuns destination
|
* @returns destination
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4s
|
mat4s
|
||||||
@@ -319,7 +319,7 @@ glms_mat4_(mulv3)(mat4s m, vec3s v, float last) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief tranpose mat4 and store result in same matrix
|
* @brief transpose mat4 and store result in same matrix
|
||||||
*
|
*
|
||||||
* @param[in] m source
|
* @param[in] m source
|
||||||
* @returns result
|
* @returns result
|
||||||
|
|||||||
@@ -446,7 +446,7 @@ glms_quat_(nlerp)(versors from, versors to, float t) {
|
|||||||
*
|
*
|
||||||
* @param[in] from from
|
* @param[in] from from
|
||||||
* @param[in] to to
|
* @param[in] to to
|
||||||
* @param[in] t amout
|
* @param[in] t amount
|
||||||
* @returns result quaternion
|
* @returns result quaternion
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ glms_vec2_(cross)(vec2s a, vec2s b) {
|
|||||||
* @brief norm * norm (magnitude) of vec
|
* @brief norm * norm (magnitude) of vec
|
||||||
*
|
*
|
||||||
* we can use this func instead of calling norm * norm, because it would call
|
* we can use this func instead of calling norm * norm, because it would call
|
||||||
* sqrtf fuction twice but with this func we can avoid func call, maybe this is
|
* sqrtf function twice but with this func we can avoid func call, maybe this is
|
||||||
* not good name for this func
|
* not good name for this func
|
||||||
*
|
*
|
||||||
* @param[in] v vector
|
* @param[in] v vector
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ glms_vec3_(dot)(vec3s a, vec3s b) {
|
|||||||
* @brief norm * norm (magnitude) of vec
|
* @brief norm * norm (magnitude) of vec
|
||||||
*
|
*
|
||||||
* we can use this func instead of calling norm * norm, because it would call
|
* we can use this func instead of calling norm * norm, because it would call
|
||||||
* sqrtf fuction twice but with this func we can avoid func call, maybe this is
|
* sqrtf function twice but with this func we can avoid func call, maybe this is
|
||||||
* not good name for this func
|
* not good name for this func
|
||||||
*
|
*
|
||||||
* @param[in] v vector
|
* @param[in] v vector
|
||||||
@@ -656,7 +656,7 @@ glms_vec3_(crossn)(vec3s a, vec3s b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief angle betwen two vector
|
* @brief angle between two vector
|
||||||
*
|
*
|
||||||
* @param[in] a vector1
|
* @param[in] a vector1
|
||||||
* @param[in] b vector2
|
* @param[in] b vector2
|
||||||
@@ -1055,7 +1055,7 @@ glms_normalize(vec3s v) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief swizzle vector components
|
* @brief swizzle vector components
|
||||||
*
|
*
|
||||||
* you can use existin masks e.g. GLM_XXX, GLM_ZYX
|
* you can use existing masks e.g. GLM_XXX, GLM_ZYX
|
||||||
*
|
*
|
||||||
* @param[in] v source
|
* @param[in] v source
|
||||||
* @param[in] mask mask
|
* @param[in] mask mask
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ glms_vec4_(dot)(vec4s a, vec4s b) {
|
|||||||
* @brief norm * norm (magnitude) of vec
|
* @brief norm * norm (magnitude) of vec
|
||||||
*
|
*
|
||||||
* we can use this func instead of calling norm * norm, because it would call
|
* we can use this func instead of calling norm * norm, because it would call
|
||||||
* sqrtf fuction twice but with this func we can avoid func call, maybe this is
|
* sqrtf function twice but with this func we can avoid func call, maybe this is
|
||||||
* not good name for this func
|
* not good name for this func
|
||||||
*
|
*
|
||||||
* @param[in] v vec4
|
* @param[in] v vec4
|
||||||
@@ -899,7 +899,7 @@ glms_vec4_(cubic)(float s) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief swizzle vector components
|
* @brief swizzle vector components
|
||||||
*
|
*
|
||||||
* you can use existin masks e.g. GLM_XXXX, GLM_WZYX
|
* you can use existing masks e.g. GLM_XXXX, GLM_WZYX
|
||||||
*
|
*
|
||||||
* @param[in] v source
|
* @param[in] v source
|
||||||
* @param[in] mask mask
|
* @param[in] mask mask
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ glm_deg(float rad) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief convert exsisting degree to radians. this will override degrees value
|
* @brief convert existing degree to radians. this will override degrees value
|
||||||
*
|
*
|
||||||
* @param[in, out] deg pointer to angle in degrees
|
* @param[in, out] deg pointer to angle in degrees
|
||||||
*/
|
*/
|
||||||
@@ -98,7 +98,7 @@ glm_make_rad(float *deg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief convert exsisting radians to degree. this will override radians value
|
* @brief convert existing radians to degree. this will override radians value
|
||||||
*
|
*
|
||||||
* @param[in, out] rad pointer to angle in radians
|
* @param[in, out] rad pointer to angle in radians
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ glm_vec2_cross(vec2 a, vec2 b) {
|
|||||||
* @brief norm * norm (magnitude) of vec
|
* @brief norm * norm (magnitude) of vec
|
||||||
*
|
*
|
||||||
* we can use this func instead of calling norm * norm, because it would call
|
* we can use this func instead of calling norm * norm, because it would call
|
||||||
* sqrtf fuction twice but with this func we can avoid func call, maybe this is
|
* sqrtf function twice but with this func we can avoid func call, maybe this is
|
||||||
* not good name for this func
|
* not good name for this func
|
||||||
*
|
*
|
||||||
* @param[in] v vector
|
* @param[in] v vector
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ glm_vec3_dot(vec3 a, vec3 b) {
|
|||||||
* @brief norm * norm (magnitude) of vec
|
* @brief norm * norm (magnitude) of vec
|
||||||
*
|
*
|
||||||
* we can use this func instead of calling norm * norm, because it would call
|
* we can use this func instead of calling norm * norm, because it would call
|
||||||
* sqrtf fuction twice but with this func we can avoid func call, maybe this is
|
* sqrtf function twice but with this func we can avoid func call, maybe this is
|
||||||
* not good name for this func
|
* not good name for this func
|
||||||
*
|
*
|
||||||
* @param[in] v vector
|
* @param[in] v vector
|
||||||
@@ -710,7 +710,7 @@ glm_vec3_crossn(vec3 a, vec3 b, vec3 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief angle betwen two vector
|
* @brief angle between two vector
|
||||||
*
|
*
|
||||||
* @param[in] a vector1
|
* @param[in] a vector1
|
||||||
* @param[in] b vector2
|
* @param[in] b vector2
|
||||||
@@ -1112,7 +1112,7 @@ glm_vec3_smoothinterpc(vec3 from, vec3 to, float t, vec3 dest) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief swizzle vector components
|
* @brief swizzle vector components
|
||||||
*
|
*
|
||||||
* you can use existin masks e.g. GLM_XXX, GLM_ZYX
|
* you can use existing masks e.g. GLM_XXX, GLM_ZYX
|
||||||
*
|
*
|
||||||
* @param[in] v source
|
* @param[in] v source
|
||||||
* @param[in] mask mask
|
* @param[in] mask mask
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ glm_vec4_dot(vec4 a, vec4 b) {
|
|||||||
* @brief norm * norm (magnitude) of vec
|
* @brief norm * norm (magnitude) of vec
|
||||||
*
|
*
|
||||||
* we can use this func instead of calling norm * norm, because it would call
|
* we can use this func instead of calling norm * norm, because it would call
|
||||||
* sqrtf fuction twice but with this func we can avoid func call, maybe this is
|
* sqrtf function twice but with this func we can avoid func call, maybe this is
|
||||||
* not good name for this func
|
* not good name for this func
|
||||||
*
|
*
|
||||||
* @param[in] v vec4
|
* @param[in] v vec4
|
||||||
@@ -1272,7 +1272,7 @@ glm_vec4_cubic(float s, vec4 dest) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief swizzle vector components
|
* @brief swizzle vector components
|
||||||
*
|
*
|
||||||
* you can use existin masks e.g. GLM_XXXX, GLM_WZYX
|
* you can use existing masks e.g. GLM_XXXX, GLM_WZYX
|
||||||
*
|
*
|
||||||
* @param[in] v source
|
* @param[in] v source
|
||||||
* @param[in] mask mask
|
* @param[in] mask mask
|
||||||
|
|||||||
Reference in New Issue
Block a user