mirror of
https://github.com/recp/cglm.git
synced 2026-08-31 11:12:48 -05:00
Merge branch 'master' into optimize-inv
This commit is contained in:
+5
-18
@@ -57,7 +57,6 @@
|
||||
CGLM_INLINE void glm_vec4_clamp(vec4 v, float minVal, float maxVal);
|
||||
CGLM_INLINE void glm_vec4_lerp(vec4 from, vec4 to, float t, vec4 dest);
|
||||
CGLM_INLINE void glm_vec4_lerpc(vec4 from, vec4 to, float t, vec4 dest);
|
||||
CGLM_INLINE void glm_vec4_step_uni(float edge, vec4 x, vec4 dest);
|
||||
CGLM_INLINE void glm_vec4_step(vec4 edge, vec4 x, vec4 dest);
|
||||
CGLM_INLINE void glm_vec4_smoothstep_uni(float edge0, float edge1, vec4 x, vec4 dest);
|
||||
CGLM_INLINE void glm_vec4_smoothstep(vec4 edge0, vec4 edge1, vec4 x, vec4 dest);
|
||||
@@ -75,6 +74,7 @@
|
||||
glm_vec4_inv
|
||||
glm_vec4_inv_to
|
||||
glm_vec4_mulv
|
||||
glm_vec4_step_uni --> use glm_vec4_steps
|
||||
*/
|
||||
|
||||
#ifndef cglm_vec4_h
|
||||
@@ -92,6 +92,7 @@
|
||||
#define glm_vec4_inv(v) glm_vec4_negate(v)
|
||||
#define glm_vec4_inv_to(v, dest) glm_vec4_negate_to(v, dest)
|
||||
#define glm_vec4_mulv(a, b, d) glm_vec4_mul(a, b, d)
|
||||
#define glm_vec4_step_uni(edge, x, dest) glm_vec4_steps(edge, x, dest)
|
||||
|
||||
#define GLM_VEC4_ONE_INIT {1.0f, 1.0f, 1.0f, 1.0f}
|
||||
#define GLM_VEC4_BLACK_INIT {0.0f, 0.0f, 0.0f, 1.0f}
|
||||
@@ -529,6 +530,8 @@ glm_vec4_divs(vec4 v, float s, vec4 dest) {
|
||||
glmm_store(dest, wasm_f32x4_div(glmm_load(v), wasm_f32x4_splat(s)));
|
||||
#elif defined( __SSE__ ) || defined( __SSE2__ )
|
||||
glmm_store(dest, _mm_div_ps(glmm_load(v), glmm_set1(s)));
|
||||
#elif defined(CGLM_NEON_FP)
|
||||
vst1q_f32(dest, vdivq_f32(vld1q_f32(v), vdupq_n_f32(s)));
|
||||
#else
|
||||
glm_vec4_scale(v, 1.0f / s, dest);
|
||||
#endif
|
||||
@@ -1148,22 +1151,6 @@ glm_vec4_mixc(vec4 from, vec4 to, float t, vec4 dest) {
|
||||
glm_vec4_lerpc(from, to, t, dest);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief threshold function (unidimensional)
|
||||
*
|
||||
* @param[in] edge threshold
|
||||
* @param[in] x value to test against threshold
|
||||
* @param[out] dest destination
|
||||
*/
|
||||
CGLM_INLINE
|
||||
void
|
||||
glm_vec4_step_uni(float edge, vec4 x, vec4 dest) {
|
||||
dest[0] = glm_step(edge, x[0]);
|
||||
dest[1] = glm_step(edge, x[1]);
|
||||
dest[2] = glm_step(edge, x[2]);
|
||||
dest[3] = glm_step(edge, x[3]);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief threshold function
|
||||
*
|
||||
@@ -1350,7 +1337,7 @@ glm_vec4_refract(vec4 v, vec4 n, float eta, vec4 dest) {
|
||||
|
||||
ndi = glm_vec4_dot(n, v);
|
||||
eni = eta * ndi;
|
||||
k = 1.0f + eta * eta - eni * eni;
|
||||
k = 1.0f - eta * eta + eni * eni;
|
||||
|
||||
if (k < 0.0f) {
|
||||
glm_vec4_zero(dest);
|
||||
|
||||
Reference in New Issue
Block a user