mirror of
https://github.com/recp/cglm.git
synced 2026-01-02 13:49:59 +00:00
change steps -> stepr and move to ext
This commit is contained in:
@@ -28,37 +28,6 @@
|
||||
//////////////////////////////
|
||||
// Proposed vec4_ext functions
|
||||
|
||||
/*!
|
||||
* @brief threshold function with scalar
|
||||
*
|
||||
* @param[in] edge threshold
|
||||
* @param[in] x value to test against threshold
|
||||
* @param[out] dest destination
|
||||
*/
|
||||
CGLM_INLINE
|
||||
void
|
||||
_glm_vec4_steps(vec4 edge, float x, vec4 dest) {
|
||||
dest[0] = glm_step(edge[0], x);
|
||||
dest[1] = glm_step(edge[1], x);
|
||||
dest[2] = glm_step(edge[2], x);
|
||||
dest[3] = glm_step(edge[3], x);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief threshold function with scalar
|
||||
*
|
||||
* @param[in] edge threshold
|
||||
* @param[in] x value to test against threshold
|
||||
* @param[out] dest destination
|
||||
*/
|
||||
CGLM_INLINE
|
||||
void
|
||||
_glm_vec3_steps(vec3 edge, float x, vec3 dest) {
|
||||
dest[0] = glm_step(edge[0], x);
|
||||
dest[1] = glm_step(edge[1], x);
|
||||
dest[2] = glm_step(edge[2], x);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief set all elements of dest to value
|
||||
*
|
||||
@@ -281,7 +250,7 @@ _glm_noiseDetail_i2gxyzw(
|
||||
|
||||
// sw = step(gw, 0.0);
|
||||
vec4 sw;
|
||||
_glm_vec4_steps(gw, 0.0f, sw); // sw = step(gw, 0.0)
|
||||
glm_vec4_stepr(gw, 0.0f, sw); // sw = step(gw, 0.0)
|
||||
|
||||
// gx -= sw * (step(vec4(0), gx) - T(0.5));
|
||||
vec4 temp = {0.0f}; // temp = 0.0
|
||||
@@ -337,7 +306,7 @@ _glm_noiseDetail_i2gxyz(
|
||||
|
||||
// sz = step(gw, 0.0);
|
||||
vec4 sz;
|
||||
_glm_vec4_steps(gz, 0.0f, sz); // sz = step(gz, 0.0)
|
||||
glm_vec4_stepr(gz, 0.0f, sz); // sz = step(gz, 0.0)
|
||||
|
||||
// gx0 -= sz0 * (step(0.0, gx0) - T(0.5));
|
||||
vec4 temp = {0.0f}; // temp = 0.0
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
CGLM_INLINE void glm_vec2_fract(vec2 v, vec2 dest);
|
||||
CGLM_INLINE void glm_vec2_floor(vec2 v, vec2 dest);
|
||||
CGLM_INLINE float glm_vec2_mods(vec2 v, float s, vec2 dest);
|
||||
CGLM_INLINE float glm_vec2_steps(float edge, vec2 v, vec2 dest);
|
||||
CGLM_INLINE void glm_vec2_stepr(vec2 edge, float v, vec2 dest);
|
||||
CGLM_INLINE void glm_vec2_sqrt(vec2 v, vec2 dest);
|
||||
CGLM_INLINE void glm_vec2_complex_mul(vec2 a, vec2 b, vec2 dest)
|
||||
CGLM_INLINE void glm_vec2_complex_div(vec2 a, vec2 b, vec2 dest)
|
||||
@@ -271,6 +273,36 @@ glm_vec2_complex_mul(vec2 a, vec2 b, vec2 dest) {
|
||||
dest[1] = ti;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @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
|
||||
* @param[out] dest destination
|
||||
*/
|
||||
CGLM_INLINE
|
||||
void
|
||||
glm_vec2_steps(float edge, vec2 x, vec2 dest) {
|
||||
dest[0] = glm_step(edge, x[0]);
|
||||
dest[1] = glm_step(edge, x[1]);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @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
|
||||
* @param[out] dest destination
|
||||
*/
|
||||
CGLM_INLINE
|
||||
void
|
||||
glm_vec2_stepr(vec2 edge, float x, vec2 dest) {
|
||||
dest[0] = glm_step(edge[0], x);
|
||||
dest[1] = glm_step(edge[1], x);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief treat vectors as complex numbers and divide them as such.
|
||||
*
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
CGLM_INLINE void glm_vec3_fract(vec3 v, vec3 dest);
|
||||
CGLM_INLINE void glm_vec3_floor(vec3 v, vec3 dest);
|
||||
CGLM_INLINE float glm_vec3_mods(vec3 v, float s, vec3 dest);
|
||||
CGLM_INLINE float glm_vec3_steps(float edge, vec3 v, vec3 dest);
|
||||
CGLM_INLINE void glm_vec3_stepr(vec3 edge, float v, vec3 dest);
|
||||
CGLM_INLINE float glm_vec3_hadd(vec3 v);
|
||||
CGLM_INLINE void glm_vec3_sqrt(vec3 v, vec3 dest);
|
||||
*/
|
||||
@@ -281,6 +283,38 @@ glm_vec3_mods(vec3 x, float y, vec3 dest) {
|
||||
dest[2] = fmodf(x[2], y);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @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
|
||||
* @param[out] dest destination
|
||||
*/
|
||||
CGLM_INLINE
|
||||
void
|
||||
glm_vec3_steps(float edge, vec3 x, vec3 dest) {
|
||||
dest[0] = glm_step(edge, x[0]);
|
||||
dest[1] = glm_step(edge, x[1]);
|
||||
dest[2] = glm_step(edge, x[2]);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @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
|
||||
* @param[out] dest destination
|
||||
*/
|
||||
CGLM_INLINE
|
||||
void
|
||||
glm_vec3_stepr(vec3 edge, float x, vec3 dest) {
|
||||
dest[0] = glm_step(edge[0], x);
|
||||
dest[1] = glm_step(edge[1], x);
|
||||
dest[2] = glm_step(edge[2], x);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief vector reduction by summation
|
||||
* @warning could overflow
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
CGLM_INLINE void glm_vec4_fract(vec4 v, vec4 dest);
|
||||
CGLM_INLINE void glm_vec4_floor(vec4 v, vec4 dest);
|
||||
CGLM_INLINE float glm_vec4_mods(vec4 v, float s, vec4 dest);
|
||||
CGLM_INLINE float glm_vec4_steps(float edge, vec4 v, vec4 dest);
|
||||
CGLM_INLINE void glm_vec4_stepr(vec4 edge, float v, vec4 dest);
|
||||
CGLM_INLINE float glm_vec4_hadd(vec4 v);
|
||||
CGLM_INLINE void glm_vec4_sqrt(vec4 v, vec4 dest);
|
||||
*/
|
||||
@@ -321,6 +323,40 @@ glm_vec4_mods(vec4 x, float y, vec4 dest) {
|
||||
dest[3] = fmodf(x[3], y);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @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
|
||||
* @param[out] dest destination
|
||||
*/
|
||||
CGLM_INLINE
|
||||
void
|
||||
glm_vec4_steps(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 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
|
||||
* @param[out] dest destination
|
||||
*/
|
||||
CGLM_INLINE
|
||||
void
|
||||
glm_vec4_stepr(vec4 edge, float x, vec4 dest) {
|
||||
dest[0] = glm_step(edge[0], x);
|
||||
dest[1] = glm_step(edge[1], x);
|
||||
dest[2] = glm_step(edge[2], x);
|
||||
dest[3] = glm_step(edge[3], x);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief vector reduction by summation
|
||||
* @warning could overflow
|
||||
|
||||
Reference in New Issue
Block a user