Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
8985564
adding const to vec3
tooold2rock-n-roll Jul 27, 2026
47afc24
changing parameters to const
tooold2rock-n-roll Jul 27, 2026
85c1555
Changing function parameters to const
tooold2rock-n-roll Jul 27, 2026
b2dc887
Changing function parameters to const.
tooold2rock-n-roll Jul 27, 2026
5149bfe
Upgrading c standard to C23.
tooold2rock-n-roll Jul 27, 2026
65caff7
Changing function parameters to const.
tooold2rock-n-roll Jul 27, 2026
f312476
Changing function parameters to const.
tooold2rock-n-roll Jul 27, 2026
d57c9ae
Changing function parameters to const.
tooold2rock-n-roll Jul 28, 2026
1b6375e
Using macro to declare const matrices as to avoid problems with C<23.
tooold2rock-n-roll Jul 28, 2026
7e7ab97
Restoring original c standard value.
tooold2rock-n-roll Jul 28, 2026
6e557ce
Fixing some functions that were missed previously.
tooold2rock-n-roll Jul 28, 2026
b530ef1
Fixing tabulation and removing trailing characters.
tooold2rock-n-roll Jul 28, 2026
0689f56
Changing function parameters to const.
tooold2rock-n-roll Jul 28, 2026
fae2a4a
Changing function parameters to const.
tooold2rock-n-roll Jul 28, 2026
a778815
Adding the const macro to the array vectors.
tooold2rock-n-roll Jul 28, 2026
e840d18
Fixing parameters not supposed to be const.
tooold2rock-n-roll Jul 28, 2026
7275ee5
Merge branch 'master' into tooold2rock-n-roll/change_func_parameters_…
tooold2rock-n-roll Jul 29, 2026
ca83b0b
Changing to const vectors and matrices at function parameters.
tooold2rock-n-roll Jul 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,14 @@ xcode/*
.vscode
.build
*.swp
*.swp
.tags
.vimrc
.lastsession.vim
*.un~
.cache/
.ccls-cache/
compile_commands.json
.compile_commands.json
.clang_complete
.ccls-root
34 changes: 17 additions & 17 deletions include/cglm/aabb2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ glm_aabb2d_zero(vec2 aabb[2]) {
*/
CGLM_INLINE
void
glm_aabb2d_copy(vec2 aabb[2], vec2 dest[2]) {
glm_aabb2d_copy(CGLM_IN(vec2) aabb[2], vec2 dest[2]) {
glm_vec2_copy(aabb[0], dest[0]);
glm_vec2_copy(aabb[1], dest[1]);
}
Expand All @@ -49,7 +49,7 @@ glm_aabb2d_copy(vec2 aabb[2], vec2 dest[2]) {
*/
CGLM_INLINE
void
glm_aabb2d_transform(vec2 aabb[2], mat3 m, vec2 dest[2]) {
glm_aabb2d_transform(CGLM_IN(vec2) aabb[2], CGLM_IN(mat3) m, vec2 dest[2]) {
vec2 v[2], xa, xb, ya, yb;

glm_vec2_scale(m[0], aabb[0][0], xa);
Expand Down Expand Up @@ -84,7 +84,7 @@ glm_aabb2d_transform(vec2 aabb[2], mat3 m, vec2 dest[2]) {
*/
CGLM_INLINE
void
glm_aabb2d_merge(vec2 aabb1[2], vec2 aabb2[2], vec2 dest[2]) {
glm_aabb2d_merge(CGLM_IN(vec2) aabb1[2], CGLM_IN(vec2) aabb2[2], vec2 dest[2]) {
dest[0][0] = glm_min(aabb1[0][0], aabb2[0][0]);
dest[0][1] = glm_min(aabb1[0][1], aabb2[0][1]);

Expand All @@ -105,7 +105,7 @@ glm_aabb2d_merge(vec2 aabb1[2], vec2 aabb2[2], vec2 dest[2]) {
*/
CGLM_INLINE
void
glm_aabb2d_crop(vec2 aabb[2], vec2 cropAabb[2], vec2 dest[2]) {
glm_aabb2d_crop(CGLM_IN(vec2) aabb[2], CGLM_IN(vec2) cropAabb[2], vec2 dest[2]) {
dest[0][0] = glm_max(aabb[0][0], cropAabb[0][0]);
dest[0][1] = glm_max(aabb[0][1], cropAabb[0][1]);

Expand All @@ -127,9 +127,9 @@ glm_aabb2d_crop(vec2 aabb[2], vec2 cropAabb[2], vec2 dest[2]) {
*/
CGLM_INLINE
void
glm_aabb2d_crop_until(vec2 aabb[2],
vec2 cropAabb[2],
vec2 clampAabb[2],
glm_aabb2d_crop_until(CGLM_IN(vec2) aabb[2],
CGLM_IN(vec2) cropAabb[2],
CGLM_IN(vec2) clampAabb[2],
vec2 dest[2]) {
glm_aabb2d_crop(aabb, cropAabb, dest);
glm_aabb2d_merge(clampAabb, dest, dest);
Expand All @@ -154,7 +154,7 @@ glm_aabb2d_invalidate(vec2 aabb[2]) {
*/
CGLM_INLINE
bool
glm_aabb2d_isvalid(vec2 aabb[2]) {
glm_aabb2d_isvalid(CGLM_IN(vec2) aabb[2]) {
return glm_vec2_max(aabb[0]) != FLT_MAX
&& glm_vec2_min(aabb[1]) != -FLT_MAX;
}
Expand All @@ -166,7 +166,7 @@ glm_aabb2d_isvalid(vec2 aabb[2]) {
*/
CGLM_INLINE
float
glm_aabb2d_diag(vec2 aabb[2]) {
glm_aabb2d_diag(CGLM_IN(vec2) aabb[2]) {
return glm_vec2_distance(aabb[0], aabb[1]);
}

Expand All @@ -178,8 +178,8 @@ glm_aabb2d_diag(vec2 aabb[2]) {
*/
CGLM_INLINE
void
glm_aabb2d_sizev(vec2 aabb[2], vec2 dest) {
glm_vec2_sub(aabb[1], aabb[0], dest);
glm_aabb2d_sizev(CGLM_IN(vec2) aabb[2], vec2 dest) {
glm_vec2_sub(aabb[1], aabb[0], dest);
}

/*!
Expand All @@ -189,7 +189,7 @@ glm_aabb2d_sizev(vec2 aabb[2], vec2 dest) {
*/
CGLM_INLINE
float
glm_aabb2d_radius(vec2 aabb[2]) {
glm_aabb2d_radius(CGLM_IN(vec2) aabb[2]) {
return glm_aabb2d_diag(aabb) * 0.5f;
}

Expand All @@ -201,7 +201,7 @@ glm_aabb2d_radius(vec2 aabb[2]) {
*/
CGLM_INLINE
void
glm_aabb2d_center(vec2 aabb[2], vec2 dest) {
glm_aabb2d_center(CGLM_IN(vec2) aabb[2], vec2 dest) {
glm_vec2_center(aabb[0], aabb[1], dest);
}

Expand All @@ -213,7 +213,7 @@ glm_aabb2d_center(vec2 aabb[2], vec2 dest) {
*/
CGLM_INLINE
bool
glm_aabb2d_aabb(vec2 aabb[2], vec2 other[2]) {
glm_aabb2d_aabb(CGLM_IN(vec2) aabb[2], CGLM_IN(vec2) other[2]) {
return (aabb[0][0] <= other[1][0] && aabb[1][0] >= other[0][0])
&& (aabb[0][1] <= other[1][1] && aabb[1][1] >= other[0][1]);
}
Expand All @@ -228,7 +228,7 @@ glm_aabb2d_aabb(vec2 aabb[2], vec2 other[2]) {
*/
CGLM_INLINE
bool
glm_aabb2d_circle(vec2 aabb[2], vec3 c) {
glm_aabb2d_circle(CGLM_IN(vec2) aabb[2], const vec3 c) {
float dmin;
int a, b;

Expand All @@ -249,7 +249,7 @@ glm_aabb2d_circle(vec2 aabb[2], vec3 c) {
*/
CGLM_INLINE
bool
glm_aabb2d_point(vec2 aabb[2], vec2 point) {
glm_aabb2d_point(CGLM_IN(vec2) aabb[2], CGLM_IN(vec2) point) {
return (point[0] >= aabb[0][0] && point[0] <= aabb[1][0])
&& (point[1] >= aabb[0][1] && point[1] <= aabb[1][1]);
}
Expand All @@ -262,7 +262,7 @@ glm_aabb2d_point(vec2 aabb[2], vec2 point) {
*/
CGLM_INLINE
bool
glm_aabb2d_contains(vec2 aabb[2], vec2 other[2]) {
glm_aabb2d_contains(CGLM_IN(vec2) aabb[2], CGLM_IN(vec2) other[2]) {
return (aabb[0][0] <= other[0][0] && aabb[1][0] >= other[1][0])
&& (aabb[0][1] <= other[0][1] && aabb[1][1] >= other[1][1]);
}
Expand Down
8 changes: 4 additions & 4 deletions include/cglm/affine-mat.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

/*
Functions:
CGLM_INLINE void glm_mul(mat4 m1, mat4 m2, mat4 dest);
CGLM_INLINE void glm_mul_rot(mat4 m1, mat4 m2, mat4 dest);
CGLM_INLINE void glm_mul(CGLM_IN(mat4) m1, CGLM_IN(mat4) m2, mat4 dest);
CGLM_INLINE void glm_mul_rot(CGLM_IN(mat4) m1, CGLM_IN(mat4) m2, mat4 dest);
CGLM_INLINE void glm_inv_tr(mat4 mat);
*/

Expand Down Expand Up @@ -53,7 +53,7 @@
*/
CGLM_INLINE
void
glm_mul(mat4 m1, mat4 m2, mat4 dest) {
glm_mul(CGLM_IN(mat4) m1, CGLM_IN(mat4) m2, mat4 dest) {
#if defined(__wasm__) && defined(__wasm_simd128__)
glm_mul_wasm(m1, m2, dest);
#elif defined(__AVX__)
Expand Down Expand Up @@ -113,7 +113,7 @@ glm_mul(mat4 m1, mat4 m2, mat4 dest) {
*/
CGLM_INLINE
void
glm_mul_rot(mat4 m1, mat4 m2, mat4 dest) {
glm_mul_rot(CGLM_IN(mat4) m1, CGLM_IN(mat4) m2, mat4 dest) {
#if defined(__wasm__) && defined(__wasm_simd128__)
glm_mul_rot_wasm(m1, m2, dest);
#elif defined( __SSE__ ) || defined( __SSE2__ )
Expand Down
32 changes: 16 additions & 16 deletions include/cglm/affine-post.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@

/*
Functions:
CGLM_INLINE void glm_translated_to(mat4 m, vec3 v, mat4 dest);
CGLM_INLINE void glm_translated(mat4 m, vec3 v);
CGLM_INLINE void glm_translated_to(CGLM_IN(mat4) m, const vec3 v, mat4 dest);
CGLM_INLINE void glm_translated(mat4 m, const vec3 v);
CGLM_INLINE void glm_translated_x(mat4 m, float to);
CGLM_INLINE void glm_translated_y(mat4 m, float to);
CGLM_INLINE void glm_translated_z(mat4 m, float to);
CGLM_INLINE void glm_rotated_x(mat4 m, float angle, mat4 dest);
CGLM_INLINE void glm_rotated_y(mat4 m, float angle, mat4 dest);
CGLM_INLINE void glm_rotated_z(mat4 m, float angle, mat4 dest);
CGLM_INLINE void glm_rotated(mat4 m, float angle, vec3 axis);
CGLM_INLINE void glm_rotated_at(mat4 m, vec3 pivot, float angle, vec3 axis);
CGLM_INLINE void glm_spinned(mat4 m, float angle, vec3 axis);
CGLM_INLINE void glm_rotated_x(CGLM_IN(mat4) m, float angle, mat4 dest);
CGLM_INLINE void glm_rotated_y(CGLM_IN(mat4) m, float angle, mat4 dest);
CGLM_INLINE void glm_rotated_z(CGLM_IN(mat4) m, float angle, mat4 dest);
CGLM_INLINE void glm_rotated(mat4 m, float angle, const vec3 axis);
CGLM_INLINE void glm_rotated_at(mat4 m, vec3 pivot, float angle, const vec3 axis);
CGLM_INLINE void glm_spinned(mat4 m, float angle, const vec3 axis);
*/

#include "common.h"
Expand All @@ -41,7 +41,7 @@
*/
CGLM_INLINE
void
glm_translated(mat4 m, vec3 v) {
glm_translated(mat4 m, const vec3 v) {
glm_vec3_add(m[3], v, m[3]);
}

Expand All @@ -59,7 +59,7 @@ glm_translated(mat4 m, vec3 v) {
*/
CGLM_INLINE
void
glm_translated_to(mat4 m, vec3 v, mat4 dest) {
glm_translated_to(CGLM_IN(mat4) m, const vec3 v, mat4 dest) {
glm_mat4_copy(m, dest);
glm_translated(dest, v);
}
Expand Down Expand Up @@ -118,7 +118,7 @@ glm_translated_z(mat4 m, float z) {
*/
CGLM_INLINE
void
glm_rotated_x(mat4 m, float angle, mat4 dest) {
glm_rotated_x(CGLM_IN(mat4) m, float angle, mat4 dest) {
CGLM_ALIGN_MAT mat4 t = GLM_MAT4_IDENTITY_INIT;
float c, s;

Expand All @@ -145,7 +145,7 @@ glm_rotated_x(mat4 m, float angle, mat4 dest) {
*/
CGLM_INLINE
void
glm_rotated_y(mat4 m, float angle, mat4 dest) {
glm_rotated_y(CGLM_IN(mat4) m, float angle, mat4 dest) {
CGLM_ALIGN_MAT mat4 t = GLM_MAT4_IDENTITY_INIT;
float c, s;

Expand All @@ -172,7 +172,7 @@ glm_rotated_y(mat4 m, float angle, mat4 dest) {
*/
CGLM_INLINE
void
glm_rotated_z(mat4 m, float angle, mat4 dest) {
glm_rotated_z(CGLM_IN(mat4) m, float angle, mat4 dest) {
CGLM_ALIGN_MAT mat4 t = GLM_MAT4_IDENTITY_INIT;
float c, s;

Expand All @@ -198,7 +198,7 @@ glm_rotated_z(mat4 m, float angle, mat4 dest) {
*/
CGLM_INLINE
void
glm_rotated(mat4 m, float angle, vec3 axis) {
glm_rotated(mat4 m, float angle, const vec3 axis) {
CGLM_ALIGN_MAT mat4 rot;
glm_rotate_make(rot, angle, axis);
glm_mul_rot(rot, m, m);
Expand All @@ -217,7 +217,7 @@ glm_rotated(mat4 m, float angle, vec3 axis) {
*/
CGLM_INLINE
void
glm_rotated_at(mat4 m, vec3 pivot, float angle, vec3 axis) {
glm_rotated_at(mat4 m, vec3 pivot, float angle, const vec3 axis) {
CGLM_ALIGN(8) vec3 pivotInv;

glm_vec3_negate_to(pivot, pivotInv);
Expand All @@ -238,7 +238,7 @@ glm_rotated_at(mat4 m, vec3 pivot, float angle, vec3 axis) {
*/
CGLM_INLINE
void
glm_spinned(mat4 m, float angle, vec3 axis) {
glm_spinned(mat4 m, float angle, const vec3 axis) {
CGLM_ALIGN_MAT mat4 rot;
glm_rotate_atm(rot, m[3], angle, axis);
glm_mat4_mul(rot, m, m);
Expand Down
34 changes: 17 additions & 17 deletions include/cglm/affine-pre.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@

/*
Functions:
CGLM_INLINE void glm_translate_to(mat4 m, vec3 v, mat4 dest);
CGLM_INLINE void glm_translate(mat4 m, vec3 v);
CGLM_INLINE void glm_translate_to(mat4 m, const vec3 v, mat4 dest);
CGLM_INLINE void glm_translate(mat4 m, const vec3 v);
CGLM_INLINE void glm_translate_x(mat4 m, float to);
CGLM_INLINE void glm_translate_y(mat4 m, float to);
CGLM_INLINE void glm_translate_z(mat4 m, float to);
CGLM_INLINE void glm_rotate_x(mat4 m, float angle, mat4 dest);
CGLM_INLINE void glm_rotate_y(mat4 m, float angle, mat4 dest);
CGLM_INLINE void glm_rotate_z(mat4 m, float angle, mat4 dest);
CGLM_INLINE void glm_rotate(mat4 m, float angle, vec3 axis);
CGLM_INLINE void glm_rotate_at(mat4 m, vec3 pivot, float angle, vec3 axis);
CGLM_INLINE void glm_rotate_atm(mat4 m, vec3 pivot, float angle, vec3 axis);
CGLM_INLINE void glm_spin(mat4 m, float angle, vec3 axis);
CGLM_INLINE void glm_rotate(mat4 m, float angle, const vec3 axis);
CGLM_INLINE void glm_rotate_at(mat4 m, const vec3 pivot, float angle, const vec3 axis);
CGLM_INLINE void glm_rotate_atm(mat4 m, const vec3 pivot, float angle, const vec3 axis);
CGLM_INLINE void glm_spin(mat4 m, float angle, const vec3 axis);
*/

#include "common.h"
Expand All @@ -40,7 +40,7 @@
*/
CGLM_INLINE
void
glm_translate(mat4 m, vec3 v) {
glm_translate(mat4 m, const vec3 v) {
#if defined(CGLM_SIMD)
glmm_128 m0, m1, m2, m3;

Expand Down Expand Up @@ -72,7 +72,7 @@ glm_translate(mat4 m, vec3 v) {
*/
CGLM_INLINE
void
glm_translate_to(mat4 m, vec3 v, mat4 dest) {
glm_translate_to(CGLM_IN(mat4) m, const vec3 v, mat4 dest) {
glm_mat4_copy(m, dest);
glm_translate(dest, v);
}
Expand Down Expand Up @@ -141,7 +141,7 @@ glm_translate_z(mat4 m, float z) {
*/
CGLM_INLINE
void
glm_rotate_x(mat4 m, float angle, mat4 dest) {
glm_rotate_x(CGLM_IN(mat4) m, float angle, mat4 dest) {
CGLM_ALIGN_MAT mat4 t = GLM_MAT4_IDENTITY_INIT;
float c, s;

Expand All @@ -166,7 +166,7 @@ glm_rotate_x(mat4 m, float angle, mat4 dest) {
*/
CGLM_INLINE
void
glm_rotate_y(mat4 m, float angle, mat4 dest) {
glm_rotate_y(CGLM_IN(mat4) m, float angle, mat4 dest) {
CGLM_ALIGN_MAT mat4 t = GLM_MAT4_IDENTITY_INIT;
float c, s;

Expand All @@ -191,7 +191,7 @@ glm_rotate_y(mat4 m, float angle, mat4 dest) {
*/
CGLM_INLINE
void
glm_rotate_z(mat4 m, float angle, mat4 dest) {
glm_rotate_z(CGLM_IN(mat4) m, float angle, mat4 dest) {
CGLM_ALIGN_MAT mat4 t = GLM_MAT4_IDENTITY_INIT;
float c, s;

Expand All @@ -207,7 +207,7 @@ glm_rotate_z(mat4 m, float angle, mat4 dest) {
}

/*!
* @brief rotate existing transform matrix
* @brief rotate existing transform matrix
* around given axis by angle at ORIGIN (0,0,0)
*
* **❗️IMPORTANT ❗️**
Expand All @@ -233,7 +233,7 @@ glm_rotate_z(mat4 m, float angle, mat4 dest) {
*/
CGLM_INLINE
void
glm_rotate(mat4 m, float angle, vec3 axis) {
glm_rotate(mat4 m, float angle, const vec3 axis) {
CGLM_ALIGN_MAT mat4 rot;
glm_rotate_make(rot, angle, axis);
glm_mul_rot(m, rot, m);
Expand All @@ -250,7 +250,7 @@ glm_rotate(mat4 m, float angle, vec3 axis) {
*/
CGLM_INLINE
void
glm_rotate_at(mat4 m, vec3 pivot, float angle, vec3 axis) {
glm_rotate_at(mat4 m, const vec3 pivot, float angle, const vec3 axis) {
CGLM_ALIGN(8) vec3 pivotInv;

glm_vec3_negate_to(pivot, pivotInv);
Expand All @@ -275,7 +275,7 @@ glm_rotate_at(mat4 m, vec3 pivot, float angle, vec3 axis) {
*/
CGLM_INLINE
void
glm_rotate_atm(mat4 m, vec3 pivot, float angle, vec3 axis) {
glm_rotate_atm(mat4 m, const vec3 pivot, float angle, const vec3 axis) {
CGLM_ALIGN(8) vec3 pivotInv;

glm_vec3_negate_to(pivot, pivotInv);
Expand All @@ -286,7 +286,7 @@ glm_rotate_atm(mat4 m, vec3 pivot, float angle, vec3 axis) {
}

/*!
* @brief rotate existing transform matrix
* @brief rotate existing transform matrix
* around given axis by angle around self (doesn't affected by position)
*
* @param[in, out] m affine transform
Expand All @@ -295,7 +295,7 @@ glm_rotate_atm(mat4 m, vec3 pivot, float angle, vec3 axis) {
*/
CGLM_INLINE
void
glm_spin(mat4 m, float angle, vec3 axis) {
glm_spin(mat4 m, float angle, const vec3 axis) {
CGLM_ALIGN_MAT mat4 rot;
glm_rotate_atm(rot, m[3], angle, axis);
glm_mat4_mul(m, rot, m);
Expand Down
Loading
Loading