mirror of
https://github.com/recp/cglm.git
synced 2026-02-17 03:39:05 +00:00
Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c51040cd41 | ||
|
|
9fc3a20d0f | ||
|
|
7f1c062696 | ||
|
|
e70571e9e0 | ||
|
|
007ee48b58 | ||
|
|
38771599c7 | ||
|
|
bfd87acfc4 | ||
|
|
a38622e1d6 | ||
|
|
9c7012bb39 | ||
|
|
71367b67cf | ||
|
|
3894ea32fb | ||
|
|
a430408ec4 | ||
|
|
3815e18fea | ||
|
|
8b5eaa5301 | ||
|
|
6037618942 | ||
|
|
c6d198d780 | ||
|
|
d001593f9c | ||
|
|
ac9461778c | ||
|
|
0b3d227568 | ||
|
|
78236d24a1 | ||
|
|
b41858f184 | ||
|
|
60bf21ba43 | ||
|
|
2386cdcc19 | ||
|
|
a0f01c5ed1 |
@@ -1,6 +1,6 @@
|
|||||||
cmake_minimum_required(VERSION 3.8.2)
|
cmake_minimum_required(VERSION 3.8.2)
|
||||||
project(cglm
|
project(cglm
|
||||||
VERSION 0.8.7
|
VERSION 0.8.9
|
||||||
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
|
||||||
@@ -41,7 +41,9 @@ else()
|
|||||||
add_compile_options(-Wall -Werror -O3)
|
add_compile_options(-Wall -Werror -O3)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
get_directory_property(hasParent PARENT_DIRECTORY)
|
||||||
|
|
||||||
|
if(NOT hasParent AND NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
message(STATUS "Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified.")
|
message(STATUS "Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified.")
|
||||||
set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE STRING "Choose the type of build." FORCE)
|
set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE STRING "Choose the type of build." FORCE)
|
||||||
# Set the possible values of build type for cmake-gui
|
# Set the possible values of build type for cmake-gui
|
||||||
@@ -157,7 +159,21 @@ install(EXPORT ${PROJECT_NAME}
|
|||||||
NAMESPACE ${PROJECT_NAME}::
|
NAMESPACE ${PROJECT_NAME}::
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
|
||||||
|
|
||||||
|
set(PACKAGE_NAME ${PROJECT_NAME})
|
||||||
|
set(prefix ${CMAKE_INSTALL_PREFIX})
|
||||||
|
set(exec_prefix ${CMAKE_INSTALL_PREFIX})
|
||||||
|
if (IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||||
|
set(includedir "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||||
|
else()
|
||||||
|
set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
|
||||||
|
endif()
|
||||||
|
if (IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}")
|
||||||
|
set(libdir "${CMAKE_INSTALL_LIBDIR}")
|
||||||
|
else()
|
||||||
|
set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
|
||||||
|
endif()
|
||||||
|
set(PACKAGE_VERSION "${PROJECT_VERSION}")
|
||||||
configure_file(cglm.pc.in cglm.pc @ONLY)
|
configure_file(cglm.pc.in cglm.pc @ONLY)
|
||||||
|
|
||||||
install(FILES ${CMAKE_BINARY_DIR}/cglm.pc
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cglm.pc
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||||
|
|||||||
16
cglm.pc.in
16
cglm.pc.in
@@ -1,11 +1,11 @@
|
|||||||
prefix=@CMAKE_INSTALL_PREFIX@
|
prefix=@prefix@
|
||||||
exec_prefix="${prefix}"
|
exec_prefix=@exec_prefix@
|
||||||
libdir="${exec_prefix}/lib"
|
libdir=@libdir@
|
||||||
includedir="${prefix}/include"
|
includedir=@includedir@
|
||||||
|
|
||||||
Name: @PROJECT_NAME@
|
Name: @PACKAGE_NAME@
|
||||||
Description: @CMAKE_PROJECT_DESCRIPTION@
|
Description: OpenGL Mathematics (glm) for C
|
||||||
URL: @CMAKE_PROJECT_HOMEPAGE_URL@
|
URL: https://github.com/recp/cglm
|
||||||
Version: @PROJECT_VERSION@
|
Version: @PACKAGE_VERSION@
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
Libs: -L${libdir} -lcglm @LIBS@
|
Libs: -L${libdir} -lcglm @LIBS@
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ Pod::Spec.new do |s|
|
|||||||
|
|
||||||
# Description
|
# Description
|
||||||
s.name = "cglm"
|
s.name = "cglm"
|
||||||
s.version = "0.8.4"
|
s.version = "0.8.8"
|
||||||
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.8.7], [info@recp.me])
|
AC_INIT([cglm], [0.8.9], [info@recp.me])
|
||||||
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects serial-tests])
|
AM_INIT_AUTOMAKE([-Wall -Werror 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.8.7'
|
version = u'0.8.9'
|
||||||
# The full version, including alpha/beta/rc tags.
|
# The full version, including alpha/beta/rc tags.
|
||||||
release = u'0.8.7'
|
release = u'0.8.9'
|
||||||
|
|
||||||
# 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.
|
||||||
|
|||||||
@@ -8,6 +8,13 @@ Header: cglm/ivec2.h
|
|||||||
Table of contents (click to go):
|
Table of contents (click to go):
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Macros:
|
||||||
|
|
||||||
|
1. GLM_IVEC2_ONE_INIT
|
||||||
|
#. GLM_IVEC2_ZERO_INIT
|
||||||
|
#. GLM_IVEC2_ONE
|
||||||
|
#. GLM_IVEC2_ZERO
|
||||||
|
|
||||||
Functions:
|
Functions:
|
||||||
|
|
||||||
1. :c:func:`glm_ivec2`
|
1. :c:func:`glm_ivec2`
|
||||||
@@ -25,6 +32,7 @@ Functions:
|
|||||||
#. :c:func:`glm_ivec2_maxv`
|
#. :c:func:`glm_ivec2_maxv`
|
||||||
#. :c:func:`glm_ivec2_minv`
|
#. :c:func:`glm_ivec2_minv`
|
||||||
#. :c:func:`glm_ivec2_clamp`
|
#. :c:func:`glm_ivec2_clamp`
|
||||||
|
#. :c:func:`glm_ivec2_abs`
|
||||||
|
|
||||||
Functions documentation
|
Functions documentation
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@@ -161,3 +169,11 @@ Functions documentation
|
|||||||
| *[in, out]* **v** vector
|
| *[in, out]* **v** vector
|
||||||
| *[in]* **minVal** minimum value
|
| *[in]* **minVal** minimum value
|
||||||
| *[in]* **maxVal** maximum value
|
| *[in]* **maxVal** maximum value
|
||||||
|
|
||||||
|
.. c:function:: void glm_ivec2_abs(ivec2 v, ivec2 dest)
|
||||||
|
|
||||||
|
absolute value of each vector item
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
| *[in]* **v** vector
|
||||||
|
| *[out]* **dest** destination vector
|
||||||
|
|||||||
@@ -8,6 +8,13 @@ Header: cglm/ivec3.h
|
|||||||
Table of contents (click to go):
|
Table of contents (click to go):
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Macros:
|
||||||
|
|
||||||
|
1. GLM_IVEC3_ONE_INIT
|
||||||
|
#. GLM_IVEC3_ZERO_INIT
|
||||||
|
#. GLM_IVEC3_ONE
|
||||||
|
#. GLM_IVEC3_ZERO
|
||||||
|
|
||||||
Functions:
|
Functions:
|
||||||
|
|
||||||
1. :c:func:`glm_ivec3`
|
1. :c:func:`glm_ivec3`
|
||||||
@@ -25,6 +32,7 @@ Functions:
|
|||||||
#. :c:func:`glm_ivec3_maxv`
|
#. :c:func:`glm_ivec3_maxv`
|
||||||
#. :c:func:`glm_ivec3_minv`
|
#. :c:func:`glm_ivec3_minv`
|
||||||
#. :c:func:`glm_ivec3_clamp`
|
#. :c:func:`glm_ivec3_clamp`
|
||||||
|
#. :c:func:`glm_ivec2_abs`
|
||||||
|
|
||||||
Functions documentation
|
Functions documentation
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@@ -161,3 +169,11 @@ Functions documentation
|
|||||||
| *[in, out]* **v** vector
|
| *[in, out]* **v** vector
|
||||||
| *[in]* **minVal** minimum value
|
| *[in]* **minVal** minimum value
|
||||||
| *[in]* **maxVal** maximum value
|
| *[in]* **maxVal** maximum value
|
||||||
|
|
||||||
|
.. c:function:: void glm_ivec3_abs(ivec3 v, ivec3 dest)
|
||||||
|
|
||||||
|
absolute value of each vector item
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
| *[in]* **v** vector
|
||||||
|
| *[out]* **dest** destination vector
|
||||||
|
|||||||
@@ -8,6 +8,13 @@ Header: cglm/ivec4.h
|
|||||||
Table of contents (click to go):
|
Table of contents (click to go):
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Macros:
|
||||||
|
|
||||||
|
1. GLM_IVEC4_ONE_INIT
|
||||||
|
#. GLM_IVEC4_ZERO_INIT
|
||||||
|
#. GLM_IVEC4_ONE
|
||||||
|
#. GLM_IVEC4_ZERO
|
||||||
|
|
||||||
Functions:
|
Functions:
|
||||||
|
|
||||||
1. :c:func:`glm_ivec4`
|
1. :c:func:`glm_ivec4`
|
||||||
@@ -25,6 +32,7 @@ Functions:
|
|||||||
#. :c:func:`glm_ivec4_maxv`
|
#. :c:func:`glm_ivec4_maxv`
|
||||||
#. :c:func:`glm_ivec4_minv`
|
#. :c:func:`glm_ivec4_minv`
|
||||||
#. :c:func:`glm_ivec4_clamp`
|
#. :c:func:`glm_ivec4_clamp`
|
||||||
|
#. :c:func:`glm_ivec4_abs`
|
||||||
|
|
||||||
Functions documentation
|
Functions documentation
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@@ -161,3 +169,11 @@ Functions documentation
|
|||||||
| *[in, out]* **v** vector
|
| *[in, out]* **v** vector
|
||||||
| *[in]* **minVal** minimum value
|
| *[in]* **minVal** minimum value
|
||||||
| *[in]* **maxVal** maximum value
|
| *[in]* **maxVal** maximum value
|
||||||
|
|
||||||
|
.. c:function:: void glm_ivec4_abs(ivec4 v, ivec4 dest)
|
||||||
|
|
||||||
|
absolute value of each vector item
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
| *[in]* **v** vector
|
||||||
|
| *[out]* **dest** destination vector
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ Functions:
|
|||||||
#. :c:func:`glm_vec2_isinf`
|
#. :c:func:`glm_vec2_isinf`
|
||||||
#. :c:func:`glm_vec2_isvalid`
|
#. :c:func:`glm_vec2_isvalid`
|
||||||
#. :c:func:`glm_vec2_sign`
|
#. :c:func:`glm_vec2_sign`
|
||||||
|
#. :c:func:`glm_vec2_abs`
|
||||||
#. :c:func:`glm_vec2_sqrt`
|
#. :c:func:`glm_vec2_sqrt`
|
||||||
|
|
||||||
Functions documentation
|
Functions documentation
|
||||||
@@ -125,6 +126,14 @@ Functions documentation
|
|||||||
| *[in]* **v** vector
|
| *[in]* **v** vector
|
||||||
| *[out]* **dest** sign vector (only keeps signs as -1, 0, -1)
|
| *[out]* **dest** sign vector (only keeps signs as -1, 0, -1)
|
||||||
|
|
||||||
|
.. c:function:: void glm_vec2_abs(vec2 v, vec2 dest)
|
||||||
|
|
||||||
|
absolute value of each vector item
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
| *[in]* **v** vector
|
||||||
|
| *[out]* **dest** destination vector
|
||||||
|
|
||||||
.. c:function:: void glm_vec2_sqrt(vec2 v, vec2 dest)
|
.. c:function:: void glm_vec2_sqrt(vec2 v, vec2 dest)
|
||||||
|
|
||||||
square root of each vector item
|
square root of each vector item
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ Table of contents (click to go):
|
|||||||
|
|
||||||
Macros:
|
Macros:
|
||||||
|
|
||||||
1. GLM_vec2_ONE_INIT
|
1. GLM_VEC2_ONE_INIT
|
||||||
#. GLM_vec2_ZERO_INIT
|
#. GLM_VEC2_ZERO_INIT
|
||||||
#. GLM_vec2_ONE
|
#. GLM_VEC2_ONE
|
||||||
#. GLM_vec2_ZERO
|
#. GLM_VEC2_ZERO
|
||||||
|
|
||||||
Functions:
|
Functions:
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ Functions:
|
|||||||
#. :c:func:`glm_vec3_isinf`
|
#. :c:func:`glm_vec3_isinf`
|
||||||
#. :c:func:`glm_vec3_isvalid`
|
#. :c:func:`glm_vec3_isvalid`
|
||||||
#. :c:func:`glm_vec3_sign`
|
#. :c:func:`glm_vec3_sign`
|
||||||
|
#. :c:func:`glm_vec3_abs`
|
||||||
#. :c:func:`glm_vec3_sqrt`
|
#. :c:func:`glm_vec3_sqrt`
|
||||||
|
|
||||||
Functions documentation
|
Functions documentation
|
||||||
@@ -134,6 +135,14 @@ Functions documentation
|
|||||||
| *[in]* **v** vector
|
| *[in]* **v** vector
|
||||||
| *[out]* **dest** sign vector (only keeps signs as -1, 0, -1)
|
| *[out]* **dest** sign vector (only keeps signs as -1, 0, -1)
|
||||||
|
|
||||||
|
.. c:function:: void glm_vec3_abs(vec3 v, vec3 dest)
|
||||||
|
|
||||||
|
absolute value of each vector item
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
| *[in]* **v** vector
|
||||||
|
| *[out]* **dest** destination vector
|
||||||
|
|
||||||
.. c:function:: void glm_vec3_sqrt(vec3 v, vec3 dest)
|
.. c:function:: void glm_vec3_sqrt(vec3 v, vec3 dest)
|
||||||
|
|
||||||
square root of each vector item
|
square root of each vector item
|
||||||
|
|||||||
@@ -73,6 +73,10 @@ CGLM_EXPORT
|
|||||||
void
|
void
|
||||||
glmc_ivec2_clamp(ivec2 v, int minVal, int maxVal);
|
glmc_ivec2_clamp(ivec2 v, int minVal, int maxVal);
|
||||||
|
|
||||||
|
CGLM_EXPORT
|
||||||
|
void
|
||||||
|
glmc_ivec2_abs(ivec2 v, ivec2 dest);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -73,6 +73,10 @@ CGLM_EXPORT
|
|||||||
void
|
void
|
||||||
glmc_ivec3_clamp(ivec3 v, int minVal, int maxVal);
|
glmc_ivec3_clamp(ivec3 v, int minVal, int maxVal);
|
||||||
|
|
||||||
|
CGLM_EXPORT
|
||||||
|
void
|
||||||
|
glmc_ivec3_abs(ivec3 v, ivec3 dest);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -73,6 +73,10 @@ CGLM_EXPORT
|
|||||||
void
|
void
|
||||||
glmc_ivec4_clamp(ivec4 v, int minVal, int maxVal);
|
glmc_ivec4_clamp(ivec4 v, int minVal, int maxVal);
|
||||||
|
|
||||||
|
CGLM_EXPORT
|
||||||
|
void
|
||||||
|
glmc_ivec4_abs(ivec4 v, ivec4 dest);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -145,6 +145,10 @@ CGLM_EXPORT
|
|||||||
void
|
void
|
||||||
glmc_vec2_clamp(vec2 v, float minval, float maxval);
|
glmc_vec2_clamp(vec2 v, float minval, float maxval);
|
||||||
|
|
||||||
|
CGLM_EXPORT
|
||||||
|
void
|
||||||
|
glmc_vec2_abs(vec2 v, vec2 dest);
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_vec2_lerp(vec2 from, vec2 to, float t, vec2 dest);
|
glmc_vec2_lerp(vec2 from, vec2 to, float t, vec2 dest);
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
@@ -44,7 +45,7 @@
|
|||||||
|
|
||||||
#ifndef CGLM_USE_DEFAULT_EPSILON
|
#ifndef CGLM_USE_DEFAULT_EPSILON
|
||||||
# ifndef GLM_FLT_EPSILON
|
# ifndef GLM_FLT_EPSILON
|
||||||
# define GLM_FLT_EPSILON 1e-5
|
# define GLM_FLT_EPSILON 1e-5f
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# define GLM_FLT_EPSILON FLT_EPSILON
|
# define GLM_FLT_EPSILON FLT_EPSILON
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CGLM_PRINT_MAX_TO_SHORT
|
#ifndef CGLM_PRINT_MAX_TO_SHORT
|
||||||
# define CGLM_PRINT_MAX_TO_SHORT 1e5
|
# define CGLM_PRINT_MAX_TO_SHORT 1e5f
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CGLM_PRINT_COLOR
|
#ifndef CGLM_PRINT_COLOR
|
||||||
@@ -77,9 +77,9 @@ glm_mat4_print(mat4 matrix,
|
|||||||
for (i = 0; i < m; i++) {
|
for (i = 0; i < m; i++) {
|
||||||
for (j = 0; j < n; j++) {
|
for (j = 0; j < n; j++) {
|
||||||
if (matrix[i][j] < CGLM_PRINT_MAX_TO_SHORT)
|
if (matrix[i][j] < CGLM_PRINT_MAX_TO_SHORT)
|
||||||
cwi = sprintf(buff, "% .*f", CGLM_PRINT_PRECISION, matrix[i][j]);
|
cwi = sprintf(buff, "% .*f", CGLM_PRINT_PRECISION, (double)matrix[i][j]);
|
||||||
else
|
else
|
||||||
cwi = sprintf(buff, "% g", matrix[i][j]);
|
cwi = sprintf(buff, "% g", (double)matrix[i][j]);
|
||||||
cw[i] = GLM_MAX(cw[i], cwi);
|
cw[i] = GLM_MAX(cw[i], cwi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -89,9 +89,9 @@ glm_mat4_print(mat4 matrix,
|
|||||||
|
|
||||||
for (j = 0; j < n; j++)
|
for (j = 0; j < n; j++)
|
||||||
if (matrix[i][j] < CGLM_PRINT_MAX_TO_SHORT)
|
if (matrix[i][j] < CGLM_PRINT_MAX_TO_SHORT)
|
||||||
fprintf(ostream, " % *.*f", cw[j], CGLM_PRINT_PRECISION, matrix[j][i]);
|
fprintf(ostream, " % *.*f", cw[j], CGLM_PRINT_PRECISION, (double)matrix[j][i]);
|
||||||
else
|
else
|
||||||
fprintf(ostream, " % *g", cw[j], matrix[j][i]);
|
fprintf(ostream, " % *g", cw[j], (double)matrix[j][i]);
|
||||||
|
|
||||||
fprintf(ostream, " |\n");
|
fprintf(ostream, " |\n");
|
||||||
}
|
}
|
||||||
@@ -120,22 +120,22 @@ glm_mat3_print(mat3 matrix,
|
|||||||
for (i = 0; i < m; i++) {
|
for (i = 0; i < m; i++) {
|
||||||
for (j = 0; j < n; j++) {
|
for (j = 0; j < n; j++) {
|
||||||
if (matrix[i][j] < CGLM_PRINT_MAX_TO_SHORT)
|
if (matrix[i][j] < CGLM_PRINT_MAX_TO_SHORT)
|
||||||
cwi = sprintf(buff, "% .*f", CGLM_PRINT_PRECISION, matrix[i][j]);
|
cwi = sprintf(buff, "% .*f", CGLM_PRINT_PRECISION, (double)matrix[i][j]);
|
||||||
else
|
else
|
||||||
cwi = sprintf(buff, "% g", matrix[i][j]);
|
cwi = sprintf(buff, "% g", (double)matrix[i][j]);
|
||||||
cw[i] = GLM_MAX(cw[i], cwi);
|
cw[i] = GLM_MAX(cw[i], cwi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < m; i++) {
|
for (i = 0; i < m; i++) {
|
||||||
fprintf(ostream, " |");
|
fprintf(ostream, " |");
|
||||||
|
|
||||||
for (j = 0; j < n; j++)
|
for (j = 0; j < n; j++)
|
||||||
if (matrix[i][j] < CGLM_PRINT_MAX_TO_SHORT)
|
if (matrix[i][j] < CGLM_PRINT_MAX_TO_SHORT)
|
||||||
fprintf(ostream, " % *.*f", cw[j], CGLM_PRINT_PRECISION, matrix[j][i]);
|
fprintf(ostream, " % *.*f", cw[j], CGLM_PRINT_PRECISION, (double)matrix[j][i]);
|
||||||
else
|
else
|
||||||
fprintf(ostream, " % *g", cw[j], matrix[j][i]);
|
fprintf(ostream, " % *g", cw[j], (double)matrix[j][i]);
|
||||||
|
|
||||||
fprintf(ostream, " |\n");
|
fprintf(ostream, " |\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,22 +162,22 @@ glm_mat2_print(mat2 matrix,
|
|||||||
for (i = 0; i < m; i++) {
|
for (i = 0; i < m; i++) {
|
||||||
for (j = 0; j < n; j++) {
|
for (j = 0; j < n; j++) {
|
||||||
if (matrix[i][j] < CGLM_PRINT_MAX_TO_SHORT)
|
if (matrix[i][j] < CGLM_PRINT_MAX_TO_SHORT)
|
||||||
cwi = sprintf(buff, "% .*f", CGLM_PRINT_PRECISION, matrix[i][j]);
|
cwi = sprintf(buff, "% .*f", CGLM_PRINT_PRECISION, (double)matrix[i][j]);
|
||||||
else
|
else
|
||||||
cwi = sprintf(buff, "% g", matrix[i][j]);
|
cwi = sprintf(buff, "% g", (double)matrix[i][j]);
|
||||||
cw[i] = GLM_MAX(cw[i], cwi);
|
cw[i] = GLM_MAX(cw[i], cwi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < m; i++) {
|
for (i = 0; i < m; i++) {
|
||||||
fprintf(ostream, " |");
|
fprintf(ostream, " |");
|
||||||
|
|
||||||
for (j = 0; j < n; j++)
|
for (j = 0; j < n; j++)
|
||||||
if (matrix[i][j] < CGLM_PRINT_MAX_TO_SHORT)
|
if (matrix[i][j] < CGLM_PRINT_MAX_TO_SHORT)
|
||||||
fprintf(ostream, " % *.*f", cw[j], CGLM_PRINT_PRECISION, matrix[j][i]);
|
fprintf(ostream, " % *.*f", cw[j], CGLM_PRINT_PRECISION, (double)matrix[j][i]);
|
||||||
else
|
else
|
||||||
fprintf(ostream, " % *g", cw[j], matrix[j][i]);
|
fprintf(ostream, " % *g", cw[j], (double)matrix[j][i]);
|
||||||
|
|
||||||
fprintf(ostream, " |\n");
|
fprintf(ostream, " |\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,9 +199,9 @@ glm_vec4_print(vec4 vec,
|
|||||||
|
|
||||||
for (i = 0; i < m; i++) {
|
for (i = 0; i < m; i++) {
|
||||||
if (vec[i] < CGLM_PRINT_MAX_TO_SHORT)
|
if (vec[i] < CGLM_PRINT_MAX_TO_SHORT)
|
||||||
fprintf(ostream, " % .*f", CGLM_PRINT_PRECISION, vec[i]);
|
fprintf(ostream, " % .*f", CGLM_PRINT_PRECISION, (double)vec[i]);
|
||||||
else
|
else
|
||||||
fprintf(ostream, " % g", vec[i]);
|
fprintf(ostream, " % g", (double)vec[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(ostream, " )" CGLM_PRINT_COLOR_RESET "\n\n");
|
fprintf(ostream, " )" CGLM_PRINT_COLOR_RESET "\n\n");
|
||||||
@@ -221,9 +221,9 @@ glm_vec3_print(vec3 vec,
|
|||||||
|
|
||||||
for (i = 0; i < m; i++) {
|
for (i = 0; i < m; i++) {
|
||||||
if (vec[i] < CGLM_PRINT_MAX_TO_SHORT)
|
if (vec[i] < CGLM_PRINT_MAX_TO_SHORT)
|
||||||
fprintf(ostream, " % .*f", CGLM_PRINT_PRECISION, vec[i]);
|
fprintf(ostream, " % .*f", CGLM_PRINT_PRECISION, (double)vec[i]);
|
||||||
else
|
else
|
||||||
fprintf(ostream, " % g", vec[i]);
|
fprintf(ostream, " % g", (double)vec[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(ostream, " )" CGLM_PRINT_COLOR_RESET "\n\n");
|
fprintf(ostream, " )" CGLM_PRINT_COLOR_RESET "\n\n");
|
||||||
@@ -245,7 +245,7 @@ glm_ivec3_print(ivec3 vec,
|
|||||||
fprintf(ostream, " % d", vec[i]);
|
fprintf(ostream, " % d", vec[i]);
|
||||||
|
|
||||||
fprintf(ostream, " )" CGLM_PRINT_COLOR_RESET "\n\n");
|
fprintf(ostream, " )" CGLM_PRINT_COLOR_RESET "\n\n");
|
||||||
|
|
||||||
#undef m
|
#undef m
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,9 +261,9 @@ glm_vec2_print(vec2 vec,
|
|||||||
|
|
||||||
for (i = 0; i < m; i++) {
|
for (i = 0; i < m; i++) {
|
||||||
if (vec[i] < CGLM_PRINT_MAX_TO_SHORT)
|
if (vec[i] < CGLM_PRINT_MAX_TO_SHORT)
|
||||||
fprintf(ostream, " % .*f", CGLM_PRINT_PRECISION, vec[i]);
|
fprintf(ostream, " % .*f", CGLM_PRINT_PRECISION, (double)vec[i]);
|
||||||
else
|
else
|
||||||
fprintf(ostream, " % g", vec[i]);
|
fprintf(ostream, " % g", (double)vec[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(ostream, " )" CGLM_PRINT_COLOR_RESET "\n\n");
|
fprintf(ostream, " )" CGLM_PRINT_COLOR_RESET "\n\n");
|
||||||
@@ -283,9 +283,9 @@ glm_versor_print(versor vec,
|
|||||||
|
|
||||||
for (i = 0; i < m; i++) {
|
for (i = 0; i < m; i++) {
|
||||||
if (vec[i] < CGLM_PRINT_MAX_TO_SHORT)
|
if (vec[i] < CGLM_PRINT_MAX_TO_SHORT)
|
||||||
fprintf(ostream, " % .*f", CGLM_PRINT_PRECISION, vec[i]);
|
fprintf(ostream, " % .*f", CGLM_PRINT_PRECISION, (double)vec[i]);
|
||||||
else
|
else
|
||||||
fprintf(ostream, " % g", vec[i]);
|
fprintf(ostream, " % g", (double)vec[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -307,12 +307,12 @@ glm_aabb_print(vec3 bbox[2],
|
|||||||
|
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
fprintf(ostream, " (");
|
fprintf(ostream, " (");
|
||||||
|
|
||||||
for (j = 0; j < m; j++) {
|
for (j = 0; j < m; j++) {
|
||||||
if (bbox[i][j] < CGLM_PRINT_MAX_TO_SHORT)
|
if (bbox[i][j] < CGLM_PRINT_MAX_TO_SHORT)
|
||||||
fprintf(ostream, " % .*f", CGLM_PRINT_PRECISION, bbox[i][j]);
|
fprintf(ostream, " % .*f", CGLM_PRINT_PRECISION, (double)bbox[i][j]);
|
||||||
else
|
else
|
||||||
fprintf(ostream, " % g", bbox[i][j]);
|
fprintf(ostream, " % g", (double)bbox[i][j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(ostream, " )\n");
|
fprintf(ostream, " )\n");
|
||||||
|
|||||||
@@ -6,7 +6,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
FUNCTIONS:
|
Macros:
|
||||||
|
GLM_IVEC2_ONE_INIT
|
||||||
|
GLM_IVEC2_ZERO_INIT
|
||||||
|
GLM_IVEC2_ONE
|
||||||
|
GLM_IVEC2_ZERO
|
||||||
|
|
||||||
|
Functions:
|
||||||
CGLM_INLINE void glm_ivec2(int * __restrict v, ivec2 dest)
|
CGLM_INLINE void glm_ivec2(int * __restrict v, ivec2 dest)
|
||||||
CGLM_INLINE void glm_ivec2_copy(ivec2 a, ivec2 dest)
|
CGLM_INLINE void glm_ivec2_copy(ivec2 a, ivec2 dest)
|
||||||
CGLM_INLINE void glm_ivec2_zero(ivec2 v)
|
CGLM_INLINE void glm_ivec2_zero(ivec2 v)
|
||||||
@@ -22,6 +28,7 @@ FUNCTIONS:
|
|||||||
CGLM_INLINE void glm_ivec2_maxv(ivec2 a, ivec2 b, ivec2 dest)
|
CGLM_INLINE void glm_ivec2_maxv(ivec2 a, ivec2 b, ivec2 dest)
|
||||||
CGLM_INLINE void glm_ivec2_minv(ivec2 a, ivec2 b, ivec2 dest)
|
CGLM_INLINE void glm_ivec2_minv(ivec2 a, ivec2 b, ivec2 dest)
|
||||||
CGLM_INLINE void glm_ivec2_clamp(ivec2 v, int minVal, int maxVal)
|
CGLM_INLINE void glm_ivec2_clamp(ivec2 v, int minVal, int maxVal)
|
||||||
|
CGLM_INLINE void glm_ivec2_abs(ivec2 v, ivec2 dest)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef cglm_ivec2_h
|
#ifndef cglm_ivec2_h
|
||||||
@@ -29,6 +36,12 @@ FUNCTIONS:
|
|||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#define GLM_IVEC2_ONE_INIT {1, 1}
|
||||||
|
#define GLM_IVEC2_ZERO_INIT {0, 0}
|
||||||
|
|
||||||
|
#define GLM_IVEC2_ONE ((ivec2)GLM_IVEC2_ONE_INIT)
|
||||||
|
#define GLM_IVEC2_ZERO ((ivec2)GLM_IVEC2_ZERO_INIT)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief init ivec2 using vec3 or vec4
|
* @brief init ivec2 using vec3 or vec4
|
||||||
*
|
*
|
||||||
@@ -239,4 +252,17 @@ glm_ivec2_clamp(ivec2 v, int minVal, int maxVal) {
|
|||||||
v[1] = maxVal;
|
v[1] = maxVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief absolute value of v
|
||||||
|
*
|
||||||
|
* @param[in] v vector
|
||||||
|
* @param[out] dest destination
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
void
|
||||||
|
glm_ivec2_abs(ivec2 v, ivec2 dest) {
|
||||||
|
dest[0] = abs(v[0]);
|
||||||
|
dest[1] = abs(v[1]);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* cglm_ivec2_h */
|
#endif /* cglm_ivec2_h */
|
||||||
|
|||||||
@@ -6,7 +6,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
FUNCTIONS:
|
Macros:
|
||||||
|
GLM_IVEC3_ONE_INIT
|
||||||
|
GLM_IVEC3_ZERO_INIT
|
||||||
|
GLM_IVEC3_ONE
|
||||||
|
GLM_IVEC3_ZERO
|
||||||
|
|
||||||
|
Functions:
|
||||||
CGLM_INLINE void glm_ivec3(ivec4 v4, ivec3 dest)
|
CGLM_INLINE void glm_ivec3(ivec4 v4, ivec3 dest)
|
||||||
CGLM_INLINE void glm_ivec3_copy(ivec3 a, ivec3 dest)
|
CGLM_INLINE void glm_ivec3_copy(ivec3 a, ivec3 dest)
|
||||||
CGLM_INLINE void glm_ivec3_zero(ivec3 v)
|
CGLM_INLINE void glm_ivec3_zero(ivec3 v)
|
||||||
@@ -22,6 +28,7 @@ FUNCTIONS:
|
|||||||
CGLM_INLINE void glm_ivec3_maxv(ivec3 a, ivec3 b, ivec3 dest)
|
CGLM_INLINE void glm_ivec3_maxv(ivec3 a, ivec3 b, ivec3 dest)
|
||||||
CGLM_INLINE void glm_ivec3_minv(ivec3 a, ivec3 b, ivec3 dest)
|
CGLM_INLINE void glm_ivec3_minv(ivec3 a, ivec3 b, ivec3 dest)
|
||||||
CGLM_INLINE void glm_ivec3_clamp(ivec3 v, int minVal, int maxVal)
|
CGLM_INLINE void glm_ivec3_clamp(ivec3 v, int minVal, int maxVal)
|
||||||
|
CGLM_INLINE void glm_ivec3_abs(ivec3 v, ivec3 dest)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef cglm_ivec3_h
|
#ifndef cglm_ivec3_h
|
||||||
@@ -29,6 +36,12 @@ FUNCTIONS:
|
|||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#define GLM_IVEC3_ONE_INIT {1, 1, 1}
|
||||||
|
#define GLM_IVEC3_ZERO_INIT {0, 0, 0}
|
||||||
|
|
||||||
|
#define GLM_IVEC3_ONE ((ivec3)GLM_IVEC3_ONE_INIT)
|
||||||
|
#define GLM_IVEC3_ZERO ((ivec3)GLM_IVEC3_ZERO_INIT)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief init ivec3 using ivec4
|
* @brief init ivec3 using ivec4
|
||||||
*
|
*
|
||||||
@@ -255,4 +268,18 @@ glm_ivec3_clamp(ivec3 v, int minVal, int maxVal) {
|
|||||||
v[2] = maxVal;
|
v[2] = maxVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief absolute value of v
|
||||||
|
*
|
||||||
|
* @param[in] v vector
|
||||||
|
* @param[out] dest destination
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
void
|
||||||
|
glm_ivec3_abs(ivec3 v, ivec3 dest) {
|
||||||
|
dest[0] = abs(v[0]);
|
||||||
|
dest[1] = abs(v[1]);
|
||||||
|
dest[2] = abs(v[2]);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* cglm_ivec3_h */
|
#endif /* cglm_ivec3_h */
|
||||||
|
|||||||
@@ -6,7 +6,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
FUNCTIONS:
|
Macros:
|
||||||
|
GLM_IVEC4_ONE_INIT
|
||||||
|
GLM_IVEC4_ZERO_INIT
|
||||||
|
GLM_IVEC4_ONE
|
||||||
|
GLM_IVEC4_ZERO
|
||||||
|
|
||||||
|
Functions:
|
||||||
CGLM_INLINE void glm_ivec4(ivec3 v3, int last, ivec4 dest)
|
CGLM_INLINE void glm_ivec4(ivec3 v3, int last, ivec4 dest)
|
||||||
CGLM_INLINE void glm_ivec4_copy(ivec4 a, ivec4 dest)
|
CGLM_INLINE void glm_ivec4_copy(ivec4 a, ivec4 dest)
|
||||||
CGLM_INLINE void glm_ivec4_zero(ivec4 v)
|
CGLM_INLINE void glm_ivec4_zero(ivec4 v)
|
||||||
@@ -22,6 +28,7 @@ FUNCTIONS:
|
|||||||
CGLM_INLINE void glm_ivec4_maxv(ivec4 a, ivec4 b, ivec4 dest)
|
CGLM_INLINE void glm_ivec4_maxv(ivec4 a, ivec4 b, ivec4 dest)
|
||||||
CGLM_INLINE void glm_ivec4_minv(ivec4 a, ivec4 b, ivec4 dest)
|
CGLM_INLINE void glm_ivec4_minv(ivec4 a, ivec4 b, ivec4 dest)
|
||||||
CGLM_INLINE void glm_ivec4_clamp(ivec4 v, int minVal, int maxVal)
|
CGLM_INLINE void glm_ivec4_clamp(ivec4 v, int minVal, int maxVal)
|
||||||
|
CGLM_INLINE void glm_ivec4_abs(ivec4 v, ivec4 dest)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef cglm_ivec4_h
|
#ifndef cglm_ivec4_h
|
||||||
@@ -29,6 +36,12 @@ FUNCTIONS:
|
|||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#define GLM_IVEC4_ONE_INIT {1, 1, 1, 1}
|
||||||
|
#define GLM_IVEC4_ZERO_INIT {0, 0, 0, 0}
|
||||||
|
|
||||||
|
#define GLM_IVEC4_ONE ((ivec4)GLM_IVEC4_ONE_INIT)
|
||||||
|
#define GLM_IVEC4_ZERO ((ivec4)GLM_IVEC4_ZERO_INIT)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief init ivec4 using ivec3
|
* @brief init ivec4 using ivec3
|
||||||
*
|
*
|
||||||
@@ -272,4 +285,19 @@ glm_ivec4_clamp(ivec4 v, int minVal, int maxVal) {
|
|||||||
v[3] = maxVal;
|
v[3] = maxVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief absolute value of v
|
||||||
|
*
|
||||||
|
* @param[in] v vector
|
||||||
|
* @param[out] dest destination
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
void
|
||||||
|
glm_ivec4_abs(ivec4 v, ivec4 dest) {
|
||||||
|
dest[0] = abs(v[0]);
|
||||||
|
dest[1] = abs(v[1]);
|
||||||
|
dest[2] = abs(v[2]);
|
||||||
|
dest[3] = abs(v[3]);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* cglm_ivec4_h */
|
#endif /* cglm_ivec4_h */
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
CGLM_INLINE bool glm_vec2_isinf(vec2 v);
|
CGLM_INLINE bool glm_vec2_isinf(vec2 v);
|
||||||
CGLM_INLINE bool glm_vec2_isvalid(vec2 v);
|
CGLM_INLINE bool glm_vec2_isvalid(vec2 v);
|
||||||
CGLM_INLINE void glm_vec2_sign(vec2 v, vec2 dest);
|
CGLM_INLINE void glm_vec2_sign(vec2 v, vec2 dest);
|
||||||
|
CGLM_INLINE void glm_vec2_abs(vec2 v, vec2 dest);
|
||||||
CGLM_INLINE void glm_vec2_sqrt(vec2 v, vec2 dest);
|
CGLM_INLINE void glm_vec2_sqrt(vec2 v, vec2 dest);
|
||||||
CGLM_INLINE void glm_vec2_complex_mul(vec2 a, vec2 b, vec2 dest)
|
CGLM_INLINE void glm_vec2_complex_mul(vec2 a, vec2 b, vec2 dest)
|
||||||
CGLM_INLINE void glm_vec2_complex_div(vec2 a, vec2 b, vec2 dest)
|
CGLM_INLINE void glm_vec2_complex_div(vec2 a, vec2 b, vec2 dest)
|
||||||
@@ -176,6 +177,19 @@ glm_vec2_sign(vec2 v, vec2 dest) {
|
|||||||
dest[1] = glm_signf(v[1]);
|
dest[1] = glm_signf(v[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief absolute value of v
|
||||||
|
*
|
||||||
|
* @param[in] v vector
|
||||||
|
* @param[out] dest destination
|
||||||
|
*/
|
||||||
|
CGLM_INLINE
|
||||||
|
void
|
||||||
|
glm_vec2_abs(vec2 v, vec2 dest) {
|
||||||
|
dest[0] = fabsf(v[0]);
|
||||||
|
dest[1] = fabsf(v[1]);
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief square root of each vector item
|
* @brief square root of each vector item
|
||||||
*
|
*
|
||||||
@@ -237,5 +251,4 @@ glm_vec2_complex_conjugate(vec2 a, vec2 dest) {
|
|||||||
dest[1] = -a[1];
|
dest[1] = -a[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* cglm_vec2_ext_h */
|
#endif /* cglm_vec2_ext_h */
|
||||||
|
|||||||
@@ -10,6 +10,6 @@
|
|||||||
|
|
||||||
#define CGLM_VERSION_MAJOR 0
|
#define CGLM_VERSION_MAJOR 0
|
||||||
#define CGLM_VERSION_MINOR 8
|
#define CGLM_VERSION_MINOR 8
|
||||||
#define CGLM_VERSION_PATCH 7
|
#define CGLM_VERSION_PATCH 9
|
||||||
|
|
||||||
#endif /* cglm_version_h */
|
#endif /* cglm_version_h */
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
project('cglm', 'c',
|
project('cglm', 'c',
|
||||||
version : '0.8.7',
|
version : '0.8.9',
|
||||||
license : 'mit',
|
license : 'mit',
|
||||||
default_options : [
|
default_options : [
|
||||||
'c_std=c11',
|
'c_std=c11',
|
||||||
|
|||||||
@@ -97,3 +97,10 @@ void
|
|||||||
glmc_ivec2_clamp(ivec2 v, int minVal, int maxVal) {
|
glmc_ivec2_clamp(ivec2 v, int minVal, int maxVal) {
|
||||||
glm_ivec2_clamp(v, minVal, maxVal);
|
glm_ivec2_clamp(v, minVal, maxVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CGLM_EXPORT
|
||||||
|
void
|
||||||
|
glmc_ivec2_abs(ivec2 v, ivec2 dest) {
|
||||||
|
glm_ivec2_abs(v, dest);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,3 +97,10 @@ void
|
|||||||
glmc_ivec3_clamp(ivec3 v, int minVal, int maxVal) {
|
glmc_ivec3_clamp(ivec3 v, int minVal, int maxVal) {
|
||||||
glm_ivec3_clamp(v, minVal, maxVal);
|
glm_ivec3_clamp(v, minVal, maxVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CGLM_EXPORT
|
||||||
|
void
|
||||||
|
glmc_ivec3_abs(ivec3 v, ivec3 dest) {
|
||||||
|
glm_ivec3_abs(v, dest);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,3 +97,10 @@ void
|
|||||||
glmc_ivec4_clamp(ivec4 v, int minVal, int maxVal) {
|
glmc_ivec4_clamp(ivec4 v, int minVal, int maxVal) {
|
||||||
glm_ivec4_clamp(v, minVal, maxVal);
|
glm_ivec4_clamp(v, minVal, maxVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CGLM_EXPORT
|
||||||
|
void
|
||||||
|
glmc_ivec4_abs(ivec4 v, ivec4 dest) {
|
||||||
|
glm_ivec4_abs(v, dest);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -206,6 +206,12 @@ glmc_vec2_clamp(vec2 v, float minval, float maxval) {
|
|||||||
glm_vec2_clamp(v, minval, maxval);
|
glm_vec2_clamp(v, minval, maxval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CGLM_EXPORT
|
||||||
|
void
|
||||||
|
glmc_vec2_abs(vec2 v, vec2 dest) {
|
||||||
|
glm_vec2_abs(v, dest);
|
||||||
|
}
|
||||||
|
|
||||||
CGLM_EXPORT
|
CGLM_EXPORT
|
||||||
void
|
void
|
||||||
glmc_vec2_lerp(vec2 from, vec2 to, float t, vec2 dest) {
|
glmc_vec2_lerp(vec2 from, vec2 to, float t, vec2 dest) {
|
||||||
|
|||||||
@@ -11,21 +11,21 @@ TEST_IMPL(clamp) {
|
|||||||
vec3 v3 = {15.07f, 0.4f, 17.3f};
|
vec3 v3 = {15.07f, 0.4f, 17.3f};
|
||||||
vec4 v4 = {5.07f, 2.3f, 1.3f, 1.4f};
|
vec4 v4 = {5.07f, 2.3f, 1.3f, 1.4f};
|
||||||
|
|
||||||
ASSERT(glm_clamp(1.6f, 0.0f, 1.0f) == 1.0f)
|
ASSERT(glm_eq(glm_clamp(1.6f, 0.0f, 1.0f), 1.0f))
|
||||||
ASSERT(glm_clamp(-1.6f, 0.0f, 1.0f) == 0.0f)
|
ASSERT(glm_eq(glm_clamp(-1.6f, 0.0f, 1.0f), 0.0f))
|
||||||
ASSERT(glm_clamp(0.6f, 0.0f, 1.0f) == 0.6f)
|
ASSERT(glm_eq(glm_clamp(0.6f, 0.0f, 1.0f), 0.6f))
|
||||||
|
|
||||||
glm_vec3_clamp(v3, 0.0, 1.0);
|
glm_vec3_clamp(v3, 0.0, 1.0);
|
||||||
glm_vec4_clamp(v4, 1.5, 3.0);
|
glm_vec4_clamp(v4, 1.5, 3.0);
|
||||||
|
|
||||||
ASSERT(v3[0] == 1.0f)
|
ASSERT(glm_eq(v3[0], 1.0f))
|
||||||
ASSERT(v3[1] == 0.4f)
|
ASSERT(glm_eq(v3[1], 0.4f))
|
||||||
ASSERT(v3[2] == 1.0f)
|
ASSERT(glm_eq(v3[2], 1.0f))
|
||||||
|
|
||||||
ASSERT(v4[0] == 3.0f)
|
ASSERT(glm_eq(v4[0], 3.0f))
|
||||||
ASSERT(v4[1] == 2.3f)
|
ASSERT(glm_eq(v4[1], 2.3f))
|
||||||
ASSERT(v4[2] == 1.5f)
|
ASSERT(glm_eq(v4[2], 1.5f))
|
||||||
ASSERT(v4[3] == 1.5f)
|
ASSERT(glm_eq(v4[3], 1.5f))
|
||||||
|
|
||||||
TEST_SUCCESS
|
TEST_SUCCESS
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -187,3 +187,18 @@ TEST_IMPL(GLM_PREFIX, ivec2_clamp) {
|
|||||||
|
|
||||||
TEST_SUCCESS
|
TEST_SUCCESS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_IMPL(GLM_PREFIX, ivec2_abs) {
|
||||||
|
ivec2 v1 = {2, -3}, v2 = {-12, -31};
|
||||||
|
ivec2 v3, v4;
|
||||||
|
|
||||||
|
GLM(ivec2_abs)(v1, v3);
|
||||||
|
GLM(ivec2_abs)(v2, v4);
|
||||||
|
|
||||||
|
ASSERT(v3[0] == 2)
|
||||||
|
ASSERT(v3[1] == 3)
|
||||||
|
ASSERT(v4[0] == 12)
|
||||||
|
ASSERT(v4[1] == 31)
|
||||||
|
|
||||||
|
TEST_SUCCESS
|
||||||
|
}
|
||||||
|
|||||||
@@ -197,3 +197,20 @@ TEST_IMPL(GLM_PREFIX, ivec3_clamp) {
|
|||||||
|
|
||||||
TEST_SUCCESS
|
TEST_SUCCESS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_IMPL(GLM_PREFIX, ivec3_abs) {
|
||||||
|
ivec3 v1 = {2, -3, 4}, v2 = {-12, -31, -42};
|
||||||
|
ivec3 v3, v4;
|
||||||
|
|
||||||
|
GLM(ivec3_abs)(v1, v3);
|
||||||
|
GLM(ivec3_abs)(v2, v4);
|
||||||
|
|
||||||
|
ASSERT(v3[0] == 2)
|
||||||
|
ASSERT(v3[1] == 3)
|
||||||
|
ASSERT(v3[2] == 4)
|
||||||
|
ASSERT(v4[0] == 12)
|
||||||
|
ASSERT(v4[1] == 31)
|
||||||
|
ASSERT(v4[2] == 42)
|
||||||
|
|
||||||
|
TEST_SUCCESS
|
||||||
|
}
|
||||||
|
|||||||
@@ -212,3 +212,22 @@ TEST_IMPL(GLM_PREFIX, ivec4_clamp) {
|
|||||||
|
|
||||||
TEST_SUCCESS
|
TEST_SUCCESS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_IMPL(GLM_PREFIX, ivec4_abs) {
|
||||||
|
ivec4 v1 = {2, -3, 4, -5}, v2 = {-12, -31, -42, -50};
|
||||||
|
ivec4 v3, v4;
|
||||||
|
|
||||||
|
GLM(ivec4_abs)(v1, v3);
|
||||||
|
GLM(ivec4_abs)(v2, v4);
|
||||||
|
|
||||||
|
ASSERT(v3[0] == 2)
|
||||||
|
ASSERT(v3[1] == 3)
|
||||||
|
ASSERT(v3[2] == 4)
|
||||||
|
ASSERT(v3[3] == 5)
|
||||||
|
ASSERT(v4[0] == 12)
|
||||||
|
ASSERT(v4[1] == 31)
|
||||||
|
ASSERT(v4[2] == 42)
|
||||||
|
ASSERT(v4[3] == 50)
|
||||||
|
|
||||||
|
TEST_SUCCESS
|
||||||
|
}
|
||||||
|
|||||||
@@ -579,6 +579,20 @@ TEST_IMPL(GLM_PREFIX, vec2_clamp) {
|
|||||||
TEST_SUCCESS
|
TEST_SUCCESS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_IMPL(GLM_PREFIX, vec2_abs) {
|
||||||
|
vec2 v1 = {2, -3}, v2 = {-12, -31};
|
||||||
|
vec2 v3, v4;
|
||||||
|
vec2 v5 = {2, 3}, v6 = {12, 31};
|
||||||
|
|
||||||
|
GLM(vec2_abs)(v1, v3);
|
||||||
|
GLM(vec2_abs)(v2, v4);
|
||||||
|
|
||||||
|
ASSERTIFY(test_assert_vec2_eq(v3, v5))
|
||||||
|
ASSERTIFY(test_assert_vec2_eq(v4, v6))
|
||||||
|
|
||||||
|
TEST_SUCCESS
|
||||||
|
}
|
||||||
|
|
||||||
TEST_IMPL(GLM_PREFIX, vec2_lerp) {
|
TEST_IMPL(GLM_PREFIX, vec2_lerp) {
|
||||||
vec2 v1 = {-100.0f, -200.0f};
|
vec2 v1 = {-100.0f, -200.0f};
|
||||||
vec2 v2 = {100.0f, 200.0f};
|
vec2 v2 = {100.0f, 200.0f};
|
||||||
|
|||||||
10
test/tests.h
10
test/tests.h
@@ -379,6 +379,7 @@ TEST_DECLARE(glm_vec2_distance)
|
|||||||
TEST_DECLARE(glm_vec2_maxv)
|
TEST_DECLARE(glm_vec2_maxv)
|
||||||
TEST_DECLARE(glm_vec2_minv)
|
TEST_DECLARE(glm_vec2_minv)
|
||||||
TEST_DECLARE(glm_vec2_clamp)
|
TEST_DECLARE(glm_vec2_clamp)
|
||||||
|
TEST_DECLARE(glm_vec2_abs)
|
||||||
TEST_DECLARE(glm_vec2_lerp)
|
TEST_DECLARE(glm_vec2_lerp)
|
||||||
TEST_DECLARE(glm_vec2_complex_mul)
|
TEST_DECLARE(glm_vec2_complex_mul)
|
||||||
TEST_DECLARE(glm_vec2_complex_div)
|
TEST_DECLARE(glm_vec2_complex_div)
|
||||||
@@ -416,6 +417,7 @@ TEST_DECLARE(glmc_vec2_distance)
|
|||||||
TEST_DECLARE(glmc_vec2_maxv)
|
TEST_DECLARE(glmc_vec2_maxv)
|
||||||
TEST_DECLARE(glmc_vec2_minv)
|
TEST_DECLARE(glmc_vec2_minv)
|
||||||
TEST_DECLARE(glmc_vec2_clamp)
|
TEST_DECLARE(glmc_vec2_clamp)
|
||||||
|
TEST_DECLARE(glmc_vec2_abs)
|
||||||
TEST_DECLARE(glmc_vec2_lerp)
|
TEST_DECLARE(glmc_vec2_lerp)
|
||||||
TEST_DECLARE(glmc_vec2_complex_mul)
|
TEST_DECLARE(glmc_vec2_complex_mul)
|
||||||
TEST_DECLARE(glmc_vec2_complex_div)
|
TEST_DECLARE(glmc_vec2_complex_div)
|
||||||
@@ -746,6 +748,7 @@ TEST_DECLARE(glm_ivec2_distance)
|
|||||||
TEST_DECLARE(glm_ivec2_maxv)
|
TEST_DECLARE(glm_ivec2_maxv)
|
||||||
TEST_DECLARE(glm_ivec2_minv)
|
TEST_DECLARE(glm_ivec2_minv)
|
||||||
TEST_DECLARE(glm_ivec2_clamp)
|
TEST_DECLARE(glm_ivec2_clamp)
|
||||||
|
TEST_DECLARE(glm_ivec2_abs)
|
||||||
|
|
||||||
TEST_DECLARE(glmc_ivec2)
|
TEST_DECLARE(glmc_ivec2)
|
||||||
TEST_DECLARE(glmc_ivec2_copy)
|
TEST_DECLARE(glmc_ivec2_copy)
|
||||||
@@ -762,6 +765,7 @@ TEST_DECLARE(glmc_ivec2_distance)
|
|||||||
TEST_DECLARE(glmc_ivec2_maxv)
|
TEST_DECLARE(glmc_ivec2_maxv)
|
||||||
TEST_DECLARE(glmc_ivec2_minv)
|
TEST_DECLARE(glmc_ivec2_minv)
|
||||||
TEST_DECLARE(glmc_ivec2_clamp)
|
TEST_DECLARE(glmc_ivec2_clamp)
|
||||||
|
TEST_DECLARE(glmc_ivec2_abs)
|
||||||
|
|
||||||
/* ivec3 */
|
/* ivec3 */
|
||||||
TEST_DECLARE(glm_ivec3)
|
TEST_DECLARE(glm_ivec3)
|
||||||
@@ -812,6 +816,7 @@ TEST_DECLARE(glm_ivec4_distance)
|
|||||||
TEST_DECLARE(glm_ivec4_maxv)
|
TEST_DECLARE(glm_ivec4_maxv)
|
||||||
TEST_DECLARE(glm_ivec4_minv)
|
TEST_DECLARE(glm_ivec4_minv)
|
||||||
TEST_DECLARE(glm_ivec4_clamp)
|
TEST_DECLARE(glm_ivec4_clamp)
|
||||||
|
TEST_DECLARE(glm_ivec4_abs)
|
||||||
|
|
||||||
TEST_DECLARE(glmc_ivec4)
|
TEST_DECLARE(glmc_ivec4)
|
||||||
TEST_DECLARE(glmc_ivec4_copy)
|
TEST_DECLARE(glmc_ivec4_copy)
|
||||||
@@ -828,6 +833,7 @@ TEST_DECLARE(glmc_ivec4_distance)
|
|||||||
TEST_DECLARE(glmc_ivec4_maxv)
|
TEST_DECLARE(glmc_ivec4_maxv)
|
||||||
TEST_DECLARE(glmc_ivec4_minv)
|
TEST_DECLARE(glmc_ivec4_minv)
|
||||||
TEST_DECLARE(glmc_ivec4_clamp)
|
TEST_DECLARE(glmc_ivec4_clamp)
|
||||||
|
TEST_DECLARE(glmc_ivec4_abs)
|
||||||
|
|
||||||
/* structs */
|
/* structs */
|
||||||
TEST_DECLARE(mat3s_identity_init)
|
TEST_DECLARE(mat3s_identity_init)
|
||||||
@@ -1244,6 +1250,7 @@ TEST_LIST {
|
|||||||
TEST_ENTRY(glmc_vec2_maxv)
|
TEST_ENTRY(glmc_vec2_maxv)
|
||||||
TEST_ENTRY(glmc_vec2_minv)
|
TEST_ENTRY(glmc_vec2_minv)
|
||||||
TEST_ENTRY(glmc_vec2_clamp)
|
TEST_ENTRY(glmc_vec2_clamp)
|
||||||
|
TEST_ENTRY(glmc_vec2_abs)
|
||||||
TEST_ENTRY(glmc_vec2_lerp)
|
TEST_ENTRY(glmc_vec2_lerp)
|
||||||
TEST_ENTRY(glmc_vec2_complex_mul)
|
TEST_ENTRY(glmc_vec2_complex_mul)
|
||||||
TEST_ENTRY(glmc_vec2_complex_div)
|
TEST_ENTRY(glmc_vec2_complex_div)
|
||||||
@@ -1573,6 +1580,7 @@ TEST_LIST {
|
|||||||
TEST_ENTRY(glm_ivec2_maxv)
|
TEST_ENTRY(glm_ivec2_maxv)
|
||||||
TEST_ENTRY(glm_ivec2_minv)
|
TEST_ENTRY(glm_ivec2_minv)
|
||||||
TEST_ENTRY(glm_ivec2_clamp)
|
TEST_ENTRY(glm_ivec2_clamp)
|
||||||
|
TEST_ENTRY(glm_ivec2_abs)
|
||||||
|
|
||||||
TEST_ENTRY(glmc_ivec2)
|
TEST_ENTRY(glmc_ivec2)
|
||||||
TEST_ENTRY(glmc_ivec2_copy)
|
TEST_ENTRY(glmc_ivec2_copy)
|
||||||
@@ -1589,6 +1597,7 @@ TEST_LIST {
|
|||||||
TEST_ENTRY(glmc_ivec2_maxv)
|
TEST_ENTRY(glmc_ivec2_maxv)
|
||||||
TEST_ENTRY(glmc_ivec2_minv)
|
TEST_ENTRY(glmc_ivec2_minv)
|
||||||
TEST_ENTRY(glmc_ivec2_clamp)
|
TEST_ENTRY(glmc_ivec2_clamp)
|
||||||
|
TEST_ENTRY(glmc_ivec2_abs)
|
||||||
|
|
||||||
/* ivec3 */
|
/* ivec3 */
|
||||||
TEST_ENTRY(glm_ivec3)
|
TEST_ENTRY(glm_ivec3)
|
||||||
@@ -1655,6 +1664,7 @@ TEST_LIST {
|
|||||||
TEST_ENTRY(glmc_ivec4_maxv)
|
TEST_ENTRY(glmc_ivec4_maxv)
|
||||||
TEST_ENTRY(glmc_ivec4_minv)
|
TEST_ENTRY(glmc_ivec4_minv)
|
||||||
TEST_ENTRY(glmc_ivec4_clamp)
|
TEST_ENTRY(glmc_ivec4_clamp)
|
||||||
|
TEST_ENTRY(glmc_ivec4_abs)
|
||||||
|
|
||||||
/* structs */
|
/* structs */
|
||||||
TEST_ENTRY(mat3s_identity_init)
|
TEST_ENTRY(mat3s_identity_init)
|
||||||
|
|||||||
Reference in New Issue
Block a user