mirror of
https://github.com/recp/cglm.git
synced 2025-12-30 12:17:50 +00:00
mat2: add new function glm_mat2_make
Function takes in a 4 element float array and converts it into a mat2 matrix. Signed-off-by: Vincent Davis Jr <vince@underview.tech>
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "test_common.h"
|
||||
|
||||
#define A_MATRIX2x2 {{1,2},{5,6}}
|
||||
#define MAT2_ARRAY {1, 5, 2, 7}
|
||||
|
||||
#ifndef CGLM_TEST_MAT2_ONCE
|
||||
#define CGLM_TEST_MAT2_ONCE
|
||||
@@ -283,4 +284,19 @@ TEST_IMPL(GLM_PREFIX, mat2_rmc) {
|
||||
TEST_SUCCESS
|
||||
}
|
||||
|
||||
TEST_IMPL(GLM_PREFIX, mat2_make) {
|
||||
mat2 dest;
|
||||
unsigned int i, j;
|
||||
float src[4] = MAT2_ARRAY;
|
||||
|
||||
GLM(mat2_make)(src, dest);
|
||||
|
||||
for (i = 0, j = 0; i < sizeof(src) / sizeof(float); i+=2, j++) {
|
||||
ASSERT(test_eq(dest[j][0], src[i]))
|
||||
ASSERT(test_eq(dest[j][1], src[i+1]))
|
||||
}
|
||||
|
||||
TEST_SUCCESS
|
||||
}
|
||||
|
||||
#undef A_MATRIX2x2
|
||||
|
||||
Reference in New Issue
Block a user