diff --git a/include/cglm/affine-pre.h b/include/cglm/affine-pre.h --- a/include/cglm/affine-pre.h +++ b/include/cglm/affine-pre.h @@ -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; @@ -72,7 +72,7 @@ */ CGLM_INLINE void -glm_translate_to(mat4 m, vec3 v, mat4 dest) { +glm_translate_to(const_mat4 m, const_vec3 v, mat4 dest) { glm_mat4_copy(m, dest); glm_translate(dest, v); } @@ -215,7 +215,7 @@ */ 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); @@ -232,7 +232,7 @@ */ 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); @@ -257,7 +257,7 @@ */ 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); diff --git a/include/cglm/affine.h b/include/cglm/affine.h --- a/include/cglm/affine.h +++ b/include/cglm/affine.h @@ -49,7 +49,7 @@ */ CGLM_INLINE void -glm_translate_make(mat4 m, vec3 v) { +glm_translate_make(mat4 m, const_vec3 v) { glm_mat4_identity(m); glm_vec3_copy(v, m[3]); } @@ -64,7 +64,7 @@ */ CGLM_INLINE void -glm_scale_to(mat4 m, vec3 v, mat4 dest) { +glm_scale_to(const_mat4 m, const_vec3 v, mat4 dest) { glm_vec4_scale(m[0], v[0], dest[0]); glm_vec4_scale(m[1], v[1], dest[1]); glm_vec4_scale(m[2], v[2], dest[2]); @@ -80,7 +80,7 @@ */ CGLM_INLINE void -glm_scale_make(mat4 m, vec3 v) { +glm_scale_make(mat4 m, const_vec3 v) { glm_mat4_identity(m); m[0][0] = v[0]; m[1][1] = v[1]; @@ -96,7 +96,7 @@ */ CGLM_INLINE void -glm_scale(mat4 m, vec3 v) { +glm_scale(mat4 m, const_vec3 v) { glm_scale_to(m, v, m); } @@ -125,7 +125,7 @@ */ CGLM_INLINE void -glm_rotate_make(mat4 m, float angle, vec3 axis) { +glm_rotate_make(mat4 m, float angle, const_vec3 axis) { CGLM_ALIGN(8) vec3 axisn, v, vs; float c; diff --git a/include/cglm/mat4.h b/include/cglm/mat4.h --- a/include/cglm/mat4.h +++ b/include/cglm/mat4.h @@ -100,7 +100,7 @@ */ CGLM_INLINE void -glm_mat4_ucopy(mat4 mat, mat4 dest) { +glm_mat4_ucopy(const_mat4 mat, mat4 dest) { dest[0][0] = mat[0][0]; dest[1][0] = mat[1][0]; dest[0][1] = mat[0][1]; dest[1][1] = mat[1][1]; dest[0][2] = mat[0][2]; dest[1][2] = mat[1][2]; @@ -120,7 +120,7 @@ */ CGLM_INLINE void -glm_mat4_copy(mat4 mat, mat4 dest) { +glm_mat4_copy(const_mat4 mat, mat4 dest) { #ifdef __AVX__ glmm_store256(dest[0], glmm_load256(mat[0])); glmm_store256(dest[2], glmm_load256(mat[2])); @@ -220,7 +220,7 @@ */ CGLM_INLINE void -glm_mat4_pick3(mat4 mat, mat3 dest) { +glm_mat4_pick3(const_mat4 mat, mat3 dest) { dest[0][0] = mat[0][0]; dest[0][1] = mat[0][1]; dest[0][2] = mat[0][2]; @@ -266,7 +266,7 @@ */ CGLM_INLINE void -glm_mat4_ins3(mat3 mat, mat4 dest) { +glm_mat4_ins3(const_mat3 mat, mat4 dest) { dest[0][0] = mat[0][0]; dest[0][1] = mat[0][1]; dest[0][2] = mat[0][2]; @@ -296,7 +296,7 @@ */ CGLM_INLINE void -glm_mat4_mul(mat4 m1, mat4 m2, mat4 dest) { +glm_mat4_mul(const_mat4 m1, const_mat4 m2, mat4 dest) { #ifdef __AVX__ glm_mat4_mul_avx(m1, m2, dest); #elif defined( __SSE__ ) || defined( __SSE2__ ) @@ -376,7 +376,7 @@ */ CGLM_INLINE void -glm_mat4_mulv(mat4 m, vec4 v, vec4 dest) { +glm_mat4_mulv(const_mat4 m, const_vec4 v, vec4 dest) { #if defined( __SSE__ ) || defined( __SSE2__ ) glm_mat4_mulv_sse2(m, v, dest); #elif defined(CGLM_NEON_FP) @@ -425,7 +425,7 @@ */ CGLM_INLINE void -glm_mat4_quat(mat4 m, versor dest) { +glm_mat4_quat(const_mat4 m, versor dest) { float trace, r, rinv; /* it seems using like m12 instead of m[1][2] causes extra instructions */ @@ -496,7 +496,7 @@ */ CGLM_INLINE void -glm_mat4_transpose_to(mat4 m, mat4 dest) { +glm_mat4_transpose_to(const_mat4 m, mat4 dest) { #if defined( __SSE__ ) || defined( __SSE2__ ) glm_mat4_transp_sse2(m, dest); #elif defined(CGLM_NEON_FP) @@ -580,7 +580,7 @@ */ CGLM_INLINE float -glm_mat4_det(mat4 mat) { +glm_mat4_det(const_mat4 mat) { #if defined( __SSE__ ) || defined( __SSE2__ ) return glm_mat4_det_sse2(mat); #elif defined(CGLM_NEON_FP) @@ -615,7 +615,7 @@ */ CGLM_INLINE void -glm_mat4_inv(mat4 mat, mat4 dest) { +glm_mat4_inv(const_mat4 mat, mat4 dest) { #if defined( __SSE__ ) || defined( __SSE2__ ) glm_mat4_inv_sse2(mat, dest); #elif defined(CGLM_NEON_FP) @@ -678,7 +678,7 @@ */ CGLM_INLINE void -glm_mat4_inv_fast(mat4 mat, mat4 dest) { +glm_mat4_inv_fast(const_mat4 mat, mat4 dest) { #if defined( __SSE__ ) || defined( __SSE2__ ) glm_mat4_inv_fast_sse2(mat, dest); #else @@ -745,7 +745,7 @@ */ CGLM_INLINE float -glm_mat4_rmc(vec4 r, mat4 m, vec4 c) { +glm_mat4_rmc(const_vec4 r, const_mat4 m, const_vec4 c) { vec4 tmp; glm_mat4_mulv(m, c, tmp); return glm_vec4_dot(r, tmp); diff --git a/include/cglm/simd/sse2/mat4.h b/include/cglm/simd/sse2/mat4.h --- a/include/cglm/simd/sse2/mat4.h +++ b/include/cglm/simd/sse2/mat4.h @@ -28,7 +28,7 @@ CGLM_INLINE void -glm_mat4_transp_sse2(mat4 m, mat4 dest) { +glm_mat4_transp_sse2(const_mat4 m, mat4 dest) { __m128 r0, r1, r2, r3; r0 = glmm_load(m[0]); @@ -46,7 +46,7 @@ CGLM_INLINE void -glm_mat4_mul_sse2(mat4 m1, mat4 m2, mat4 dest) { +glm_mat4_mul_sse2(const_mat4 m1, const_mat4 m2, mat4 dest) { /* D = R * L (Column-Major) */ glmm_128 l, r0, r1, r2, r3, v0, v1, v2, v3; @@ -88,7 +88,7 @@ CGLM_INLINE void -glm_mat4_mulv_sse2(mat4 m, vec4 v, vec4 dest) { +glm_mat4_mulv_sse2(const_mat4 m, const_vec4 v, vec4 dest) { __m128 x0, x1, m0, m1, m2, m3, v0, v1, v2, v3; m0 = glmm_load(m[0]); @@ -112,7 +112,7 @@ CGLM_INLINE float -glm_mat4_det_sse2(mat4 mat) { +glm_mat4_det_sse2(const_mat4 mat) { __m128 r0, r1, r2, r3, x0, x1, x2; /* 127 <- 0, [square] det(A) = det(At) */ @@ -160,7 +160,7 @@ CGLM_INLINE void -glm_mat4_inv_fast_sse2(mat4 mat, mat4 dest) { +glm_mat4_inv_fast_sse2(const_mat4 mat, mat4 dest) { __m128 r0, r1, r2, r3, v0, v1, v2, v3, t0, t1, t2, t3, t4, t5, @@ -296,7 +296,7 @@ CGLM_INLINE void -glm_mat4_inv_sse2(mat4 mat, mat4 dest) { +glm_mat4_inv_sse2(const_mat4 mat, mat4 dest) { __m128 r0, r1, r2, r3, v0, v1, v2, v3, t0, t1, t2, t3, t4, t5, diff --git a/include/cglm/types.h b/include/cglm/types.h --- a/include/cglm/types.h +++ b/include/cglm/types.h @@ -54,6 +54,30 @@ typedef CGLM_ALIGN_IF(16) vec2 mat2[2]; typedef CGLM_ALIGN_MAT vec4 mat4[4]; +#if defined(CGLM_ENABLE_CONST) +# define const_ivec2 const ivec2 +# define const_ivec3 const ivec3 +# define const_ivec4 const ivec4 +# define const_vec2 const vec2 +# define const_vec3 const vec3 +# define const_vec4 const vec4 +# define const_versor const versor +# define const_mat3 const mat3 +# define const_mat2 const mat2 +# define const_mat4 const mat4 +#else +# define const_ivec2 ivec2 +# define const_ivec3 ivec3 +# define const_ivec4 ivec4 +# define const_vec2 vec2 +# define const_vec3 vec3 +# define const_vec4 vec4 +# define const_versor versor +# define const_mat3 mat3 +# define const_mat2 mat2 +# define const_mat4 mat4 +#endif + /* Important: cglm stores quaternion as [x, y, z, w] in memory since v0.4.0 it was [w, x, y, z] before v0.4.0 ( v0.3.5 and earlier ). w is real part. diff --git a/include/cglm/vec3-ext.h b/include/cglm/vec3-ext.h --- a/include/cglm/vec3-ext.h +++ b/include/cglm/vec3-ext.h @@ -68,7 +68,7 @@ */ CGLM_INLINE bool -glm_vec3_eq(vec3 v, float val) { +glm_vec3_eq(const_vec3 v, float val) { return v[0] == val && v[0] == v[1] && v[0] == v[2]; } @@ -80,7 +80,7 @@ */ CGLM_INLINE bool -glm_vec3_eq_eps(vec3 v, float val) { +glm_vec3_eq_eps(const_vec3 v, float val) { return fabsf(v[0] - val) <= GLM_FLT_EPSILON && fabsf(v[1] - val) <= GLM_FLT_EPSILON && fabsf(v[2] - val) <= GLM_FLT_EPSILON; @@ -93,7 +93,7 @@ */ CGLM_INLINE bool -glm_vec3_eq_all(vec3 v) { +glm_vec3_eq_all(const_vec3 v) { return glm_vec3_eq_eps(v, v[0]); } @@ -105,7 +105,7 @@ */ CGLM_INLINE bool -glm_vec3_eqv(vec3 a, vec3 b) { +glm_vec3_eqv(const_vec3 a, const_vec3 b) { return a[0] == b[0] && a[1] == b[1] && a[2] == b[2]; @@ -119,7 +119,7 @@ */ CGLM_INLINE bool -glm_vec3_eqv_eps(vec3 a, vec3 b) { +glm_vec3_eqv_eps(const_vec3 a, const_vec3 b) { return fabsf(a[0] - b[0]) <= GLM_FLT_EPSILON && fabsf(a[1] - b[1]) <= GLM_FLT_EPSILON && fabsf(a[2] - b[2]) <= GLM_FLT_EPSILON; @@ -132,7 +132,7 @@ */ CGLM_INLINE float -glm_vec3_max(vec3 v) { +glm_vec3_max(const_vec3 v) { float max; max = v[0]; @@ -151,7 +151,7 @@ */ CGLM_INLINE float -glm_vec3_min(vec3 v) { +glm_vec3_min(const_vec3 v) { float min; min = v[0]; @@ -171,7 +171,7 @@ */ CGLM_INLINE bool -glm_vec3_isnan(vec3 v) { +glm_vec3_isnan(const_vec3 v) { return isnan(v[0]) || isnan(v[1]) || isnan(v[2]); } @@ -183,7 +183,7 @@ */ CGLM_INLINE bool -glm_vec3_isinf(vec3 v) { +glm_vec3_isinf(const_vec3 v) { return isinf(v[0]) || isinf(v[1]) || isinf(v[2]); } @@ -195,7 +195,7 @@ */ CGLM_INLINE bool -glm_vec3_isvalid(vec3 v) { +glm_vec3_isvalid(const_vec3 v) { return !glm_vec3_isnan(v) && !glm_vec3_isinf(v); } @@ -208,7 +208,7 @@ */ CGLM_INLINE void -glm_vec3_sign(vec3 v, vec3 dest) { +glm_vec3_sign(const_vec3 v, vec3 dest) { dest[0] = glm_signf(v[0]); dest[1] = glm_signf(v[1]); dest[2] = glm_signf(v[2]); @@ -222,7 +222,7 @@ */ CGLM_INLINE void -glm_vec3_abs(vec3 v, vec3 dest) { +glm_vec3_abs(const_vec3 v, vec3 dest) { dest[0] = fabsf(v[0]); dest[1] = fabsf(v[1]); dest[2] = fabsf(v[2]); @@ -236,7 +236,7 @@ */ CGLM_INLINE void -glm_vec3_fract(vec3 v, vec3 dest) { +glm_vec3_fract(const_vec3 v, vec3 dest) { dest[0] = fminf(v[0] - floorf(v[0]), 0.999999940395355224609375f); dest[1] = fminf(v[1] - floorf(v[1]), 0.999999940395355224609375f); dest[2] = fminf(v[2] - floorf(v[2]), 0.999999940395355224609375f); @@ -251,7 +251,7 @@ */ CGLM_INLINE float -glm_vec3_hadd(vec3 v) { +glm_vec3_hadd(const_vec3 v) { return v[0] + v[1] + v[2]; } @@ -263,7 +263,7 @@ */ CGLM_INLINE void -glm_vec3_sqrt(vec3 v, vec3 dest) { +glm_vec3_sqrt(const_vec3 v, vec3 dest) { dest[0] = sqrtf(v[0]); dest[1] = sqrtf(v[1]); dest[2] = sqrtf(v[2]); diff --git a/include/cglm/vec3.h b/include/cglm/vec3.h --- a/include/cglm/vec3.h +++ b/include/cglm/vec3.h @@ -143,7 +143,7 @@ */ CGLM_INLINE void -glm_vec3_copy(vec3 a, vec3 dest) { +glm_vec3_copy(const_vec3 a, vec3 dest) { dest[0] = a[0]; dest[1] = a[1]; dest[2] = a[2]; @@ -181,7 +181,7 @@ */ CGLM_INLINE float -glm_vec3_dot(vec3 a, vec3 b) { +glm_vec3_dot(const_vec3 a, const_vec3 b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; } @@ -198,7 +198,7 @@ */ CGLM_INLINE float -glm_vec3_norm2(vec3 v) { +glm_vec3_norm2(const_vec3 v) { return glm_vec3_dot(v, v); } @@ -212,7 +212,7 @@ */ CGLM_INLINE float -glm_vec3_norm(vec3 v) { +glm_vec3_norm(const_vec3 v) { return sqrtf(glm_vec3_norm2(v)); } @@ -268,7 +268,7 @@ */ CGLM_INLINE void -glm_vec3_add(vec3 a, vec3 b, vec3 dest) { +glm_vec3_add(const_vec3 a, const_vec3 b, vec3 dest) { dest[0] = a[0] + b[0]; dest[1] = a[1] + b[1]; dest[2] = a[2] + b[2]; @@ -283,7 +283,7 @@ */ CGLM_INLINE void -glm_vec3_adds(vec3 v, float s, vec3 dest) { +glm_vec3_adds(const_vec3 v, float s, vec3 dest) { dest[0] = v[0] + s; dest[1] = v[1] + s; dest[2] = v[2] + s; @@ -298,7 +298,7 @@ */ CGLM_INLINE void -glm_vec3_sub(vec3 a, vec3 b, vec3 dest) { +glm_vec3_sub(const_vec3 a, const_vec3 b, vec3 dest) { dest[0] = a[0] - b[0]; dest[1] = a[1] - b[1]; dest[2] = a[2] - b[2]; @@ -313,7 +313,7 @@ */ CGLM_INLINE void -glm_vec3_subs(vec3 v, float s, vec3 dest) { +glm_vec3_subs(const_vec3 v, float s, vec3 dest) { dest[0] = v[0] - s; dest[1] = v[1] - s; dest[2] = v[2] - s; @@ -328,7 +328,7 @@ */ CGLM_INLINE void -glm_vec3_mul(vec3 a, vec3 b, vec3 dest) { +glm_vec3_mul(const_vec3 a, const_vec3 b, vec3 dest) { dest[0] = a[0] * b[0]; dest[1] = a[1] * b[1]; dest[2] = a[2] * b[2]; @@ -343,7 +343,7 @@ */ CGLM_INLINE void -glm_vec3_scale(vec3 v, float s, vec3 dest) { +glm_vec3_scale(const_vec3 v, float s, vec3 dest) { dest[0] = v[0] * s; dest[1] = v[1] * s; dest[2] = v[2] * s; @@ -379,7 +379,7 @@ */ CGLM_INLINE void -glm_vec3_div(vec3 a, vec3 b, vec3 dest) { +glm_vec3_div(const_vec3 a, const_vec3 b, vec3 dest) { dest[0] = a[0] / b[0]; dest[1] = a[1] / b[1]; dest[2] = a[2] / b[2]; @@ -394,7 +394,7 @@ */ CGLM_INLINE void -glm_vec3_divs(vec3 v, float s, vec3 dest) { +glm_vec3_divs(const_vec3 v, float s, vec3 dest) { dest[0] = v[0] / s; dest[1] = v[1] / s; dest[2] = v[2] / s; @@ -510,7 +510,7 @@ */ CGLM_INLINE void -glm_vec3_negate_to(vec3 v, vec3 dest) { +glm_vec3_negate_to(const_vec3 v, vec3 dest) { dest[0] = -v[0]; dest[1] = -v[1]; dest[2] = -v[2]; @@ -555,7 +555,7 @@ */ CGLM_INLINE void -glm_vec3_normalize_to(vec3 v, vec3 dest) { +glm_vec3_normalize_to(const_vec3 v, vec3 dest) { float norm; norm = glm_vec3_norm(v); @@ -577,7 +577,7 @@ */ CGLM_INLINE void -glm_vec3_cross(vec3 a, vec3 b, vec3 dest) { +glm_vec3_cross(const_vec3 a, const_vec3 b, vec3 dest) { vec3 c; /* (u2.v3 - u3.v2, u3.v1 - u1.v3, u1.v2 - u2.v1) */ c[0] = a[1] * b[2] - a[2] * b[1]; @@ -610,7 +610,7 @@ */ CGLM_INLINE float -glm_vec3_angle(vec3 a, vec3 b) { +glm_vec3_angle(const_vec3 a, const_vec3 b) { float norm, dot; /* maybe compiler generate approximation instruction (rcp) */ @@ -634,7 +634,7 @@ */ CGLM_INLINE void -glm_vec3_rotate(vec3 v, float angle, vec3 axis) { +glm_vec3_rotate(vec3 v, float angle, const_vec3 axis) { vec3 v1, v2, k; float c, s; @@ -672,7 +672,7 @@ */ CGLM_INLINE void -glm_vec3_rotate_m4(mat4 m, vec3 v, vec3 dest) { +glm_vec3_rotate_m4(const_mat4 m, const_vec3 v, vec3 dest) { vec4 x, y, z, res; glm_vec4_normalize_to(m[0], x); @@ -695,7 +695,7 @@ */ CGLM_INLINE void -glm_vec3_rotate_m3(mat3 m, vec3 v, vec3 dest) { +glm_vec3_rotate_m3(const_mat3 m, const_vec3 v, vec3 dest) { vec4 res, x, y, z; glm_vec4(m[0], 0.0f, x); @@ -722,7 +722,7 @@ */ CGLM_INLINE void -glm_vec3_proj(vec3 a, vec3 b, vec3 dest) { +glm_vec3_proj(const_vec3 a, const_vec3 b, vec3 dest) { glm_vec3_scale(b, glm_vec3_dot(a, b) / glm_vec3_norm2(b), dest); @@ -737,7 +737,7 @@ */ CGLM_INLINE void -glm_vec3_center(vec3 a, vec3 b, vec3 dest) { +glm_vec3_center(const_vec3 a, const_vec3 b, vec3 dest) { glm_vec3_add(a, b, dest); glm_vec3_scale(dest, 0.5f, dest); } @@ -751,7 +751,7 @@ */ CGLM_INLINE float -glm_vec3_distance2(vec3 a, vec3 b) { +glm_vec3_distance2(const_vec3 a, const_vec3 b) { return glm_pow2(a[0] - b[0]) + glm_pow2(a[1] - b[1]) + glm_pow2(a[2] - b[2]); @@ -766,7 +766,7 @@ */ CGLM_INLINE float -glm_vec3_distance(vec3 a, vec3 b) { +glm_vec3_distance(const_vec3 a, const_vec3 b) { return sqrtf(glm_vec3_distance2(a, b)); } @@ -779,7 +779,7 @@ */ CGLM_INLINE void -glm_vec3_maxv(vec3 a, vec3 b, vec3 dest) { +glm_vec3_maxv(const_vec3 a, const_vec3 b, vec3 dest) { dest[0] = glm_max(a[0], b[0]); dest[1] = glm_max(a[1], b[1]); dest[2] = glm_max(a[2], b[2]); @@ -794,7 +794,7 @@ */ CGLM_INLINE void -glm_vec3_minv(vec3 a, vec3 b, vec3 dest) { +glm_vec3_minv(const_vec3 a, const_vec3 b, vec3 dest) { dest[0] = glm_min(a[0], b[0]); dest[1] = glm_min(a[1], b[1]); dest[2] = glm_min(a[2], b[2]); @@ -808,7 +808,7 @@ */ CGLM_INLINE void -glm_vec3_ortho(vec3 v, vec3 dest) { +glm_vec3_ortho(const_vec3 v, vec3 dest) { float ignore; float f = modff(fabsf(v[0]) + 0.5f, &ignore); vec3 result = {-v[1], v[0] - f * v[2], f * v[1]}; @@ -842,7 +842,7 @@ */ CGLM_INLINE void -glm_vec3_lerp(vec3 from, vec3 to, float t, vec3 dest) { +glm_vec3_lerp(const_vec3 from, const_vec3 to, float t, vec3 dest) { vec3 s, v; /* from + s * (to - from) */ @@ -880,7 +880,7 @@ */ CGLM_INLINE void -glm_vec3_mix(vec3 from, vec3 to, float t, vec3 dest) { +glm_vec3_mix(const_vec3 from, const_vec3 to, float t, vec3 dest) { glm_vec3_lerp(from, to, t, dest); } @@ -1011,7 +1011,7 @@ */ CGLM_INLINE void -glm_vec3_swizzle(vec3 v, int mask, vec3 dest) { +glm_vec3_swizzle(const_vec3 v, int mask, vec3 dest) { vec3 t; t[0] = v[(mask & (3 << 0))]; diff --git a/include/cglm/vec4.h b/include/cglm/vec4.h --- a/include/cglm/vec4.h +++ b/include/cglm/vec4.h @@ -107,7 +107,7 @@ */ CGLM_INLINE void -glm_vec4(vec3 v3, float last, vec4 dest) { +glm_vec4(const_vec3 v3, float last, vec4 dest) { dest[0] = v3[0]; dest[1] = v3[1]; dest[2] = v3[2]; @@ -136,7 +136,7 @@ */ CGLM_INLINE void -glm_vec4_copy(vec4 v, vec4 dest) { +glm_vec4_copy(const_vec4 v, vec4 dest) { #if defined( __SSE__ ) || defined( __SSE2__ ) glmm_store(dest, glmm_load(v)); #elif defined(CGLM_NEON_FP) @@ -216,7 +216,7 @@ */ CGLM_INLINE float -glm_vec4_dot(vec4 a, vec4 b) { +glm_vec4_dot(const_vec4 a, const_vec4 b) { #if defined(CGLM_SIMD) return glmm_dot(glmm_load(a), glmm_load(b)); #else @@ -429,7 +429,7 @@ */ CGLM_INLINE void -glm_vec4_scale(vec4 v, float s, vec4 dest) { +glm_vec4_scale(const_vec4 v, float s, vec4 dest) { #if defined( __SSE__ ) || defined( __SSE2__ ) glmm_store(dest, _mm_mul_ps(glmm_load(v), _mm_set1_ps(s))); #elif defined(CGLM_NEON_FP) @@ -696,7 +696,7 @@ */ CGLM_INLINE void -glm_vec4_normalize_to(vec4 v, vec4 dest) { +glm_vec4_normalize_to(const_vec4 v, vec4 dest) { #if defined( __SSE__ ) || defined( __SSE2__ ) __m128 xdot, x0; float dot;