summaryrefslogtreecommitdiffstats
path: root/math.cginc
diff options
context:
space:
mode:
Diffstat (limited to 'math.cginc')
-rw-r--r--math.cginc10
1 files changed, 10 insertions, 0 deletions
diff --git a/math.cginc b/math.cginc
index 8938940..fd5dda0 100644
--- a/math.cginc
+++ b/math.cginc
@@ -113,5 +113,15 @@ float fbm(float3 p, const int n_octaves, float w)
return res;
}
+float median(float x, float y, float z)
+{
+ return max(min(x, y), min(max(x, y), z));
+}
+
+float median(float3 x)
+{
+ return median(x.x, x.y, x.z);
+}
+
#endif // __MATH_INC