-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial function being glm_mat2x3_make Signed-off-by: Vincent Davis Jr <[email protected]>
- Loading branch information
1 parent
3b683cf
commit 6317ed9
Showing
24 changed files
with
284 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,7 @@ Follow the :doc:`build` documentation for this | |
quat | ||
euler | ||
mat2 | ||
mat2x3 | ||
mat3 | ||
mat4 | ||
vec2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
.. default-domain:: C | ||
|
||
mat2x3 | ||
====== | ||
|
||
Header: cglm/mat2x3.h | ||
|
||
Table of contents (click to go): | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Macros: | ||
|
||
1. GLM_MAT2X3_ZERO_INIT | ||
#. GLM_MAT2x3_ZERO | ||
|
||
Functions: | ||
|
||
1. :c:func:`glm_mat2x3_make` | ||
|
||
Functions documentation | ||
~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. c:function:: void glm_mat2x3_make(float * __restrict src, mat2x3 dest) | ||
Create mat2x3 matrix from pointer | ||
| NOTE: **@src** must contain at least 6 elements. | ||
Parameters: | ||
| *[in]* **src** pointer to an array of floats | ||
| *[out]* **dest** destination matrix2x3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright (c), Recep Aslantas. | ||
* | ||
* MIT License (MIT), http://opensource.org/licenses/MIT | ||
* Full license can be found in the LICENSE file | ||
*/ | ||
|
||
#ifndef cglmc_mat2x3_h | ||
#define cglmc_mat2x3_h | ||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#include "../cglm.h" | ||
|
||
CGLM_EXPORT | ||
void | ||
glmc_mat2x3_make(float * __restrict src, mat2x3 dest); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
#endif /* cglmc_mat2x3_h */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright (c), Recep Aslantas. | ||
* | ||
* MIT License (MIT), http://opensource.org/licenses/MIT | ||
* Full license can be found in the LICENSE file | ||
*/ | ||
|
||
/* | ||
Macros: | ||
GLM_MAT2X3_ZERO_INIT | ||
GLM_MAT2X3_ZERO | ||
Functions: | ||
CGLM_INLINE void glm_mat2x3_make(float * restrict src, mat2x3 dest) | ||
*/ | ||
|
||
#ifndef cglm_mat2x3_h | ||
#define cglm_mat2x3_h | ||
|
||
#include "common.h" | ||
|
||
#define GLM_MAT2X3_ZERO_INIT {{0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f}} | ||
|
||
/* for C only */ | ||
#define GLM_MAT2X3_ZERO ((mat2x3)GLM_MAT2X3_ZERO_INIT) | ||
|
||
/*! | ||
* @brief Create mat2x3 matrix from pointer | ||
* | ||
* @param[in] src pointer to an array of floats | ||
* @param[out] dest matrix | ||
*/ | ||
CGLM_INLINE | ||
void | ||
glm_mat2x3_make(float * __restrict src, mat2x3 dest) { | ||
dest[0][0] = src[0]; | ||
dest[0][1] = src[1]; | ||
dest[0][2] = src[2]; | ||
|
||
dest[1][0] = src[3]; | ||
dest[1][1] = src[4]; | ||
dest[1][2] = src[5]; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (c), Recep Aslantas. | ||
* | ||
* MIT License (MIT), http://opensource.org/licenses/MIT | ||
* Full license can be found in the LICENSE file | ||
*/ | ||
|
||
/* | ||
Macros: | ||
GLMS_MAT2X3_ZERO_INIT | ||
GLMS_MAT2X3_ZERO | ||
Functions: | ||
CGLM_INLINE float glms_mat2x3_make(float * __restrict src); | ||
*/ | ||
|
||
#ifndef cglms_mat2x3_h | ||
#define cglms_mat2x3_h | ||
|
||
#include "../common.h" | ||
#include "../types-struct.h" | ||
#include "../mat2x3.h" | ||
|
||
/* api definition */ | ||
#define glms_mat2x3_(NAME) CGLM_STRUCTAPI(mat2x3, NAME) | ||
|
||
#define GLMS_MAT2X3_ZERO_INIT {GLM_MAT2X3_ZERO_INIT} | ||
|
||
/* for C only */ | ||
#define GLMS_MAT2X3_ZERO ((mat2x3s)GLMS_MAT2X3_ZERO_INIT) | ||
|
||
/*! | ||
* @brief Create mat2x3 matrix from pointer | ||
* | ||
* @param[in] src pointer to an array of floats | ||
* @return constructed matrix from raw pointer | ||
*/ | ||
CGLM_INLINE | ||
mat2x3s | ||
glms_mat2x3_(make)(float * __restrict src) { | ||
mat2x3s r; | ||
glm_mat2x3_make(src, r.raw); | ||
return r; | ||
} | ||
|
||
#endif /* cglms_mat2x3_h */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Copyright (c), Recep Aslantas. | ||
* | ||
* MIT License (MIT), http://opensource.org/licenses/MIT | ||
* Full license can be found in the LICENSE file | ||
*/ | ||
|
||
#include "../include/cglm/cglm.h" | ||
#include "../include/cglm/call.h" | ||
|
||
CGLM_EXPORT | ||
void | ||
glmc_mat2x3_make(float * __restrict src, mat2x3 dest) { | ||
glm_mat2x3_make(src, dest); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (c), Recep Aslantas. | ||
* | ||
* MIT License (MIT), http://opensource.org/licenses/MIT | ||
* Full license can be found in the LICENSE file | ||
*/ | ||
|
||
#include "test_common.h" | ||
|
||
#ifndef CGLM_TEST_MAT2X3_ONCE | ||
#define CGLM_TEST_MAT2X3_ONCE | ||
|
||
TEST_IMPL(MACRO_GLM_MAT2X3_ZERO_INIT) { | ||
mat2x3 m = GLM_MAT2X3_ZERO_INIT; | ||
|
||
ASSERT(test_eq(m[0][0], 0.0f)) | ||
ASSERT(test_eq(m[0][1], 0.0f)) | ||
ASSERT(test_eq(m[0][2], 0.0f)) | ||
ASSERT(test_eq(m[1][0], 0.0f)) | ||
ASSERT(test_eq(m[1][1], 0.0f)) | ||
ASSERT(test_eq(m[1][2], 0.0f)) | ||
|
||
TEST_SUCCESS | ||
} | ||
|
||
#endif /* CGLM_TEST_MAT2X3_ONCE */ | ||
|
||
TEST_IMPL(GLM_PREFIX, mat2x3_make) { | ||
float src[18] = { | ||
0.5f, 1.7f, 10.3f, 4.2f, 8.9f, 1.1f, | ||
2.3f, 4.2f, 66.5f, 23.7f, 6.6f, 8.9f, | ||
5.3f, 4.8f, 96.3f, 13.7f, 4.7f, 5.5f | ||
}; | ||
|
||
mat2x3 dest[3]; | ||
|
||
float *srcp = src; | ||
unsigned int i, j, k; | ||
|
||
for (i = 0, j = 0, k = 0; i < sizeof(src) / sizeof(float); i+=6,j++) { | ||
GLM(mat2x3_make)(srcp + i, dest[j]); | ||
|
||
ASSERT(test_eq(src[ i ], dest[j][k][0])); | ||
ASSERT(test_eq(src[i+1], dest[j][k][1])); | ||
ASSERT(test_eq(src[i+2], dest[j][k][2])); | ||
|
||
ASSERT(test_eq(src[i+3], dest[j][k+1][0])); | ||
ASSERT(test_eq(src[i+4], dest[j][k+1][1])); | ||
ASSERT(test_eq(src[i+5], dest[j][k+1][2])); | ||
} | ||
|
||
TEST_SUCCESS | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.