mirror of
https://github.com/recp/cglm.git
synced 2026-02-17 03:39:05 +00:00
Compare commits
33 Commits
v0.9.5
...
integratio
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1bd04c819b | ||
|
|
8560da0e70 | ||
|
|
ed7a658637 | ||
|
|
bcc475e2b7 | ||
|
|
bdca98ba48 | ||
|
|
b33e29d50f | ||
|
|
4b3e9bb779 | ||
|
|
214842db27 | ||
|
|
60e4d6c188 | ||
|
|
5063d4b2b0 | ||
|
|
a16bc2ae4a | ||
|
|
b694c97204 | ||
|
|
4791fe3f24 | ||
|
|
b64067a94d | ||
|
|
43363e8c43 | ||
|
|
f3094cdc65 | ||
|
|
a7bd64952e | ||
|
|
4141298161 | ||
|
|
05979281ac | ||
|
|
4b3dcceb9d | ||
|
|
cfb8cd9447 | ||
|
|
8d01d1d135 | ||
|
|
c6caddc75e | ||
|
|
8b810c2280 | ||
|
|
fd3b21f5d7 | ||
|
|
c1ea9e7a69 | ||
|
|
44b5952ec3 | ||
|
|
6e2976d415 | ||
|
|
9a7f52202d | ||
|
|
e96b6a382d | ||
|
|
091c475422 | ||
|
|
144d1e7c29 | ||
|
|
643700c05e |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -80,4 +80,5 @@ confdefs.h
|
|||||||
cmake-build-debug
|
cmake-build-debug
|
||||||
*.o.tmp
|
*.o.tmp
|
||||||
xcode/*
|
xcode/*
|
||||||
.vscode
|
.vscode
|
||||||
|
.build
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
project(cglm
|
project(cglm
|
||||||
VERSION 0.9.5
|
VERSION 0.9.6
|
||||||
HOMEPAGE_URL https://github.com/recp/cglm
|
HOMEPAGE_URL https://github.com/recp/cglm
|
||||||
DESCRIPTION "OpenGL Mathematics (glm) for C"
|
DESCRIPTION "OpenGL Mathematics (glm) for C"
|
||||||
LANGUAGES C
|
LANGUAGES C
|
||||||
@@ -44,7 +44,7 @@ if(MSVC)
|
|||||||
endforeach(flag_var)
|
endforeach(flag_var)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
add_compile_options(-Wall)
|
add_compile_options(-Wall -Wextra -Wpedantic -Wconversion)
|
||||||
|
|
||||||
if(NOT CMAKE_BUILD_TYPE MATCHES Debug)
|
if(NOT CMAKE_BUILD_TYPE MATCHES Debug)
|
||||||
add_compile_options(-O3)
|
add_compile_options(-O3)
|
||||||
|
|||||||
@@ -131,7 +131,8 @@ cglm_call_HEADERS = include/cglm/call/mat4.h \
|
|||||||
include/cglm/call/bezier.h \
|
include/cglm/call/bezier.h \
|
||||||
include/cglm/call/ray.h \
|
include/cglm/call/ray.h \
|
||||||
include/cglm/call/affine.h \
|
include/cglm/call/affine.h \
|
||||||
include/cglm/call/affine2d.h
|
include/cglm/call/affine2d.h \
|
||||||
|
include/cglm/call/aabb2d.h
|
||||||
|
|
||||||
cglm_call_clipspacedir=$(includedir)/cglm/call/clipspace
|
cglm_call_clipspacedir=$(includedir)/cglm/call/clipspace
|
||||||
cglm_call_clipspace_HEADERS = include/cglm/call/clipspace/persp_lh_no.h \
|
cglm_call_clipspace_HEADERS = include/cglm/call/clipspace/persp_lh_no.h \
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ Pod::Spec.new do |s|
|
|||||||
|
|
||||||
# Description
|
# Description
|
||||||
s.name = "cglm"
|
s.name = "cglm"
|
||||||
s.version = "0.9.4"
|
s.version = "0.9.5"
|
||||||
s.summary = "📽 Highly Optimized Graphics Math (glm) for C"
|
s.summary = "📽 Highly Optimized Graphics Math (glm) for C"
|
||||||
s.description = <<-DESC
|
s.description = <<-DESC
|
||||||
cglm is math library for graphics programming for C. See the documentation or README for all features.
|
cglm is math library for graphics programming for C. See the documentation or README for all features.
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#*****************************************************************************
|
#*****************************************************************************
|
||||||
|
|
||||||
AC_PREREQ([2.69])
|
AC_PREREQ([2.69])
|
||||||
AC_INIT([cglm], [0.9.5], [info@recp.me])
|
AC_INIT([cglm], [0.9.6], [info@recp.me])
|
||||||
AM_INIT_AUTOMAKE([-Wall foreign subdir-objects serial-tests])
|
AM_INIT_AUTOMAKE([-Wall foreign subdir-objects serial-tests])
|
||||||
|
|
||||||
# Don't use the default cflags (-O2 -g), we set ours manually in Makefile.am.
|
# Don't use the default cflags (-O2 -g), we set ours manually in Makefile.am.
|
||||||
|
|||||||
@@ -62,9 +62,9 @@ author = u'Recep Aslantas'
|
|||||||
# built documents.
|
# built documents.
|
||||||
#
|
#
|
||||||
# The short X.Y version.
|
# The short X.Y version.
|
||||||
version = u'0.9.5'
|
version = u'0.9.6'
|
||||||
# The full version, including alpha/beta/rc tags.
|
# The full version, including alpha/beta/rc tags.
|
||||||
release = u'0.9.5'
|
release = u'0.9.6'
|
||||||
|
|
||||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
# for a list of supported languages.
|
# for a list of supported languages.
|
||||||
|
|||||||
@@ -36,58 +36,103 @@ Represented
|
|||||||
Functions documentation
|
Functions documentation
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
.. c:function:: void glm_mat2x3_copy(mat2x3 mat, mat2x3 dest)
|
.. c:function:: void glm_mat2x3_copy(mat2x3 src, mat2x3 dest)
|
||||||
|
|
||||||
copy mat2x3 to another one (dest).
|
Copy mat2x3 (src) to mat2x3 (dest).
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **mat** source
|
| *[in]* **src** mat2x3 (left)
|
||||||
| *[out]* **dest** destination
|
| *[out]* **dest** destination (result, mat2x3)
|
||||||
|
|
||||||
.. c:function:: void glm_mat2x3_zero(mat2x3 mat)
|
.. csv-table:: mat2x3 **(src)**
|
||||||
|
|
||||||
make given matrix zero
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
| *[in,out]* **mat** matrix
|
|
||||||
|
|
||||||
.. c:function:: void glm_mat2x3_make(const float * __restrict src, mat2x3 dest)
|
|
||||||
|
|
||||||
Create mat2x3 matrix from pointer
|
|
||||||
|
|
||||||
.. note:: **@src** must contain at least 6 elements.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
| *[in]* **src** pointer to an array of floats
|
|
||||||
| *[out]* **dest** destination matrix2x3
|
|
||||||
|
|
||||||
.. c:function:: void glm_mat2x3_mul(mat2x3 m1, mat3x2 m2, mat3 dest)
|
|
||||||
|
|
||||||
multiply m1 and m2 to dest
|
|
||||||
|
|
||||||
.. code-block:: c
|
|
||||||
|
|
||||||
glm_mat2x3_mul(mat2x3, mat3x2, mat3);
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
| *[in]* **m1** left matrix (mat2x3)
|
|
||||||
| *[in]* **m2** right matrix (mat3x2)
|
|
||||||
| *[out]* **dest** destination matrix (mat3)
|
|
||||||
|
|
||||||
.. csv-table:: mat2x3
|
|
||||||
:header: "", "column 1", "column 2"
|
:header: "", "column 1", "column 2"
|
||||||
|
|
||||||
"row 1", "a00", "a10"
|
"row 1", "a00", "a10"
|
||||||
"row 2", "a01", "a11"
|
"row 2", "a01", "a11"
|
||||||
"row 3", "a02", "a12"
|
"row 3", "a02", "a12"
|
||||||
|
|
||||||
.. csv-table:: mat3x2
|
.. csv-table:: mat2x3 **(dest)**
|
||||||
|
:header: "", "column 1", "column 2"
|
||||||
|
|
||||||
|
"row 1", "b00 = a00", "b10 = a10"
|
||||||
|
"row 2", "b01 = a01", "b11 = a11"
|
||||||
|
"row 3", "b02 = a02", "b12 = a12"
|
||||||
|
|
||||||
|
.. c:function:: void glm_mat2x3_zero(mat2x3 m)
|
||||||
|
|
||||||
|
Zero out the mat2x3 (m).
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
| *[in, out]* **mat** mat2x3 (src, dest)
|
||||||
|
|
||||||
|
.. csv-table:: mat2x3 **(m)**
|
||||||
|
:header: "", "column 1", "column 2"
|
||||||
|
|
||||||
|
"row 1", "0.00", "2.00"
|
||||||
|
"row 2", "5.00", "4.00"
|
||||||
|
"row 3", "7.00", "6.00"
|
||||||
|
|
||||||
|
.. csv-table:: mat2x3 **(m)**
|
||||||
|
:header: "", "column 1", "column 2"
|
||||||
|
|
||||||
|
"row 1", "0.00", "0.00"
|
||||||
|
"row 2", "0.00", "0.00"
|
||||||
|
"row 3", "0.00", "0.00"
|
||||||
|
|
||||||
|
.. c:function:: void glm_mat2x3_make(const float * __restrict src, mat2x3 dest)
|
||||||
|
|
||||||
|
Create mat2x3 (dest) from pointer (src).
|
||||||
|
|
||||||
|
.. note:: **@src** must contain at least 6 elements.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
| *[in]* **src** pointer to an array of floats (left)
|
||||||
|
| *[out]* **dest** destination (result, mat2x3)
|
||||||
|
|
||||||
|
.. csv-table:: float array (1x6) **(src)**
|
||||||
|
:header: "", "column 1"
|
||||||
|
|
||||||
|
"row 1", "v0"
|
||||||
|
"row 2", "v1"
|
||||||
|
"row 3", "v2"
|
||||||
|
"row 4", "v3"
|
||||||
|
"row 5", "v4"
|
||||||
|
"row 6", "v5"
|
||||||
|
|
||||||
|
.. csv-table:: mat2x3 **(dest)**
|
||||||
|
:header: "", "column 1", "column 2"
|
||||||
|
|
||||||
|
"row 1", "v0", "v3"
|
||||||
|
"row 2", "v1", "v4"
|
||||||
|
"row 3", "v2", "v5"
|
||||||
|
|
||||||
|
.. c:function:: void glm_mat2x3_mul(mat2x3 m1, mat3x2 m2, mat3 dest)
|
||||||
|
|
||||||
|
Multiply mat2x3 (m1) by mat3x2 (m2) and store in mat3 (dest).
|
||||||
|
|
||||||
|
.. code-block:: c
|
||||||
|
|
||||||
|
glm_mat2x3_mul(mat2x3, mat3x2, mat3);
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
| *[in]* **m1** mat2x3 (left)
|
||||||
|
| *[in]* **m2** mat3x2 (right)
|
||||||
|
| *[out]* **dest** destination (result, mat3)
|
||||||
|
|
||||||
|
.. csv-table:: mat2x3 **(m1)**
|
||||||
|
:header: "", "column 1", "column 2"
|
||||||
|
|
||||||
|
"row 1", "a00", "a10"
|
||||||
|
"row 2", "a01", "a11"
|
||||||
|
"row 3", "a02", "a12"
|
||||||
|
|
||||||
|
.. csv-table:: mat3x2 **(m2)**
|
||||||
:header: "", "column 1", "column 2", "column 3"
|
:header: "", "column 1", "column 2", "column 3"
|
||||||
|
|
||||||
"row 1", "b00", "b10", "b20"
|
"row 1", "b00", "b10", "b20"
|
||||||
"row 2", "b01", "b11", "b21"
|
"row 2", "b01", "b11", "b21"
|
||||||
|
|
||||||
.. csv-table:: mat3x3
|
.. csv-table:: mat3 **(dest)**
|
||||||
:header: "", "column 1", "column 2", "column 3"
|
:header: "", "column 1", "column 2", "column 3"
|
||||||
|
|
||||||
"row 1", "a00 * b00 + a10 * b01", "a00 * b10 + a10 * b11", "a00 * b20 + a10 * b21"
|
"row 1", "a00 * b00 + a10 * b01", "a00 * b10 + a10 * b11", "a00 * b20 + a10 * b21"
|
||||||
@@ -96,45 +141,65 @@ Functions documentation
|
|||||||
|
|
||||||
.. c:function:: void glm_mat2x3_mulv(mat2x3 m, vec2 v, vec3 dest)
|
.. c:function:: void glm_mat2x3_mulv(mat2x3 m, vec2 v, vec3 dest)
|
||||||
|
|
||||||
multiply mat2x3 with vec2 (column vector) and store in dest column vector
|
Multiply mat2x3 (m) by vec2 (v) and store in vec3 (dest).
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m** mat2x3 (left)
|
| *[in]* **m** mat2x3 (left)
|
||||||
| *[in]* **v** vec3 (right, column vector)
|
| *[in]* **v** vec2 (right, column vector)
|
||||||
| *[out]* **dest** destination (result, column vector)
|
| *[out]* **dest** destination (result, column vector)
|
||||||
|
|
||||||
.. csv-table:: mat2x3
|
.. csv-table:: mat2x3 **(m)**
|
||||||
:header: "", "column 1", "column 2"
|
:header: "", "column 1", "column 2"
|
||||||
|
|
||||||
"row 1", "m00", "m10"
|
"row 1", "m00", "m10"
|
||||||
"row 2", "m01", "m11"
|
"row 2", "m01", "m11"
|
||||||
"row 3", "m02", "m12"
|
"row 3", "m02", "m12"
|
||||||
|
|
||||||
.. csv-table:: column vec2 (1x2)
|
.. csv-table:: column vec2 (1x2) **(v)**
|
||||||
:header: "", "column 1"
|
:header: "", "column 1"
|
||||||
|
|
||||||
"row 1", "v0"
|
"row 1", "v0"
|
||||||
"row 2", "v1"
|
"row 2", "v1"
|
||||||
|
|
||||||
.. csv-table:: column vec3 (1x3)
|
.. csv-table:: column vec3 (1x3) **(dest)**
|
||||||
:header: "", "column 1"
|
:header: "", "column 1"
|
||||||
|
|
||||||
"row 1", "m00 * v0 + m10 * v1"
|
"row 1", "m00 * v0 + m10 * v1"
|
||||||
"row 2", "m01 * v0 + m11 * v1"
|
"row 2", "m01 * v0 + m11 * v1"
|
||||||
"row 3", "m02 * v0 + m12 * v1"
|
"row 3", "m02 * v0 + m12 * v1"
|
||||||
|
|
||||||
.. c:function:: void glm_mat2x3_transpose(mat2x3 m, mat3x2 dest)
|
.. c:function:: void glm_mat2x3_transpose(mat2x3 src, mat3x2 dest)
|
||||||
|
|
||||||
transpose matrix and store in dest
|
Transpose mat2x3 (src) and store in mat3x2 (dest).
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m** matrix
|
| *[in]* **src** mat2x3 (left)
|
||||||
| *[out]* **dest** destination
|
| *[out]* **dest** destination (result, mat3x2)
|
||||||
|
|
||||||
.. c:function:: void glm_mat2x3_scale(mat2x3 m, float s)
|
.. csv-table:: mat2x3 **(src)**
|
||||||
|
:header: "", "column 1", "column 2"
|
||||||
|
|
||||||
multiply matrix with scalar
|
"row 1", "a00", "a10"
|
||||||
|
"row 2", "a01", "a11"
|
||||||
|
"row 3", "a02", "a12"
|
||||||
|
|
||||||
|
.. csv-table:: mat3x2 **(dest)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3"
|
||||||
|
|
||||||
|
"row 1", "b00 = a00", "b10 = a01", "b20 = a02"
|
||||||
|
"row 2", "b01 = a10", "b11 = a11", "b21 = a12"
|
||||||
|
|
||||||
|
.. c:function:: void glm_mat2x3_scale(mat2x3 m, float s)
|
||||||
|
|
||||||
|
Multiply mat2x3 (m) by scalar constant (s).
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** matrix
|
| *[in, out]* **m** mat2x3 (src, dest)
|
||||||
| *[in]* **s** scalar
|
| *[in]* **s** float (scalar)
|
||||||
|
|
||||||
|
.. csv-table:: mat2x3 **(m)**
|
||||||
|
:header: "", "column 1", "column 2"
|
||||||
|
|
||||||
|
"row 1", "m00 = m00 * s", "m10 = m10 * s"
|
||||||
|
"row 2", "m01 = m01 * s", "m11 = m11 * s"
|
||||||
|
"row 3", "m02 = m02 * s", "m12 = m12 * s"
|
||||||
|
|||||||
@@ -37,45 +37,15 @@ Represented
|
|||||||
Functions documentation
|
Functions documentation
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
.. c:function:: void glm_mat2x4_copy(mat2x4 mat, mat2x4 dest)
|
.. c:function:: void glm_mat2x4_copy(mat2x4 src, mat2x4 dest)
|
||||||
|
|
||||||
copy mat2x4 to another one (dest).
|
Copy mat2x4 (src) to mat2x4 (dest).
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **mat** source
|
| *[in]* **src** mat2x4 (left)
|
||||||
| *[out]* **dest** destination
|
| *[out]* **dest** destination (result, mat2x4)
|
||||||
|
|
||||||
.. c:function:: void glm_mat2x4_zero(mat2x4 mat)
|
.. csv-table:: mat2x4 **(src)**
|
||||||
|
|
||||||
make given matrix zero
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
| *[in,out]* **mat** matrix
|
|
||||||
|
|
||||||
.. c:function:: void glm_mat2x4_make(const float * __restrict src, mat2x4 dest)
|
|
||||||
|
|
||||||
Create mat2x4 matrix from pointer
|
|
||||||
|
|
||||||
.. note:: **@src** must contain at least 8 elements.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
| *[in]* **src** pointer to an array of floats
|
|
||||||
| *[out]* **dest** destination matrix2x4
|
|
||||||
|
|
||||||
.. c:function:: void glm_mat2x4_mul(mat2x4 m1, mat4x2 m2, mat4 dest)
|
|
||||||
|
|
||||||
multiply m1 and m2 to dest
|
|
||||||
|
|
||||||
.. code-block:: c
|
|
||||||
|
|
||||||
glm_mat2x4_mul(mat2x4, mat4x2, mat4);
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
| *[in]* **m1** left matrix (mat2x4)
|
|
||||||
| *[in]* **m2** right matrix (mat4x2)
|
|
||||||
| *[out]* **dest** destination matrix (mat4)
|
|
||||||
|
|
||||||
.. csv-table:: mat2x4
|
|
||||||
:header: "", "column 1", "column 2"
|
:header: "", "column 1", "column 2"
|
||||||
|
|
||||||
"row 1", "a00", "a10"
|
"row 1", "a00", "a10"
|
||||||
@@ -83,13 +53,95 @@ Functions documentation
|
|||||||
"row 3", "a02", "a12"
|
"row 3", "a02", "a12"
|
||||||
"row 4", "a03", "a13"
|
"row 4", "a03", "a13"
|
||||||
|
|
||||||
.. csv-table:: mat4x2
|
.. csv-table:: mat2x4 **(dest)**
|
||||||
|
:header: "", "column 1", "column 2"
|
||||||
|
|
||||||
|
"row 1", "b00 = a00", "b10 = a10"
|
||||||
|
"row 2", "b01 = a01", "b11 = a11"
|
||||||
|
"row 3", "b02 = a02", "b12 = a12"
|
||||||
|
"row 4", "b03 = a03", "b13 = a13"
|
||||||
|
|
||||||
|
.. c:function:: void glm_mat2x4_zero(mat2x4 m)
|
||||||
|
|
||||||
|
Zero out the mat2x4 (m).
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
| *[in, out]* **m** mat2x4 (src, dest)
|
||||||
|
|
||||||
|
.. csv-table:: mat2x4 **(m)**
|
||||||
|
:header: "", "column 1", "column 2"
|
||||||
|
|
||||||
|
"row 1", "0.00", "2.00"
|
||||||
|
"row 2", "5.00", "4.00"
|
||||||
|
"row 3", "7.00", "6.00"
|
||||||
|
"row 4", "23.00", "1.00"
|
||||||
|
|
||||||
|
.. csv-table:: mat2x4 **(m)**
|
||||||
|
:header: "", "column 1", "column 2"
|
||||||
|
|
||||||
|
"row 1", "0.00", "0.00"
|
||||||
|
"row 2", "0.00", "0.00"
|
||||||
|
"row 3", "0.00", "0.00"
|
||||||
|
"row 4", "0.00", "0.00"
|
||||||
|
|
||||||
|
.. c:function:: void glm_mat2x4_make(const float * __restrict src, mat2x4 dest)
|
||||||
|
|
||||||
|
Create mat2x4 (dest) from pointer (src).
|
||||||
|
|
||||||
|
.. note:: **@src** must contain at least 8 elements.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
| *[in]* **src** pointer to an array of floats (left)
|
||||||
|
| *[out]* **dest** destination (result, mat2x4)
|
||||||
|
|
||||||
|
.. csv-table:: float array (1x8) **(src)**
|
||||||
|
:header: "", "column 1"
|
||||||
|
|
||||||
|
"row 1", "v0"
|
||||||
|
"row 2", "v1"
|
||||||
|
"row 3", "v2"
|
||||||
|
"row 4", "v3"
|
||||||
|
"row 5", "v4"
|
||||||
|
"row 6", "v5"
|
||||||
|
"row 7", "v6"
|
||||||
|
"row 8", "v7"
|
||||||
|
|
||||||
|
.. csv-table:: mat2x4 **(dest)**
|
||||||
|
:header: "", "column 1", "column 2"
|
||||||
|
|
||||||
|
"row 1", "v0", "v4"
|
||||||
|
"row 2", "v1", "v5"
|
||||||
|
"row 3", "v2", "v6"
|
||||||
|
"row 4", "v3", "v7"
|
||||||
|
|
||||||
|
.. c:function:: void glm_mat2x4_mul(mat2x4 m1, mat4x2 m2, mat4 dest)
|
||||||
|
|
||||||
|
Multiply mat2x4 (m1) by mat4x2 (m2) and store in mat4 (dest).
|
||||||
|
|
||||||
|
.. code-block:: c
|
||||||
|
|
||||||
|
glm_mat2x4_mul(mat2x4, mat4x2, mat4);
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
| *[in]* **m1** mat2x4 (left)
|
||||||
|
| *[in]* **m2** mat4x2 (right)
|
||||||
|
| *[out]* **dest** destination (result, mat4)
|
||||||
|
|
||||||
|
.. csv-table:: mat2x4 **(m1)**
|
||||||
|
:header: "", "column 1", "column 2"
|
||||||
|
|
||||||
|
"row 1", "a00", "a10"
|
||||||
|
"row 2", "a01", "a11"
|
||||||
|
"row 3", "a02", "a12"
|
||||||
|
"row 4", "a03", "a13"
|
||||||
|
|
||||||
|
.. csv-table:: mat4x2 **(m2)**
|
||||||
:header: "", "column 1", "column 2", "column 3", "column 4"
|
:header: "", "column 1", "column 2", "column 3", "column 4"
|
||||||
|
|
||||||
"row 1", "b00", "b10", "b20", "b30"
|
"row 1", "b00", "b10", "b20", "b30"
|
||||||
"row 2", "b01", "b11", "b21", "b31"
|
"row 2", "b01", "b11", "b21", "b31"
|
||||||
|
|
||||||
.. csv-table:: mat4x4
|
.. csv-table:: mat4x4 **(dest)**
|
||||||
:header: "", "column 1", "column 2", "column 3", "column 4"
|
:header: "", "column 1", "column 2", "column 3", "column 4"
|
||||||
|
|
||||||
"row 1", "a00 * b00 + a10 * b01", "a00 * b10 + a10 * b11", "a00 * b20 + a10 * b21", "a00 * b30 + a10 * b31"
|
"row 1", "a00 * b00 + a10 * b01", "a00 * b10 + a10 * b11", "a00 * b20 + a10 * b21", "a00 * b30 + a10 * b31"
|
||||||
@@ -99,14 +151,14 @@ Functions documentation
|
|||||||
|
|
||||||
.. c:function:: void glm_mat2x4_mulv(mat2x4 m, vec2 v, vec4 dest)
|
.. c:function:: void glm_mat2x4_mulv(mat2x4 m, vec2 v, vec4 dest)
|
||||||
|
|
||||||
multiply mat2x4 with vec2 (column vector) and store in dest column vector
|
Multiply mat2x4 (m) by vec2 (v) and store in vec4 (dest).
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m** mat2x4 (left)
|
| *[in]* **m** mat2x4 (left)
|
||||||
| *[in]* **v** vec2 (right, column vector)
|
| *[in]* **v** vec2 (right, column vector)
|
||||||
| *[out]* **dest** destination (result, column vector)
|
| *[out]* **dest** destination (result, column vector)
|
||||||
|
|
||||||
.. csv-table:: mat2x4
|
.. csv-table:: mat2x4 **(m)**
|
||||||
:header: "", "column 1", "column 2"
|
:header: "", "column 1", "column 2"
|
||||||
|
|
||||||
"row 1", "m00", "m10"
|
"row 1", "m00", "m10"
|
||||||
@@ -114,13 +166,13 @@ Functions documentation
|
|||||||
"row 3", "m02", "m12"
|
"row 3", "m02", "m12"
|
||||||
"row 4", "m03", "m13"
|
"row 4", "m03", "m13"
|
||||||
|
|
||||||
.. csv-table:: column vec2 (1x2)
|
.. csv-table:: column vec2 (1x2) **(v)**
|
||||||
:header: "", "column 1"
|
:header: "", "column 1"
|
||||||
|
|
||||||
"row 1", "v0"
|
"row 1", "v0"
|
||||||
"row 2", "v1"
|
"row 2", "v1"
|
||||||
|
|
||||||
.. csv-table:: column vec4 (1x4)
|
.. csv-table:: column vec4 (1x4) **(dest)**
|
||||||
:header: "", "column 1"
|
:header: "", "column 1"
|
||||||
|
|
||||||
"row 1", "m00 * v0 + m10 * v1"
|
"row 1", "m00 * v0 + m10 * v1"
|
||||||
@@ -128,18 +180,40 @@ Functions documentation
|
|||||||
"row 3", "m02 * v0 + m12 * v1"
|
"row 3", "m02 * v0 + m12 * v1"
|
||||||
"row 4", "m03 * v0 + m13 * v1"
|
"row 4", "m03 * v0 + m13 * v1"
|
||||||
|
|
||||||
.. c:function:: void glm_mat2x4_transpose(mat2x4 m, mat4x2 dest)
|
.. c:function:: void glm_mat2x4_transpose(mat2x4 src, mat4x2 dest)
|
||||||
|
|
||||||
transpose matrix and store in dest
|
Transpose mat2x4 (src) and store in mat4x2 (dest).
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m** matrix
|
| *[in]* **src** mat2x4 (left)
|
||||||
| *[out]* **dest** destination
|
| *[out]* **dest** destination (result, mat4x2)
|
||||||
|
|
||||||
|
.. csv-table:: mat2x4 **(src)**
|
||||||
|
:header: "", "column 1", "column 2"
|
||||||
|
|
||||||
|
"row 1", "a00", "a10"
|
||||||
|
"row 2", "a01", "a11"
|
||||||
|
"row 3", "a02", "a12"
|
||||||
|
"row 4", "a03", "a13"
|
||||||
|
|
||||||
|
.. csv-table:: mat4x2 **(dest)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3", "column 4"
|
||||||
|
|
||||||
|
"row 1", "b00 = a00", "b10 = a01", "b20 = a02", "b30 = a03"
|
||||||
|
"row 2", "b01 = a10", "b11 = a11", "b21 = a12", "b31 = a13"
|
||||||
|
|
||||||
.. c:function:: void glm_mat2x4_scale(mat2x4 m, float s)
|
.. c:function:: void glm_mat2x4_scale(mat2x4 m, float s)
|
||||||
|
|
||||||
multiply matrix with scalar
|
Multiply mat2x4 (m) by scalar constant (s).
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** matrix
|
| *[in, out]* **m** mat2x4 (src, dest)
|
||||||
| *[in]* **s** scalar
|
| *[in]* **s** float (scalar)
|
||||||
|
|
||||||
|
.. csv-table:: mat2x4 **(m)**
|
||||||
|
:header: "", "column 1", "column 2"
|
||||||
|
|
||||||
|
"row 1", "m00 = m00 * s", "m10 = m10 * s"
|
||||||
|
"row 2", "m01 = m01 * s", "m11 = m11 * s"
|
||||||
|
"row 3", "m02 = m02 * s", "m12 = m12 * s"
|
||||||
|
"row 4", "m03 = m03 * s", "m13 = m13 * s"
|
||||||
|
|||||||
@@ -35,58 +35,98 @@ Represented
|
|||||||
Functions documentation
|
Functions documentation
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
.. c:function:: void glm_mat3x2_copy(mat3x2 mat, mat3x2 dest)
|
.. c:function:: void glm_mat3x2_copy(mat3x2 src, mat3x2 dest)
|
||||||
|
|
||||||
copy mat3x2 to another one (dest).
|
Copy mat3x2 (src) to mat3x2 (dest).
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **mat** source
|
| *[in]* **src** mat3x2 (left)
|
||||||
| *[out]* **dest** destination
|
| *[out]* **dest** destination (result, mat3x2)
|
||||||
|
|
||||||
.. c:function:: void glm_mat3x2_zero(mat3x2 mat)
|
.. csv-table:: mat3x2 **(src)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3"
|
||||||
|
|
||||||
make given matrix zero
|
"row 1", "a00", "a10", "a20"
|
||||||
|
"row 2", "a01", "a11", "a21"
|
||||||
|
|
||||||
|
.. csv-table:: mat3x2 **(dest)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3"
|
||||||
|
|
||||||
|
"row 1", "b00 = a00", "b10 = a10", "b20 = a20"
|
||||||
|
"row 2", "b01 = a01", "b11 = a11", "b21 = a21"
|
||||||
|
|
||||||
|
.. c:function:: void glm_mat3x2_zero(mat3x2 m)
|
||||||
|
|
||||||
|
Zero out the mat3x2 (m).
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in,out]* **mat** matrix
|
| *[in, out]* **m** mat3x2 (src, dest)
|
||||||
|
|
||||||
|
.. csv-table:: mat3x2 **(m)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3"
|
||||||
|
|
||||||
|
"row 1", "0.00", "2.00", "15.00"
|
||||||
|
"row 2", "5.00", "4.00", "6.00"
|
||||||
|
|
||||||
|
.. csv-table:: mat3x2 **(m)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3"
|
||||||
|
|
||||||
|
"row 1", "0.00", "0.00", "0.00"
|
||||||
|
"row 2", "0.00", "0.00", "0.00"
|
||||||
|
|
||||||
.. c:function:: void glm_mat3x2_make(const float * __restrict src, mat3x2 dest)
|
.. c:function:: void glm_mat3x2_make(const float * __restrict src, mat3x2 dest)
|
||||||
|
|
||||||
Create mat3x2 matrix from pointer
|
Create mat3x2 (dest) from pointer (src).
|
||||||
|
|
||||||
.. note:: **@src** must contain at least 6 elements.
|
.. note:: **@src** must contain at least 6 elements.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **src** pointer to an array of floats
|
| *[in]* **src** pointer to an array of floats (left)
|
||||||
| *[out]* **dest** destination matrix3x2
|
| *[out]* **dest** destination (result, mat3x2)
|
||||||
|
|
||||||
|
.. csv-table:: float array (1x6) **(src)**
|
||||||
|
:header: "", "column 1"
|
||||||
|
|
||||||
|
"row 1", "v0"
|
||||||
|
"row 2", "v1"
|
||||||
|
"row 3", "v2"
|
||||||
|
"row 4", "v3"
|
||||||
|
"row 5", "v4"
|
||||||
|
"row 6", "v5"
|
||||||
|
|
||||||
|
.. csv-table:: mat3x2 **(dest)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3"
|
||||||
|
|
||||||
|
"row 1", "v0", "v2", "v4"
|
||||||
|
"row 2", "v1", "v3", "v5"
|
||||||
|
|
||||||
.. c:function:: void glm_mat3x2_mul(mat3x2 m1, mat2x3 m2, mat2 dest)
|
.. c:function:: void glm_mat3x2_mul(mat3x2 m1, mat2x3 m2, mat2 dest)
|
||||||
|
|
||||||
multiply m1 and m2 to dest
|
Multiply mat3x2 (m1) by mat2x3 (m2) and store in mat2 (dest).
|
||||||
|
|
||||||
.. code-block:: c
|
.. code-block:: c
|
||||||
|
|
||||||
glm_mat3x2_mul(mat3x2, mat2x3, mat2);
|
glm_mat3x2_mul(mat3x2, mat2x3, mat2);
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m1** left matrix (mat3x2)
|
| *[in]* **m1** mat3x2 (left)
|
||||||
| *[in]* **m2** right matrix (mat2x3)
|
| *[in]* **m2** mat2x3 (right)
|
||||||
| *[out]* **dest** destination matrix (mat2)
|
| *[out]* **dest** destination (result, mat2)
|
||||||
|
|
||||||
.. csv-table:: mat3x2
|
.. csv-table:: mat3x2 **(m1)**
|
||||||
:header: "", "column 1", "column 2", "column 3"
|
:header: "", "column 1", "column 2", "column 3"
|
||||||
|
|
||||||
"row 1", "a00", "a10", "a20"
|
"row 1", "a00", "a10", "a20"
|
||||||
"row 2", "a01", "a11", "a21"
|
"row 2", "a01", "a11", "a21"
|
||||||
|
|
||||||
.. csv-table:: mat2x3
|
.. csv-table:: mat2x3 **(m2)**
|
||||||
:header: "", "column 1", "column 2"
|
:header: "", "column 1", "column 2"
|
||||||
|
|
||||||
"row 1", "b00", "b10"
|
"row 1", "b00", "b10"
|
||||||
"row 2", "b01", "b11"
|
"row 2", "b01", "b11"
|
||||||
"row 3", "b02", "b12"
|
"row 3", "b02", "b12"
|
||||||
|
|
||||||
.. csv-table:: mat2x2
|
.. csv-table:: mat2x2 **(dest)**
|
||||||
:header: "", "column 1", "column 2"
|
:header: "", "column 1", "column 2"
|
||||||
|
|
||||||
"row 1", "a00 * b00 + a10 * b01 + a20 * b02", "a00 * b10 + a10 * b11 + a20 * b12"
|
"row 1", "a00 * b00 + a10 * b01 + a20 * b02", "a00 * b10 + a10 * b11 + a20 * b12"
|
||||||
@@ -94,44 +134,63 @@ Functions documentation
|
|||||||
|
|
||||||
.. c:function:: void glm_mat3x2_mulv(mat3x2 m, vec3 v, vec2 dest)
|
.. c:function:: void glm_mat3x2_mulv(mat3x2 m, vec3 v, vec2 dest)
|
||||||
|
|
||||||
multiply mat3x2 with vec3 (column vector) and store in dest vector
|
Multiply mat3x2 (m) by vec3 (v) and store in vec2 (dest).
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m** mat3x2 (left)
|
| *[in]* **m** mat3x2 (left)
|
||||||
| *[in]* **v** vec3 (right, column vector)
|
| *[in]* **v** vec3 (right, column vector)
|
||||||
| *[out]* **dest** destination (result, column vector)
|
| *[out]* **dest** destination (result, column vector)
|
||||||
|
|
||||||
.. csv-table:: mat3x2
|
.. csv-table:: mat3x2 **(m)**
|
||||||
:header: "", "column 1", "column 2", "column 3"
|
:header: "", "column 1", "column 2", "column 3"
|
||||||
|
|
||||||
"row 1", "m00", "m10", "m20"
|
"row 1", "m00", "m10", "m20"
|
||||||
"row 2", "m01", "m11", "m21"
|
"row 2", "m01", "m11", "m21"
|
||||||
|
|
||||||
.. csv-table:: column vec3 (1x3)
|
.. csv-table:: column vec3 (1x3) **(v)**
|
||||||
:header: "", "column 1"
|
:header: "", "column 1"
|
||||||
|
|
||||||
"row 1", "v0"
|
"row 1", "v0"
|
||||||
"row 2", "v1"
|
"row 2", "v1"
|
||||||
"row 3", "v2"
|
"row 3", "v2"
|
||||||
|
|
||||||
.. csv-table:: column vec2 (1x2)
|
.. csv-table:: column vec2 (1x2) **(dest)**
|
||||||
:header: "", "column 1"
|
:header: "", "column 1"
|
||||||
|
|
||||||
"row 1", "m00 * v0 + m10 * v1 + m20 * v2"
|
"row 1", "m00 * v0 + m10 * v1 + m20 * v2"
|
||||||
"row 2", "m01 * v0 + m11 * v1 + m21 * v2"
|
"row 2", "m01 * v0 + m11 * v1 + m21 * v2"
|
||||||
|
|
||||||
.. c:function:: void glm_mat3x2_transpose(mat3x2 m, mat2x3 dest)
|
.. c:function:: void glm_mat3x2_transpose(mat3x2 src, mat2x3 dest)
|
||||||
|
|
||||||
transpose matrix and store in dest
|
Transpose mat3x2 (src) and store in mat2x3 (dest).
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m** matrix
|
| *[in]* **src** mat3x2 (left)
|
||||||
| *[out]* **dest** destination
|
| *[out]* **dest** destination (result, mat2x3)
|
||||||
|
|
||||||
.. c:function:: void glm_mat3x2_scale(mat3x2 m, float s)
|
.. csv-table:: mat3x2 **(src)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3"
|
||||||
|
|
||||||
multiply matrix with scalar
|
"row 1", "a00", "a10", "a20"
|
||||||
|
"row 2", "a01", "a11", "a21"
|
||||||
|
|
||||||
|
.. csv-table:: mat2x3 **(dest)**
|
||||||
|
:header: "", "column 1", "column 2"
|
||||||
|
|
||||||
|
"row 1", "b00 = a00", "b10 = a01"
|
||||||
|
"row 2", "b01 = a10", "b11 = a11"
|
||||||
|
"row 3", "b02 = a20", "b12 = a21"
|
||||||
|
|
||||||
|
.. c:function:: void glm_mat3x2_scale(mat3x2 m, float s)
|
||||||
|
|
||||||
|
Multiply mat3x2 (m) by scalar constant (s).
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** matrix
|
| *[in, out]* **m** mat3x2 (src, dest)
|
||||||
| *[in]* **s** scalar
|
| *[in]* **s** float (scalar)
|
||||||
|
|
||||||
|
.. csv-table:: mat3x2 **(m)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3"
|
||||||
|
|
||||||
|
"row 1", "m00 = m00 * s", "m10 = m10 * s", "m20 = m20 * s"
|
||||||
|
"row 2", "m01 = m01 * s", "m11 = m11 * s", "m21 = m21 * s"
|
||||||
|
|||||||
@@ -37,45 +37,15 @@ Represented
|
|||||||
Functions documentation
|
Functions documentation
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
.. c:function:: void glm_mat3x4_copy(mat3x4 mat, mat3x4 dest)
|
.. c:function:: void glm_mat3x4_copy(mat3x4 src, mat3x4 dest)
|
||||||
|
|
||||||
copy mat3x4 to another one (dest).
|
Copy mat3x4 (src) to mat3x4 (dest).
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **mat** source
|
| *[in]* **src** mat3x4 (left)
|
||||||
| *[out]* **dest** destination
|
| *[out]* **dest** destination (result, mat3x4)
|
||||||
|
|
||||||
.. c:function:: void glm_mat3x4_zero(mat3x4 mat)
|
.. csv-table:: mat3x4 **(src)**
|
||||||
|
|
||||||
make given matrix zero
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
| *[in,out]* **mat** matrix
|
|
||||||
|
|
||||||
.. c:function:: void glm_mat3x4_make(const float * __restrict src, mat3x4 dest)
|
|
||||||
|
|
||||||
Create mat3x4 matrix from pointer
|
|
||||||
|
|
||||||
.. note::: **@src** must contain at least 12 elements.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
| *[in]* **src** pointer to an array of floats
|
|
||||||
| *[out]* **dest** destination matrix3x4
|
|
||||||
|
|
||||||
.. c:function:: void glm_mat3x4_mul(mat3x4 m1, mat4x3 m2, mat4 dest)
|
|
||||||
|
|
||||||
multiply m1 and m2 to dest
|
|
||||||
|
|
||||||
.. code-block:: c
|
|
||||||
|
|
||||||
glm_mat3x4_mul(mat3x4, mat4x3, mat4);
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
| *[in]* **m1** left matrix (mat3x4)
|
|
||||||
| *[in]* **m2** right matrix (mat4x3)
|
|
||||||
| *[out]* **dest** destination matrix (mat4)
|
|
||||||
|
|
||||||
.. csv-table:: mat3x4
|
|
||||||
:header: "", "column 1", "column 2", "column 3"
|
:header: "", "column 1", "column 2", "column 3"
|
||||||
|
|
||||||
"row 1", "a00", "a10", "a20"
|
"row 1", "a00", "a10", "a20"
|
||||||
@@ -83,14 +53,100 @@ Functions documentation
|
|||||||
"row 3", "a02", "a12", "a22"
|
"row 3", "a02", "a12", "a22"
|
||||||
"row 4", "a03", "a13", "a23"
|
"row 4", "a03", "a13", "a23"
|
||||||
|
|
||||||
.. csv-table:: mat4x3
|
.. csv-table:: mat3x4 **(dest)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3"
|
||||||
|
|
||||||
|
"row 1", "b00 = a00", "b10 = a10", "b20 = a20"
|
||||||
|
"row 2", "b01 = a01", "b11 = a11", "b21 = a21"
|
||||||
|
"row 3", "b02 = a02", "b12 = a12", "b22 = a22"
|
||||||
|
"row 4", "b03 = a03", "b13 = a13", "b23 = a23"
|
||||||
|
|
||||||
|
.. c:function:: void glm_mat3x4_zero(mat3x4 m)
|
||||||
|
|
||||||
|
Zero out the mat3x4 (m).
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
| *[in, out]* **m** mat3x4 (src, dest)
|
||||||
|
|
||||||
|
.. csv-table:: mat3x4 **(m)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3"
|
||||||
|
|
||||||
|
"row 1", "0.00", "2.00", "78.00"
|
||||||
|
"row 2", "5.00", "4.00", "12.00"
|
||||||
|
"row 3", "7.00", "6.00", "32.00"
|
||||||
|
"row 4", "23.00", "1.00", "9.00"
|
||||||
|
|
||||||
|
.. csv-table:: mat3x4 **(m)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3"
|
||||||
|
|
||||||
|
"row 1", "0.00", "0.00", "0.00"
|
||||||
|
"row 2", "0.00", "0.00", "0.00"
|
||||||
|
"row 3", "0.00", "0.00", "0.00"
|
||||||
|
"row 4", "0.00", "0.00", "0.00"
|
||||||
|
|
||||||
|
.. c:function:: void glm_mat3x4_make(const float * __restrict src, mat3x4 dest)
|
||||||
|
|
||||||
|
Create mat3x4 (dest) from pointer (src).
|
||||||
|
|
||||||
|
.. note:: **@src** must contain at least 12 elements.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
| *[in]* **src** pointer to an array of floats (left)
|
||||||
|
| *[out]* **dest** destination (result, mat3x4)
|
||||||
|
|
||||||
|
.. csv-table:: float array (1x12) **(src)**
|
||||||
|
:header: "", "column 1"
|
||||||
|
|
||||||
|
"row 1", "v0"
|
||||||
|
"row 2", "v1"
|
||||||
|
"row 3", "v2"
|
||||||
|
"row 4", "v3"
|
||||||
|
"row 5", "v4"
|
||||||
|
"row 6", "v5"
|
||||||
|
"row 7", "v6"
|
||||||
|
"row 8", "v7"
|
||||||
|
"row 9", "v8"
|
||||||
|
"row 10", "v9"
|
||||||
|
"row 11", "v10"
|
||||||
|
"row 12", "v11"
|
||||||
|
|
||||||
|
.. csv-table:: mat3x4 **(dest)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3"
|
||||||
|
|
||||||
|
"row 1", "v0", "v4", "v8"
|
||||||
|
"row 2", "v1", "v5", "v9"
|
||||||
|
"row 3", "v2", "v6", "v10"
|
||||||
|
"row 4", "v3", "v7", "v11"
|
||||||
|
|
||||||
|
.. c:function:: void glm_mat3x4_mul(mat3x4 m1, mat4x3 m2, mat4 dest)
|
||||||
|
|
||||||
|
Multiply mat3x4 (m1) by mat4x3 (m2) and store in mat4 (dest).
|
||||||
|
|
||||||
|
.. code-block:: c
|
||||||
|
|
||||||
|
glm_mat3x4_mul(mat3x4, mat4x3, mat4);
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
| *[in]* **m1** mat2x4 (left)
|
||||||
|
| *[in]* **m2** mat4x2 (right)
|
||||||
|
| *[out]* **dest** destination (result, mat4)
|
||||||
|
|
||||||
|
.. csv-table:: mat3x4 **(m1)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3"
|
||||||
|
|
||||||
|
"row 1", "a00", "a10", "a20"
|
||||||
|
"row 2", "a01", "a11", "a21"
|
||||||
|
"row 3", "a02", "a12", "a22"
|
||||||
|
"row 4", "a03", "a13", "a23"
|
||||||
|
|
||||||
|
.. csv-table:: mat4x3 **(m2)**
|
||||||
:header: "", "column 1", "column 2", "column 3", "column 4"
|
:header: "", "column 1", "column 2", "column 3", "column 4"
|
||||||
|
|
||||||
"row 1", "b00", "b10", "b20", "b30"
|
"row 1", "b00", "b10", "b20", "b30"
|
||||||
"row 2", "b01", "b11", "b21", "b31"
|
"row 2", "b01", "b11", "b21", "b31"
|
||||||
"row 3", "b02", "b12", "b22", "b32"
|
"row 3", "b02", "b12", "b22", "b32"
|
||||||
|
|
||||||
.. csv-table:: mat4x4
|
.. csv-table:: mat4x4 **(dest)**
|
||||||
:header: "", "column 1", "column 2", "column 3", "column 4"
|
:header: "", "column 1", "column 2", "column 3", "column 4"
|
||||||
|
|
||||||
"row 1", "a00 * b00 + a10 * b01 + a20 * b02", "a00 * b10 + a10 * b11 + a20 * b12", "a00 * b20 + a10 * b21 + a20 * b22", "a00 * b30 + a10 * b31 + a20 * b32"
|
"row 1", "a00 * b00 + a10 * b01 + a20 * b02", "a00 * b10 + a10 * b11 + a20 * b12", "a00 * b20 + a10 * b21 + a20 * b22", "a00 * b30 + a10 * b31 + a20 * b32"
|
||||||
@@ -100,14 +156,14 @@ Functions documentation
|
|||||||
|
|
||||||
.. c:function:: void glm_mat3x4_mulv(mat3x4 m, vec3 v, vec4 dest)
|
.. c:function:: void glm_mat3x4_mulv(mat3x4 m, vec3 v, vec4 dest)
|
||||||
|
|
||||||
multiply mat3x4 with vec3 (column vector) and store in dest vector
|
Multiply ma3x4 (m) by vec3 (v) and store in vec4 (dest).
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m** mat3x4 (left)
|
| *[in]* **m** mat3x4 (left)
|
||||||
| *[in]* **v** vec3 (right, column vector)
|
| *[in]* **v** vec3 (right, column vector)
|
||||||
| *[out]* **dest** destination (result, column vector)
|
| *[out]* **dest** destination (result, column vector)
|
||||||
|
|
||||||
.. csv-table:: mat3x4
|
.. csv-table:: mat3x4 **(m)**
|
||||||
:header: "", "column 1", "column 2", "column 3"
|
:header: "", "column 1", "column 2", "column 3"
|
||||||
|
|
||||||
"row 1", "m00", "m10", "m20"
|
"row 1", "m00", "m10", "m20"
|
||||||
@@ -115,14 +171,14 @@ Functions documentation
|
|||||||
"row 3", "m02", "m12", "m22"
|
"row 3", "m02", "m12", "m22"
|
||||||
"row 4", "m03", "m13", "m23"
|
"row 4", "m03", "m13", "m23"
|
||||||
|
|
||||||
.. csv-table:: column vec3 (1x3)
|
.. csv-table:: column vec3 (1x3) **(v)**
|
||||||
:header: "", "column 1"
|
:header: "", "column 1"
|
||||||
|
|
||||||
"row 1", "v0"
|
"row 1", "v0"
|
||||||
"row 2", "v1"
|
"row 2", "v1"
|
||||||
"row 3", "v2"
|
"row 3", "v2"
|
||||||
|
|
||||||
.. csv-table:: column vec4 (1x4)
|
.. csv-table:: column vec4 (1x4) **(dest)**
|
||||||
:header: "", "column 1"
|
:header: "", "column 1"
|
||||||
|
|
||||||
"row 1", "m00 * v0 + m10 * v1 + m20 * v2"
|
"row 1", "m00 * v0 + m10 * v1 + m20 * v2"
|
||||||
@@ -130,18 +186,41 @@ Functions documentation
|
|||||||
"row 3", "m02 * v0 + m12 * v1 + m22 * v2"
|
"row 3", "m02 * v0 + m12 * v1 + m22 * v2"
|
||||||
"row 4", "m03 * v0 + m13 * v1 + m23 * v2"
|
"row 4", "m03 * v0 + m13 * v1 + m23 * v2"
|
||||||
|
|
||||||
.. c:function:: void glm_mat3x4_transpose(mat3x4 m, mat4x3 dest)
|
.. c:function:: void glm_mat3x4_transpose(mat3x4 src, mat4x3 dest)
|
||||||
|
|
||||||
transpose matrix and store in dest
|
Transpose mat3x4 (src) and store in mat4x3 (dest).
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m** matrix
|
| *[in]* **src** mat3x4 (left)
|
||||||
| *[out]* **dest** destination
|
| *[out]* **dest** destination (result, mat4x3)
|
||||||
|
|
||||||
|
.. csv-table:: mat3x4 **(src)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3"
|
||||||
|
|
||||||
|
"row 1", "a00", "a10", "a20"
|
||||||
|
"row 2", "a01", "a11", "a21"
|
||||||
|
"row 3", "a02", "a12", "a22"
|
||||||
|
"row 4", "a03", "a13", "a23"
|
||||||
|
|
||||||
|
.. csv-table:: mat4x3 **(dest)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3", "column 4"
|
||||||
|
|
||||||
|
"row 1", "b00 = a00", "b10 = a01", "b20 = a02", "b30 = a03"
|
||||||
|
"row 2", "b01 = a10", "b11 = a11", "b21 = a12", "b31 = a13"
|
||||||
|
"row 3", "b02 = a20", "b12 = a21", "b22 = a22", "b32 = a23"
|
||||||
|
|
||||||
.. c:function:: void glm_mat3x4_scale(mat3x4 m, float s)
|
.. c:function:: void glm_mat3x4_scale(mat3x4 m, float s)
|
||||||
|
|
||||||
multiply matrix with scalar
|
Multiply mat3x4 (m) by scalar constant (s).
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** matrix
|
| *[in, out]* **m** mat3x4 (src, dest)
|
||||||
| *[in]* **s** scalar
|
| *[in]* **s** float (scalar)
|
||||||
|
|
||||||
|
.. csv-table:: mat3x4 **(m)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3"
|
||||||
|
|
||||||
|
"row 1", "m00 = m00 * s", "m10 = m10 * s", "m20 = m20 * s"
|
||||||
|
"row 2", "m01 = m01 * s", "m11 = m11 * s", "m21 = m21 * s"
|
||||||
|
"row 3", "m02 = m02 * s", "m12 = m12 * s", "m22 = m22 * s"
|
||||||
|
"row 4", "m03 = m03 * s", "m13 = m13 * s", "m23 = m23 * s"
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ Functions documentation
|
|||||||
|
|
||||||
.. code-block:: c
|
.. code-block:: c
|
||||||
|
|
||||||
mat m1, m2, m3, m4, res;
|
mat4 m1, m2, m3, m4, res;
|
||||||
glm_mat4_mulN((mat4 *[]){&m1, &m2, &m3, &m4}, 4, res);
|
glm_mat4_mulN((mat4 *[]){&m1, &m2, &m3, &m4}, 4, res);
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
|||||||
@@ -35,51 +35,93 @@ Represented
|
|||||||
Functions documentation
|
Functions documentation
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
.. c:function:: void glm_mat4x2_copy(mat4x2 mat, mat4x2 dest)
|
.. c:function:: void glm_mat4x2_copy(mat4x2 src, mat4x2 dest)
|
||||||
|
|
||||||
copy mat4x2 to another one (dest).
|
Copy mat4x2 (src) to mat4x2 (dest).
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **mat** source
|
| *[in]* **src** mat4x2 (left)
|
||||||
| *[out]* **dest** destination
|
| *[out]* **dest** destination (result, mat4x2)
|
||||||
|
|
||||||
.. c:function:: void glm_mat4x2_zero(mat4x2 mat)
|
.. csv-table:: mat4x2 **(src)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3", "column 4"
|
||||||
|
|
||||||
make given matrix zero
|
"row 1", "a00", "a10", "a20", "a30"
|
||||||
|
"row 2", "a01", "a11", "a21", "a31"
|
||||||
|
|
||||||
|
.. csv-table:: ma4x2 **(dest)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3", "column 4"
|
||||||
|
|
||||||
|
"row 1", "b00 = a00", "b10 = a10", "b20 = a20", "b30 = a30"
|
||||||
|
"row 2", "b01 = a01", "b11 = a11", "b21 = a21", "b31 = a31"
|
||||||
|
|
||||||
|
.. c:function:: void glm_mat4x2_zero(mat4x2 m)
|
||||||
|
|
||||||
|
Zero out the mat4x2 (m).
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in,out]* **mat** matrix
|
| *[in, out]* **m** mat4x2 (src, dest)
|
||||||
|
|
||||||
|
.. csv-table:: mat4x2 **(m)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3", "column 4"
|
||||||
|
|
||||||
|
"row 1", "0.00", "2.00", "15.00", "44.00"
|
||||||
|
"row 2", "5.00", "4.00", "6.00", "12.00"
|
||||||
|
|
||||||
|
.. csv-table:: mat4x2 **(m)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3", "column 4"
|
||||||
|
|
||||||
|
"row 1", "0.00", "0.00", "0.00", "0.00"
|
||||||
|
"row 2", "0.00", "0.00", "0.00", "0.00"
|
||||||
|
|
||||||
.. c:function:: void glm_mat4x2_make(const float * __restrict src, mat4x2 dest)
|
.. c:function:: void glm_mat4x2_make(const float * __restrict src, mat4x2 dest)
|
||||||
|
|
||||||
Create mat4x2 matrix from pointer
|
Create mat4x2 (dest) from pointer (src).
|
||||||
|
|
||||||
.. note:: **@src** must contain at least 8 elements.
|
.. note:: **@src** must contain at least 8 elements.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **src** pointer to an array of floats
|
| *[in]* **src** pointer to an array of floats (left)
|
||||||
| *[out]* **dest** destination matrix4x2
|
| *[out]* **dest** destination (result, mat4x2)
|
||||||
|
|
||||||
|
.. csv-table:: float array (1x8) **(src)**
|
||||||
|
:header: "", "column 1"
|
||||||
|
|
||||||
|
"row 1", "v0"
|
||||||
|
"row 2", "v1"
|
||||||
|
"row 3", "v2"
|
||||||
|
"row 4", "v3"
|
||||||
|
"row 5", "v4"
|
||||||
|
"row 6", "v5"
|
||||||
|
"row 7", "v6"
|
||||||
|
"row 8", "v7"
|
||||||
|
|
||||||
|
.. csv-table:: mat4x2 **(dest)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3", "column 4"
|
||||||
|
|
||||||
|
"row 1", "v0", "v2", "v4", "v6"
|
||||||
|
"row 2", "v1", "v3", "v5", "v7"
|
||||||
|
|
||||||
.. c:function:: void glm_mat4x2_mul(mat4x2 m1, mat2x4 m2, mat2 dest)
|
.. c:function:: void glm_mat4x2_mul(mat4x2 m1, mat2x4 m2, mat2 dest)
|
||||||
|
|
||||||
multiply m1 and m2 to dest
|
Multiply mat4x2 (m1) by mat2x4 (m2) and store in mat2 (dest).
|
||||||
|
|
||||||
.. code-block:: c
|
.. code-block:: c
|
||||||
|
|
||||||
glm_mat4x2_mul(mat4x2, mat2x4, mat2);
|
glm_mat4x2_mul(mat4x2, mat2x4, mat2);
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m1** left matrix (mat4x2)
|
| *[in]* **m1** mat4x2 (left)
|
||||||
| *[in]* **m2** right matrix (mat2x4)
|
| *[in]* **m2** mat2x4 (right)
|
||||||
| *[out]* **dest** destination matrix (mat2)
|
| *[out]* **dest** destination (result, mat2)
|
||||||
|
|
||||||
.. csv-table:: mat4x2
|
.. csv-table:: mat4x2 **(m1)**
|
||||||
:header: "", "column 1", "column 2", "column 3", "column 4"
|
:header: "", "column 1", "column 2", "column 3", "column 4"
|
||||||
|
|
||||||
"row 1", "a00", "a10", "a20", "a30"
|
"row 1", "a00", "a10", "a20", "a30"
|
||||||
"row 2", "a01", "a11", "a21", "a31"
|
"row 2", "a01", "a11", "a21", "a31"
|
||||||
|
|
||||||
.. csv-table:: mat2x4
|
.. csv-table:: mat2x4 **(m2)**
|
||||||
:header: "", "column 1", "column 2"
|
:header: "", "column 1", "column 2"
|
||||||
|
|
||||||
"row 1", "b00", "b10"
|
"row 1", "b00", "b10"
|
||||||
@@ -87,7 +129,7 @@ Functions documentation
|
|||||||
"row 3", "b02", "b12"
|
"row 3", "b02", "b12"
|
||||||
"row 4", "b03", "b13"
|
"row 4", "b03", "b13"
|
||||||
|
|
||||||
.. csv-table:: mat2x2
|
.. csv-table:: mat2x2 **(dest)**
|
||||||
:header: "", "column 1", "column 2"
|
:header: "", "column 1", "column 2"
|
||||||
|
|
||||||
"row 1", "a00 * b00 + a10 * b01 + a20 * b02 + a30 * b03", "a00 * b10 + a10 * b11 + a20 * b12 + a30 * b13"
|
"row 1", "a00 * b00 + a10 * b01 + a20 * b02 + a30 * b03", "a00 * b10 + a10 * b11 + a20 * b12 + a30 * b13"
|
||||||
@@ -95,22 +137,20 @@ Functions documentation
|
|||||||
|
|
||||||
.. c:function:: void glm_mat4x2_mulv(mat4x2 m, vec4 v, vec2 dest)
|
.. c:function:: void glm_mat4x2_mulv(mat4x2 m, vec4 v, vec2 dest)
|
||||||
|
|
||||||
multiply mat4x2 with vec4 (column vector) and store in dest vector
|
Multiply mat4x2 (m) by vec4 (v) and store in vec2 (dest).
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m** mat4x2 (left)
|
| *[in]* **m** mat4x2 (left)
|
||||||
| *[in]* **v** vec4 (right, column vector)
|
| *[in]* **v** vec4 (right, column vector)
|
||||||
| *[out]* **dest** destination (result, column vector)
|
| *[out]* **dest** destination (result, column vector)
|
||||||
|
|
||||||
.. csv-table:: mat4x2
|
.. csv-table:: mat4x2 **(m)**
|
||||||
:header: "", "column 1", "column 2", "column 3"
|
:header: "", "column 1", "column 2", "column 3", "column 4"
|
||||||
|
|
||||||
"row 1", "m00", "m10", "m20"
|
"row 1", "m00", "m10", "m20", "m30"
|
||||||
"row 2", "m01", "m11", "m21"
|
"row 2", "m01", "m11", "m21", "m31"
|
||||||
"row 3", "m02", "m12", "m22"
|
|
||||||
"row 4", "m03", "m13", "m23"
|
|
||||||
|
|
||||||
.. csv-table:: column vec4 (1x4)
|
.. csv-table:: column vec4 (1x4) **(v)**
|
||||||
:header: "", "column 1"
|
:header: "", "column 1"
|
||||||
|
|
||||||
"row 1", "v0"
|
"row 1", "v0"
|
||||||
@@ -118,24 +158,44 @@ Functions documentation
|
|||||||
"row 3", "v2"
|
"row 3", "v2"
|
||||||
"row 4", "v3"
|
"row 4", "v3"
|
||||||
|
|
||||||
.. csv-table:: column vec2 (1x2)
|
.. csv-table:: column vec2 (1x2) **(dest)**
|
||||||
:header: "", "column 1"
|
:header: "", "column 1"
|
||||||
|
|
||||||
"row 1", "m00 * v0 + m10 * v1 + m20 * v2 + m30 * v3"
|
"row 1", "m00 * v0 + m10 * v1 + m20 * v2 + m30 * v3"
|
||||||
"row 2", "m01 * v0 + m11 * v1 + m21 * v2 + m31 * v3"
|
"row 2", "m01 * v0 + m11 * v1 + m21 * v2 + m31 * v3"
|
||||||
|
|
||||||
.. c:function:: void glm_mat4x2_transpose(mat4x2 m, mat2x4 dest)
|
.. c:function:: void glm_mat4x2_transpose(mat4x2 src, mat2x4 dest)
|
||||||
|
|
||||||
transpose matrix and store in dest
|
Transpose mat4x2 (src) and store in mat2x4 (dest).
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m** matrix
|
| *[in]* **src** mat4x2 (left)
|
||||||
| *[out]* **dest** destination
|
| *[out]* **dest** destination (result, mat2x4)
|
||||||
|
|
||||||
|
.. csv-table:: mat4x2 **(src)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3", "column 4"
|
||||||
|
|
||||||
|
"row 1", "a00", "a10", "a20", "a30"
|
||||||
|
"row 2", "a01", "a11", "a21", "a31"
|
||||||
|
|
||||||
|
.. csv-table:: mat2x4 **(dest)**
|
||||||
|
:header: "", "column 1", "column 2"
|
||||||
|
|
||||||
|
"row 1", "b00 = a00", "b10 = a01"
|
||||||
|
"row 2", "b01 = a10", "b11 = a11"
|
||||||
|
"row 3", "b02 = a20", "b12 = a21"
|
||||||
|
"row 4", "b03 = a30", "b13 = a31"
|
||||||
|
|
||||||
.. c:function:: void glm_mat4x2_scale(mat4x2 m, float s)
|
.. c:function:: void glm_mat4x2_scale(mat4x2 m, float s)
|
||||||
|
|
||||||
multiply matrix with scalar
|
Multiply mat4x2 (m) by scalar constant (s).
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** matrix
|
| *[in, out]* **m** mat4x2 (src, dest)
|
||||||
| *[in]* **s** scalar
|
| *[in]* **s** float (scalar)
|
||||||
|
|
||||||
|
.. csv-table:: mat4x2 **(m)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3", "column 4"
|
||||||
|
|
||||||
|
"row 1", "m00 = m00 * s", "m10 = m10 * s", "m20 = m20 * s", "m30 = m30 * s"
|
||||||
|
"row 2", "m01 = m01 * s", "m11 = m11 * s", "m21 = m21 * s", "m31 = m31 * s"
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ Represented
|
|||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
|
|
||||||
.. csv-table:: mat4x3
|
.. csv-table:: mat4x3
|
||||||
:header: "", "column 1", "column 2", "column 3", "column4"
|
:header: "", "column 1", "column 2", "column 3", "column 4"
|
||||||
|
|
||||||
"row 1", "m00", "m10", "m20", "m30"
|
"row 1", "m00", "m10", "m20", "m30"
|
||||||
"row 2", "m01", "m11", "m21", "m31"
|
"row 2", "m01", "m11", "m21", "m31"
|
||||||
@@ -36,52 +36,103 @@ Represented
|
|||||||
Functions documentation
|
Functions documentation
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
.. c:function:: void glm_mat4x3_copy(mat4x3 mat, mat4x3 dest)
|
.. c:function:: void glm_mat4x3_copy(mat4x3 src, mat4x3 dest)
|
||||||
|
|
||||||
copy mat4x3 to another one (dest).
|
Copy mat4x3 (src) to mat4x3 (dest).
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **mat** source
|
| *[in]* **src** mat4x3 (left)
|
||||||
| *[out]* **dest** destination
|
| *[out]* **dest** destination (result, mat4x3)
|
||||||
|
|
||||||
.. c:function:: void glm_mat4x3_zero(mat4x3 mat)
|
.. csv-table:: mat4x3 **(src)**
|
||||||
|
|
||||||
make given matrix zero
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
| *[in,out]* **mat** matrix
|
|
||||||
|
|
||||||
.. c:function:: void glm_mat4x3_make(const float * __restrict src, mat4x3 dest)
|
|
||||||
|
|
||||||
Create mat4x3 matrix from pointer
|
|
||||||
|
|
||||||
.. note:: **@src** must contain at least 12 elements.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
| *[in]* **src** pointer to an array of floats
|
|
||||||
| *[out]* **dest** destination matrix4x3
|
|
||||||
|
|
||||||
.. c:function:: void glm_mat4x3_mul(mat4x3 m1, mat3x4 m2, mat3 dest)
|
|
||||||
|
|
||||||
multiply m1 and m2 to dest
|
|
||||||
|
|
||||||
.. code-block:: c
|
|
||||||
|
|
||||||
glm_mat4x3_mul(mat4x3, mat3x4, mat3);
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
| *[in]* **m1** left matrix (mat4x3)
|
|
||||||
| *[in]* **m2** right matrix (mat3x4)
|
|
||||||
| *[out]* **dest** destination matrix (mat3)
|
|
||||||
|
|
||||||
.. csv-table:: mat4x3
|
|
||||||
:header: "", "column 1", "column 2", "column 3", "column 4"
|
:header: "", "column 1", "column 2", "column 3", "column 4"
|
||||||
|
|
||||||
"row 1", "a00", "a10", "a20", "a30"
|
"row 1", "a00", "a10", "a20", "a30"
|
||||||
"row 2", "a01", "a11", "a21", "a31"
|
"row 2", "a01", "a11", "a21", "a31"
|
||||||
"row 3", "a02", "a12", "a22", "a32"
|
"row 3", "a02", "a12", "a22", "a32"
|
||||||
|
|
||||||
.. csv-table:: mat3x4
|
.. csv-table:: mat4x3 **(dest)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3", "column 4"
|
||||||
|
|
||||||
|
"row 1", "b00 = a00", "b10 = a10", "b20 = a20", "b30 = a30"
|
||||||
|
"row 2", "b01 = a01", "b11 = a11", "b21 = a21", "b31 = a31"
|
||||||
|
"row 3", "b02 = a02", "b12 = a12", "b22 = a22", "b32 = a32"
|
||||||
|
|
||||||
|
.. c:function:: void glm_mat4x3_zero(mat4x3 m)
|
||||||
|
|
||||||
|
Zero out the mat4x3 (m).
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
| *[in, out]* **m** mat4x3 (src, dest)
|
||||||
|
|
||||||
|
.. csv-table:: mat4x3 **(m)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3", "column 4"
|
||||||
|
|
||||||
|
"row 1", "0.00", "2.00", "15.00", "44.00"
|
||||||
|
"row 2", "5.00", "4.00", "6.00", "12.00"
|
||||||
|
"row 3", "88.00", "8.00", "4.30", "15.00"
|
||||||
|
|
||||||
|
.. csv-table:: mat4x3 **(m)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3", "column 4"
|
||||||
|
|
||||||
|
"row 1", "0.00", "0.00", "0.00", "0.00"
|
||||||
|
"row 2", "0.00", "0.00", "0.00", "0.00"
|
||||||
|
"row3", "0.00", "0.00", "0.00", "0.00"
|
||||||
|
|
||||||
|
.. c:function:: void glm_mat4x3_make(const float * __restrict src, mat4x3 dest)
|
||||||
|
|
||||||
|
Create mat4x3 (dest) from pointer (src).
|
||||||
|
|
||||||
|
.. note:: **@src** must contain at least 12 elements.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
| *[in]* **src** pointer to an array of floats (left)
|
||||||
|
| *[out]* **dest** destination (result, mat4x3)
|
||||||
|
|
||||||
|
.. csv-table:: float array (1x12) **(src)**
|
||||||
|
:header: "", "column 1"
|
||||||
|
|
||||||
|
"row 1", "v0"
|
||||||
|
"row 2", "v1"
|
||||||
|
"row 3", "v2"
|
||||||
|
"row 4", "v3"
|
||||||
|
"row 5", "v4"
|
||||||
|
"row 6", "v5"
|
||||||
|
"row 7", "v6"
|
||||||
|
"row 8", "v7"
|
||||||
|
"row 9", "v8"
|
||||||
|
"row 10", "v9"
|
||||||
|
"row 11", "v10"
|
||||||
|
"row 12", "v11"
|
||||||
|
|
||||||
|
.. csv-table:: mat4x3 **(dest)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3", "column 4"
|
||||||
|
|
||||||
|
"row 1", "v0", "v3", "v6", "v9"
|
||||||
|
"row 2", "v1", "v4", "v7", "v10"
|
||||||
|
"row 3", "v2", "v5", "v8", "v11"
|
||||||
|
|
||||||
|
.. c:function:: void glm_mat4x3_mul(mat4x3 m1, mat3x4 m2, mat3 dest)
|
||||||
|
|
||||||
|
Multiply mat4x3 (m1) by mat3x4 (m2) and store in mat3 (dest).
|
||||||
|
|
||||||
|
.. code-block:: c
|
||||||
|
|
||||||
|
glm_mat4x3_mul(mat4x3, mat3x4, mat3);
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
| *[in]* **m1** mat4x3 (left)
|
||||||
|
| *[in]* **m2** mat3x4 (right)
|
||||||
|
| *[out]* **dest** destination (result, mat3)
|
||||||
|
|
||||||
|
.. csv-table:: mat4x3 **(m1)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3", "column 4"
|
||||||
|
|
||||||
|
"row 1", "a00", "a10", "a20", "a30"
|
||||||
|
"row 2", "a01", "a11", "a21", "a31"
|
||||||
|
"row 3", "a02", "a12", "a22", "a32"
|
||||||
|
|
||||||
|
.. csv-table:: mat3x4 **(m2)**
|
||||||
:header: "", "column 1", "column 2", "column 3"
|
:header: "", "column 1", "column 2", "column 3"
|
||||||
|
|
||||||
"row 1", "b00", "b10", "b20"
|
"row 1", "b00", "b10", "b20"
|
||||||
@@ -89,7 +140,7 @@ Functions documentation
|
|||||||
"row 3", "b02", "b12", "b22"
|
"row 3", "b02", "b12", "b22"
|
||||||
"row 4", "b03", "b13", "b23"
|
"row 4", "b03", "b13", "b23"
|
||||||
|
|
||||||
.. csv-table:: mat3x3
|
.. csv-table:: mat3x3 **(dest)**
|
||||||
:header: "", "column 1", "column 2", "column 3"
|
:header: "", "column 1", "column 2", "column 3"
|
||||||
|
|
||||||
"row 1", "a00 * b00 + a10 * b01 + a20 * b02 + a30 * b03", "a00 * b10 + a10 * b11 + a20 * b12 + a30 * b13", "a00 * b20 + a10 * b21 + a20 * b22 + a30 * b23"
|
"row 1", "a00 * b00 + a10 * b01 + a20 * b02 + a30 * b03", "a00 * b10 + a10 * b11 + a20 * b12 + a30 * b13", "a00 * b20 + a10 * b21 + a20 * b22 + a30 * b23"
|
||||||
@@ -98,21 +149,21 @@ Functions documentation
|
|||||||
|
|
||||||
.. c:function:: void glm_mat4x3_mulv(mat4x3 m, vec4 v, vec3 dest)
|
.. c:function:: void glm_mat4x3_mulv(mat4x3 m, vec4 v, vec3 dest)
|
||||||
|
|
||||||
multiply mat4x3 with vec4 (column vector) and store in dest column vector
|
Multiply mat4x3 (m) by vec4 (v) and store in vec3 (dest).
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m** mat4x3 (left)
|
| *[in]* **m** mat4x3 (left)
|
||||||
| *[in]* **v** vec4 (right, column vector)
|
| *[in]* **v** vec4 (right, column vector)
|
||||||
| *[out]* **dest** destination (result, column vector)
|
| *[out]* **dest** destination (result, column vector)
|
||||||
|
|
||||||
.. csv-table:: mat4x3
|
.. csv-table:: mat4x3 **(m)**
|
||||||
:header: "", "column 1", "column 2", "column 3", "column 4"
|
:header: "", "column 1", "column 2", "column 3", "column 4"
|
||||||
|
|
||||||
"row 1", "m00", "m10", "m20", "m30"
|
"row 1", "m00", "m10", "m20", "m30"
|
||||||
"row 2", "m01", "m11", "m21", "m31"
|
"row 2", "m01", "m11", "m21", "m31"
|
||||||
"row 3", "m02", "m12", "m22", "m32"
|
"row 3", "m02", "m12", "m22", "m32"
|
||||||
|
|
||||||
.. csv-table:: column vec4 (1x4)
|
.. csv-table:: column vec4 (1x4) **(v)**
|
||||||
:header: "", "column 1"
|
:header: "", "column 1"
|
||||||
|
|
||||||
"row 1", "v0"
|
"row 1", "v0"
|
||||||
@@ -120,25 +171,47 @@ Functions documentation
|
|||||||
"row 3", "v2"
|
"row 3", "v2"
|
||||||
"row 4", "v3"
|
"row 4", "v3"
|
||||||
|
|
||||||
.. csv-table:: column vec3 (1x3)
|
.. csv-table:: column vec3 (1x3) **(dest)**
|
||||||
:header: "", "column 1"
|
:header: "", "column 1"
|
||||||
|
|
||||||
"row 1", "m00 * v0 + m10 * v1 + m20 * v2 + m30 * v3"
|
"row 1", "m00 * v0 + m10 * v1 + m20 * v2 + m30 * v3"
|
||||||
"row 2", "m01 * v0 + m11 * v1 + m21 * v2 + m31 * v3"
|
"row 2", "m01 * v0 + m11 * v1 + m21 * v2 + m31 * v3"
|
||||||
"row 3", "m02 * v0 + m12 * v1 + m22 * v2 + m32 * v3"
|
"row 3", "m02 * v0 + m12 * v1 + m22 * v2 + m32 * v3"
|
||||||
|
|
||||||
.. c:function:: void glm_mat4x3_transpose(mat4x3 m, mat3x4 dest)
|
.. c:function:: void glm_mat4x3_transpose(mat4x3 src, mat3x4 dest)
|
||||||
|
|
||||||
transpose matrix and store in dest
|
Transpose mat4x3 (src) and store in mat3x4 (dest).
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in]* **m** matrix
|
| *[in]* **src** mat4x3 (left)
|
||||||
| *[out]* **dest** destination
|
| *[out]* **dest** destination (result, mat3x4)
|
||||||
|
|
||||||
.. c:function:: void glm_mat4x3_scale(mat4x3 m, float s)
|
.. csv-table:: mat4x3 **(src)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3", "column 4"
|
||||||
|
|
||||||
multiply matrix with scalar
|
"row 1", "a00", "a10", "a20", "a30"
|
||||||
|
"row 2", "a01", "a11", "a21", "a31"
|
||||||
|
"row 3", "a02", "a12", "a22", "a32"
|
||||||
|
|
||||||
|
.. csv-table:: mat3x4 **(dest)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3"
|
||||||
|
|
||||||
|
"row 1", "b00 = a00", "b10 = a01", "b20 = a02"
|
||||||
|
"row 2", "b01 = a10", "b11 = a11", "b21 = a12"
|
||||||
|
"row 3", "b02 = a20", "b12 = a21", "b22 = a22"
|
||||||
|
"row 4", "b03 = a30", "b13 = a31", "b23 = a32"
|
||||||
|
|
||||||
|
.. c:function:: void glm_mat4x3_scale(mat4x3 m, float s)
|
||||||
|
|
||||||
|
Multiply mat4x3 (m) by scalar constant (s).
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
| *[in, out]* **m** matrix
|
| *[in, out]* **m** mat4x3 (src, dest)
|
||||||
| *[in]* **s** scalar
|
| *[in]* **s** float (scalar)
|
||||||
|
|
||||||
|
.. csv-table:: mat4x3 **(m)**
|
||||||
|
:header: "", "column 1", "column 2", "column 3", "column 4"
|
||||||
|
|
||||||
|
"row 1", "m00 = m00 * s", "m10 = m10 * s", "m20 = m20 * s", "m30 = m30 * s"
|
||||||
|
"row 2", "m01 = m01 * s", "m11 = m11 * s", "m21 = m21 * s", "m31 = m31 * s"
|
||||||
|
"row 3", "m02 = m02 * s", "m12 = m12 * s", "m22 = m22 * s", "m32 = m32 * s"
|
||||||
|
|||||||
132
include/cglm/affine2d-post.h
Normal file
132
include/cglm/affine2d-post.h
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c), Recep Aslantas.
|
||||||
|
*
|
||||||
|
* MIT License (MIT), http://opensource.org/licenses/MIT
|
||||||
|
* Full license can be found in the LICENSE file
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef cglm_affine2d_post_h
|
||||||
|
#define cglm_affine2d_post_h
|
||||||
|
|
||||||
|
/*
|
||||||
|
Functions:
|
||||||
|
CGLM_INLINE void glm_translated2d(mat3 m, vec2 v);
|
||||||
|
CGLM_INLINE void glm_translated2d_x(mat3 m, float to);
|
||||||
|
CGLM_INLINE void glm_translated2d_y(mat3 m, float to);
|
||||||
|
CGLM_INLINE void glm_rotated2d(mat3 m, float angle);
|
||||||
|
CGLM_INLINE void glm_scaled2d(mat3 m, vec2 v);
|
||||||
|
CGLM_INLINE void glm_scaled2d_uni(mat3 m, float s);
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "vec2.h"
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief translate existing transform matrix by v vector
|
||||||
|
* and store result in same matrix
|
||||||
|
*
|
||||||
|
* this is POST transform, applies to existing transform as last transform
|
||||||
|
*
|
||||||
|
* @param[in, out] m affine transform
|
||||||
|
* @param[in] v translate vector [x, y]
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
void
|
||||||
|
glm_translated2d(mat3 m, vec2 v) {
|
||||||
|
glm_vec2_add(m[2], v, m[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief translate existing transform matrix by x factor
|
||||||
|
*
|
||||||
|
* this is POST transform, applies to existing transform as last transform
|
||||||
|
*
|
||||||
|
* @param[in, out] m affine transform
|
||||||
|
* @param[in] x x factor
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
void
|
||||||
|
glm_translated2d_x(mat3 m, float x) {
|
||||||
|
m[2][0] += x;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief translate existing transform matrix by y factor
|
||||||
|
*
|
||||||
|
* this is POST transform, applies to existing transform as last transform
|
||||||
|
*
|
||||||
|
* @param[in, out] m affine transform
|
||||||
|
* @param[in] y y factor
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
void
|
||||||
|
glm_translated2d_y(mat3 m, float y) {
|
||||||
|
m[2][1] += y;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief rotate existing transform matrix by angle
|
||||||
|
*
|
||||||
|
* this is POST transform, applies to existing transform as last transform
|
||||||
|
*
|
||||||
|
* @param[in, out] m affine transform
|
||||||
|
* @param[in] angle angle (radians)
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
void
|
||||||
|
glm_rotated2d(mat3 m, float angle) {
|
||||||
|
float c = cosf(angle),
|
||||||
|
s = sinf(angle),
|
||||||
|
|
||||||
|
m00 = m[0][0], m10 = m[1][0], m20 = m[2][0],
|
||||||
|
m01 = m[0][1], m11 = m[1][1], m21 = m[2][1];
|
||||||
|
|
||||||
|
m[0][0] = c * m00 - s * m01;
|
||||||
|
m[1][0] = c * m10 - s * m11;
|
||||||
|
m[2][0] = c * m20 - s * m21;
|
||||||
|
|
||||||
|
m[0][1] = s * m00 + c * m01;
|
||||||
|
m[1][1] = s * m10 + c * m11;
|
||||||
|
m[2][1] = s * m20 + c * m21;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief scale existing 2d transform matrix by v vector
|
||||||
|
*
|
||||||
|
* this is POST transform, applies to existing transform as last transform
|
||||||
|
*
|
||||||
|
* @param[in, out] m affine transform
|
||||||
|
* @param[in] v scale vector [x, y]
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
void
|
||||||
|
glm_scaled2d(mat3 m, vec2 v) {
|
||||||
|
m[0][0] *= v[0];
|
||||||
|
m[1][0] *= v[0];
|
||||||
|
m[2][0] *= v[0];
|
||||||
|
|
||||||
|
m[0][1] *= v[1];
|
||||||
|
m[1][1] *= v[1];
|
||||||
|
m[2][1] *= v[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief applies uniform scale to existing 2d transform matrix v = [s, s]
|
||||||
|
*
|
||||||
|
* this is POST transform, applies to existing transform as last transform
|
||||||
|
*
|
||||||
|
* @param[in, out] m affine transform
|
||||||
|
* @param[in] s scale factor
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
void
|
||||||
|
glm_scaled2d_uni(mat3 m, float s) {
|
||||||
|
m[0][0] *= s;
|
||||||
|
m[1][0] *= s;
|
||||||
|
m[2][0] *= s;
|
||||||
|
|
||||||
|
m[0][1] *= s;
|
||||||
|
m[1][1] *= s;
|
||||||
|
m[2][1] *= s;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* cglm_affine2d_post_h */
|
||||||
@@ -14,16 +14,17 @@
|
|||||||
&& defined(SIMD_VECTOR_TYPES)
|
&& defined(SIMD_VECTOR_TYPES)
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "struct.h"
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief converts mat4 to Apple's simd type simd_float4x4
|
* @brief converts mat4 to Apple's simd type simd_float4x4
|
||||||
* @return simd_float4x4
|
* @return simd_float4x4
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
simd_float4x4
|
simd_float4x4
|
||||||
glm_mat4_applesimd(mat4 m) {
|
glm_mat4_applesimd(mat4 m) {
|
||||||
simd_float4x4 t;
|
simd_float4x4 t;
|
||||||
|
|
||||||
t.columns[0][0] = m[0][0];
|
t.columns[0][0] = m[0][0];
|
||||||
t.columns[0][1] = m[0][1];
|
t.columns[0][1] = m[0][1];
|
||||||
t.columns[0][2] = m[0][2];
|
t.columns[0][2] = m[0][2];
|
||||||
@@ -55,7 +56,7 @@ CGLM_INLINE
|
|||||||
simd_float3x3
|
simd_float3x3
|
||||||
glm_mat3_applesimd(mat3 m) {
|
glm_mat3_applesimd(mat3 m) {
|
||||||
simd_float3x3 t;
|
simd_float3x3 t;
|
||||||
|
|
||||||
t.columns[0][0] = m[0][0];
|
t.columns[0][0] = m[0][0];
|
||||||
t.columns[0][1] = m[0][1];
|
t.columns[0][1] = m[0][1];
|
||||||
t.columns[0][2] = m[0][2];
|
t.columns[0][2] = m[0][2];
|
||||||
@@ -83,7 +84,7 @@ glm_vec4_applesimd(vec4 v) {
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief converts vec3 to Apple's simd type simd_float3
|
* @brief converts vec3 to Apple's simd type simd_float3
|
||||||
* @return v
|
* @return simd_float3
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
simd_float3
|
simd_float3
|
||||||
@@ -91,5 +92,45 @@ glm_vec3_applesimd(vec3 v) {
|
|||||||
return (simd_float3){v[0], v[1], v[2]};
|
return (simd_float3){v[0], v[1], v[2]};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief generic function to convert cglm types to Apple's simd types
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* simd_float4x4 m = applesimd(mat4_value);
|
||||||
|
* simd_float3 v = applesimd(vec3_value);
|
||||||
|
*
|
||||||
|
* @param x cglm type (mat4, mat3, vec4, vec3)
|
||||||
|
* @return corresponding Apple simd type
|
||||||
|
*/
|
||||||
|
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
|
||||||
|
# define applesimd(x) _Generic((x), \
|
||||||
|
mat4: glm_mat4_applesimd, \
|
||||||
|
mat3: glm_mat3_applesimd, \
|
||||||
|
vec4: glm_vec4_applesimd, \
|
||||||
|
vec3: glm_vec3_applesimd \
|
||||||
|
)((x))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef cglm_types_struct_h
|
||||||
|
CGLM_INLINE simd_float4x4 glms_mat4_(applesimd)(mat4s m) { return glm_mat4_applesimd(m.raw); }
|
||||||
|
CGLM_INLINE simd_float3x3 glms_mat3_(applesimd)(mat3s m) { return glm_mat3_applesimd(m.raw); }
|
||||||
|
CGLM_INLINE simd_float4 glms_vec4_(applesimd)(vec4s v) { return glm_vec4_applesimd(v.raw); }
|
||||||
|
CGLM_INLINE simd_float3 glms_vec3_(applesimd)(vec3s v) { return glm_vec3_applesimd(v.raw); }
|
||||||
|
|
||||||
|
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
|
||||||
|
# undef applesimd
|
||||||
|
# define applesimd(x) _Generic((x), \
|
||||||
|
mat4: glm_mat4_applesimd, \
|
||||||
|
mat3: glm_mat3_applesimd, \
|
||||||
|
vec4: glm_vec4_applesimd, \
|
||||||
|
vec3: glm_vec3_applesimd, \
|
||||||
|
mat4s: glms_mat4_(applesimd), \
|
||||||
|
mat3s: glms_mat3_(applesimd), \
|
||||||
|
vec4s: glms_vec4_(applesimd), \
|
||||||
|
vec3s: glms_vec3_(applesimd) \
|
||||||
|
)((x))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif /* cglm_applesimd_h */
|
#endif /* cglm_applesimd_h */
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ extern "C" {
|
|||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat2x3_copy(mat2x3 mat, mat2x3 dest);
|
glmc_mat2x3_copy(mat2x3 src, mat2x3 dest);
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat2x3_zero(mat2x3 mat);
|
glmc_mat2x3_zero(mat2x3 m);
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
@@ -35,7 +35,7 @@ glmc_mat2x3_mulv(mat2x3 m, vec2 v, vec3 dest);
|
|||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat2x3_transpose(mat2x3 m, mat3x2 dest);
|
glmc_mat2x3_transpose(mat2x3 src, mat3x2 dest);
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ extern "C" {
|
|||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat2x4_copy(mat2x4 mat, mat2x4 dest);
|
glmc_mat2x4_copy(mat2x4 src, mat2x4 dest);
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat2x4_zero(mat2x4 mat);
|
glmc_mat2x4_zero(mat2x4 m);
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
@@ -35,7 +35,7 @@ glmc_mat2x4_mulv(mat2x4 m, vec2 v, vec4 dest);
|
|||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat2x4_transpose(mat2x4 m, mat4x2 dest);
|
glmc_mat2x4_transpose(mat2x4 src, mat4x2 dest);
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ extern "C" {
|
|||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat3x2_copy(mat3x2 mat, mat3x2 dest);
|
glmc_mat3x2_copy(mat3x2 src, mat3x2 dest);
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat3x2_zero(mat3x2 mat);
|
glmc_mat3x2_zero(mat3x2 m);
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
@@ -35,7 +35,7 @@ glmc_mat3x2_mulv(mat3x2 m, vec3 v, vec2 dest);
|
|||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat3x2_transpose(mat3x2 m, mat2x3 dest);
|
glmc_mat3x2_transpose(mat3x2 src, mat2x3 dest);
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ extern "C" {
|
|||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat3x4_copy(mat3x4 mat, mat3x4 dest);
|
glmc_mat3x4_copy(mat3x4 src, mat3x4 dest);
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat3x4_zero(mat3x4 mat);
|
glmc_mat3x4_zero(mat3x4 m);
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
@@ -35,7 +35,7 @@ glmc_mat3x4_mulv(mat3x4 m, vec3 v, vec4 dest);
|
|||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat3x4_transpose(mat3x4 m, mat4x3 dest);
|
glmc_mat3x4_transpose(mat3x4 src, mat4x3 dest);
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ extern "C" {
|
|||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat4x2_copy(mat4x2 mat, mat4x2 dest);
|
glmc_mat4x2_copy(mat4x2 src, mat4x2 dest);
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat4x2_zero(mat4x2 mat);
|
glmc_mat4x2_zero(mat4x2 m);
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
@@ -35,7 +35,7 @@ glmc_mat4x2_mulv(mat4x2 m, vec4 v, vec2 dest);
|
|||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat4x2_transpose(mat4x2 m, mat2x4 dest);
|
glmc_mat4x2_transpose(mat4x2 src, mat2x4 dest);
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ extern "C" {
|
|||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat4x3_copy(mat4x3 mat, mat4x3 dest);
|
glmc_mat4x3_copy(mat4x3 src, mat4x3 dest);
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat4x3_zero(mat4x3 mat);
|
glmc_mat4x3_zero(mat4x3 m);
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
@@ -35,7 +35,7 @@ glmc_mat4x3_mulv(mat4x3 m, vec4 v, vec3 dest);
|
|||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat4x3_transpose(mat4x3 m, mat3x4 dest);
|
glmc_mat4x3_transpose(mat4x3 src, mat3x4 dest);
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -43,5 +43,6 @@
|
|||||||
#include "bezier.h"
|
#include "bezier.h"
|
||||||
#include "ray.h"
|
#include "ray.h"
|
||||||
#include "affine2d.h"
|
#include "affine2d.h"
|
||||||
|
#include "affine2d-post.h"
|
||||||
|
|
||||||
#endif /* cglm_h */
|
#endif /* cglm_h */
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
#ifndef cglm_common_h
|
#ifndef cglm_common_h
|
||||||
#define cglm_common_h
|
#define cglm_common_h
|
||||||
|
|
||||||
|
#define __cglm__ 1
|
||||||
|
|
||||||
#ifndef _USE_MATH_DEFINES
|
#ifndef _USE_MATH_DEFINES
|
||||||
# define _USE_MATH_DEFINES /* for windows */
|
# define _USE_MATH_DEFINES /* for windows */
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -11,12 +11,12 @@
|
|||||||
GLM_MAT2X3_ZERO
|
GLM_MAT2X3_ZERO
|
||||||
|
|
||||||
Functions:
|
Functions:
|
||||||
CGLM_INLINE void glm_mat2x3_copy(mat2x3 mat, mat2x3 dest);
|
CGLM_INLINE void glm_mat2x3_copy(mat2x3 src, mat2x3 dest);
|
||||||
CGLM_INLINE void glm_mat2x3_zero(mat2x3 mat);
|
CGLM_INLINE void glm_mat2x3_zero(mat2x3 m);
|
||||||
CGLM_INLINE void glm_mat2x3_make(const float * __restrict src, mat2x3 dest);
|
CGLM_INLINE void glm_mat2x3_make(const float * __restrict src, mat2x3 dest);
|
||||||
CGLM_INLINE void glm_mat2x3_mul(mat2x3 m1, mat3x2 m2, mat3 dest);
|
CGLM_INLINE void glm_mat2x3_mul(mat2x3 m1, mat3x2 m2, mat3 dest);
|
||||||
CGLM_INLINE void glm_mat2x3_mulv(mat2x3 m, vec2 v, vec3 dest);
|
CGLM_INLINE void glm_mat2x3_mulv(mat2x3 m, vec2 v, vec3 dest);
|
||||||
CGLM_INLINE void glm_mat2x3_transpose(mat2x3 m, mat3x2 dest);
|
CGLM_INLINE void glm_mat2x3_transpose(mat2x3 src, mat3x2 dest);
|
||||||
CGLM_INLINE void glm_mat2x3_scale(mat2x3 m, float s);
|
CGLM_INLINE void glm_mat2x3_scale(mat2x3 m, float s);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -31,40 +31,35 @@
|
|||||||
#define GLM_MAT2X3_ZERO GLM_MAT2X3_ZERO_INIT
|
#define GLM_MAT2X3_ZERO GLM_MAT2X3_ZERO_INIT
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief copy all members of [mat] to [dest]
|
* @brief Copy mat2x3 (src) to mat2x3 (dest).
|
||||||
*
|
*
|
||||||
* @param[in] mat source
|
* @param[in] src mat2x3 (left)
|
||||||
* @param[out] dest destination
|
* @param[out] dest destination (result, mat2x3)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
glm_mat2x3_copy(mat2x3 mat, mat2x3 dest) {
|
glm_mat2x3_copy(mat2x3 src, mat2x3 dest) {
|
||||||
dest[0][0] = mat[0][0];
|
glm_vec3_copy(src[0], dest[0]);
|
||||||
dest[0][1] = mat[0][1];
|
glm_vec3_copy(src[1], dest[1]);
|
||||||
dest[0][2] = mat[0][2];
|
|
||||||
|
|
||||||
dest[1][0] = mat[1][0];
|
|
||||||
dest[1][1] = mat[1][1];
|
|
||||||
dest[1][2] = mat[1][2];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief make given matrix zero.
|
* @brief Zero out the mat2x3 (m).
|
||||||
*
|
*
|
||||||
* @param[in, out] mat matrix
|
* @param[in, out] mat2x3 (src, dest)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
glm_mat2x3_zero(mat2x3 mat) {
|
glm_mat2x3_zero(mat2x3 m) {
|
||||||
CGLM_ALIGN_MAT mat2x3 t = GLM_MAT2X3_ZERO_INIT;
|
CGLM_ALIGN_MAT mat2x3 t = GLM_MAT2X3_ZERO_INIT;
|
||||||
glm_mat2x3_copy(t, mat);
|
glm_mat2x3_copy(t, m);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Create mat2x3 matrix from pointer
|
* @brief Create mat2x3 (dest) from pointer (src).
|
||||||
*
|
*
|
||||||
* @param[in] src pointer to an array of floats
|
* @param[in] src pointer to an array of floats (left)
|
||||||
* @param[out] dest matrix
|
* @param[out] dest destination (result, mat2x3)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
@@ -79,15 +74,15 @@ glm_mat2x3_make(const float * __restrict src, mat2x3 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply m1 and m2 to dest
|
* @brief Multiply mat2x3 (m1) by mat3x2 (m2) and store in mat3 (dest).
|
||||||
*
|
*
|
||||||
* @code
|
* @code
|
||||||
* glm_mat2x3_mul(mat2x3, mat3x2, mat3);
|
* glm_mat2x3_mul(mat2x3, mat3x2, mat3);
|
||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
* @param[in] m1 left matrix (mat2x3)
|
* @param[in] m1 mat2x3 (left)
|
||||||
* @param[in] m2 right matrix (mat3x2)
|
* @param[in] m2 mat3x2 (right)
|
||||||
* @param[out] dest destination matrix (mat2)
|
* @param[out] dest destination (result, mat3)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
@@ -113,11 +108,11 @@ glm_mat2x3_mul(mat2x3 m1, mat3x2 m2, mat3 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply matrix with column vector and store in dest vector
|
* @brief Multiply mat2x3 (m) by vec2 (v) and store in vec3 (dest).
|
||||||
*
|
*
|
||||||
* @param[in] m matrix (left)
|
* @param[in] m mat2x3 (left)
|
||||||
* @param[in] v vector (right, column vector)
|
* @param[in] v vec2 (right, column vector)
|
||||||
* @param[out] dest result vector
|
* @param[out] dest destination (result, column vector)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
@@ -130,26 +125,24 @@ glm_mat2x3_mulv(mat2x3 m, vec2 v, vec3 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief transpose matrix and store in dest
|
* @brief Transpose mat2x3 (src) and store in mat3x2 (dest).
|
||||||
*
|
*
|
||||||
* @param[in] m matrix
|
* @param[in] src mat2x3 (left)
|
||||||
* @param[out] dest result
|
* @param[out] dest destination (result, mat3x2)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
glm_mat2x3_transpose(mat2x3 m, mat3x2 dest) {
|
glm_mat2x3_transpose(mat2x3 src, mat3x2 dest) {
|
||||||
dest[0][0] = m[0][0]; dest[0][1] = m[1][0];
|
dest[0][0] = src[0][0]; dest[0][1] = src[1][0];
|
||||||
dest[1][0] = m[0][1]; dest[1][1] = m[1][1];
|
dest[1][0] = src[0][1]; dest[1][1] = src[1][1];
|
||||||
dest[2][0] = m[0][2]; dest[2][1] = m[1][2];
|
dest[2][0] = src[0][2]; dest[2][1] = src[1][2];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief scale (multiply with scalar) matrix
|
* @brief Multiply mat2x3 (m) by scalar constant (s).
|
||||||
*
|
*
|
||||||
* multiply matrix with scalar
|
* @param[in, out] m (src, dest)
|
||||||
*
|
* @param[in] float (scalar)
|
||||||
* @param[in, out] m matrix
|
|
||||||
* @param[in] s scalar
|
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -11,12 +11,12 @@
|
|||||||
GLM_MAT2X4_ZERO
|
GLM_MAT2X4_ZERO
|
||||||
|
|
||||||
Functions:
|
Functions:
|
||||||
CGLM_INLINE void glm_mat2x4_copy(mat2x4 mat, mat2x4 dest);
|
CGLM_INLINE void glm_mat2x4_copy(mat2x4 src, mat2x4 dest);
|
||||||
CGLM_INLINE void glm_mat2x4_zero(mat2x4 mat);
|
CGLM_INLINE void glm_mat2x4_zero(mat2x4 m);
|
||||||
CGLM_INLINE void glm_mat2x4_make(const float * __restrict src, mat2x4 dest);
|
CGLM_INLINE void glm_mat2x4_make(const float * __restrict src, mat2x4 dest);
|
||||||
CGLM_INLINE void glm_mat2x4_mul(mat2x4 m1, mat4x2 m2, mat4 dest);
|
CGLM_INLINE void glm_mat2x4_mul(mat2x4 m1, mat4x2 m2, mat4 dest);
|
||||||
CGLM_INLINE void glm_mat2x4_mulv(mat2x4 m, vec2 v, vec4 dest);
|
CGLM_INLINE void glm_mat2x4_mulv(mat2x4 m, vec2 v, vec4 dest);
|
||||||
CGLM_INLINE void glm_mat2x4_transpose(mat2x4 m, mat4x2 dest);
|
CGLM_INLINE void glm_mat2x4_transpose(mat2x4 src, mat4x2 dest);
|
||||||
CGLM_INLINE void glm_mat2x4_scale(mat2x4 m, float s);
|
CGLM_INLINE void glm_mat2x4_scale(mat2x4 m, float s);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -32,35 +32,35 @@
|
|||||||
#define GLM_MAT2X4_ZERO GLM_MAT2X4_ZERO_INIT
|
#define GLM_MAT2X4_ZERO GLM_MAT2X4_ZERO_INIT
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief copy all members of [mat] to [dest]
|
* @brief Copy mat2x4 (src) to mat2x4 (dest).
|
||||||
*
|
*
|
||||||
* @param[in] mat source
|
* @param[in] src mat2x4 (left)
|
||||||
* @param[out] dest destination
|
* @param[out] dest destination (result, mat2x4)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
glm_mat2x4_copy(mat2x4 mat, mat2x4 dest) {
|
glm_mat2x4_copy(mat2x4 src, mat2x4 dest) {
|
||||||
glm_vec4_ucopy(mat[0], dest[0]);
|
glm_vec4_ucopy(src[0], dest[0]);
|
||||||
glm_vec4_ucopy(mat[1], dest[1]);
|
glm_vec4_ucopy(src[1], dest[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief make given matrix zero.
|
* @brief Zero out the mat2x4 (m).
|
||||||
*
|
*
|
||||||
* @param[in, out] mat matrix
|
* @param[in, out] mat2x4 (src, dest)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
glm_mat2x4_zero(mat2x4 mat) {
|
glm_mat2x4_zero(mat2x4 m) {
|
||||||
CGLM_ALIGN_MAT mat2x4 t = GLM_MAT2X4_ZERO_INIT;
|
CGLM_ALIGN_MAT mat2x4 t = GLM_MAT2X4_ZERO_INIT;
|
||||||
glm_mat2x4_copy(t, mat);
|
glm_mat2x4_copy(t, m);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Create mat2x4 matrix from pointer
|
* @brief Create mat2x4 (dest) from pointer (src).
|
||||||
*
|
*
|
||||||
* @param[in] src pointer to an array of floats
|
* @param[in] src pointer to an array of floats (left)
|
||||||
* @param[out] dest matrix
|
* @param[out] dest destination (result, mat2x4)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
@@ -77,15 +77,15 @@ glm_mat2x4_make(const float * __restrict src, mat2x4 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply m1 and m2 to dest
|
* @brief Multiply mat2x4 (m1) by mat4x2 (m2) and store in mat4 (dest).
|
||||||
*
|
*
|
||||||
* @code
|
* @code
|
||||||
* glm_mat2x4_mul(mat2x4, mat4x2, mat4);
|
* glm_mat2x4_mul(mat2x4, mat4x2, mat4);
|
||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
* @param[in] m1 left matrix (mat2x4)
|
* @param[in] m1 mat2x4 (left)
|
||||||
* @param[in] m2 right matrix (mat4x2)
|
* @param[in] m2 mat4x2 (right)
|
||||||
* @param[out] dest destination matrix (mat4)
|
* @param[out] dest destination (result, mat4)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
@@ -120,11 +120,11 @@ glm_mat2x4_mul(mat2x4 m1, mat4x2 m2, mat4 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply matrix with column vector and store in dest column vector
|
* @brief Multiply mat2x4 (m) by vec2 (v) and store in vec4 (dest).
|
||||||
*
|
*
|
||||||
* @param[in] m matrix (left)
|
* @param[in] m mat2x4 (left)
|
||||||
* @param[in] v vector (right, column vector)
|
* @param[in] v vec2 (right, column vector)
|
||||||
* @param[out] dest result vector
|
* @param[out] dest destination (result, column vector)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
@@ -138,27 +138,25 @@ glm_mat2x4_mulv(mat2x4 m, vec2 v, vec4 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief transpose matrix and store in dest
|
* @brief Transpose mat2x4 (src) and store in mat4x2 (dest).
|
||||||
*
|
*
|
||||||
* @param[in] m matrix
|
* @param[in] src mat2x4 (left)
|
||||||
* @param[out] dest result
|
* @param[out] dest destination (result, mat4x2)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
glm_mat2x4_transpose(mat2x4 m, mat4x2 dest) {
|
glm_mat2x4_transpose(mat2x4 src, mat4x2 dest) {
|
||||||
dest[0][0] = m[0][0]; dest[0][1] = m[1][0];
|
dest[0][0] = src[0][0]; dest[0][1] = src[1][0];
|
||||||
dest[1][0] = m[0][1]; dest[1][1] = m[1][1];
|
dest[1][0] = src[0][1]; dest[1][1] = src[1][1];
|
||||||
dest[2][0] = m[0][2]; dest[2][1] = m[1][2];
|
dest[2][0] = src[0][2]; dest[2][1] = src[1][2];
|
||||||
dest[3][0] = m[0][3]; dest[3][1] = m[1][3];
|
dest[3][0] = src[0][3]; dest[3][1] = src[1][3];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief scale (multiply with scalar) matrix
|
* @brief Multiply mat2x4 (m) by scalar constant (s).
|
||||||
*
|
*
|
||||||
* multiply matrix with scalar
|
* @param[in, out] m (src, dest)
|
||||||
*
|
* @param[in] s float (scalar)
|
||||||
* @param[in, out] m matrix
|
|
||||||
* @param[in] s scalar
|
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -11,12 +11,12 @@
|
|||||||
GLM_MAT3X2_ZERO
|
GLM_MAT3X2_ZERO
|
||||||
|
|
||||||
Functions:
|
Functions:
|
||||||
CGLM_INLINE void glm_mat3x2_copy(mat3x2 mat, mat3x2 dest);
|
CGLM_INLINE void glm_mat3x2_copy(mat3x2 src, mat3x2 dest);
|
||||||
CGLM_INLINE void glm_mat3x2_zero(mat3x2 mat);
|
CGLM_INLINE void glm_mat3x2_zero(mat3x2 m);
|
||||||
CGLM_INLINE void glm_mat3x2_make(const float * __restrict src, mat3x2 dest);
|
CGLM_INLINE void glm_mat3x2_make(const float * __restrict src, mat3x2 dest);
|
||||||
CGLM_INLINE void glm_mat3x2_mul(mat3x2 m1, mat2x3 m2, mat2 dest);
|
CGLM_INLINE void glm_mat3x2_mul(mat3x2 m1, mat2x3 m2, mat2 dest);
|
||||||
CGLM_INLINE void glm_mat3x2_mulv(mat3x2 m, vec3 v, vec2 dest);
|
CGLM_INLINE void glm_mat3x2_mulv(mat3x2 m, vec3 v, vec2 dest);
|
||||||
CGLM_INLINE void glm_mat3x2_transpose(mat3x2 m, mat2x3 dest);
|
CGLM_INLINE void glm_mat3x2_transpose(mat3x2 src, mat2x3 dest);
|
||||||
CGLM_INLINE void glm_mat3x2_scale(mat3x2 m, float s);
|
CGLM_INLINE void glm_mat3x2_scale(mat3x2 m, float s);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -31,41 +31,36 @@
|
|||||||
#define GLM_MAT3X2_ZERO GLM_MAT3X2_ZERO_INIT
|
#define GLM_MAT3X2_ZERO GLM_MAT3X2_ZERO_INIT
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief copy all members of [mat] to [dest]
|
* @brief Copy mat3x2 (src) to mat3x2 (dest).
|
||||||
*
|
*
|
||||||
* @param[in] mat source
|
* @param[in] src mat3x2 (left)
|
||||||
* @param[out] dest destination
|
* @param[out] dest destination (result, mat3x2)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
glm_mat3x2_copy(mat3x2 mat, mat3x2 dest) {
|
glm_mat3x2_copy(mat3x2 src, mat3x2 dest) {
|
||||||
dest[0][0] = mat[0][0];
|
glm_vec2_copy(src[0], dest[0]);
|
||||||
dest[0][1] = mat[0][1];
|
glm_vec2_copy(src[1], dest[1]);
|
||||||
|
glm_vec2_copy(src[2], dest[2]);
|
||||||
dest[1][0] = mat[1][0];
|
|
||||||
dest[1][1] = mat[1][1];
|
|
||||||
|
|
||||||
dest[2][0] = mat[2][0];
|
|
||||||
dest[2][1] = mat[2][1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief make given matrix zero.
|
* @brief Zero out the mat3x2 (m).
|
||||||
*
|
*
|
||||||
* @param[in, out] mat matrix
|
* @param[in, out] mat3x2 (src, dest)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
glm_mat3x2_zero(mat3x2 mat) {
|
glm_mat3x2_zero(mat3x2 m) {
|
||||||
CGLM_ALIGN_MAT mat3x2 t = GLM_MAT3X2_ZERO_INIT;
|
CGLM_ALIGN_MAT mat3x2 t = GLM_MAT3X2_ZERO_INIT;
|
||||||
glm_mat3x2_copy(t, mat);
|
glm_mat3x2_copy(t, m);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Create mat3x2 matrix from pointer
|
* @brief Create mat3x2 (dest) from pointer (src).
|
||||||
*
|
*
|
||||||
* @param[in] src pointer to an array of floats
|
* @param[in] src pointer to an array of floats (left)
|
||||||
* @param[out] dest matrix
|
* @param[out] dest destination (result, mat3x2)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
@@ -81,15 +76,15 @@ glm_mat3x2_make(const float * __restrict src, mat3x2 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply m1 and m2 to dest
|
* @brief Multiply mat3x2 (m1) by mat2x3 (m2) and store in mat2 (dest).
|
||||||
*
|
*
|
||||||
* @code
|
* @code
|
||||||
* glm_mat3x2_mul(mat3x2, mat2x3, mat2);
|
* glm_mat3x2_mul(mat3x2, mat2x3, mat2);
|
||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
* @param[in] m1 left matrix (mat3x2)
|
* @param[in] m1 mat3x2 (left)
|
||||||
* @param[in] m2 right matrix (mat2x3)
|
* @param[in] m2 mat2x3 (right)
|
||||||
* @param[out] dest destination matrix (mat2)
|
* @param[out] dest destination (result, mat2)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
@@ -109,11 +104,11 @@ glm_mat3x2_mul(mat3x2 m1, mat2x3 m2, mat2 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply matrix with column vector and store in dest column vector
|
* @brief Multiply mat3x2 (m) by vec3 (v) and store in vec2 (dest).
|
||||||
*
|
*
|
||||||
* @param[in] m matrix (left)
|
* @param[in] m mat3x2 (left)
|
||||||
* @param[in] v vector (right, column vector)
|
* @param[in] v vec3 (right, column vector)
|
||||||
* @param[out] dest result vector
|
* @param[out] dest destination (result, column vector)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
@@ -125,25 +120,23 @@ glm_mat3x2_mulv(mat3x2 m, vec3 v, vec2 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief transpose matrix and store in dest
|
* @brief Transpose mat3x2 (src) and store in mat2x3 (dest).
|
||||||
*
|
*
|
||||||
* @param[in] m matrix
|
* @param[in] src mat3x2 (left)
|
||||||
* @param[out] dest result
|
* @param[out] dest destination (result, mat2x3)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
glm_mat3x2_transpose(mat3x2 m, mat2x3 dest) {
|
glm_mat3x2_transpose(mat3x2 src, mat2x3 dest) {
|
||||||
dest[0][0] = m[0][0]; dest[0][1] = m[1][0]; dest[0][2] = m[2][0];
|
dest[0][0] = src[0][0]; dest[0][1] = src[1][0]; dest[0][2] = src[2][0];
|
||||||
dest[1][0] = m[0][1]; dest[1][1] = m[1][1]; dest[1][2] = m[2][1];
|
dest[1][0] = src[0][1]; dest[1][1] = src[1][1]; dest[1][2] = src[2][1];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief scale (multiply with scalar) matrix
|
* @brief Multiply mat3x2 (m) by scalar constant (s).
|
||||||
*
|
*
|
||||||
* multiply matrix with scalar
|
* @param[in, out] m (src, dest)
|
||||||
*
|
* @param[in] s float (scalar)
|
||||||
* @param[in, out] m matrix
|
|
||||||
* @param[in] s scalar
|
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -11,12 +11,12 @@
|
|||||||
GLM_MAT3X4_ZERO
|
GLM_MAT3X4_ZERO
|
||||||
|
|
||||||
Functions:
|
Functions:
|
||||||
CGLM_INLINE void glm_mat3x4_copy(mat3x4 mat, mat3x4 dest);
|
CGLM_INLINE void glm_mat3x4_copy(mat3x4 src, mat3x4 dest);
|
||||||
CGLM_INLINE void glm_mat3x4_zero(mat3x4 mat);
|
CGLM_INLINE void glm_mat3x4_zero(mat3x4 m);
|
||||||
CGLM_INLINE void glm_mat3x4_make(const float * __restrict src, mat3x4 dest);
|
CGLM_INLINE void glm_mat3x4_make(const float * __restrict src, mat3x4 dest);
|
||||||
CGLM_INLINE void glm_mat3x4_mul(mat3x4 m1, mat4x3 m2, mat4 dest);
|
CGLM_INLINE void glm_mat3x4_mul(mat3x4 m1, mat4x3 m2, mat4 dest);
|
||||||
CGLM_INLINE void glm_mat3x4_mulv(mat3x4 m, vec3 v, vec4 dest);
|
CGLM_INLINE void glm_mat3x4_mulv(mat3x4 m, vec3 v, vec4 dest);
|
||||||
CGLM_INLINE void glm_mat3x4_transpose(mat3x4 m, mat4x3 dest);
|
CGLM_INLINE void glm_mat3x4_transpose(mat3x4 src, mat4x3 dest);
|
||||||
CGLM_INLINE void glm_mat3x4_scale(mat3x4 m, float s);
|
CGLM_INLINE void glm_mat3x4_scale(mat3x4 m, float s);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -33,36 +33,36 @@
|
|||||||
#define GLM_MAT3X4_ZERO GLM_MAT3X4_ZERO_INIT
|
#define GLM_MAT3X4_ZERO GLM_MAT3X4_ZERO_INIT
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief copy all members of [mat] to [dest]
|
* @brief Copy mat3x4 (src) to mat3x4 (dest).
|
||||||
*
|
*
|
||||||
* @param[in] mat source
|
* @param[in] src mat3x4 (left)
|
||||||
* @param[out] dest destination
|
* @param[out] dest destination (result, mat3x4)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
glm_mat3x4_copy(mat3x4 mat, mat3x4 dest) {
|
glm_mat3x4_copy(mat3x4 src, mat3x4 dest) {
|
||||||
glm_vec4_ucopy(mat[0], dest[0]);
|
glm_vec4_ucopy(src[0], dest[0]);
|
||||||
glm_vec4_ucopy(mat[1], dest[1]);
|
glm_vec4_ucopy(src[1], dest[1]);
|
||||||
glm_vec4_ucopy(mat[2], dest[2]);
|
glm_vec4_ucopy(src[2], dest[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief make given matrix zero.
|
* @brief Zero out the mat3x4 (m).
|
||||||
*
|
*
|
||||||
* @param[in, out] mat matrix
|
* @param[in, out] mat3x4 (src, dest)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
glm_mat3x4_zero(mat3x4 mat) {
|
glm_mat3x4_zero(mat3x4 m) {
|
||||||
CGLM_ALIGN_MAT mat3x4 t = GLM_MAT3X4_ZERO_INIT;
|
CGLM_ALIGN_MAT mat3x4 t = GLM_MAT3X4_ZERO_INIT;
|
||||||
glm_mat3x4_copy(t, mat);
|
glm_mat3x4_copy(t, m);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Create mat3x4 matrix from pointer
|
* @brief Create mat3x4 (dest) from pointer (src).
|
||||||
*
|
*
|
||||||
* @param[in] src pointer to an array of floats
|
* @param[in] src pointer to an array of floats (left)
|
||||||
* @param[out] dest matrix
|
* @param[out] dest destination (result, mat3x4)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
@@ -84,15 +84,15 @@ glm_mat3x4_make(const float * __restrict src, mat3x4 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply m1 and m2 to dest
|
* @brief Multiply mat3x4 (m1) by mat4x3 (m2) and store in mat4 (dest).
|
||||||
*
|
*
|
||||||
* @code
|
* @code
|
||||||
* glm_mat3x4_mul(mat3x4, mat4x3, mat4);
|
* glm_mat3x4_mul(mat3x4, mat4x3, mat4);
|
||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
* @param[in] m1 left matrix (mat3x4)
|
* @param[in] m1 mat3x4 (left)
|
||||||
* @param[in] m2 right matrix (mat4x3)
|
* @param[in] m2 mat4x3 (right)
|
||||||
* @param[out] dest destination matrix (mat4)
|
* @param[out] dest destination (result, mat4)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
@@ -128,11 +128,11 @@ glm_mat3x4_mul(mat3x4 m1, mat4x3 m2, mat4 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply matrix with column vector and store in dest column vector
|
* @brief Multiply mat3x4 (m) by vec3 (v) and store in vec4 (dest).
|
||||||
*
|
*
|
||||||
* @param[in] m matrix (left)
|
* @param[in] m mat3x4 (left)
|
||||||
* @param[in] v vector (right, column vector)
|
* @param[in] v vec3 (right, column vector)
|
||||||
* @param[out] dest result vector
|
* @param[out] dest destination (result, column vector)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
@@ -146,27 +146,25 @@ glm_mat3x4_mulv(mat3x4 m, vec3 v, vec4 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief transpose matrix and store in dest
|
* @brief Transpose mat3x4 (src) and store in mat4x3 (dest).
|
||||||
*
|
*
|
||||||
* @param[in] m matrix
|
* @param[in] src mat3x4 (left)
|
||||||
* @param[out] dest result
|
* @param[out] dest destination (result, mat4x3)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
glm_mat3x4_transpose(mat3x4 m, mat4x3 dest) {
|
glm_mat3x4_transpose(mat3x4 src, mat4x3 dest) {
|
||||||
dest[0][0] = m[0][0]; dest[0][1] = m[1][0]; dest[0][2] = m[2][0];
|
dest[0][0] = src[0][0]; dest[0][1] = src[1][0]; dest[0][2] = src[2][0];
|
||||||
dest[1][0] = m[0][1]; dest[1][1] = m[1][1]; dest[1][2] = m[2][1];
|
dest[1][0] = src[0][1]; dest[1][1] = src[1][1]; dest[1][2] = src[2][1];
|
||||||
dest[2][0] = m[0][2]; dest[2][1] = m[1][2]; dest[2][2] = m[2][2];
|
dest[2][0] = src[0][2]; dest[2][1] = src[1][2]; dest[2][2] = src[2][2];
|
||||||
dest[3][0] = m[0][3]; dest[3][1] = m[1][3]; dest[3][2] = m[2][3];
|
dest[3][0] = src[0][3]; dest[3][1] = src[1][3]; dest[3][2] = src[2][3];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief scale (multiply with scalar) matrix
|
* @brief Multiply mat3x4 (m) by scalar constant (s).
|
||||||
*
|
*
|
||||||
* multiply matrix with scalar
|
* @param[in, out] m (src, dest)
|
||||||
*
|
* @param[in] s float (scalar)
|
||||||
* @param[in, out] m matrix
|
|
||||||
* @param[in] s scalar
|
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ glm_mat4_mul(mat4 m1, mat4 m2, mat4 dest) {
|
|||||||
* size but if <b>len</b> is too small then compiler may unroll whole loop,
|
* size but if <b>len</b> is too small then compiler may unroll whole loop,
|
||||||
* usage:
|
* usage:
|
||||||
* @code
|
* @code
|
||||||
* mat m1, m2, m3, m4, res;
|
* mat4 m1, m2, m3, m4, res;
|
||||||
*
|
*
|
||||||
* glm_mat4_mulN((mat4 *[]){&m1, &m2, &m3, &m4}, 4, res);
|
* glm_mat4_mulN((mat4 *[]){&m1, &m2, &m3, &m4}, 4, res);
|
||||||
* @endcode
|
* @endcode
|
||||||
|
|||||||
@@ -11,12 +11,12 @@
|
|||||||
GLM_MAT4X2_ZERO
|
GLM_MAT4X2_ZERO
|
||||||
|
|
||||||
Functions:
|
Functions:
|
||||||
CGLM_INLINE void glm_mat4x2_copy(mat4x2 mat, mat4x2 dest);
|
CGLM_INLINE void glm_mat4x2_copy(mat4x2 src, mat4x2 dest);
|
||||||
CGLM_INLINE void glm_mat4x2_zero(mat4x2 mat);
|
CGLM_INLINE void glm_mat4x2_zero(mat4x2 m);
|
||||||
CGLM_INLINE void glm_mat4x2_make(const float * __restrict src, mat4x2 dest);
|
CGLM_INLINE void glm_mat4x2_make(const float * __restrict src, mat4x2 dest);
|
||||||
CGLM_INLINE void glm_mat4x2_mul(mat4x2 m1, mat2x4 m2, mat2 dest);
|
CGLM_INLINE void glm_mat4x2_mul(mat4x2 m1, mat2x4 m2, mat2 dest);
|
||||||
CGLM_INLINE void glm_mat4x2_mulv(mat4x2 m, vec4 v, vec2 dest);
|
CGLM_INLINE void glm_mat4x2_mulv(mat4x2 m, vec4 v, vec2 dest);
|
||||||
CGLM_INLINE void glm_mat4x2_transpose(mat4x2 m, mat2x4 dest);
|
CGLM_INLINE void glm_mat4x2_transpose(mat4x2 src, mat2x4 dest);
|
||||||
CGLM_INLINE void glm_mat4x2_scale(mat4x2 m, float s);
|
CGLM_INLINE void glm_mat4x2_scale(mat4x2 m, float s);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -31,44 +31,37 @@
|
|||||||
#define GLM_MAT4X2_ZERO GLM_MAT4X2_ZERO_INIT
|
#define GLM_MAT4X2_ZERO GLM_MAT4X2_ZERO_INIT
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief copy all members of [mat] to [dest]
|
* @brief Copy mat4x2 (src) to mat4x2 (dest).
|
||||||
*
|
*
|
||||||
* @param[in] mat source
|
* @param[in] src mat4x2 (left)
|
||||||
* @param[out] dest destination
|
* @param[out] dest destination (result, mat4x2)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
glm_mat4x2_copy(mat4x2 mat, mat4x2 dest) {
|
glm_mat4x2_copy(mat4x2 src, mat4x2 dest) {
|
||||||
dest[0][0] = mat[0][0];
|
glm_vec2_copy(src[0], dest[0]);
|
||||||
dest[0][1] = mat[0][1];
|
glm_vec2_copy(src[1], dest[1]);
|
||||||
|
glm_vec2_copy(src[2], dest[2]);
|
||||||
dest[1][0] = mat[1][0];
|
glm_vec2_copy(src[3], dest[3]);
|
||||||
dest[1][1] = mat[1][1];
|
|
||||||
|
|
||||||
dest[2][0] = mat[2][0];
|
|
||||||
dest[2][1] = mat[2][1];
|
|
||||||
|
|
||||||
dest[3][0] = mat[3][0];
|
|
||||||
dest[3][1] = mat[3][1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief make given matrix zero.
|
* @brief Zero out the mat4x2 (m).
|
||||||
*
|
*
|
||||||
* @param[in, out] mat matrix
|
* @param[in, out] mat4x2 (src, dest)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
glm_mat4x2_zero(mat4x2 mat) {
|
glm_mat4x2_zero(mat4x2 m) {
|
||||||
CGLM_ALIGN_MAT mat4x2 t = GLM_MAT4X2_ZERO_INIT;
|
CGLM_ALIGN_MAT mat4x2 t = GLM_MAT4X2_ZERO_INIT;
|
||||||
glm_mat4x2_copy(t, mat);
|
glm_mat4x2_copy(t, m);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Create mat4x2 matrix from pointer
|
* @brief Create mat4x2 (dest) from pointer (src).
|
||||||
*
|
*
|
||||||
* @param[in] src pointer to an array of floats
|
* @param[in] src pointer to an array of floats (left)
|
||||||
* @param[out] dest matrix
|
* @param[out] dest destination (result, mat4x2)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
@@ -87,15 +80,15 @@ glm_mat4x2_make(const float * __restrict src, mat4x2 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply m1 and m2 to dest
|
* @brief Multiply mat4x2 (m1) by mat2x4 (m2) and store in mat2 (dest).
|
||||||
*
|
*
|
||||||
* @code
|
* @code
|
||||||
* glm_mat4x2_mul(mat4x2, mat2x4, mat2);
|
* glm_mat4x2_mul(mat4x2, mat2x4, mat2);
|
||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
* @param[in] m1 left matrix (mat4x2)
|
* @param[in] m1 mat4x2 (left)
|
||||||
* @param[in] m2 right matrix (mat2x4)
|
* @param[in] m2 mat2x4 (right)
|
||||||
* @param[out] dest destination matrix (mat2)
|
* @param[out] dest destination (result, mat2)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
@@ -116,11 +109,11 @@ glm_mat4x2_mul(mat4x2 m1, mat2x4 m2, mat2 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply matrix with column vector and store in dest column vector
|
* @brief Multiply mat4x2 (m) by vec4 (v) and store in vec2 (dest).
|
||||||
*
|
*
|
||||||
* @param[in] m matrix (left)
|
* @param[in] m mat4x2 (left)
|
||||||
* @param[in] v vector (right, column vector)
|
* @param[in] v vec4 (right, column vector)
|
||||||
* @param[out] dest result vector
|
* @param[out] dest destination (result, column vector)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
@@ -132,31 +125,23 @@ glm_mat4x2_mulv(mat4x2 m, vec4 v, vec2 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief transpose matrix and store in dest
|
* @brief Transpose mat4x2 (src) and store in mat2x4 (dest).
|
||||||
*
|
*
|
||||||
* @param[in] m matrix
|
* @param[in] src mat4x2 (left)
|
||||||
* @param[out] dest result
|
* @param[out] dest destination (result, mat2x4)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
glm_mat4x2_transpose(mat4x2 m, mat2x4 dest) {
|
glm_mat4x2_transpose(mat4x2 m, mat2x4 dest) {
|
||||||
dest[0][0] = m[0][0];
|
dest[0][0] = m[0][0]; dest[0][1] = m[1][0]; dest[0][2] = m[2][0]; dest[0][3] = m[3][0];
|
||||||
dest[0][1] = m[1][0];
|
dest[1][0] = m[0][1]; dest[1][1] = m[1][1]; dest[1][2] = m[2][1]; dest[1][3] = m[3][1];
|
||||||
dest[0][2] = m[2][0];
|
|
||||||
dest[0][3] = m[3][0];
|
|
||||||
dest[1][0] = m[0][1];
|
|
||||||
dest[1][1] = m[1][1];
|
|
||||||
dest[1][2] = m[2][1];
|
|
||||||
dest[1][3] = m[3][1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief scale (multiply with scalar) matrix
|
* @brief Multiply mat4x2 (m) by scalar constant (s).
|
||||||
*
|
*
|
||||||
* multiply matrix with scalar
|
* @param[in, out] m (src, dest)
|
||||||
*
|
* @param[in] s float (scalar)
|
||||||
* @param[in, out] m matrix
|
|
||||||
* @param[in] s scalar
|
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -11,12 +11,12 @@
|
|||||||
GLM_MAT4X3_ZERO
|
GLM_MAT4X3_ZERO
|
||||||
|
|
||||||
Functions:
|
Functions:
|
||||||
CGLM_INLINE void glm_mat4x3_copy(mat4x3 mat, mat4x3 dest);
|
CGLM_INLINE void glm_mat4x3_copy(mat4x3 src, mat4x3 dest);
|
||||||
CGLM_INLINE void glm_mat4x3_zero(mat4x3 mat);
|
CGLM_INLINE void glm_mat4x3_zero(mat4x3 m);
|
||||||
CGLM_INLINE void glm_mat4x3_make(const float * __restrict src, mat4x3 dest);
|
CGLM_INLINE void glm_mat4x3_make(const float * __restrict src, mat4x3 dest);
|
||||||
CGLM_INLINE void glm_mat4x3_mul(mat4x3 m1, mat3x4 m2, mat3 dest);
|
CGLM_INLINE void glm_mat4x3_mul(mat4x3 m1, mat3x4 m2, mat3 dest);
|
||||||
CGLM_INLINE void glm_mat4x3_mulv(mat4x3 m, vec4 v, vec3 dest);
|
CGLM_INLINE void glm_mat4x3_mulv(mat4x3 m, vec4 v, vec3 dest);
|
||||||
CGLM_INLINE void glm_mat4x3_transpose(mat4x3 m, mat3x4 dest);
|
CGLM_INLINE void glm_mat4x3_transpose(mat4x3 src, mat3x4 dest);
|
||||||
CGLM_INLINE void glm_mat4x3_scale(mat4x3 m, float s);
|
CGLM_INLINE void glm_mat4x3_scale(mat4x3 m, float s);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -32,48 +32,37 @@
|
|||||||
#define GLM_MAT4X3_ZERO GLM_MAT4X3_ZERO_INIT
|
#define GLM_MAT4X3_ZERO GLM_MAT4X3_ZERO_INIT
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief copy all members of [mat] to [dest]
|
* @brief Copy mat4x3 (src) to mat4x3 (dest).
|
||||||
*
|
*
|
||||||
* @param[in] mat source
|
* @param[in] src mat4x3 (left)
|
||||||
* @param[out] dest destination
|
* @param[out] dest destination (result, mat4x3)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
glm_mat4x3_copy(mat4x3 mat, mat4x3 dest) {
|
glm_mat4x3_copy(mat4x3 src, mat4x3 dest) {
|
||||||
dest[0][0] = mat[0][0];
|
glm_vec3_copy(src[0], dest[0]);
|
||||||
dest[0][1] = mat[0][1];
|
glm_vec3_copy(src[1], dest[1]);
|
||||||
dest[0][2] = mat[0][2];
|
glm_vec3_copy(src[2], dest[2]);
|
||||||
|
glm_vec3_copy(src[3], dest[3]);
|
||||||
dest[1][0] = mat[1][0];
|
|
||||||
dest[1][1] = mat[1][1];
|
|
||||||
dest[1][2] = mat[1][2];
|
|
||||||
|
|
||||||
dest[2][0] = mat[2][0];
|
|
||||||
dest[2][1] = mat[2][1];
|
|
||||||
dest[2][2] = mat[2][2];
|
|
||||||
|
|
||||||
dest[3][0] = mat[3][0];
|
|
||||||
dest[3][1] = mat[3][1];
|
|
||||||
dest[3][2] = mat[3][2];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief make given matrix zero.
|
* @brief Zero out the mat4x3 (m).
|
||||||
*
|
*
|
||||||
* @param[in, out] mat matrix
|
* @param[in, out] mat4x3 (src, dest)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
glm_mat4x3_zero(mat4x3 mat) {
|
glm_mat4x3_zero(mat4x3 m) {
|
||||||
CGLM_ALIGN_MAT mat4x3 t = GLM_MAT4X3_ZERO_INIT;
|
CGLM_ALIGN_MAT mat4x3 t = GLM_MAT4X3_ZERO_INIT;
|
||||||
glm_mat4x3_copy(t, mat);
|
glm_mat4x3_copy(t, m);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Create mat4x3 matrix from pointer
|
* @brief Create mat4x3 (dest) from pointer (src).
|
||||||
*
|
*
|
||||||
* @param[in] src pointer to an array of floats
|
* @param[in] src pointer to an array of floats (left)
|
||||||
* @param[out] dest matrix
|
* @param[out] dest destination (result, mat4x3)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
@@ -96,15 +85,15 @@ glm_mat4x3_make(const float * __restrict src, mat4x3 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply m1 and m2 to dest
|
* @brief Multiply mat4x3 (m1) by mat3x4 (m2) and store in mat3 (dest).
|
||||||
*
|
*
|
||||||
* @code
|
* @code
|
||||||
* glm_mat4x3_mul(mat4x3, mat3x4, mat3);
|
* glm_mat4x3_mul(mat4x3, mat3x4, mat3);
|
||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
* @param[in] m1 left matrix (mat4x3)
|
* @param[in] m1 mat4x3 (left)
|
||||||
* @param[in] m2 right matrix (mat3x4)
|
* @param[in] m2 mat3x4 (right)
|
||||||
* @param[out] dest destination matrix (mat3)
|
* @param[out] dest destination (result, mat3)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
@@ -132,11 +121,11 @@ glm_mat4x3_mul(mat4x3 m1, mat3x4 m2, mat3 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply matrix with column vector and store in dest column vector
|
* @brief Multiply mat4x3 (m) by vec4 (v) and store in vec3 (dest).
|
||||||
*
|
*
|
||||||
* @param[in] m matrix (left)
|
* @param[in] m mat4x3 (left)
|
||||||
* @param[in] v vector (right, column vector)
|
* @param[in] v vec3 (right, column vector)
|
||||||
* @param[out] dest result vector
|
* @param[out] dest destination (result, column vector)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
@@ -149,37 +138,24 @@ glm_mat4x3_mulv(mat4x3 m, vec4 v, vec3 dest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief transpose matrix and store in dest
|
* @brief Transpose mat4x3 (src) and store in mat3x4 (dest).
|
||||||
*
|
*
|
||||||
* @param[in] m matrix
|
* @param[in] src mat4x3 (left)
|
||||||
* @param[out] dest result
|
* @param[out] dest destination (result, mat3x4)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
glm_mat4x3_transpose(mat4x3 m, mat3x4 dest) {
|
glm_mat4x3_transpose(mat4x3 src, mat3x4 dest) {
|
||||||
dest[0][0] = m[0][0];
|
dest[0][0] = src[0][0]; dest[0][1] = src[1][0]; dest[0][2] = src[2][0]; dest[0][3] = src[3][0];
|
||||||
dest[0][1] = m[1][0];
|
dest[1][0] = src[0][1]; dest[1][1] = src[1][1]; dest[1][2] = src[2][1]; dest[1][3] = src[3][1];
|
||||||
dest[0][2] = m[2][0];
|
dest[2][0] = src[0][2]; dest[2][1] = src[1][2]; dest[2][2] = src[2][2]; dest[2][3] = src[3][2];
|
||||||
dest[0][3] = m[3][0];
|
|
||||||
|
|
||||||
dest[1][0] = m[0][1];
|
|
||||||
dest[1][1] = m[1][1];
|
|
||||||
dest[1][2] = m[2][1];
|
|
||||||
dest[1][3] = m[3][1];
|
|
||||||
|
|
||||||
dest[2][0] = m[0][2];
|
|
||||||
dest[2][1] = m[1][2];
|
|
||||||
dest[2][2] = m[2][2];
|
|
||||||
dest[2][3] = m[3][2];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief scale (multiply with scalar) matrix
|
* @brief Multiply mat4x3 (m) by scalar constant (s).
|
||||||
*
|
*
|
||||||
* multiply matrix with scalar
|
* @param[in, out] m (src, dest)
|
||||||
*
|
* @param[in] s float (scalar)
|
||||||
* @param[in, out] m matrix
|
|
||||||
* @param[in] s scalar
|
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
@@ -189,4 +165,4 @@ glm_mat4x3_scale(mat4x3 m, float s) {
|
|||||||
m[2][2] *= s; m[3][0] *= s; m[3][1] *= s; m[3][2] *= s;
|
m[2][2] *= s; m[3][0] *= s; m[3][1] *= s; m[3][2] *= s;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif /* cglm_mat4x3_h */
|
||||||
|
|||||||
@@ -19,8 +19,10 @@
|
|||||||
#define glmm_load(p) vld1q_f32(p)
|
#define glmm_load(p) vld1q_f32(p)
|
||||||
#define glmm_store(p, a) vst1q_f32(p, a)
|
#define glmm_store(p, a) vst1q_f32(p, a)
|
||||||
|
|
||||||
#define glmm_set1(x) vdupq_n_f32(x)
|
#define glmm_set1(x) vdupq_n_f32(x)
|
||||||
#define glmm_128 float32x4_t
|
#define glmm_set1_ptr(x) vdupq_n_f32(*x)
|
||||||
|
#define glmm_set1_rval(x) vdupq_n_f32(x)
|
||||||
|
#define glmm_128 float32x4_t
|
||||||
|
|
||||||
#define glmm_splat_x(x) vdupq_lane_f32(vget_low_f32(x), 0)
|
#define glmm_splat_x(x) vdupq_lane_f32(vget_low_f32(x), 0)
|
||||||
#define glmm_splat_y(x) vdupq_lane_f32(vget_low_f32(x), 1)
|
#define glmm_splat_y(x) vdupq_lane_f32(vget_low_f32(x), 1)
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#define glmm_store(p, a) wasm_v128_store(p, (a))
|
#define glmm_store(p, a) wasm_v128_store(p, (a))
|
||||||
|
|
||||||
#define glmm_set1(x) wasm_f32x4_splat(x)
|
#define glmm_set1(x) wasm_f32x4_splat(x)
|
||||||
|
#define glmm_set1_ptr(x) wasm_f32x4_splat(*x)
|
||||||
#define glmm_set1_rval(x) wasm_f32x4_splat(x)
|
#define glmm_set1_rval(x) wasm_f32x4_splat(x)
|
||||||
#define glmm_128 v128_t
|
#define glmm_128 v128_t
|
||||||
|
|
||||||
|
|||||||
@@ -35,87 +35,85 @@
|
|||||||
#define GLMS_MAT2X3_ZERO ((mat2x3s)GLMS_MAT2X3_ZERO_INIT)
|
#define GLMS_MAT2X3_ZERO ((mat2x3s)GLMS_MAT2X3_ZERO_INIT)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief make given matrix zero.
|
* @brief Zero out the mat2x3s (dest).
|
||||||
*
|
*
|
||||||
* @param[in, out] mat matrix
|
* @return[out] dest constructed mat2x3s from raw pointer
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat2x3s
|
mat2x3s
|
||||||
glms_mat2x3_(zero)(void) {
|
glms_mat2x3_(zero)(void) {
|
||||||
mat2x3s r;
|
mat2x3s dest;
|
||||||
glm_mat2x3_zero(r.raw);
|
glm_mat2x3_zero(dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Create mat2x3 matrix from pointer
|
* @brief Create mat2x3s (dest) from pointer (src).
|
||||||
*
|
*
|
||||||
* @param[in] src pointer to an array of floats
|
* @param[in] src pointer to an array of floats
|
||||||
* @return constructed matrix from raw pointer
|
* @return[out] dest constructed mat2x3s from raw pointer
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat2x3s
|
mat2x3s
|
||||||
glms_mat2x3_(make)(const float * __restrict src) {
|
glms_mat2x3_(make)(const float * __restrict src) {
|
||||||
mat2x3s r;
|
mat2x3s dest;
|
||||||
glm_mat2x3_make(src, r.raw);
|
glm_mat2x3_make(src, dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply m1 and m2 to dest
|
* @brief Multiply mat2x3s (m1) by mat3x2s (m2) and store in mat3s (dest).
|
||||||
*
|
*
|
||||||
* @code
|
* @code
|
||||||
* r = glms_mat2x3_mul(mat2x3s, mat3x2s);
|
* r = glms_mat2x3_mul(mat2x3s, mat3x2s);
|
||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
* @param[in] m1 left matrix (mat2x3s)
|
* @param[in] m1 mat2x3s (left)
|
||||||
* @param[in] m2 right matrix (mat3x2s)
|
* @param[in] m2 mat3x2s (right)
|
||||||
* @returns destination matrix (mat2s)
|
* @return[out] dest constructed mat3s from raw pointers
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat3s
|
mat3s
|
||||||
glms_mat2x3_(mul)(mat2x3s m1, mat3x2s m2) {
|
glms_mat2x3_(mul)(mat2x3s m1, mat3x2s m2) {
|
||||||
mat3s r;
|
mat3s dest;
|
||||||
glm_mat2x3_mul(m1.raw, m2.raw, r.raw);
|
glm_mat2x3_mul(m1.raw, m2.raw, dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply matrix with column vector and store in dest vector
|
* @brief Multiply mat2x3s (m) by vec2s (v) and store in vec3s (dest).
|
||||||
*
|
*
|
||||||
* @param[in] m matrix (left)
|
* @param[in] m mat2x3s (left)
|
||||||
* @param[in] v vector (right, column vector)
|
* @param[in] v vec2s (right, column vector)
|
||||||
* @returns destination vector (vec3s)
|
* @return[out] dest constructed vec3s from raw pointers
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
vec3s
|
vec3s
|
||||||
glms_mat2x3_(mulv)(mat2x3s m, vec2s v) {
|
glms_mat2x3_(mulv)(mat2x3s m, vec2s v) {
|
||||||
vec3s r;
|
vec3s dest;
|
||||||
glm_mat2x3_mulv(m.raw, v.raw, r.raw);
|
glm_mat2x3_mulv(m.raw, v.raw, dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief transpose matrix and store in dest
|
* @brief Transpose mat2x3s (m) and store in mat3x2s (dest).
|
||||||
*
|
*
|
||||||
* @param[in] m matrix
|
* @param[in] m mat2x3s (left)
|
||||||
* @param[out] dest result
|
* @return[out] dest constructed mat3x2s from raw pointers
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat3x2s
|
mat3x2s
|
||||||
glms_mat2x3_(transpose)(mat2x3s m) {
|
glms_mat2x3_(transpose)(mat2x3s m) {
|
||||||
mat3x2s r;
|
mat3x2s dest;
|
||||||
glm_mat2x3_transpose(m.raw, r.raw);
|
glm_mat2x3_transpose(m.raw, dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief scale (multiply with scalar) matrix
|
* @brief Multiply mat2x3s (m) by scalar constant (s).
|
||||||
*
|
*
|
||||||
* multiply matrix with scalar
|
* @param[in, out] m mat2x3 (src, dest)
|
||||||
*
|
* @param[in] s float (scalar)
|
||||||
* @param[in, out] m matrix
|
|
||||||
* @param[in] s scalar
|
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat2x3s
|
mat2x3s
|
||||||
|
|||||||
@@ -35,87 +35,85 @@
|
|||||||
#define GLMS_MAT2X4_ZERO ((mat2x4s)GLMS_MAT2X4_ZERO_INIT)
|
#define GLMS_MAT2X4_ZERO ((mat2x4s)GLMS_MAT2X4_ZERO_INIT)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief make given matrix zero.
|
* @brief Zero out the mat2x4s (dest).
|
||||||
*
|
*
|
||||||
* @param[in, out] mat matrix
|
* @return[out] dest constructed mat2x4s from raw pointer
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat2x4s
|
mat2x4s
|
||||||
glms_mat2x4_(zero)(void) {
|
glms_mat2x4_(zero)(void) {
|
||||||
mat2x4s r;
|
mat2x4s dest;
|
||||||
glm_mat2x4_zero(r.raw);
|
glm_mat2x4_zero(dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Create mat2x4 matrix from pointer
|
* @brief Create mat2x4s (dest) from pointer (src).
|
||||||
*
|
*
|
||||||
* @param[in] src pointer to an array of floats
|
* @param[in] src pointer to an array of floats
|
||||||
* @return constructed matrix from raw pointer
|
* @return[out] dest constructed mat2x4s from raw pointer
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat2x4s
|
mat2x4s
|
||||||
glms_mat2x4_(make)(const float * __restrict src) {
|
glms_mat2x4_(make)(const float * __restrict src) {
|
||||||
mat2x4s r;
|
mat2x4s dest;
|
||||||
glm_mat2x4_make(src, r.raw);
|
glm_mat2x4_make(src, dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply m1 and m2 to dest
|
* @brief Multiply mat2x4s (m1) by mat4x2s (m2) and store in mat4s (dest).
|
||||||
*
|
*
|
||||||
* @code
|
* @code
|
||||||
* r = glms_mat2x4_mul(mat2x4s, mat4x2s);
|
* r = glms_mat2x4_mul(mat2x4s, mat4x2s);
|
||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
* @param[in] m1 left matrix (mat2x4s)
|
* @param[in] m1 mat2x4s (left)
|
||||||
* @param[in] m2 right matrix (mat4x2s)
|
* @param[in] m2 mat4x2s (right)
|
||||||
* @returns destination matrix (mat2s)
|
* @return[out] dest constructed mat4s from raw pointers
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4s
|
mat4s
|
||||||
glms_mat2x4_(mul)(mat2x4s m1, mat4x2s m2) {
|
glms_mat2x4_(mul)(mat2x4s m1, mat4x2s m2) {
|
||||||
mat4s r;
|
mat4s dest;
|
||||||
glm_mat2x4_mul(m1.raw, m2.raw, r.raw);
|
glm_mat2x4_mul(m1.raw, m2.raw, dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply matrix with column vector and store in dest column vector
|
* @brief Multiply mat2x4s (m) by vec2s (v) and store in vec4s (dest).
|
||||||
*
|
*
|
||||||
* @param[in] m matrix (left)
|
* @param[in] m mat2x4s (left)
|
||||||
* @param[in] v vector (right, column vector)
|
* @param[in] v vec2s (right, column vector)
|
||||||
* @param[out] dest result vector
|
* @return[out] dest constructed vec4s from raw pointers
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
vec4s
|
vec4s
|
||||||
glms_mat2x4_(mulv)(mat2x4s m, vec2s v) {
|
glms_mat2x4_(mulv)(mat2x4s m, vec2s v) {
|
||||||
vec4s r;
|
vec4s dest;
|
||||||
glm_mat2x4_mulv(m.raw, v.raw, r.raw);
|
glm_mat2x4_mulv(m.raw, v.raw, dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief transpose matrix and store in dest
|
* @brief Transpose mat2x4s (m) and store in mat4x2s (dest).
|
||||||
*
|
*
|
||||||
* @param[in] m matrix
|
* @param[in] m mat2x4s (left)
|
||||||
* @param[out] dest result
|
* @return[out] dest constructed mat4x2s from raw pointers
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4x2s
|
mat4x2s
|
||||||
glms_mat2x4_(transpose)(mat2x4s m) {
|
glms_mat2x4_(transpose)(mat2x4s m) {
|
||||||
mat4x2s r;
|
mat4x2s dest;
|
||||||
glm_mat2x4_transpose(m.raw, r.raw);
|
glm_mat2x4_transpose(m.raw, dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief scale (multiply with scalar) matrix
|
* @brief Multiply mat2x4s (m) by scalar constant (s).
|
||||||
*
|
*
|
||||||
* multiply matrix with scalar
|
* @param[in, out] m mat2x4s (src, dest)
|
||||||
*
|
* @param[in] s float (scalar)
|
||||||
* @param[in, out] m matrix
|
|
||||||
* @param[in] s scalar
|
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat2x4s
|
mat2x4s
|
||||||
|
|||||||
@@ -35,87 +35,85 @@
|
|||||||
#define GLMS_MAT3X2_ZERO ((mat3x2s)GLMS_MAT3X2_ZERO_INIT)
|
#define GLMS_MAT3X2_ZERO ((mat3x2s)GLMS_MAT3X2_ZERO_INIT)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief make given matrix zero.
|
* @brief Zero out the mat3x2s (dest).
|
||||||
*
|
*
|
||||||
* @param[in, out] mat matrix
|
* @return[out] dest constructed mat3x2s from raw pointer
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat3x2s
|
mat3x2s
|
||||||
glms_mat3x2_(zero)(void) {
|
glms_mat3x2_(zero)(void) {
|
||||||
mat3x2s r;
|
mat3x2s dest;
|
||||||
glm_mat3x2_zero(r.raw);
|
glm_mat3x2_zero(dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Create mat3x2 matrix from pointer
|
* @brief Create mat3x2s (dest) from pointer (src).
|
||||||
*
|
*
|
||||||
* @param[in] src pointer to an array of floats
|
* @param[in] src pointer to an array of floats
|
||||||
* @return constructed matrix from raw pointer
|
* @return[out] dest constructed mat3x2s from raw pointer
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat3x2s
|
mat3x2s
|
||||||
glms_mat3x2_(make)(const float * __restrict src) {
|
glms_mat3x2_(make)(const float * __restrict src) {
|
||||||
mat3x2s r;
|
mat3x2s dest;
|
||||||
glm_mat3x2_make(src, r.raw);
|
glm_mat3x2_make(src, dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply m1 and m2 to dest
|
* @brief Multiply mat3x2s (m1) by mat2x3s (m2) and store in mat2s (dest).
|
||||||
*
|
*
|
||||||
* @code
|
* @code
|
||||||
* r = glms_mat3x2_mul(mat3x2s, mat2x3s);
|
* r = glms_mat3x2_mul(mat3x2s, mat2x3s);
|
||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
* @param[in] m1 left matrix (mat3x2s)
|
* @param[in] m1 mat3x2s (left)
|
||||||
* @param[in] m2 right matrix (mat2x3s)
|
* @param[in] m2 mat2x3s (right)
|
||||||
* @returns destination matrix (mat3s)
|
* @return[out] dest constructed mat2s from raw pointers
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat2s
|
mat2s
|
||||||
glms_mat3x2_(mul)(mat3x2s m1, mat2x3s m2) {
|
glms_mat3x2_(mul)(mat3x2s m1, mat2x3s m2) {
|
||||||
mat2s r;
|
mat2s dest;
|
||||||
glm_mat3x2_mul(m1.raw, m2.raw, r.raw);
|
glm_mat3x2_mul(m1.raw, m2.raw, dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply matrix with column vector and store in dest vector
|
* @brief Multiply mat3x2s (m) by vec3s (v) and store in vec2s (dest).
|
||||||
*
|
*
|
||||||
* @param[in] m matrix (left)
|
* @param[in] m mat3x2s (left)
|
||||||
* @param[in] v vector (right, column vector)
|
* @param[in] v vec3s (right, column vector)
|
||||||
* @param[out] dest result vector
|
* @return[out] dest constructed vec2s from raw pointers
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
vec2s
|
vec2s
|
||||||
glms_mat3x2_(mulv)(mat3x2s m, vec3s v) {
|
glms_mat3x2_(mulv)(mat3x2s m, vec3s v) {
|
||||||
vec2s r;
|
vec2s dest;
|
||||||
glm_mat3x2_mulv(m.raw, v.raw, r.raw);
|
glm_mat3x2_mulv(m.raw, v.raw, dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief transpose matrix and store in dest
|
* @brief Transpose mat3x2s (m) and store in mat2x3s (dest).
|
||||||
*
|
*
|
||||||
* @param[in] m matrix
|
* @param[in] m mat3x2s (left)
|
||||||
* @param[out] dest result
|
* @return[out] dest constructed mat2x3s from raw pointers
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat2x3s
|
mat2x3s
|
||||||
glms_mat3x2_(transpose)(mat3x2s m) {
|
glms_mat3x2_(transpose)(mat3x2s m) {
|
||||||
mat2x3s r;
|
mat2x3s dest;
|
||||||
glm_mat3x2_transpose(m.raw, r.raw);
|
glm_mat3x2_transpose(m.raw, dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief scale (multiply with scalar) matrix
|
* @brief Multiply mat3x2s (m) by scalar constant (s).
|
||||||
*
|
*
|
||||||
* multiply matrix with scalar
|
* @param[in, out] m mat3x2s (src, dest)
|
||||||
*
|
* @param[in] s float (scalar)
|
||||||
* @param[in, out] m matrix
|
|
||||||
* @param[in] s scalar
|
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat3x2s
|
mat3x2s
|
||||||
|
|||||||
@@ -35,87 +35,85 @@
|
|||||||
#define GLMS_MAT3X4_ZERO ((mat3x4s)GLMS_MAT3X4_ZERO_INIT)
|
#define GLMS_MAT3X4_ZERO ((mat3x4s)GLMS_MAT3X4_ZERO_INIT)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief make given matrix zero.
|
* @brief Zero out the mat3x4s (dest).
|
||||||
*
|
*
|
||||||
* @param[in, out] mat matrix
|
* @return[out] dest constructed mat3x4s from raw pointer
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat3x4s
|
mat3x4s
|
||||||
glms_mat3x4_(zero)(void) {
|
glms_mat3x4_(zero)(void) {
|
||||||
mat3x4s r;
|
mat3x4s dest;
|
||||||
glm_mat3x4_zero(r.raw);
|
glm_mat3x4_zero(dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Create mat3x4 matrix from pointer
|
* @brief Create mat3x4s (dest) from pointer (src).
|
||||||
*
|
*
|
||||||
* @param[in] src pointer to an array of floats
|
* @param[in] src pointer to an array of floats
|
||||||
* @return constructed matrix from raw pointer
|
* @return[out] dest constructed mat3x4s from raw pointer
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat3x4s
|
mat3x4s
|
||||||
glms_mat3x4_(make)(const float * __restrict src) {
|
glms_mat3x4_(make)(const float * __restrict src) {
|
||||||
mat3x4s r;
|
mat3x4s dest;
|
||||||
glm_mat3x4_make(src, r.raw);
|
glm_mat3x4_make(src, dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply m1 and m2 to dest
|
* @brief Multiply mat3x4s (m1) by mat4x3s (m2) and store in mat4s (dest).
|
||||||
*
|
*
|
||||||
* @code
|
* @code
|
||||||
* r = glms_mat3x4_mul(mat3x4s, mat4x3s);
|
* r = glms_mat3x4_mul(mat3x4s, mat4x3s);
|
||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
* @param[in] m1 left matrix (mat3x4s)
|
* @param[in] m1 mat3x4s (left)
|
||||||
* @param[in] m2 right matrix (mat4x3s)
|
* @param[in] m2 mat4x3s (right)
|
||||||
* @returns destination matrix (mat4s)
|
* @return[out] dest constructed mat4s from raw pointers
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4s
|
mat4s
|
||||||
glms_mat3x4_(mul)(mat3x4s m1, mat4x3s m2) {
|
glms_mat3x4_(mul)(mat3x4s m1, mat4x3s m2) {
|
||||||
mat4s r;
|
mat4s dest;
|
||||||
glm_mat3x4_mul(m1.raw, m2.raw, r.raw);
|
glm_mat3x4_mul(m1.raw, m2.raw, dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply matrix with column vector and store in dest column vector
|
* @brief Multiply mat3x4s (m) by vec3s (v) and store in vec4s (dest).
|
||||||
*
|
*
|
||||||
* @param[in] m matrix (left)
|
* @param[in] m mat3x4s (left)
|
||||||
* @param[in] v vector (right, column vector)
|
* @param[in] v vec3s (right, column vector)
|
||||||
* @returns destination vector (vec4s)
|
* @return[out] dest constructed vec4s from raw pointers
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
vec4s
|
vec4s
|
||||||
glms_mat3x4_(mulv)(mat3x4s m, vec3s v) {
|
glms_mat3x4_(mulv)(mat3x4s m, vec3s v) {
|
||||||
vec4s r;
|
vec4s dest;
|
||||||
glm_mat3x4_mulv(m.raw, v.raw, r.raw);
|
glm_mat3x4_mulv(m.raw, v.raw, dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief transpose matrix and store in dest
|
* @brief Transpose mat3x4s (m) and store in mat4x3s (dest).
|
||||||
*
|
*
|
||||||
* @param[in] m matrix
|
* @param[in] m mat3x4s (left)
|
||||||
* @param[out] dest result
|
* @return[out] dest constructed mat4x3s from raw pointers
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4x3s
|
mat4x3s
|
||||||
glms_mat3x4_(transpose)(mat3x4s m) {
|
glms_mat3x4_(transpose)(mat3x4s m) {
|
||||||
mat4x3s r;
|
mat4x3s dest;
|
||||||
glm_mat3x4_transpose(m.raw, r.raw);
|
glm_mat3x4_transpose(m.raw, dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief scale (multiply with scalar) matrix
|
* @brief Multiply mat3x4s (m) by scalar constant (s).
|
||||||
*
|
*
|
||||||
* multiply matrix with scalar
|
* @param[in, out] m mat3x4s (src, dest)
|
||||||
*
|
* @param[in] s float (scalar)
|
||||||
* @param[in, out] m matrix
|
|
||||||
* @param[in] s scalar
|
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat3x4s
|
mat3x4s
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ glms_mat4_(mul)(mat4s m1, mat4s m2) {
|
|||||||
* size but if <b>len</b> is too small then compiler may unroll whole loop,
|
* size but if <b>len</b> is too small then compiler may unroll whole loop,
|
||||||
* usage:
|
* usage:
|
||||||
* @code
|
* @code
|
||||||
* mat m1, m2, m3, m4, res;
|
* mat4 m1, m2, m3, m4, res;
|
||||||
*
|
*
|
||||||
* res = glm_mat4_mulN((mat4 *[]){&m1, &m2, &m3, &m4}, 4);
|
* res = glm_mat4_mulN((mat4 *[]){&m1, &m2, &m3, &m4}, 4);
|
||||||
* @endcode
|
* @endcode
|
||||||
|
|||||||
@@ -36,87 +36,85 @@
|
|||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief make given matrix zero.
|
* @brief Zero out the mat4x2s (dest).
|
||||||
*
|
*
|
||||||
* @param[in, out] mat matrix
|
* @return[out] dest constructed mat4x2s from raw pointer
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4x2s
|
mat4x2s
|
||||||
glms_mat4x2_(zero)(void) {
|
glms_mat4x2_(zero)(void) {
|
||||||
mat4x2s r;
|
mat4x2s dest;
|
||||||
glm_mat4x2_zero(r.raw);
|
glm_mat4x2_zero(dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Create mat4x2 matrix from pointer
|
* @brief Create mat4x2s (dest) from pointer (src).
|
||||||
*
|
*
|
||||||
* @param[in] src pointer to an array of floats
|
* @param[in] src pointer to an array of floats
|
||||||
* @return constructed matrix from raw pointer
|
* @return[out] dest constructed mat4x2s from raw pointer
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4x2s
|
mat4x2s
|
||||||
glms_mat4x2_(make)(const float * __restrict src) {
|
glms_mat4x2_(make)(const float * __restrict src) {
|
||||||
mat4x2s r;
|
mat4x2s dest;
|
||||||
glm_mat4x2_make(src, r.raw);
|
glm_mat4x2_make(src, dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply m1 and m2 to dest
|
* @brief Multiply mat4x2s (m1) by mat2x4s (m2) and store in mat2s (dest).
|
||||||
*
|
*
|
||||||
* @code
|
* @code
|
||||||
* r = glms_mat4x2_mul(mat4x2s, mat2x4s);
|
* r = glms_mat4x2_mul(mat4x2s, mat2x4s);
|
||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
* @param[in] m1 left matrix (mat4x2s)
|
* @param[in] m1 mat4x2s (left)
|
||||||
* @param[in] m2 right matrix (mat2x4s)
|
* @param[in] m2 mat2x4s (right)
|
||||||
* @returns destination matrix (mat2s)
|
* @return[out] dest constructed mat2s from raw pointers
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat2s
|
mat2s
|
||||||
glms_mat4x2_(mul)(mat4x2s m1, mat2x4s m2) {
|
glms_mat4x2_(mul)(mat4x2s m1, mat2x4s m2) {
|
||||||
mat2s r;
|
mat2s dest;
|
||||||
glm_mat4x2_mul(m1.raw, m2.raw, r.raw);
|
glm_mat4x2_mul(m1.raw, m2.raw, dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply matrix with column vector and store in dest column vector
|
* @brief Multiply mat4x2s (m) by vec4s (v) and store in vec2s (dest).
|
||||||
*
|
*
|
||||||
* @param[in] m matrix (left)
|
* @param[in] m mat4x2s (left)
|
||||||
* @param[in] v vector (right, column vector)
|
* @param[in] v vec4s (right, column vector)
|
||||||
* @returns destination vector (vec2s)
|
* @return[out] dest constructed vec2s from raw pointers
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
vec2s
|
vec2s
|
||||||
glms_mat4x2_(mulv)(mat4x2s m, vec4s v) {
|
glms_mat4x2_(mulv)(mat4x2s m, vec4s v) {
|
||||||
vec2s r;
|
vec2s dest;
|
||||||
glm_mat4x2_mulv(m.raw, v.raw, r.raw);
|
glm_mat4x2_mulv(m.raw, v.raw, dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief transpose matrix and store in dest
|
* @brief Transpose mat4x2s (m) and store in mat2x4s (dest).
|
||||||
*
|
*
|
||||||
* @param[in] m matrix
|
* @param[in] m mat4x2s (left)
|
||||||
* @param[out] dest result
|
* @return[out] dest constructed mat2x4s from raw pointers
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat2x4s
|
mat2x4s
|
||||||
glms_mat4x2_(transpose)(mat4x2s m) {
|
glms_mat4x2_(transpose)(mat4x2s m) {
|
||||||
mat2x4s r;
|
mat2x4s dest;
|
||||||
glm_mat4x2_transpose(m.raw, r.raw);
|
glm_mat4x2_transpose(m.raw, dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief scale (multiply with scalar) matrix
|
* @brief Multiply mat4x2s (m) by scalar constant (s).
|
||||||
*
|
*
|
||||||
* multiply matrix with scalar
|
* @param[in, out] m mat4x2s (src, dest)
|
||||||
*
|
* @param[in] s float (scalar)
|
||||||
* @param[in, out] m matrix
|
|
||||||
* @param[in] s scalar
|
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4x2s
|
mat4x2s
|
||||||
|
|||||||
@@ -35,87 +35,85 @@
|
|||||||
#define GLMS_MAT4X3_ZERO ((mat4x3s)GLMS_MAT4X3_ZERO_INIT)
|
#define GLMS_MAT4X3_ZERO ((mat4x3s)GLMS_MAT4X3_ZERO_INIT)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief make given matrix zero.
|
* @brief Zero out the mat4x3s (dest).
|
||||||
*
|
*
|
||||||
* @param[in, out] mat matrix
|
* @return[out] dest constructed mat4x3s from raw pointer
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4x3s
|
mat4x3s
|
||||||
glms_mat4x3_(zero)(void) {
|
glms_mat4x3_(zero)(void) {
|
||||||
mat4x3s r;
|
mat4x3s dest;
|
||||||
glm_mat4x3_zero(r.raw);
|
glm_mat4x3_zero(dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Create mat4x3 matrix from pointer
|
* @brief Create mat4x3s (dest) from pointer (src).
|
||||||
*
|
*
|
||||||
* @param[in] src pointer to an array of floats
|
* @param[in] src pointer to an array of floats
|
||||||
* @return constructed matrix from raw pointer
|
* @return[out] dest constructed mat4x3s from raw pointer
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4x3s
|
mat4x3s
|
||||||
glms_mat4x3_(make)(const float * __restrict src) {
|
glms_mat4x3_(make)(const float * __restrict src) {
|
||||||
mat4x3s r;
|
mat4x3s dest;
|
||||||
glm_mat4x3_make(src, r.raw);
|
glm_mat4x3_make(src, dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply m1 and m2 to dest
|
* @brief Multiply mat4x3s (m1) by mat3x4s (m2) and store in mat3s (dest).
|
||||||
*
|
*
|
||||||
* @code
|
* @code
|
||||||
* r = glms_mat4x3_mul(mat4x3s, mat3x4s);
|
* r = glms_mat4x3_mul(mat4x3s, mat3x4s);
|
||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
* @param[in] m1 left matrix (mat4x3s)
|
* @param[in] m1 mat4x3s (left)
|
||||||
* @param[in] m2 right matrix (mat3x4s)
|
* @param[in] m2 mat3x4s (right)
|
||||||
* @returns destination matrix (mat3s)
|
* @return[out] dest constructed mat3s from raw pointers
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat3s
|
mat3s
|
||||||
glms_mat4x3_(mul)(mat4x3s m1, mat3x4s m2) {
|
glms_mat4x3_(mul)(mat4x3s m1, mat3x4s m2) {
|
||||||
mat3s r;
|
mat3s dest;
|
||||||
glm_mat4x3_mul(m1.raw, m2.raw, r.raw);
|
glm_mat4x3_mul(m1.raw, m2.raw, dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief multiply matrix with column vector and store in dest vector
|
* @brief Multiply mat4x3s (m) by vec4s (v) and store in vec3s (dest).
|
||||||
*
|
*
|
||||||
* @param[in] m matrix (left)
|
* @param[in] m mat4x3s (left)
|
||||||
* @param[in] v vector (right, column vector)
|
* @param[in] v vec4s (right, column vector)
|
||||||
* @returns destination vector (vec3s)
|
* @return[out] dest constructed vec3s from raw pointers
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
vec3s
|
vec3s
|
||||||
glms_mat4x3_(mulv)(mat4x3s m, vec4s v) {
|
glms_mat4x3_(mulv)(mat4x3s m, vec4s v) {
|
||||||
vec3s r;
|
vec3s dest;
|
||||||
glm_mat4x3_mulv(m.raw, v.raw, r.raw);
|
glm_mat4x3_mulv(m.raw, v.raw, dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief transpose matrix and store in dest
|
* @brief Transpose mat4x3s (m) and store in mat3x4s (dest).
|
||||||
*
|
*
|
||||||
* @param[in] m matrix
|
* @param[in] m mat4x3s (left)
|
||||||
* @param[out] dest result
|
* @return[out] dest constructed mat3x4s from raw pointers
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat3x4s
|
mat3x4s
|
||||||
glms_mat4x3_(transpose)(mat4x3s m) {
|
glms_mat4x3_(transpose)(mat4x3s m) {
|
||||||
mat3x4s r;
|
mat3x4s dest;
|
||||||
glm_mat4x3_transpose(m.raw, r.raw);
|
glm_mat4x3_transpose(m.raw, dest.raw);
|
||||||
return r;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief scale (multiply with scalar) matrix
|
* @brief Multiply mat4x3s (m) by scalar constant (s).
|
||||||
*
|
*
|
||||||
* multiply matrix with scalar
|
* @param[in, out] m mat4x3s (src, dest)
|
||||||
*
|
* @param[in] s float (scalar)
|
||||||
* @param[in, out] m matrix
|
|
||||||
* @param[in] s scalar
|
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
mat4x3s
|
mat4x3s
|
||||||
|
|||||||
@@ -106,23 +106,35 @@ typedef vec3 mat4x3[4]; /* [col (4), row (3)] */
|
|||||||
#define GLM_PI_4 0.785398163397448309615660845819875721 /* pi/4 */
|
#define GLM_PI_4 0.785398163397448309615660845819875721 /* pi/4 */
|
||||||
#define GLM_1_PI 0.318309886183790671537767526745028724 /* 1/pi */
|
#define GLM_1_PI 0.318309886183790671537767526745028724 /* 1/pi */
|
||||||
#define GLM_2_PI 0.636619772367581343075535053490057448 /* 2/pi */
|
#define GLM_2_PI 0.636619772367581343075535053490057448 /* 2/pi */
|
||||||
|
#define GLM_TAU 6.283185307179586476925286766559005768 /* tau */
|
||||||
|
#define GLM_TAU_2 GLM_PI /* tau/2 */
|
||||||
|
#define GLM_TAU_4 GLM_PI_2 /* tau/4 */
|
||||||
|
#define GLM_1_TAU 0.159154943091895335768883763372514362 /* 1/tau */
|
||||||
|
#define GLM_2_TAU 0.318309886183790671537767526745028724 /* 2/tau */
|
||||||
#define GLM_2_SQRTPI 1.12837916709551257389615890312154517 /* 2/sqrt(pi) */
|
#define GLM_2_SQRTPI 1.12837916709551257389615890312154517 /* 2/sqrt(pi) */
|
||||||
|
#define GLM_SQRTTAU 2.506628274631000502415765284811045253 /* sqrt(tau) */
|
||||||
#define GLM_SQRT2 1.41421356237309504880168872420969808 /* sqrt(2) */
|
#define GLM_SQRT2 1.41421356237309504880168872420969808 /* sqrt(2) */
|
||||||
#define GLM_SQRT1_2 0.707106781186547524400844362104849039 /* 1/sqrt(2) */
|
#define GLM_SQRT1_2 0.707106781186547524400844362104849039 /* 1/sqrt(2) */
|
||||||
|
|
||||||
#define GLM_Ef ((float)GLM_E)
|
#define GLM_Ef ((float)GLM_E)
|
||||||
#define GLM_LOG2Ef ((float)GLM_LOG2E)
|
#define GLM_LOG2Ef ((float)GLM_LOG2E)
|
||||||
#define GLM_LOG10Ef ((float)GLM_LOG10E)
|
#define GLM_LOG10Ef ((float)GLM_LOG10E)
|
||||||
#define GLM_LN2f ((float)GLM_LN2)
|
#define GLM_LN2f ((float)GLM_LN2)
|
||||||
#define GLM_LN10f ((float)GLM_LN10)
|
#define GLM_LN10f ((float)GLM_LN10)
|
||||||
#define GLM_PIf ((float)GLM_PI)
|
#define GLM_PIf ((float)GLM_PI)
|
||||||
#define GLM_PI_2f ((float)GLM_PI_2)
|
#define GLM_PI_2f ((float)GLM_PI_2)
|
||||||
#define GLM_PI_4f ((float)GLM_PI_4)
|
#define GLM_PI_4f ((float)GLM_PI_4)
|
||||||
#define GLM_1_PIf ((float)GLM_1_PI)
|
#define GLM_1_PIf ((float)GLM_1_PI)
|
||||||
#define GLM_2_PIf ((float)GLM_2_PI)
|
#define GLM_2_PIf ((float)GLM_2_PI)
|
||||||
#define GLM_2_SQRTPIf ((float)GLM_2_SQRTPI)
|
#define GLM_TAUf ((float)GLM_TAU)
|
||||||
#define GLM_SQRT2f ((float)GLM_SQRT2)
|
#define GLM_TAU_2f ((float)GLM_TAU_2)
|
||||||
#define GLM_SQRT1_2f ((float)GLM_SQRT1_2)
|
#define GLM_TAU_4f ((float)GLM_TAU_4)
|
||||||
|
#define GLM_1_TAUf ((float)GLM_1_TAU)
|
||||||
|
#define GLM_2_TAUf ((float)GLM_2_TAU)
|
||||||
|
#define GLM_2_SQRTPIf ((float)GLM_2_SQRTPI)
|
||||||
|
#define GLM_2_SQRTTAUf ((float)GLM_SQRTTAU)
|
||||||
|
#define GLM_SQRT2f ((float)GLM_SQRT2)
|
||||||
|
#define GLM_SQRT1_2f ((float)GLM_SQRT1_2)
|
||||||
|
|
||||||
/* DEPRECATED! use GLM_PI and friends */
|
/* DEPRECATED! use GLM_PI and friends */
|
||||||
#define CGLM_PI GLM_PIf
|
#define CGLM_PI GLM_PIf
|
||||||
|
|||||||
@@ -10,6 +10,6 @@
|
|||||||
|
|
||||||
#define CGLM_VERSION_MAJOR 0
|
#define CGLM_VERSION_MAJOR 0
|
||||||
#define CGLM_VERSION_MINOR 9
|
#define CGLM_VERSION_MINOR 9
|
||||||
#define CGLM_VERSION_PATCH 5
|
#define CGLM_VERSION_PATCH 6
|
||||||
|
|
||||||
#endif /* cglm_version_h */
|
#endif /* cglm_version_h */
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
project('cglm', 'c',
|
project('cglm', 'c',
|
||||||
version : '0.9.5',
|
version : '0.9.6',
|
||||||
license : 'mit',
|
license : 'mit',
|
||||||
default_options : [
|
default_options : [
|
||||||
'c_std=c11',
|
'c_std=c11',
|
||||||
|
|||||||
12
src/mat2x3.c
12
src/mat2x3.c
@@ -10,14 +10,14 @@
|
|||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat2x3_copy(mat2x3 mat, mat2x3 dest) {
|
glmc_mat2x3_copy(mat2x3 src, mat2x3 dest) {
|
||||||
glm_mat2x3_copy(mat, dest);
|
glm_mat2x3_copy(src, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat2x3_zero(mat2x3 mat) {
|
glmc_mat2x3_zero(mat2x3 m) {
|
||||||
glm_mat2x3_zero(mat);
|
glm_mat2x3_zero(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
@@ -40,8 +40,8 @@ glmc_mat2x3_mulv(mat2x3 m, vec2 v, vec3 dest) {
|
|||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat2x3_transpose(mat2x3 m, mat3x2 dest) {
|
glmc_mat2x3_transpose(mat2x3 src, mat3x2 dest) {
|
||||||
glm_mat2x3_transpose(m, dest);
|
glm_mat2x3_transpose(src, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
|
|||||||
12
src/mat2x4.c
12
src/mat2x4.c
@@ -10,14 +10,14 @@
|
|||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat2x4_copy(mat2x4 mat, mat2x4 dest) {
|
glmc_mat2x4_copy(mat2x4 src, mat2x4 dest) {
|
||||||
glm_mat2x4_copy(mat, dest);
|
glm_mat2x4_copy(src, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat2x4_zero(mat2x4 mat) {
|
glmc_mat2x4_zero(mat2x4 m) {
|
||||||
glm_mat2x4_zero(mat);
|
glm_mat2x4_zero(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
@@ -40,8 +40,8 @@ glmc_mat2x4_mulv(mat2x4 m, vec2 v, vec4 dest) {
|
|||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat2x4_transpose(mat2x4 m, mat4x2 dest) {
|
glmc_mat2x4_transpose(mat2x4 src, mat4x2 dest) {
|
||||||
glm_mat2x4_transpose(m, dest);
|
glm_mat2x4_transpose(src, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
|
|||||||
12
src/mat3x2.c
12
src/mat3x2.c
@@ -10,14 +10,14 @@
|
|||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat3x2_copy(mat3x2 mat, mat3x2 dest) {
|
glmc_mat3x2_copy(mat3x2 src, mat3x2 dest) {
|
||||||
glm_mat3x2_copy(mat, dest);
|
glm_mat3x2_copy(src, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat3x2_zero(mat3x2 mat) {
|
glmc_mat3x2_zero(mat3x2 m) {
|
||||||
glm_mat3x2_zero(mat);
|
glm_mat3x2_zero(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
@@ -40,8 +40,8 @@ glmc_mat3x2_mulv(mat3x2 m, vec3 v, vec2 dest) {
|
|||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat3x2_transpose(mat3x2 m, mat2x3 dest) {
|
glmc_mat3x2_transpose(mat3x2 src, mat2x3 dest) {
|
||||||
glm_mat3x2_transpose(m, dest);
|
glm_mat3x2_transpose(src, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
|
|||||||
12
src/mat3x4.c
12
src/mat3x4.c
@@ -10,14 +10,14 @@
|
|||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat3x4_copy(mat3x4 mat, mat3x4 dest) {
|
glmc_mat3x4_copy(mat3x4 src, mat3x4 dest) {
|
||||||
glm_mat3x4_copy(mat, dest);
|
glm_mat3x4_copy(src, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat3x4_zero(mat3x4 mat) {
|
glmc_mat3x4_zero(mat3x4 m) {
|
||||||
glm_mat3x4_zero(mat);
|
glm_mat3x4_zero(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
@@ -40,8 +40,8 @@ glmc_mat3x4_mulv(mat3x4 m, vec3 v, vec4 dest) {
|
|||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat3x4_transpose(mat3x4 m, mat4x3 dest) {
|
glmc_mat3x4_transpose(mat3x4 src, mat4x3 dest) {
|
||||||
glm_mat3x4_transpose(m, dest);
|
glm_mat3x4_transpose(src, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
|
|||||||
12
src/mat4x2.c
12
src/mat4x2.c
@@ -10,14 +10,14 @@
|
|||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat4x2_copy(mat4x2 mat, mat4x2 dest) {
|
glmc_mat4x2_copy(mat4x2 src, mat4x2 dest) {
|
||||||
glm_mat4x2_copy(mat, dest);
|
glm_mat4x2_copy(src, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat4x2_zero(mat4x2 mat) {
|
glmc_mat4x2_zero(mat4x2 m) {
|
||||||
glm_mat4x2_zero(mat);
|
glm_mat4x2_zero(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
@@ -40,8 +40,8 @@ glmc_mat4x2_mulv(mat4x2 m, vec4 v, vec2 dest) {
|
|||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat4x2_transpose(mat4x2 m, mat2x4 dest) {
|
glmc_mat4x2_transpose(mat4x2 src, mat2x4 dest) {
|
||||||
glm_mat4x2_transpose(m, dest);
|
glm_mat4x2_transpose(src, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
|
|||||||
12
src/mat4x3.c
12
src/mat4x3.c
@@ -10,14 +10,14 @@
|
|||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat4x3_copy(mat4x3 mat, mat4x3 dest) {
|
glmc_mat4x3_copy(mat4x3 src, mat4x3 dest) {
|
||||||
glm_mat4x3_copy(mat, dest);
|
glm_mat4x3_copy(src, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat4x3_zero(mat4x3 mat) {
|
glmc_mat4x3_zero(mat4x3 m) {
|
||||||
glm_mat4x3_zero(mat);
|
glm_mat4x3_zero(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
@@ -40,8 +40,8 @@ glmc_mat4x3_mulv(mat4x3 m, vec4 v, vec3 dest) {
|
|||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_mat4x3_transpose(mat4x3 m, mat3x4 dest) {
|
glmc_mat4x3_transpose(mat4x3 src, mat3x4 dest) {
|
||||||
glm_mat4x3_transpose(m, dest);
|
glm_mat4x3_transpose(src, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
|
|||||||
@@ -24,4 +24,4 @@ CGLM_EXPORT
|
|||||||
float
|
float
|
||||||
glmc_perlin_vec2(vec2 p) {
|
glmc_perlin_vec2(vec2 p) {
|
||||||
return glm_perlin_vec2(p);
|
return glm_perlin_vec2(p);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ main(int argc, const char * argv[]) {
|
|||||||
test_entry_t *entry;
|
test_entry_t *entry;
|
||||||
test_status_t st;
|
test_status_t st;
|
||||||
int32_t i, count, passed, failed, maxlen;
|
int32_t i, count, passed, failed, maxlen;
|
||||||
double start, end, elapsed, total;
|
clock_t start, end, elapsed, total;
|
||||||
(void)argc;
|
(void)argc;
|
||||||
(void)argv;
|
(void)argv;
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ main(int argc, const char * argv[]) {
|
|||||||
fprintf(stderr, GREEN " " OK_TEXT RESET " %-*s ", maxlen, entry->name);
|
fprintf(stderr, GREEN " " OK_TEXT RESET " %-*s ", maxlen, entry->name);
|
||||||
|
|
||||||
if (elapsed > 0.01)
|
if (elapsed > 0.01)
|
||||||
fprintf(stderr, YELLOW "%.2fs", elapsed);
|
fprintf(stderr, YELLOW "%.2lus", elapsed);
|
||||||
else
|
else
|
||||||
fprintf(stderr, "0");
|
fprintf(stderr, "0");
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ main(int argc, const char * argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
CYAN "\ncglm test results (%0.2fs):\n" RESET
|
CYAN "\ncglm test results (%0.2lus):\n" RESET
|
||||||
"--------------------------\n"
|
"--------------------------\n"
|
||||||
|
|
||||||
MAGENTA "%d" RESET " tests ran, "
|
MAGENTA "%d" RESET " tests ran, "
|
||||||
|
|||||||
104
test/src/test_affine2d_post.h
Normal file
104
test/src/test_affine2d_post.h
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c), Recep Aslantas.
|
||||||
|
*
|
||||||
|
* MIT License (MIT), http://opensource.org/licenses/MIT
|
||||||
|
* Full license can be found in the LICENSE file
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "test_common.h"
|
||||||
|
|
||||||
|
TEST_IMPL(GLM_PREFIX, translated2d) {
|
||||||
|
mat3 m1, m2, tmp;
|
||||||
|
vec2 v = { 1.2f, 3.4f };
|
||||||
|
|
||||||
|
test_rand_transform2d(m1);
|
||||||
|
glm_mat3_copy(m1, m2);
|
||||||
|
GLM(translated2d)(m2, v);
|
||||||
|
|
||||||
|
glm_translate2d_make(tmp, v);
|
||||||
|
glm_mat3_mul(tmp, m1, m1);
|
||||||
|
|
||||||
|
test_assert_mat3_eq(m1, m2);
|
||||||
|
|
||||||
|
TEST_SUCCESS
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_IMPL(GLM_PREFIX, translated2d_x) {
|
||||||
|
mat3 m1, m2, tmp;
|
||||||
|
float x = test_rand();
|
||||||
|
|
||||||
|
test_rand_transform2d(m1);
|
||||||
|
glm_mat3_copy(m1, m2);
|
||||||
|
GLM(translated2d_x)(m2, x);
|
||||||
|
|
||||||
|
glm_translate2d_make(tmp, (vec2) { x, 0.0f });
|
||||||
|
glm_mat3_mul(tmp, m1, m1);
|
||||||
|
|
||||||
|
test_assert_mat3_eq(m1, m2);
|
||||||
|
|
||||||
|
TEST_SUCCESS
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_IMPL(GLM_PREFIX, translated2d_y) {
|
||||||
|
mat3 m1, m2, tmp;
|
||||||
|
float y = test_rand();
|
||||||
|
|
||||||
|
test_rand_transform2d(m1);
|
||||||
|
glm_mat3_copy(m1, m2);
|
||||||
|
GLM(translated2d_y)(m2, y);
|
||||||
|
|
||||||
|
glm_translate2d_make(tmp, (vec2) { 0.0f, y });
|
||||||
|
glm_mat3_mul(tmp, m1, m1);
|
||||||
|
|
||||||
|
test_assert_mat3_eq(m1, m2);
|
||||||
|
|
||||||
|
TEST_SUCCESS
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_IMPL(GLM_PREFIX, rotated2d) {
|
||||||
|
mat3 m1, m2, tmp;
|
||||||
|
float a = test_rand();
|
||||||
|
|
||||||
|
test_rand_transform2d(m1);
|
||||||
|
glm_mat3_copy(m1, m2);
|
||||||
|
GLM(rotated2d)(m2, a);
|
||||||
|
|
||||||
|
glm_rotate2d_make(tmp, a);
|
||||||
|
glm_mat3_mul(tmp, m1, m1);
|
||||||
|
|
||||||
|
test_assert_mat3_eq(m1, m2);
|
||||||
|
|
||||||
|
TEST_SUCCESS
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_IMPL(GLM_PREFIX, scaled2d) {
|
||||||
|
mat3 m1, m2, tmp;
|
||||||
|
vec2 v = { test_rand(), test_rand() };
|
||||||
|
|
||||||
|
test_rand_transform2d(m1);
|
||||||
|
glm_mat3_copy(m1, m2);
|
||||||
|
GLM(scaled2d)(m2, v);
|
||||||
|
|
||||||
|
glm_scale2d_make(tmp, v);
|
||||||
|
glm_mat3_mul(tmp, m1, m1);
|
||||||
|
|
||||||
|
test_assert_mat3_eq(m1, m2);
|
||||||
|
|
||||||
|
TEST_SUCCESS
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_IMPL(GLM_PREFIX, scaled2d_uni) {
|
||||||
|
mat3 m1, m2, tmp;
|
||||||
|
float s = test_rand();
|
||||||
|
|
||||||
|
test_rand_transform2d(m1);
|
||||||
|
glm_mat3_copy(m1, m2);
|
||||||
|
GLM(scaled2d_uni)(m2, s);
|
||||||
|
|
||||||
|
glm_scale2d_make(tmp, (vec2) { s, s });
|
||||||
|
glm_mat3_mul(tmp, m1, m1);
|
||||||
|
|
||||||
|
test_assert_mat3_eq(m1, m2);
|
||||||
|
|
||||||
|
TEST_SUCCESS
|
||||||
|
}
|
||||||
@@ -61,8 +61,8 @@ TEST_IMPL(GLM_PREFIX, mul_rot) {
|
|||||||
mat4 m4 = GLM_MAT4_ZERO_INIT;
|
mat4 m4 = GLM_MAT4_ZERO_INIT;
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
|
|
||||||
glm_rotate(m1, drand48(), (vec3){drand48(), drand48(), drand48()});
|
glm_rotate(m1, frand48(), (vec3){frand48(), frand48(), frand48()});
|
||||||
glm_rotate(m2, drand48(), (vec3){drand48(), drand48(), drand48()});
|
glm_rotate(m2, frand48(), (vec3){frand48(), frand48(), frand48()});
|
||||||
|
|
||||||
GLM(mul_rot)(m1, m2, m3);
|
GLM(mul_rot)(m1, m2, m3);
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
|
|||||||
@@ -11,49 +11,49 @@ test_rand_mat4(mat4 dest) {
|
|||||||
glm_mat4_copy(GLM_MAT4_IDENTITY, dest);
|
glm_mat4_copy(GLM_MAT4_IDENTITY, dest);
|
||||||
|
|
||||||
/* random position */
|
/* random position */
|
||||||
dest[3][0] = drand48();
|
dest[3][0] = frand48();
|
||||||
dest[3][1] = drand48();
|
dest[3][1] = frand48();
|
||||||
dest[3][2] = drand48();
|
dest[3][2] = frand48();
|
||||||
|
|
||||||
/* random rotatation around random axis with random angle */
|
/* random rotatation around random axis with random angle */
|
||||||
glm_rotate(dest, drand48(), (vec3){drand48(), drand48(), drand48()});
|
glm_rotate(dest, frand48(), (vec3){frand48(), frand48(), frand48()});
|
||||||
|
|
||||||
/* random scale */
|
/* random scale */
|
||||||
/* glm_scale(dest, (vec3){drand48(), drand48(), drand48()}); */
|
/* glm_scale(dest, (vec3){frand48(), frand48(), frand48()}); */
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
test_rand_mat4x2(mat4x2 dest) {
|
test_rand_mat4x2(mat4x2 dest) {
|
||||||
dest[0][0] = drand48();
|
dest[0][0] = frand48();
|
||||||
dest[0][1] = drand48();
|
dest[0][1] = frand48();
|
||||||
|
|
||||||
dest[1][0] = drand48();
|
dest[1][0] = frand48();
|
||||||
dest[1][1] = drand48();
|
dest[1][1] = frand48();
|
||||||
|
|
||||||
dest[2][0] = drand48();
|
dest[2][0] = frand48();
|
||||||
dest[2][1] = drand48();
|
dest[2][1] = frand48();
|
||||||
|
|
||||||
dest[3][0] = drand48();
|
dest[3][0] = frand48();
|
||||||
dest[3][1] = drand48();
|
dest[3][1] = frand48();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
test_rand_mat4x3(mat4x3 dest) {
|
test_rand_mat4x3(mat4x3 dest) {
|
||||||
dest[0][0] = drand48();
|
dest[0][0] = frand48();
|
||||||
dest[0][1] = drand48();
|
dest[0][1] = frand48();
|
||||||
dest[0][2] = drand48();
|
dest[0][2] = frand48();
|
||||||
|
|
||||||
dest[1][0] = drand48();
|
dest[1][0] = frand48();
|
||||||
dest[1][1] = drand48();
|
dest[1][1] = frand48();
|
||||||
dest[1][2] = drand48();
|
dest[1][2] = frand48();
|
||||||
|
|
||||||
dest[2][0] = drand48();
|
dest[2][0] = frand48();
|
||||||
dest[2][1] = drand48();
|
dest[2][1] = frand48();
|
||||||
dest[2][2] = drand48();
|
dest[2][2] = frand48();
|
||||||
|
|
||||||
dest[3][0] = drand48();
|
dest[3][0] = frand48();
|
||||||
dest[3][1] = drand48();
|
dest[3][1] = frand48();
|
||||||
dest[3][2] = drand48();
|
dest[3][2] = frand48();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -61,73 +61,80 @@ test_rand_mat3(mat3 dest) {
|
|||||||
mat4 m4;
|
mat4 m4;
|
||||||
|
|
||||||
/* random rotatation around random axis with random angle */
|
/* random rotatation around random axis with random angle */
|
||||||
glm_rotate_make(m4, drand48(), (vec3){drand48(), drand48(), drand48()});
|
glm_rotate_make(m4, frand48(), (vec3){frand48(), frand48(), frand48()});
|
||||||
glm_mat4_pick3(m4, dest);
|
glm_mat4_pick3(m4, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
test_rand_mat3x2(mat3x2 dest) {
|
test_rand_mat3x2(mat3x2 dest) {
|
||||||
dest[0][0] = drand48();
|
dest[0][0] = frand48();
|
||||||
dest[0][1] = drand48();
|
dest[0][1] = frand48();
|
||||||
dest[1][0] = drand48();
|
dest[1][0] = frand48();
|
||||||
dest[1][1] = drand48();
|
dest[1][1] = frand48();
|
||||||
dest[2][0] = drand48();
|
dest[2][0] = frand48();
|
||||||
dest[2][1] = drand48();
|
dest[2][1] = frand48();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
test_rand_mat3x4(mat3x4 dest) {
|
test_rand_mat3x4(mat3x4 dest) {
|
||||||
dest[0][0] = drand48();
|
dest[0][0] = frand48();
|
||||||
dest[0][1] = drand48();
|
dest[0][1] = frand48();
|
||||||
dest[0][2] = drand48();
|
dest[0][2] = frand48();
|
||||||
dest[0][3] = drand48();
|
dest[0][3] = frand48();
|
||||||
|
|
||||||
dest[1][0] = drand48();
|
dest[1][0] = frand48();
|
||||||
dest[1][1] = drand48();
|
dest[1][1] = frand48();
|
||||||
dest[1][2] = drand48();
|
dest[1][2] = frand48();
|
||||||
dest[1][3] = drand48();
|
dest[1][3] = frand48();
|
||||||
|
|
||||||
dest[2][0] = drand48();
|
dest[2][0] = frand48();
|
||||||
dest[2][1] = drand48();
|
dest[2][1] = frand48();
|
||||||
dest[2][2] = drand48();
|
dest[2][2] = frand48();
|
||||||
dest[2][3] = drand48();
|
dest[2][3] = frand48();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
test_rand_mat2(mat2 dest) {
|
test_rand_mat2(mat2 dest) {
|
||||||
dest[0][0] = drand48();
|
dest[0][0] = frand48();
|
||||||
dest[0][1] = drand48();
|
dest[0][1] = frand48();
|
||||||
dest[1][0] = drand48();
|
dest[1][0] = frand48();
|
||||||
dest[1][1] = drand48();
|
dest[1][1] = frand48();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
test_rand_mat2x3(mat2x3 dest) {
|
test_rand_mat2x3(mat2x3 dest) {
|
||||||
dest[0][0] = drand48();
|
dest[0][0] = frand48();
|
||||||
dest[0][1] = drand48();
|
dest[0][1] = frand48();
|
||||||
dest[0][2] = drand48();
|
dest[0][2] = frand48();
|
||||||
dest[1][0] = drand48();
|
dest[1][0] = frand48();
|
||||||
dest[1][1] = drand48();
|
dest[1][1] = frand48();
|
||||||
dest[1][2] = drand48();
|
dest[1][2] = frand48();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
test_rand_mat2x4(mat2x4 dest) {
|
test_rand_mat2x4(mat2x4 dest) {
|
||||||
dest[0][0] = drand48();
|
dest[0][0] = frand48();
|
||||||
dest[0][1] = drand48();
|
dest[0][1] = frand48();
|
||||||
dest[0][2] = drand48();
|
dest[0][2] = frand48();
|
||||||
dest[0][3] = drand48();
|
dest[0][3] = frand48();
|
||||||
dest[1][0] = drand48();
|
dest[1][0] = frand48();
|
||||||
dest[1][1] = drand48();
|
dest[1][1] = frand48();
|
||||||
dest[1][2] = drand48();
|
dest[1][2] = frand48();
|
||||||
dest[1][3] = drand48();
|
dest[1][3] = frand48();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
test_rand_transform2d(mat3 dest) {
|
||||||
|
glm_translate2d_make(dest, (vec2) { frand48(), frand48() });
|
||||||
|
glm_rotate2d(dest, frand48());
|
||||||
|
glm_scale2d(dest, (vec2) { frand48(), frand48() });
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
test_rand_vec3(vec3 dest) {
|
test_rand_vec3(vec3 dest) {
|
||||||
dest[0] = drand48();
|
dest[0] = frand48();
|
||||||
dest[1] = drand48();
|
dest[1] = frand48();
|
||||||
dest[2] = drand48();
|
dest[2] = frand48();
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3s
|
vec3s
|
||||||
@@ -139,10 +146,10 @@ test_rand_vec3s(void) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
test_rand_vec4(vec4 dest) {
|
test_rand_vec4(vec4 dest) {
|
||||||
dest[0] = drand48();
|
dest[0] = frand48();
|
||||||
dest[1] = drand48();
|
dest[1] = frand48();
|
||||||
dest[2] = drand48();
|
dest[2] = frand48();
|
||||||
dest[3] = drand48();
|
dest[3] = frand48();
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4s
|
vec4s
|
||||||
@@ -154,12 +161,12 @@ test_rand_vec4s(void) {
|
|||||||
|
|
||||||
float
|
float
|
||||||
test_rand(void) {
|
test_rand(void) {
|
||||||
return drand48();
|
return frand48();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
test_rand_quat(versor q) {
|
test_rand_quat(versor q) {
|
||||||
glm_quat(q, drand48(), drand48(), drand48(), drand48());
|
glm_quat(q, frand48(), frand48(), frand48(), frand48());
|
||||||
glm_quat_normalize(q);
|
glm_quat_normalize(q);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,9 @@ test_rand_mat2x3(mat2x3 dest);
|
|||||||
void
|
void
|
||||||
test_rand_mat2x4(mat2x4 dest);
|
test_rand_mat2x4(mat2x4 dest);
|
||||||
|
|
||||||
|
void
|
||||||
|
test_rand_transform2d(mat3 dest);
|
||||||
|
|
||||||
test_status_t
|
test_status_t
|
||||||
test_assert_eqf(float a, float b);
|
test_assert_eqf(float a, float b);
|
||||||
|
|
||||||
@@ -173,4 +176,11 @@ test_eq_th(float a, float b, float th) {
|
|||||||
return fabsf(a - b) <= th;
|
return fabsf(a - b) <= th;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* drand with explicit conversion to lower precision */
|
||||||
|
CGLM_INLINE
|
||||||
|
float
|
||||||
|
frand48(void) {
|
||||||
|
return (float)drand48();
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* test_common_h */
|
#endif /* test_common_h */
|
||||||
|
|||||||
@@ -196,11 +196,12 @@ TEST_IMPL(GLM_PREFIX, mat2_trace) {
|
|||||||
TEST_IMPL(GLM_PREFIX, mat2_scale) {
|
TEST_IMPL(GLM_PREFIX, mat2_scale) {
|
||||||
mat2 m1 = A_MATRIX2x2;
|
mat2 m1 = A_MATRIX2x2;
|
||||||
mat2 m2 = A_MATRIX2x2;
|
mat2 m2 = A_MATRIX2x2;
|
||||||
int i, j, scale;
|
int i, j;
|
||||||
|
float scale;
|
||||||
|
|
||||||
scale = rand() % 100;
|
scale = rand() % 100;
|
||||||
|
|
||||||
GLM(mat2_scale)(m1, (float)scale);
|
GLM(mat2_scale)(m1, scale);
|
||||||
|
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
for (j = 0; j < 2; j++) {
|
for (j = 0; j < 2; j++) {
|
||||||
|
|||||||
@@ -140,11 +140,12 @@ TEST_IMPL(GLM_PREFIX, mat2x3_transpose) {
|
|||||||
TEST_IMPL(GLM_PREFIX, mat2x3_scale) {
|
TEST_IMPL(GLM_PREFIX, mat2x3_scale) {
|
||||||
mat2x3 m1 = A_MATRIX2X3;
|
mat2x3 m1 = A_MATRIX2X3;
|
||||||
mat2x3 m2 = A_MATRIX2X3;
|
mat2x3 m2 = A_MATRIX2X3;
|
||||||
int i, j, scale;
|
int i, j;
|
||||||
|
float scale;
|
||||||
|
|
||||||
scale = rand() % 100;
|
scale = rand() % 100;
|
||||||
|
|
||||||
GLM(mat2x3_scale)(m1, (float) scale);
|
GLM(mat2x3_scale)(m1, scale);
|
||||||
|
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
for (j = 0; j < 3; j++) {
|
for (j = 0; j < 3; j++) {
|
||||||
|
|||||||
@@ -143,11 +143,12 @@ TEST_IMPL(GLM_PREFIX, mat2x4_transpose) {
|
|||||||
TEST_IMPL(GLM_PREFIX, mat2x4_scale) {
|
TEST_IMPL(GLM_PREFIX, mat2x4_scale) {
|
||||||
mat2x4 m1 = A_MATRIX2X4;
|
mat2x4 m1 = A_MATRIX2X4;
|
||||||
mat2x4 m2 = A_MATRIX2X4;
|
mat2x4 m2 = A_MATRIX2X4;
|
||||||
int i, j, scale;
|
int i, j;
|
||||||
|
float scale;
|
||||||
|
|
||||||
scale = rand() % 100;
|
scale = rand() % 100;
|
||||||
|
|
||||||
GLM(mat2x4_scale)(m1, (float) scale);
|
GLM(mat2x4_scale)(m1, scale);
|
||||||
|
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
for (j = 0; j < 4; j++) {
|
for (j = 0; j < 4; j++) {
|
||||||
|
|||||||
@@ -184,11 +184,12 @@ TEST_IMPL(GLM_PREFIX, mat3_transpose) {
|
|||||||
TEST_IMPL(GLM_PREFIX, mat3_scale) {
|
TEST_IMPL(GLM_PREFIX, mat3_scale) {
|
||||||
mat3 m1 = A_MATRIX;
|
mat3 m1 = A_MATRIX;
|
||||||
mat3 m2 = A_MATRIX;
|
mat3 m2 = A_MATRIX;
|
||||||
int i, j, k, scale;
|
int i, j, k;
|
||||||
|
float scale;
|
||||||
|
|
||||||
scale = rand() % 100;
|
scale = rand() % 100;
|
||||||
|
|
||||||
GLM(mat3_scale)(m1, (float)scale);
|
GLM(mat3_scale)(m1, scale);
|
||||||
|
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
for (j = 0; j < 3; j++) {
|
for (j = 0; j < 3; j++) {
|
||||||
|
|||||||
@@ -139,11 +139,12 @@ TEST_IMPL(GLM_PREFIX, mat3x2_transpose) {
|
|||||||
TEST_IMPL(GLM_PREFIX, mat3x2_scale) {
|
TEST_IMPL(GLM_PREFIX, mat3x2_scale) {
|
||||||
mat3x2 m1 = A_MATRIX3X2;
|
mat3x2 m1 = A_MATRIX3X2;
|
||||||
mat3x2 m2 = A_MATRIX3X2;
|
mat3x2 m2 = A_MATRIX3X2;
|
||||||
int i, j, scale;
|
int i, j;
|
||||||
|
float scale;
|
||||||
|
|
||||||
scale = rand() % 100;
|
scale = rand() % 100;
|
||||||
|
|
||||||
GLM(mat3x2_scale)(m1, (float) scale);
|
GLM(mat3x2_scale)(m1, scale);
|
||||||
|
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
for (j = 0; j < 2; j++) {
|
for (j = 0; j < 2; j++) {
|
||||||
|
|||||||
@@ -145,11 +145,12 @@ TEST_IMPL(GLM_PREFIX, mat3x4_transpose) {
|
|||||||
TEST_IMPL(GLM_PREFIX, mat3x4_scale) {
|
TEST_IMPL(GLM_PREFIX, mat3x4_scale) {
|
||||||
mat3x4 m1 = A_MATRIX3X4;
|
mat3x4 m1 = A_MATRIX3X4;
|
||||||
mat3x4 m2 = A_MATRIX3X4;
|
mat3x4 m2 = A_MATRIX3X4;
|
||||||
int i, j, scale;
|
int i, j;
|
||||||
|
float scale;
|
||||||
|
|
||||||
scale = rand() % 100;
|
scale = rand() % 100;
|
||||||
|
|
||||||
GLM(mat3x4_scale)(m1, (float) scale);
|
GLM(mat3x4_scale)(m1, scale);
|
||||||
|
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
for (j = 0; j < 4; j++) {
|
for (j = 0; j < 4; j++) {
|
||||||
|
|||||||
@@ -292,11 +292,12 @@ TEST_IMPL(GLM_PREFIX, mat4_transpose) {
|
|||||||
TEST_IMPL(GLM_PREFIX, mat4_scale_p) {
|
TEST_IMPL(GLM_PREFIX, mat4_scale_p) {
|
||||||
mat4 m1 = A_MATRIX;
|
mat4 m1 = A_MATRIX;
|
||||||
mat4 m2 = A_MATRIX;
|
mat4 m2 = A_MATRIX;
|
||||||
int i, j, k, scale;
|
int i, j, k;
|
||||||
|
float scale;
|
||||||
|
|
||||||
scale = rand() % 100;
|
scale = rand() % 100;
|
||||||
|
|
||||||
GLM(mat4_scale_p)(m1, (float)scale);
|
GLM(mat4_scale_p)(m1, scale);
|
||||||
|
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
for (j = 0; j < 4; j++) {
|
for (j = 0; j < 4; j++) {
|
||||||
@@ -311,11 +312,12 @@ TEST_IMPL(GLM_PREFIX, mat4_scale_p) {
|
|||||||
TEST_IMPL(GLM_PREFIX, mat4_scale) {
|
TEST_IMPL(GLM_PREFIX, mat4_scale) {
|
||||||
mat4 m1 = A_MATRIX;
|
mat4 m1 = A_MATRIX;
|
||||||
mat4 m2 = A_MATRIX;
|
mat4 m2 = A_MATRIX;
|
||||||
int i, j, k, scale;
|
int i, j, k;
|
||||||
|
float scale;
|
||||||
|
|
||||||
scale = rand() % 100;
|
scale = rand() % 100;
|
||||||
|
|
||||||
GLM(mat4_scale)(m1, (float)scale);
|
GLM(mat4_scale)(m1, scale);
|
||||||
|
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
for (j = 0; j < 4; j++) {
|
for (j = 0; j < 4; j++) {
|
||||||
|
|||||||
@@ -142,11 +142,12 @@ TEST_IMPL(GLM_PREFIX, mat4x2_transpose) {
|
|||||||
TEST_IMPL(GLM_PREFIX, mat4x2_scale) {
|
TEST_IMPL(GLM_PREFIX, mat4x2_scale) {
|
||||||
mat4x2 m1 = A_MATRIX4X2;
|
mat4x2 m1 = A_MATRIX4X2;
|
||||||
mat4x2 m2 = A_MATRIX4X2;
|
mat4x2 m2 = A_MATRIX4X2;
|
||||||
int i, j, scale;
|
int i, j;
|
||||||
|
float scale;
|
||||||
|
|
||||||
scale = rand() % 100;
|
scale = rand() % 100;
|
||||||
|
|
||||||
GLM(mat4x2_scale)(m1, (float) scale);
|
GLM(mat4x2_scale)(m1, scale);
|
||||||
|
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
for (j = 0; j < 2; j++) {
|
for (j = 0; j < 2; j++) {
|
||||||
|
|||||||
@@ -146,11 +146,12 @@ TEST_IMPL(GLM_PREFIX, mat4x3_transpose) {
|
|||||||
TEST_IMPL(GLM_PREFIX, mat4x3_scale) {
|
TEST_IMPL(GLM_PREFIX, mat4x3_scale) {
|
||||||
mat4x3 m1 = A_MATRIX4X3;
|
mat4x3 m1 = A_MATRIX4X3;
|
||||||
mat4x3 m2 = A_MATRIX4X3;
|
mat4x3 m2 = A_MATRIX4X3;
|
||||||
int i, j, scale;
|
int i, j;
|
||||||
|
float scale;
|
||||||
|
|
||||||
scale = rand() % 100;
|
scale = rand() % 100;
|
||||||
|
|
||||||
GLM(mat4x3_scale)(m1, (float) scale);
|
GLM(mat4x3_scale)(m1, scale);
|
||||||
|
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
for (j = 0; j < 3; j++) {
|
for (j = 0; j < 3; j++) {
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include "test_noise.h"
|
#include "test_noise.h"
|
||||||
#include "test_affine.h"
|
#include "test_affine.h"
|
||||||
#include "test_affine2d.h"
|
#include "test_affine2d.h"
|
||||||
|
#include "test_affine2d_post.h"
|
||||||
#include "test_affine_mat.h"
|
#include "test_affine_mat.h"
|
||||||
#include "test_aabb2d.h"
|
#include "test_aabb2d.h"
|
||||||
#include "test_ray.h"
|
#include "test_ray.h"
|
||||||
|
|||||||
16
test/tests.h
16
test/tests.h
@@ -97,6 +97,14 @@ TEST_DECLARE(glmc_rotate2d_make)
|
|||||||
TEST_DECLARE(glmc_rotate2d)
|
TEST_DECLARE(glmc_rotate2d)
|
||||||
TEST_DECLARE(glmc_rotate2d_to)
|
TEST_DECLARE(glmc_rotate2d_to)
|
||||||
|
|
||||||
|
/* affine 2d post */
|
||||||
|
TEST_DECLARE(glm_translated2d)
|
||||||
|
TEST_DECLARE(glm_translated2d_x)
|
||||||
|
TEST_DECLARE(glm_translated2d_y)
|
||||||
|
TEST_DECLARE(glm_rotated2d)
|
||||||
|
TEST_DECLARE(glm_scaled2d)
|
||||||
|
TEST_DECLARE(glm_scaled2d_uni)
|
||||||
|
|
||||||
/* aabb2d */
|
/* aabb2d */
|
||||||
TEST_DECLARE(glm_aabb2d_sizev)
|
TEST_DECLARE(glm_aabb2d_sizev)
|
||||||
|
|
||||||
@@ -1308,6 +1316,14 @@ TEST_LIST {
|
|||||||
TEST_ENTRY(glmc_rotate2d)
|
TEST_ENTRY(glmc_rotate2d)
|
||||||
TEST_ENTRY(glmc_rotate2d_to)
|
TEST_ENTRY(glmc_rotate2d_to)
|
||||||
|
|
||||||
|
/* affine 2d post */
|
||||||
|
TEST_ENTRY(glm_translated2d)
|
||||||
|
TEST_ENTRY(glm_translated2d_x)
|
||||||
|
TEST_ENTRY(glm_translated2d_y)
|
||||||
|
TEST_ENTRY(glm_rotated2d)
|
||||||
|
TEST_ENTRY(glm_scaled2d)
|
||||||
|
TEST_ENTRY(glm_scaled2d_uni)
|
||||||
|
|
||||||
/* aabb2d */
|
/* aabb2d */
|
||||||
TEST_ENTRY(glm_aabb2d_sizev)
|
TEST_ENTRY(glm_aabb2d_sizev)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user