mirror of
https://github.com/recp/cglm.git
synced 2026-11-17 10:17:13 -06: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 <[email protected]>
This commit is contained in:
1 parent
49dd24eaf2
commit
b3de85a14e
7 files changed
+72
No files matched your search
@@ -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