mat4: precise matrix inverse

* TODO: duplicated code!
This commit is contained in:
Recep Aslantas
2016-10-11 14:22:25 +03:00
parent b2e8e7c77b
commit 3c26a7f820
2 changed files with 149 additions and 1 deletions

View File

@@ -340,7 +340,9 @@ glm_mat4_det(mat4 mat) {
/*!
* @brief inverse mat4 and store in dest
*
* @todo this function could return existence of inverse (BOOL)
* this func uses reciprocal approximation without extra corrections
* e.g Newton-Raphson. this should work faster than _precise,
* to get precise value use _precise version
*
* @param[in] mat matrix
* @param[out] dest inverse matrix
@@ -399,4 +401,26 @@ glm_mat4_inv(mat4 mat, mat4 dest) {
#endif
}
/*!
* @brief inverse mat4 precisely and store in dest
*
* this do same thing as glm_mat4_inv did. the only diff is this func uses
* division instead of reciprocal approximation. Due to division this might
* work slower than glm_mat4_inv
*
* @param[in] mat matrix
* @param[out] dest inverse matrix
*/
CGLM_INLINE
void
glm_mat4_inv_precise(mat4 mat, mat4 dest) {
#if defined( __SSE__ ) || defined( __SSE2__ )
glm_mat4_inv_precise_sse2(mat, dest);
#else
glm_mat4_inv_precise(mat, dest);
#endif
}
#else
#endif /* cglm_mat_h */