blob: 607ac60a09bddade46325a515bcb84875a8c2395 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
@group(0) @binding(0) var smplr: sampler;
@group(0) @binding(1) var txt: texture_2d<f32>;
#include "common_uniforms"
struct DistortParams {
strength: f32,
speed: f32,
};
@group(0) @binding(2) var<uniform> uniforms: CommonUniforms;
@group(0) @binding(3) var<uniform> params: DistortParams;
#include "render/fullscreen_vs"
@fragment fn fs_main(@builtin(position) p: vec4<f32>) -> @location(0) vec4<f32> {
let uv = p.xy / uniforms.resolution;
let dist = params.strength * uniforms.audio_intensity * sin(uv.y * 20.0 + uniforms.time * params.speed * 5.0);
return textureSample(txt, smplr, uv + vec2<f32>(dist, 0.0));
}
|