mirror of
https://github.com/recp/cglm.git
synced 2025-12-24 20:34:58 +00:00
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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user