Originally created by: recp
glm_vec_rotate(vec, angle, axis))There could be inline wrapper for some functions e.g. glm_vec_crossand glm_vec_dot like glm_cross and glm_dot. Original functions must stay where they are. This is not necessary but could help to write code fast and more readable .
One another things there could be convenient functions for operations like this ( it is just example ):
/* v = v1 * v2 + v3 * v4 + v5 * v6 */
vec3 sum;
vec3 tmp, tmp2;
glm_vec_mulv(v1, v2, sum);
glm_vec_mulv(v3, v4, tmp2);
glm_vec_add(tmp2, sum, sum);
glm_vec_mulv(v5, v6, tmp2);
glm_vec_add(tmp2, sum, sum);
/* ... */
It could be something like this:
/* v = v1 * v2 + v3 * v4 + v5 * v6 */
vec3 sum;
glm_vec_mulv(v1, v2, sum);
glm_vec_muladd(v3, v4, sum);
glm_vec_muladd(v5, v6, sum);
/* ... */
this is also not necessary, just my thoughts. In short I mean convenient functions for +=, *=, -=, /=
Also any feature request, feedback or contribution are welcome. We can use this issue collect feature requests and feedbacks
Originally posted by: recp
Rename
glm_scale1toglm_scale_uniOriginally posted by: recp
Find perpendicular vector util e.g.
glm_vec_perpendicularorglm_vec_orthogonalorglm_vec_ortho, the last one seems cool!I found a good, fast solution, only subtraction: https://www.quora.com/How-do-I-find-a-vector-perpendicular-to-another-vector/answer/Tom-Thompson-1?srid=uEqzq
We must add this to cglm. For rendering shadowmap this could be useful for selecting UP vector against light direction.
Originally posted by: recp
Proposals for double and half precision names
Types
Double: vec3d vec4d mat4d
Half: vec3h vec4h mat4h
Unaligned Types:
Double: uvec4d umat4d
Half: uvec4h umat4h
Proposals for double
glm_dbl_mat4_mulglm_dmat4_mulglm_mat4d_mulglm_mat4_mul_dblglm_mat4_muldglm_mat4_mul64glmd_mat4_mul<- looks good but there will be call verisonglmcd_mat4_mulProposals for half precision
glm_half_mat4_mulorglm_hlf_mat4_mulglm_hmat4_mulglm_mat4h_mulglm_mat4_mul_halforglm_mat4_mul_hlfglm_mat4_mulhglm_mat4_mul16glmh_mat4_mulorglm16_mat4_mul<- looks goodglm_lookatdorglm_dbl_lookatorglm_dlookatorglmd_lookatglm_lookathorglm_hlf_lookatorglm_hlookatorglmh_lookatWe must select best name for future use, mat4 is used for example. Also there will be unaligned versions for vec4 and mat4 based functions including quaternions
We already use
glmc_for pre-compiled functions. We could continue use this style likeglmd_orglmh_orglm64_orglm16_...Alternative name proposals are welcome!
Originally posted by: recp
TODOs for vector:
glm_vec_shuffle,glm_vec4_shuffledot,crossproductsglm_vec_muladd,glm_vec4_muladdÂglm_vec_hadd,glm_vec4_hadd similar to SIMD hadd, hsubOriginally posted by: recp
vec_expvec_logvec_pow= exp(log(v) * p)especially vec4 version could use SIMD instructions.
I want to add these functions because we could use
glm_vec4_pow(srgb, 2.2f, linear)for sRGB to LINEAR or vise versaglm_vec4_pow(linear, 1.0f / 2.2f, srgb)