diff options
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/math_base_inline.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c index 8cc5c31a4c7..1dc7c21f1d4 100644 --- a/source/blender/blenlib/intern/math_base_inline.c +++ b/source/blender/blenlib/intern/math_base_inline.c @@ -387,6 +387,14 @@ MINLINE float wrapf(float value, float max, float min) return (range != 0.0f) ? value - (range * floorf((value - min) / range)) : min; } +MINLINE float pingpongf(float value, float scale) +{ + if (scale == 0.0f) { + return 0.0f; + } + return fabsf(fractf((value - scale) / (scale * 2.0f)) * scale * 2.0f - scale); +} + // Square. MINLINE int square_s(short a) |