cglm
cglm copied to clipboard
Request: Functions for building vectors from floats
trafficstars
Currently the only way to build, say, a vec3s is manually:
vec3s value = {{ 1.0f, 0.0f, 0.5f }};
value = (vec3s) {{ 0.0f, 0.5f, 2.5f }};
This is very verbose, and the double braces required for the struct versions seem to confuse vim's syntax highlighting. It would be nice if there was a function to clean this up. (Something like glms_vec3(), but that's already taken for converting from vec4s.)
For example:
CGLM_INLINE vec3s glms_vec3_fromfloat(float a, float b, float c)
{
return (vec3s){{a, b, c}};
}
vec3s value = glms_vec3_fromfloat(1.0f, 0.0f, 3.5f);
I don't know what an appropriate name would be in this case (glms_vec3_float? glms_vec3f? The shorter, the better.).
Hi @Nairou
Thanks for your feedbacks 🤗, let's get more feedbacks for what to do
It would be nice to use glm_vec3 for this purpose :/ but maybe we can find alternative or better names...