summaryrefslogtreecommitdiffstats
path: root/math.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2024-11-05 21:37:05 -0800
committeryum <yum.food.vr@gmail.com>2024-11-05 21:37:05 -0800
commit23ed2a68de0d1d9c4538e71b05b87b791d30459f (patch)
tree8e6947714e3927e15cf140b2662d59457cb7deb2 /math.cginc
parentc137315f90aa4658f0729bdc73400e1c11be350d (diff)
Fog cleanup
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 636232d..758ff52 100644
--- a/math.cginc
+++ b/math.cginc
@@ -136,6 +136,11 @@ float dsaturate(float x, float k)
return dmin(dmax(x, 0, k), 1, k);
}
+float dclamp(float x, float lo, float hi, float k)
+{
+ return dmin(dmax(x, lo, k), hi, k);
+}
+
float rand(uint seed) {
seed = seed * 747796405 + 2891336453;
uint result = ((seed >> ((seed >> 28) + 4)) ^ seed) * 277803737;