summaryrefslogtreecommitdiffstats
path: root/math.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2024-10-24 18:45:29 -0700
committeryum <yum.food.vr@gmail.com>2024-10-24 18:45:29 -0700
commit1705cd25f5bcd796a560bcce22ef91d190a94900 (patch)
tree122c80d25228e2e7c83fa720982576535223ebab /math.cginc
parent09aa66c9c13965105133ca000da4d2c37d455877 (diff)
add water stuff
Diffstat (limited to 'math.cginc')
-rw-r--r--math.cginc5
1 files changed, 5 insertions, 0 deletions
diff --git a/math.cginc b/math.cginc
index bfbe653..8aaa5ea 100644
--- a/math.cginc
+++ b/math.cginc
@@ -125,6 +125,11 @@ float dabs(float a, float k)
return log2(exp2(k * a) + exp2(-1.0 * k * a));
}
+float dsaturate(float x, float k)
+{
+ return dmin(dmax(x, 0, k), 1, k);
+}
+
float rand(uint seed) {
seed = seed * 747796405 + 2891336453;
uint result = ((seed >> ((seed >> 28) + 4)) ^ seed) * 277803737;