mirror of
https://github.com/recp/cglm.git
synced 2025-10-04 09:08:53 +00:00
update mat4 and mat4 mul
because m1 and m2 could be same matrix e.g dest = m1*m1
This commit is contained in:
@@ -33,14 +33,30 @@
|
|||||||
|
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
glm_mat_mul4(float * __restrict m1,
|
glm_mat_mul4(mat4 m1, mat4 m2, mat4 dest) {
|
||||||
float * __restrict m2,
|
float * __restrict d;
|
||||||
float * __restrict dest) {
|
float * __restrict l;
|
||||||
|
|
||||||
|
d = (float *)dest;
|
||||||
|
l = (float *)m1;
|
||||||
|
|
||||||
|
if (m1 != m2) {
|
||||||
|
float * __restrict r;
|
||||||
|
|
||||||
|
r = (float *)m2;
|
||||||
|
|
||||||
#if defined( __SSE__ ) || defined( __SSE2__ )
|
#if defined( __SSE__ ) || defined( __SSE2__ )
|
||||||
CGLM_MAT_MUL_SSE_4x4f(m1, m2, dest);
|
CGLM_MAT_MUL_SSE_4x4f(l, r, d);
|
||||||
#else
|
#else
|
||||||
glm_mat_mul4_impl(m1, m2, dest);
|
glm_mat_mul4_impl(l, r, d);
|
||||||
#endif
|
#endif
|
||||||
|
} else {
|
||||||
|
#if defined( __SSE__ ) || defined( __SSE2__ )
|
||||||
|
CGLM_MAT_MUL_SSE_4x4f(l, l, d);
|
||||||
|
#else
|
||||||
|
glm_mat_mul4_impl(l, l, d);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* cglm_mat_h */
|
#endif /* cglm_mat_h */
|
||||||
|
@@ -14,13 +14,13 @@ typedef float vec3[3];
|
|||||||
typedef float vec4[4];
|
typedef float vec4[4];
|
||||||
|
|
||||||
typedef float mat3[3];
|
typedef float mat3[3];
|
||||||
typedef float mat4[16];
|
typedef vec4 mat4[4];
|
||||||
|
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
glm_mat_mul4(float * __restrict m1,
|
glm_mat_mul4(mat4 m1,
|
||||||
float * __restrict m2,
|
mat4 m2,
|
||||||
float * __restrict dest);
|
mat4 dest);
|
||||||
|
|
||||||
#include "cglm-vec.h"
|
#include "cglm-vec.h"
|
||||||
#include "cglm-mat.h"
|
#include "cglm-mat.h"
|
||||||
|
Reference in New Issue
Block a user