func for make matrix identity

This commit is contained in:
Recep Aslantas
2017-05-29 20:52:38 +03:00
parent 3728102644
commit 3fbf590d39
6 changed files with 62 additions and 0 deletions

View File

@@ -25,6 +25,10 @@ CGLM_EXPORT
void
glmc_mat4_copy(mat4 mat, mat4 dest);
CGLM_EXPORT
void
glmc_mat4_identity(mat4 mat);
CGLM_EXPORT
void
glmc_mat4_pick3(mat4 mat, mat3 dest);

View File

@@ -20,6 +20,10 @@ CGLM_EXPORT
void
glmc_mat3_copy(mat3 mat, mat3 dest);
CGLM_EXPORT
void
glmc_mat3_identity(mat3 mat);
CGLM_EXPORT
void
glmc_mat3_mul(mat3 m1, mat3 m2, mat3 dest);

View File

@@ -74,6 +74,27 @@ glm_mat4_copy(mat4 mat, mat4 dest) {
#endif
}
/*!
* @brief make given matrix identity. It is identical with below,
* but it is more easy to do that with this func especially for members
* e.g. glm_mat4_identity(aStruct->aMatrix);
*
* @code
* glm_mat4_copy(GLM_MAT4_IDENTITY, mat); // C only
*
* // or
* mat4 mat = GLM_MAT4_IDENTITY_INIT;
* @endcode
*
* @param[in, out] mat destination
*/
CGLM_INLINE
void
glm_mat4_identity(mat4 mat) {
mat4 t = GLM_MAT4_IDENTITY_INIT;
glm_mat4_copy(t, mat);
}
/*!
* @brief copy upper-left of mat4 to mat3
*

View File

@@ -38,6 +38,27 @@ glm_mat3_copy(mat3 mat, mat3 dest) {
glm__memcpy(float, dest, mat, sizeof(mat3));
}
/*!
* @brief make given matrix identity. It is identical with below,
* but it is more easy to do that with this func especially for members
* e.g. glm_mat3_identity(aStruct->aMatrix);
*
* @code
* glm_mat3_copy(GLM_MAT3_IDENTITY, mat); // C only
*
* // or
* mat3 mat = GLM_MAT3_IDENTITY_INIT;
* @endcode
*
* @param[in, out] mat destination
*/
CGLM_INLINE
void
glm_mat3_identity(mat3 mat) {
mat3 t = GLM_MAT3_IDENTITY_INIT;
glm_mat3_copy(t, mat);
}
/*!
* @brief multiply m1 and m2 to dest
*

View File

@@ -19,6 +19,12 @@ glmc_mat4_copy(mat4 mat, mat4 dest) {
glm_mat4_copy(mat, dest);
}
CGLM_EXPORT
void
glmc_mat4_identity(mat4 mat) {
glm_mat4_identity(mat);
}
CGLM_EXPORT
void
glmc_mat4_pick3(mat4 mat, mat3 dest) {

View File

@@ -13,6 +13,12 @@ glmc_mat3_copy(mat3 mat, mat3 dest) {
glm_mat3_copy(mat, dest);
}
CGLM_EXPORT
void
glmc_mat3_identity(mat3 mat) {
glm_mat3_identity(mat);
}
CGLM_EXPORT
void
glmc_mat3_mul(mat3 m1, mat3 m2, mat3 dest) {