Generate agents with compute shader

This commit is contained in:
Andras Schmelczer 2023-05-20 13:28:15 +01:00
commit 6b17a8e023
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
15 changed files with 206 additions and 154 deletions

View file

@ -5,3 +5,14 @@ fn random_with_seed(uv: vec2<f32>, seed: f32) -> f32 {
fn random(uv: vec2<f32>) -> f32 {
return fract(sin(dot(uv, vec2(12.9898, 78.233)))* 43758.5453123);
}
fn hash(state0 : u32) -> f32 {
var state : u32 = state0;
state = state ^ 2747636419u;
state = state * 2654435769u;
state = state ^ (state >> 16u);
state = state * 2654435769u;
state = state ^ (state >> 16u);
state = state * 2654435769u;
return f32(state) / 4294967295.0;
}