Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharlie Jolly <charlie>2021-10-15 17:27:16 +0300
committerCharlie Jolly <mistajolly@gmail.com>2021-10-15 17:28:20 +0300
commit104887800c0f221fbcffa84bb360dd9ff001d7f1 (patch)
tree743a308c6eda1918e4e97df0d8ba32b7046bedf7 /source/blender/blenlib/intern/math_base_inline.c
parent6e4ab5b761b03b52177985ecbeb2c2f576159c74 (diff)
Geometry Nodes: Add Voronoi Texture
Port shader Voronoi to GN Reviewed By: JacquesLucke Differential Revision: https://developer.blender.org/D12725
Diffstat (limited to 'source/blender/blenlib/intern/math_base_inline.c')
-rw-r--r--source/blender/blenlib/intern/math_base_inline.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c
index 49f9faf1704..f609d5f8e8b 100644
--- a/source/blender/blenlib/intern/math_base_inline.c
+++ b/source/blender/blenlib/intern/math_base_inline.c
@@ -511,6 +511,22 @@ MINLINE float smoothminf(float a, float b, float c)
}
}
+MINLINE float smoothstep(float edge0, float edge1, float x)
+{
+ float result;
+ if (x < edge0) {
+ result = 0.0f;
+ }
+ else if (x >= edge1) {
+ result = 1.0f;
+ }
+ else {
+ float t = (x - edge0) / (edge1 - edge0);
+ result = (3.0f - 2.0f * t) * (t * t);
+ }
+ return result;
+}
+
MINLINE double min_dd(double a, double b)
{
return (a < b) ? a : b;