vec2: add new function glm_vec2_make

Just a copy of glm_vec2, but with the
word _make suffixed at the end.

Function takes in a float array array must be
at least of size 2 and converts it into
a 2D vector.

Signed-off-by: Vincent Davis Jr <vince@underview.tech>
This commit is contained in:
Vincent Davis Jr
2023-07-02 11:59:39 -05:00
parent 49dd24eaf2
commit b3de85a14e
7 changed files with 72 additions and 0 deletions

View File

@@ -637,3 +637,23 @@ TEST_IMPL(GLM_PREFIX, vec2_complex_div) {
TEST_SUCCESS
}
TEST_IMPL(GLM_PREFIX, vec2_make) {
float src[6] = {
7.2f, 1.0f,
2.5f, 6.1f,
17.7f, 4.3f
};
vec2 dest[3];
float *srcp = src;
unsigned int i, j;
for (i = 0, j = 0; i < sizeof(src) / sizeof(float); i+=2,j++) {
GLM(vec2_make)(srcp + i, dest[j]);
ASSERT(test_eq(src[ i ], dest[j][0]));
ASSERT(test_eq(src[i+1], dest[j][1]));
}
TEST_SUCCESS
}