pick mat3 from mat4

This commit is contained in:
Recep Aslantas
2016-10-11 00:15:57 +03:00
parent 77ed5d389d
commit 5344599ae4
2 changed files with 45 additions and 0 deletions

View File

@@ -63,6 +63,32 @@ glm_mat4_dup(mat4 mat, mat4 dest) {
#endif
}
/*!
* @brief copy top-left of mat4 to mat3
*
* @param[in] mat source
* @param[out] dest destination
*/
CGLM_INLINE
void
glm_mat4_pick3(mat4 mat, mat3 dest) {
#if defined( __SSE__ ) || defined( __SSE2__ )
glm_mat4_pick3_sse2(mat, dest);
#else
dest[0][0] = mat[0][0];
dest[0][1] = mat[0][1];
dest[0][2] = mat[0][2];
dest[1][0] = mat[1][0];
dest[1][1] = mat[1][1];
dest[1][2] = mat[1][2];
dest[2][0] = mat[2][0];
dest[2][1] = mat[2][1];
dest[2][2] = mat[2][2];
#endif
}
/*!
* @brief multiply m1 and m2 to dest
*