mirror of
https://github.com/recp/cglm.git
synced 2026-01-01 05:06:13 +00:00
matrix scale
This commit is contained in:
@@ -48,4 +48,14 @@
|
||||
_mm_store_ps(D[3], r3); \
|
||||
} while (0)
|
||||
|
||||
#define CGLM_MAT_SCALE_SSE_4x4f(M, S) \
|
||||
do { \
|
||||
__m128 xmm0; \
|
||||
xmm0 = _mm_set1_ps(S); \
|
||||
_mm_store_ps(M[0], _mm_mul_ps(_mm_load_ps(M[0]), xmm0)); \
|
||||
_mm_store_ps(M[1], _mm_mul_ps(_mm_load_ps(M[1]), xmm0)); \
|
||||
_mm_store_ps(M[2], _mm_mul_ps(_mm_load_ps(M[2]), xmm0)); \
|
||||
_mm_store_ps(M[3], _mm_mul_ps(_mm_load_ps(M[3]), xmm0)); \
|
||||
} while (0)
|
||||
|
||||
#endif /* cglm_mat_sse_h */
|
||||
|
||||
@@ -124,6 +124,19 @@ glm_mat_transpose_self(mat4 m) {
|
||||
#endif
|
||||
}
|
||||
|
||||
CGLM_INLINE
|
||||
void
|
||||
glm_mat4_scale(mat4 m, float s) {
|
||||
#if defined( __SSE__ ) || defined( __SSE2__ )
|
||||
CGLM_MAT_SCALE_SSE_4x4f(m, s);
|
||||
#else
|
||||
m[0][0] *= s; m[0][1] *= s; m[0][2] *= s; m[0][3] *= s;
|
||||
m[1][0] *= s; m[1][1] *= s; m[1][2] *= s; m[1][3] *= s;
|
||||
m[2][0] *= s; m[2][1] *= s; m[2][2] *= s; m[2][3] *= s;
|
||||
m[3][0] *= s; m[3][1] *= s; m[3][2] *= s; m[3][3] *= s;
|
||||
#endif
|
||||
}
|
||||
|
||||
CGLM_INLINE
|
||||
float
|
||||
glm_mat4_det(mat4 mat) {
|
||||
|
||||
Reference in New Issue
Block a user