mirror of
https://github.com/recp/cglm.git
synced 2025-12-24 12:32:40 +00:00
steps and stepr boilerplate
This commit is contained in:
@@ -205,6 +205,14 @@ CGLM_EXPORT
|
||||
void
|
||||
glmc_vec2_lerp(vec2 from, vec2 to, float t, vec2 dest);
|
||||
|
||||
CGLM_EXPORT
|
||||
void
|
||||
glmc_vec2_steps(float edge, vec2 x, vec2 dest);
|
||||
|
||||
CGLM_EXPORT
|
||||
void
|
||||
glmc_vec2_stepr(vec2 edge, float x, vec2 dest);
|
||||
|
||||
CGLM_EXPORT
|
||||
void
|
||||
glmc_vec2_complex_mul(vec2 a, vec2 b, vec2 dest);
|
||||
|
||||
@@ -330,6 +330,14 @@ CGLM_EXPORT
|
||||
void
|
||||
glmc_vec3_mods(vec3 v, float s, vec3 dest);
|
||||
|
||||
CGLM_EXPORT
|
||||
void
|
||||
glmc_vec3_steps(float edge, vec3 x, vec3 dest);
|
||||
|
||||
CGLM_EXPORT
|
||||
void
|
||||
glmc_vec3_stepr(vec3 edge, float x, vec3 dest);
|
||||
|
||||
CGLM_EXPORT
|
||||
float
|
||||
glmc_vec3_hadd(vec3 v);
|
||||
|
||||
@@ -307,6 +307,14 @@ CGLM_EXPORT
|
||||
void
|
||||
glmc_vec4_mods(vec4 v, float s, vec4 dest);
|
||||
|
||||
CGLM_EXPORT
|
||||
void
|
||||
glmc_vec4_steps(float edge, vec4 x, vec4 dest);
|
||||
|
||||
CGLM_EXPORT
|
||||
void
|
||||
glmc_vec4_stepr(vec4 edge, float x, vec4 dest);
|
||||
|
||||
CGLM_EXPORT
|
||||
float
|
||||
glmc_vec4_hadd(vec4 v);
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
CGLM_INLINE vec2s glms_vec2_abs(vec2s v)
|
||||
CGLM_INLINE vec2s glms_vec2_fract(vec2s v)
|
||||
CGLM_INLINE vec2s glms_vec2_floor(vec2s v)
|
||||
CGLM_INLINE vec2s glms_vec2_steps(float edge, vec2s v)
|
||||
CGLM_INLINE vec2s glms_vec2_stepr(vec2s edge, float v)
|
||||
CGLM_INLINE vec2s glms_vec2_sqrt(vec2s v)
|
||||
*/
|
||||
|
||||
@@ -244,6 +246,38 @@ glms_vec2_(mods)(vec2s v, float s) {
|
||||
return r;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief threshold each vector item with scalar
|
||||
* condition is: (x[i] < edge) ? 0.0 : 1.0
|
||||
*
|
||||
* @param[in] edge threshold
|
||||
* @param[in] x vector to test against threshold
|
||||
* @returns destination
|
||||
*/
|
||||
CGLM_INLINE
|
||||
vec2s
|
||||
glms_vec2_(steps)(float edge, vec2s x) {
|
||||
vec2s r;
|
||||
glm_vec2_steps(edge, x.raw, r.raw);
|
||||
return r;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief threshold a value with *vector* as the threshold
|
||||
* condition is: (x < edge[i]) ? 0.0 : 1.0
|
||||
*
|
||||
* @param[in] edge threshold vector
|
||||
* @param[in] x value to test against threshold
|
||||
* @returns destination
|
||||
*/
|
||||
CGLM_INLINE
|
||||
vec2s
|
||||
glms_vec2_(stepr)(vec2s edge, float x) {
|
||||
vec2s r;
|
||||
glm_vec2_stepr(edge.raw, x, r.raw);
|
||||
return r;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief square root of each vector item
|
||||
*
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
CGLM_INLINE vec3s glms_vec3_abs(vec3s v);
|
||||
CGLM_INLINE vec3s glms_vec3_fract(vec3s v);
|
||||
CGLM_INLINE vec3s glms_vec3_floor(vec3s v);
|
||||
CGLM_INLINE vec3s glms_vec3_steps(float edge, vec3s v);
|
||||
CGLM_INLINE vec3s glms_vec3_stepr(vec3s edge, float v);
|
||||
CGLM_INLINE float glms_vec3_hadd(vec3s v);
|
||||
CGLM_INLINE vec3s glms_vec3_sqrt(vec3s v);
|
||||
*/
|
||||
@@ -260,6 +262,38 @@ glms_vec3_(mods)(vec3s v, float s) {
|
||||
return r;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief threshold each vector item with scalar
|
||||
* condition is: (x[i] < edge) ? 0.0 : 1.0
|
||||
*
|
||||
* @param[in] edge threshold
|
||||
* @param[in] x vector to test against threshold
|
||||
* @returns destination
|
||||
*/
|
||||
CGLM_INLINE
|
||||
vec3s
|
||||
glms_vec3_(steps)(float edge, vec3s x) {
|
||||
vec3s r;
|
||||
glm_vec3_steps(edge, x.raw, r.raw);
|
||||
return r;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief threshold a value with *vector* as the threshold
|
||||
* condition is: (x < edge[i]) ? 0.0 : 1.0
|
||||
*
|
||||
* @param[in] edge threshold vector
|
||||
* @param[in] x value to test against threshold
|
||||
* @returns destination
|
||||
*/
|
||||
CGLM_INLINE
|
||||
vec3s
|
||||
glms_vec3_(stepr)(vec3s edge, float x) {
|
||||
vec3s r;
|
||||
glm_vec3_stepr(edge.raw, x, r.raw);
|
||||
return r;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief vector reduction by summation
|
||||
* @warning could overflow
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
CGLM_INLINE vec4s glms_vec4_abs(vec4s v);
|
||||
CGLM_INLINE vec4s glms_vec4_fract(vec4s v);
|
||||
CGLM_INLINE float glms_vec4_floor(vec4s v);
|
||||
CGLM_INLINE float glms_vec4_steps(float edge, vec4s v);
|
||||
CGLM_INLINE void glms_vec4_stepr(vec4s edge, float v);
|
||||
CGLM_INLINE float glms_vec4_hadd(vec4s v);
|
||||
CGLM_INLINE vec4s glms_vec4_sqrt(vec4s v);
|
||||
*/
|
||||
@@ -260,6 +262,38 @@ glms_vec4_(mods)(vec4s v, float s) {
|
||||
return r;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief threshold each vector item with scalar
|
||||
* condition is: (x[i] < edge) ? 0.0 : 1.0
|
||||
*
|
||||
* @param[in] edge threshold
|
||||
* @param[in] x vector to test against threshold
|
||||
* @returns destination
|
||||
*/
|
||||
CGLM_INLINE
|
||||
vec4s
|
||||
glms_vec4_(steps)(float edge, vec4s x) {
|
||||
vec4s r;
|
||||
glm_vec4_steps(edge, x.raw, r.raw);
|
||||
return r;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief threshold a value with *vector* as the threshold
|
||||
* condition is: (x < edge[i]) ? 0.0 : 1.0
|
||||
*
|
||||
* @param[in] edge threshold vector
|
||||
* @param[in] x value to test against threshold
|
||||
* @returns destination
|
||||
*/
|
||||
CGLM_INLINE
|
||||
vec4s
|
||||
glms_vec4_(stepr)(vec4s edge, float x) {
|
||||
vec4s r;
|
||||
glm_vec4_stepr(edge.raw, x, r.raw);
|
||||
return r;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief vector reduction by summation
|
||||
* @warning could overflow
|
||||
|
||||
12
src/vec2.c
12
src/vec2.c
@@ -291,6 +291,18 @@ glmc_vec2_mods(vec2 v, float s, vec2 dest) {
|
||||
glm_vec2_mods(v, s, dest);
|
||||
}
|
||||
|
||||
CGLM_EXPORT
|
||||
void
|
||||
glmc_vec2_step(vec2 edge, vec2 v, vec2 dest) {
|
||||
glm_vec2_step(edge, v, dest);
|
||||
}
|
||||
|
||||
CGLM_EXPORT
|
||||
void
|
||||
glmc_vec2_steps(float edge, vec2 v, vec2 dest) {
|
||||
glm_vec2_steps(edge, v, dest);
|
||||
}
|
||||
|
||||
CGLM_EXPORT
|
||||
void
|
||||
glmc_vec2_lerp(vec2 from, vec2 to, float t, vec2 dest) {
|
||||
|
||||
Reference in New Issue
Block a user