From c5119193ffaedf4ac94fecfb434a3292a4746259 Mon Sep 17 00:00:00 2001 From: ladevieq Date: Sun, 26 Sep 2021 23:57:26 +0200 Subject: Refactor gltf loading and triangles attributes --- shaders/include/rand.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 shaders/include/rand.h (limited to 'shaders/include/rand.h') diff --git a/shaders/include/rand.h b/shaders/include/rand.h new file mode 100644 index 0000000..e1f8b27 --- /dev/null +++ b/shaders/include/rand.h @@ -0,0 +1,12 @@ +uint pcg_hash(inout uint seed) +{ + uint state = seed; + seed *= 747796405u + 2891336453u; + uint word = ((state >> ((state >> 28u) + 4u)) ^ state) * 277803737u; + return (word >> 22u) ^ word; +} + +float rand(inout uint seed) +{ + return float(pcg_hash(seed)) / 4294967296.0; +} -- cgit v1.3