mirror of
https://github.com/recp/cglm.git
synced 2025-12-26 02:25:02 +00:00
Fix typos.
This commit is contained in:
@@ -89,7 +89,7 @@ Functions documentation
|
||||
Parameters:
|
||||
| *[in]* **aabb** bounding box
|
||||
| *[in]* **cropAabb** crop box
|
||||
| *[in]* **clampAabb** miniumum box
|
||||
| *[in]* **clampAabb** minimum box
|
||||
| *[out]* **dest** cropped bounding box
|
||||
|
||||
.. c:function:: void glm_aabb2d_invalidate(vec2 aabb[2])
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
3D Affine Transforms (common)
|
||||
================================================================================
|
||||
|
||||
Common transfrom functions.
|
||||
Common transform functions.
|
||||
|
||||
Table of contents (click to go):
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@@ -30,7 +30,7 @@ Functions documentation
|
||||
creates NEW translate transform matrix by *v* vector.
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** affine transfrom
|
||||
| *[in, out]* **m** affine transform
|
||||
| *[in]* **v** translate vector [x, y, z]
|
||||
|
||||
.. 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
|
||||
|
||||
Parameters:
|
||||
| *[in]* **m** affine transfrom
|
||||
| *[in]* **m** affine transform
|
||||
| *[in]* **v** scale vector [x, y, z]
|
||||
| *[out]* **dest** scaled matrix
|
||||
|
||||
@@ -47,7 +47,7 @@ Functions documentation
|
||||
creates NEW scale matrix by v vector
|
||||
|
||||
Parameters:
|
||||
| *[out]* **m** affine transfrom
|
||||
| *[out]* **m** affine transform
|
||||
| *[in]* **v** scale vector [x, y, z]
|
||||
|
||||
.. c:function:: void glm_scale(mat4 m, vec3 v)
|
||||
@@ -56,7 +56,7 @@ Functions documentation
|
||||
and stores result in same matrix
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** affine transfrom
|
||||
| *[in, out]* **m** affine transform
|
||||
| *[in]* **v** scale vector [x, y, z]
|
||||
|
||||
.. c:function:: void glm_scale_uni(mat4 m, float s)
|
||||
@@ -65,7 +65,7 @@ Functions documentation
|
||||
and stores result in same matrix
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** affine transfrom
|
||||
| *[in, out]* **m** affine transform
|
||||
| *[in]* **v** scale factor
|
||||
|
||||
.. 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
|
||||
|
||||
Parameters:
|
||||
| *[out]* **m** affine transfrom
|
||||
| *[out]* **m** affine transform
|
||||
| *[in]* **axis** angle (radians)
|
||||
| *[in]* **axis** axis
|
||||
|
||||
@@ -86,7 +86,7 @@ Functions documentation
|
||||
| this should work faster than glm_rotate_at because it reduces one glm_translate.
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** affine transfrom
|
||||
| *[in, out]* **m** affine transform
|
||||
| *[in]* **pivot** pivot, anchor point, rotation center
|
||||
| *[in]* **angle** angle (radians)
|
||||
| *[in]* **axis** axis
|
||||
@@ -123,7 +123,7 @@ Functions documentation
|
||||
DON'T pass projected matrix here
|
||||
|
||||
Parameters:
|
||||
| *[in]* **m** affine transfrom
|
||||
| *[in]* **m** affine transform
|
||||
| *[out]* **t** translation vector
|
||||
| *[out]* **r** rotation matrix (mat4)
|
||||
| *[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
|
||||
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):
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -3,10 +3,8 @@
|
||||
3D Affine Transforms (post)
|
||||
================================================================================
|
||||
|
||||
Post transfrom 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.
|
||||
|
||||
Ther are named af
|
||||
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) transform.
|
||||
|
||||
Table of contents (click to go):
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@@ -33,7 +31,7 @@ Functions documentation
|
||||
translate existing transform matrix by *v* vector and store result in dest
|
||||
|
||||
Parameters:
|
||||
| *[in]* **m** affine transfrom
|
||||
| *[in]* **m** affine transform
|
||||
| *[in]* **v** translate vector [x, y, z]
|
||||
| *[out]* **dest** translated matrix
|
||||
|
||||
@@ -43,7 +41,7 @@ Functions documentation
|
||||
and stores result in same matrix
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** affine transfrom
|
||||
| *[in, out]* **m** affine transform
|
||||
| *[in]* **v** translate vector [x, y, z]
|
||||
|
||||
.. c:function:: void glm_translated_x(mat4 m, float x)
|
||||
@@ -51,7 +49,7 @@ Functions documentation
|
||||
translate existing transform matrix by x factor
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** affine transfrom
|
||||
| *[in, out]* **m** affine transform
|
||||
| *[in]* **v** x factor
|
||||
|
||||
.. c:function:: void glm_translated_y(mat4 m, float y)
|
||||
@@ -59,7 +57,7 @@ Functions documentation
|
||||
translate existing transform matrix by *y* factor
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** affine transfrom
|
||||
| *[in, out]* **m** affine transform
|
||||
| *[in]* **v** y factor
|
||||
|
||||
.. c:function:: void glm_translated_z(mat4 m, float z)
|
||||
@@ -67,7 +65,7 @@ Functions documentation
|
||||
translate existing transform matrix by *z* factor
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** affine transfrom
|
||||
| *[in, out]* **m** affine transform
|
||||
| *[in]* **v** z factor
|
||||
|
||||
.. c:function:: void glm_rotated_x(mat4 m, float angle, mat4 dest)
|
||||
@@ -76,7 +74,7 @@ Functions documentation
|
||||
and store result in dest
|
||||
|
||||
Parameters:
|
||||
| *[in]* **m** affine transfrom
|
||||
| *[in]* **m** affine transform
|
||||
| *[in]* **angle** angle (radians)
|
||||
| *[out]* **dest** rotated matrix
|
||||
|
||||
@@ -86,7 +84,7 @@ Functions documentation
|
||||
and store result in dest
|
||||
|
||||
Parameters:
|
||||
| *[in]* **m** affine transfrom
|
||||
| *[in]* **m** affine transform
|
||||
| *[in]* **angle** angle (radians)
|
||||
| *[out]* **dest** rotated matrix
|
||||
|
||||
@@ -96,7 +94,7 @@ Functions documentation
|
||||
and store result in dest
|
||||
|
||||
Parameters:
|
||||
| *[in]* **m** affine transfrom
|
||||
| *[in]* **m** affine transform
|
||||
| *[in]* **angle** angle (radians)
|
||||
| *[out]* **dest** rotated matrix
|
||||
|
||||
@@ -105,7 +103,7 @@ Functions documentation
|
||||
rotate existing transform matrix around Z axis by angle and axis
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** affine transfrom
|
||||
| *[in, out]* **m** affine transform
|
||||
| *[in]* **angle** angle (radians)
|
||||
| *[in]* **axis** axis
|
||||
|
||||
@@ -114,7 +112,7 @@ Functions documentation
|
||||
rotate existing transform around given axis by angle at given pivot point (rotation center)
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** affine transfrom
|
||||
| *[in, out]* **m** affine transform
|
||||
| *[in]* **pivot** pivot, anchor point, rotation center
|
||||
| *[in]* **angle** angle (radians)
|
||||
| *[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)
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** affine transfrom
|
||||
| *[in, out]* **m** affine transform
|
||||
| *[in]* **angle** angle (radians)
|
||||
| *[in]* **axis** axis
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
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):
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@@ -41,7 +41,7 @@ Functions documentation
|
||||
translate existing transform matrix by *v* vector and store result in dest
|
||||
|
||||
Parameters:
|
||||
| *[in]* **m** affine transfrom
|
||||
| *[in]* **m** affine transform
|
||||
| *[in]* **v** translate vector [x, y, z]
|
||||
| *[out]* **dest** translated matrix
|
||||
|
||||
@@ -51,7 +51,7 @@ Functions documentation
|
||||
and stores result in same matrix
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** affine transfrom
|
||||
| *[in, out]* **m** affine transform
|
||||
| *[in]* **v** translate vector [x, y, z]
|
||||
|
||||
.. c:function:: void glm_translate_x(mat4 m, float x)
|
||||
@@ -59,7 +59,7 @@ Functions documentation
|
||||
translate existing transform matrix by x factor
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** affine transfrom
|
||||
| *[in, out]* **m** affine transform
|
||||
| *[in]* **v** x factor
|
||||
|
||||
.. c:function:: void glm_translate_y(mat4 m, float y)
|
||||
@@ -67,7 +67,7 @@ Functions documentation
|
||||
translate existing transform matrix by *y* factor
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** affine transfrom
|
||||
| *[in, out]* **m** affine transform
|
||||
| *[in]* **v** y factor
|
||||
|
||||
.. c:function:: void glm_translate_z(mat4 m, float z)
|
||||
@@ -75,7 +75,7 @@ Functions documentation
|
||||
translate existing transform matrix by *z* factor
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** affine transfrom
|
||||
| *[in, out]* **m** affine transform
|
||||
| *[in]* **v** z factor
|
||||
|
||||
.. c:function:: void glm_translate_make(mat4 m, vec3 v)
|
||||
@@ -83,7 +83,7 @@ Functions documentation
|
||||
creates NEW translate transform matrix by *v* vector.
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** affine transfrom
|
||||
| *[in, out]* **m** affine transform
|
||||
| *[in]* **v** translate vector [x, y, z]
|
||||
|
||||
.. 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
|
||||
|
||||
Parameters:
|
||||
| *[in]* **m** affine transfrom
|
||||
| *[in]* **m** affine transform
|
||||
| *[in]* **v** scale vector [x, y, z]
|
||||
| *[out]* **dest** scaled matrix
|
||||
|
||||
@@ -100,7 +100,7 @@ Functions documentation
|
||||
creates NEW scale matrix by v vector
|
||||
|
||||
Parameters:
|
||||
| *[out]* **m** affine transfrom
|
||||
| *[out]* **m** affine transform
|
||||
| *[in]* **v** scale vector [x, y, z]
|
||||
|
||||
.. c:function:: void glm_scale(mat4 m, vec3 v)
|
||||
@@ -109,7 +109,7 @@ Functions documentation
|
||||
and stores result in same matrix
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** affine transfrom
|
||||
| *[in, out]* **m** affine transform
|
||||
| *[in]* **v** scale vector [x, y, z]
|
||||
|
||||
.. c:function:: void glm_scale_uni(mat4 m, float s)
|
||||
@@ -118,7 +118,7 @@ Functions documentation
|
||||
and stores result in same matrix
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** affine transfrom
|
||||
| *[in, out]* **m** affine transform
|
||||
| *[in]* **v** scale factor
|
||||
|
||||
.. c:function:: void glm_rotate_x(mat4 m, float angle, mat4 dest)
|
||||
@@ -127,7 +127,7 @@ Functions documentation
|
||||
and store result in dest
|
||||
|
||||
Parameters:
|
||||
| *[in]* **m** affine transfrom
|
||||
| *[in]* **m** affine transform
|
||||
| *[in]* **angle** angle (radians)
|
||||
| *[out]* **dest** rotated matrix
|
||||
|
||||
@@ -137,7 +137,7 @@ Functions documentation
|
||||
and store result in dest
|
||||
|
||||
Parameters:
|
||||
| *[in]* **m** affine transfrom
|
||||
| *[in]* **m** affine transform
|
||||
| *[in]* **angle** angle (radians)
|
||||
| *[out]* **dest** rotated matrix
|
||||
|
||||
@@ -147,7 +147,7 @@ Functions documentation
|
||||
and store result in dest
|
||||
|
||||
Parameters:
|
||||
| *[in]* **m** affine transfrom
|
||||
| *[in]* **m** affine transform
|
||||
| *[in]* **angle** angle (radians)
|
||||
| *[out]* **dest** rotated matrix
|
||||
|
||||
@@ -157,7 +157,7 @@ Functions documentation
|
||||
axis will be normalized so you don't need to normalize it
|
||||
|
||||
Parameters:
|
||||
| *[out]* **m** affine transfrom
|
||||
| *[out]* **m** affine transform
|
||||
| *[in]* **axis** angle (radians)
|
||||
| *[in]* **axis** axis
|
||||
|
||||
@@ -166,7 +166,7 @@ Functions documentation
|
||||
rotate existing transform matrix around Z axis by angle and axis
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** affine transfrom
|
||||
| *[in, out]* **m** affine transform
|
||||
| *[in]* **angle** angle (radians)
|
||||
| *[in]* **axis** axis
|
||||
|
||||
@@ -175,7 +175,7 @@ Functions documentation
|
||||
rotate existing transform around given axis by angle at given pivot point (rotation center)
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** affine transfrom
|
||||
| *[in, out]* **m** affine transform
|
||||
| *[in]* **pivot** pivot, anchor point, rotation center
|
||||
| *[in]* **angle** angle (radians)
|
||||
| *[in]* **axis** axis
|
||||
@@ -188,7 +188,7 @@ Functions documentation
|
||||
| this should work faster than glm_rotate_at because it reduces one glm_translate.
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** affine transfrom
|
||||
| *[in, out]* **m** affine transform
|
||||
| *[in]* **pivot** pivot, anchor point, rotation center
|
||||
| *[in]* **angle** angle (radians)
|
||||
| *[in]* **axis** axis
|
||||
@@ -225,7 +225,7 @@ Functions documentation
|
||||
DON'T pass projected matrix here
|
||||
|
||||
Parameters:
|
||||
| *[in]* **m** affine transfrom
|
||||
| *[in]* **m** affine transform
|
||||
| *[out]* **t** translation vector
|
||||
| *[out]* **r** rotation matrix (mat4)
|
||||
| *[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)
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** affine transfrom
|
||||
| *[in, out]* **m** affine transform
|
||||
| *[in]* **angle** angle (radians)
|
||||
| *[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.
|
||||
|
||||
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.
|
||||
|
||||
@@ -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
|
||||
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
|
||||
decompose matrix after projected.
|
||||
@@ -35,7 +35,7 @@ Rotation Center
|
||||
Rotating functions uses origin as rotation center (pivot/anchor point),
|
||||
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.
|
||||
**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.
|
||||
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)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
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)**
|
||||
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
|
||||
:linenos:
|
||||
|
||||
TransformMatrix = TransformMatrix * TraslateMatrix; // glm_translate()
|
||||
TransformMatrix = TransformMatrix * TranslateMatrix; // glm_translate()
|
||||
TransformMatrix = TransformMatrix * RotateMatrix; // glm_rotate(), glm_quat_rotate()
|
||||
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
|
||||
: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
|
||||
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
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@@ -45,7 +45,7 @@ Functions:
|
||||
translate existing 2d transform matrix by *v* vector and stores result in same matrix
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** 2d affine transfrom
|
||||
| *[in, out]* **m** 2d affine transform
|
||||
| *[in]* **v** translate vector [x, y]
|
||||
|
||||
.. 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
|
||||
|
||||
Parameters:
|
||||
| *[in]* **m** 2d affine transfrom
|
||||
| *[in]* **m** 2d affine transform
|
||||
| *[in]* **v** translate vector [x, y]
|
||||
| *[out]* **dest** translated matrix
|
||||
|
||||
@@ -62,7 +62,7 @@ Functions:
|
||||
translate existing 2d transform matrix by x factor
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** 2d affine transfrom
|
||||
| *[in, out]* **m** 2d affine transform
|
||||
| *[in]* **x** x factor
|
||||
|
||||
.. c:function:: void glm_translate2d_y(mat3 m, float y)
|
||||
@@ -70,7 +70,7 @@ Functions:
|
||||
translate existing 2d transform matrix by y factor
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** 2d affine transfrom
|
||||
| *[in, out]* **m** 2d affine transform
|
||||
| *[in]* **y** y factor
|
||||
|
||||
.. c:function:: void glm_translate2d_make(mat3 m, vec2 v)
|
||||
@@ -78,7 +78,7 @@ Functions:
|
||||
creates NEW translate 2d transform matrix by *v* vector
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** affine transfrom
|
||||
| *[in, out]* **m** affine transform
|
||||
| *[in]* **v** translate vector [x, y]
|
||||
|
||||
.. 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
|
||||
|
||||
Parameters:
|
||||
| *[in]* **m** affine transfrom
|
||||
| *[in]* **m** affine transform
|
||||
| *[in]* **v** scale vector [x, y]
|
||||
| *[out]* **dest** scaled matrix
|
||||
|
||||
@@ -95,7 +95,7 @@ Functions:
|
||||
creates NEW 2d scale matrix by *v* vector
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** affine transfrom
|
||||
| *[in, out]* **m** affine transform
|
||||
| *[in]* **v** scale vector [x, y]
|
||||
|
||||
.. 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
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** affine transfrom
|
||||
| *[in, out]* **m** affine transform
|
||||
| *[in]* **v** translate vector [x, y]
|
||||
|
||||
.. 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
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** affine transfrom
|
||||
| *[in, out]* **m** affine transform
|
||||
| *[in]* **s** scale factor
|
||||
|
||||
.. c:function:: void glm_rotate2d_make(mat3 m, float angle)
|
||||
@@ -119,7 +119,7 @@ Functions:
|
||||
creates NEW rotation matrix by angle around *Z* axis
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** affine transfrom
|
||||
| *[in, out]* **m** affine transform
|
||||
| *[in]* **angle** angle (radians)
|
||||
|
||||
.. 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
|
||||
|
||||
Parameters:
|
||||
| *[in, out]* **m** affine transfrom
|
||||
| *[in, out]* **m** affine transform
|
||||
| *[in]* **angle** angle (radians)
|
||||
|
||||
.. 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
|
||||
|
||||
Parameters:
|
||||
| *[in]* **m** affine transfrom
|
||||
| *[in]* **m** affine transform
|
||||
| *[in]* **angle** angle (radians)
|
||||
| *[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
|
||||
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.
|
||||
Since struct apis are inline you don't need to build or link *cglm* against
|
||||
|
||||
@@ -82,7 +82,7 @@ Functions documentation
|
||||
Parameters:
|
||||
| *[in]* **box** bounding box
|
||||
| *[in]* **cropBox** crop box
|
||||
| *[in]* **clampBox** miniumum box
|
||||
| *[in]* **clampBox** minimum box
|
||||
| *[out]* **dest** cropped bounding box
|
||||
|
||||
.. c:function:: bool glm_aabb_frustum(vec3 box[2], vec4 planes[6])
|
||||
|
||||
@@ -3,17 +3,17 @@
|
||||
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.
|
||||
|
||||
Precompiled versions are in **glmc_** namespace. *c* in the namespace stands for
|
||||
"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.
|
||||
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
|
||||
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)
|
||||
|
||||
| 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:
|
||||
| *[in]* **proj** perspective projection matrix
|
||||
|
||||
@@ -2,7 +2,7 @@ Features
|
||||
================================================================================
|
||||
|
||||
* **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.
|
||||
* general purpose matrix operations (mat4, mat3)
|
||||
* 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.
|
||||
|
||||
**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.
|
||||
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];
|
||||
#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*
|
||||
|
||||
Alignment Is Required:
|
||||
@@ -35,7 +35,7 @@ Alignment Is Required:
|
||||
|
||||
| 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:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -29,7 +29,7 @@ Example to print mat4 matrix:
|
||||
cglm may provide precision parameter in the future
|
||||
|
||||
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 ;)
|
||||
* Some print improvements
|
||||
* New options with default values:
|
||||
@@ -143,5 +143,5 @@ Functions documentation
|
||||
|
||||
Parameters:
|
||||
| *[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
|
||||
|
||||
@@ -92,7 +92,7 @@ Functions documentation
|
||||
norm * norm (magnitude) of vector
|
||||
|
||||
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
|
||||
|
||||
Parameters:
|
||||
|
||||
@@ -47,7 +47,7 @@ Functions documentation
|
||||
|
||||
.. 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:
|
||||
| *[out]* **mat** matrix
|
||||
@@ -94,7 +94,7 @@ Functions documentation
|
||||
|
||||
.. 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:
|
||||
| *[in]* **mat** source
|
||||
|
||||
@@ -49,7 +49,7 @@ Functions documentation
|
||||
|
||||
.. 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:
|
||||
| *[out]* **mat** matrix
|
||||
@@ -96,7 +96,7 @@ Functions documentation
|
||||
|
||||
.. 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:
|
||||
| *[in]* **mat** source
|
||||
|
||||
@@ -70,7 +70,7 @@ Functions documentation
|
||||
|
||||
.. 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:
|
||||
| *[out]* **mat** matrix
|
||||
@@ -214,7 +214,7 @@ Functions documentation
|
||||
|
||||
.. 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:
|
||||
| *[in]* **m** source
|
||||
|
||||
@@ -43,14 +43,14 @@ array of matrices:
|
||||
/* ... */
|
||||
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:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
|
||||
@@ -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
|
||||
via 'project A' may force types to be aligned and another cglm header
|
||||
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.
|
||||
|
||||
@@ -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
|
||||
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`...
|
||||
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**
|
||||
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]**
|
||||
|
||||
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.
|
||||
|
||||
Table of contents (click to go):
|
||||
|
||||
@@ -68,14 +68,14 @@ Functions documentation
|
||||
|
||||
.. 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:
|
||||
| *[in, out]* **deg** pointer to angle in degrees
|
||||
|
||||
.. 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:
|
||||
| *[in, out]* **rad** pointer to angle in radians
|
||||
|
||||
@@ -117,7 +117,7 @@ Functions documentation
|
||||
norm * norm (magnitude) of vector
|
||||
|
||||
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
|
||||
|
||||
Parameters:
|
||||
|
||||
@@ -13,7 +13,7 @@ Header: cglm/vec3.h
|
||||
We mostly use vectors in graphics math, to make writing code faster
|
||||
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`,
|
||||
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
|
||||
rotate *vec3* with matrix.
|
||||
@@ -148,7 +148,7 @@ Functions documentation
|
||||
norm * norm (magnitude) of vector
|
||||
|
||||
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
|
||||
|
||||
Parameters:
|
||||
@@ -309,7 +309,7 @@ Functions documentation
|
||||
|
||||
.. c:function:: void glm_vec3_flipsign(vec3 v)
|
||||
|
||||
**DEPRACATED!**
|
||||
**DEPRECATED!**
|
||||
|
||||
use :c:func:`glm_vec3_negate`
|
||||
|
||||
@@ -318,7 +318,7 @@ Functions documentation
|
||||
|
||||
.. c:function:: void glm_vec3_flipsign_to(vec3 v, vec3 dest)
|
||||
|
||||
**DEPRACATED!**
|
||||
**DEPRECATED!**
|
||||
|
||||
use :c:func:`glm_vec3_negate_to`
|
||||
|
||||
@@ -328,7 +328,7 @@ Functions documentation
|
||||
|
||||
.. c:function:: void glm_vec3_inv(vec3 v)
|
||||
|
||||
**DEPRACATED!**
|
||||
**DEPRECATED!**
|
||||
|
||||
use :c:func:`glm_vec3_negate`
|
||||
|
||||
@@ -337,7 +337,7 @@ Functions documentation
|
||||
|
||||
.. c:function:: void glm_vec3_inv_to(vec3 v, vec3 dest)
|
||||
|
||||
**DEPRACATED!**
|
||||
**DEPRECATED!**
|
||||
|
||||
use :c:func:`glm_vec3_negate_to`
|
||||
|
||||
@@ -377,7 +377,7 @@ Functions documentation
|
||||
|
||||
.. c:function:: float glm_vec3_angle(vec3 v1, vec3 v2)
|
||||
|
||||
angle betwen two vector
|
||||
angle between two vector
|
||||
|
||||
Parameters:
|
||||
| *[in]* **v1** vector1
|
||||
|
||||
@@ -124,7 +124,7 @@ Functions documentation
|
||||
norm * norm (magnitude) of vector
|
||||
|
||||
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
|
||||
|
||||
Parameters:
|
||||
@@ -284,7 +284,7 @@ Functions documentation
|
||||
|
||||
.. c:function:: void glm_vec4_flipsign(vec4 v)
|
||||
|
||||
**DEPRACATED!**
|
||||
**DEPRECATED!**
|
||||
|
||||
use :c:func:`glm_vec4_negate`
|
||||
|
||||
@@ -293,7 +293,7 @@ Functions documentation
|
||||
|
||||
.. c:function:: void glm_vec4_flipsign_to(vec4 v, vec4 dest)
|
||||
|
||||
**DEPRACATED!**
|
||||
**DEPRECATED!**
|
||||
|
||||
use :c:func:`glm_vec4_negate_to`
|
||||
|
||||
@@ -303,7 +303,7 @@ Functions documentation
|
||||
|
||||
.. c:function:: void glm_vec4_inv(vec4 v)
|
||||
|
||||
**DEPRACATED!**
|
||||
**DEPRECATED!**
|
||||
|
||||
use :c:func:`glm_vec4_negate`
|
||||
|
||||
@@ -312,7 +312,7 @@ Functions documentation
|
||||
|
||||
.. c:function:: void glm_vec4_inv_to(vec4 v, vec4 dest)
|
||||
|
||||
**DEPRACATED!**
|
||||
**DEPRECATED!**
|
||||
|
||||
use :c:func:`glm_vec4_negate_to`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user