Refactor & improve

This commit is contained in:
Andras Schmelczer 2023-05-01 12:14:36 +01:00
commit b3d9229af5
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
22 changed files with 713 additions and 334 deletions

View file

@ -1,21 +1,17 @@
struct Settings {
size: vec2<f32>,
deltaTime: f32,
time: f32,
brushColor: vec3<f32>,
speciesColorA: vec3<f32>,
speciesColorB: vec3<f32>,
};
@group(0) @binding(0) var<uniform> settings: Settings;
@group(0) @binding(1) var Sampler: sampler;
@group(0) @binding(2) var trailMap: texture_2d<f32>;
@group(0) @binding(3) var noiseMap: texture_2d<f32>;
@group(1) @binding(0) var<uniform> settings: Settings;
@group(1) @binding(1) var Sampler: sampler;
@group(1) @binding(2) var trailMap: texture_2d<f32>;
@fragment
fn fragment(@location(0) uv: vec2<f32>) -> @location(0) vec4<f32> {
let traces = textureSample(trailMap, Sampler, uv);
let noise = textureSample(noiseMap, Sampler, uv);
let random = textureSample(noise, noiseSampler, uv);
let speciesAStrength = traces.r;
let speciesBStrength = traces.g;
@ -28,7 +24,7 @@ fn fragment(@location(0) uv: vec2<f32>) -> @location(0) vec4<f32> {
));
let bg = vec3(0.9) + 0.2 * (noise.r - 0.5);
let bg = vec3(0.9) + 0.05 * (random.r - 0.5);
return vec4(bg - rgbColor, 1);