diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-09 11:17:53 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-09 11:17:53 +0100 |
| commit | fd19130b3360d17b44247ec26533b20e051b7f8c (patch) | |
| tree | f3116150299e320c4a5951aa7a2fdd1dc12a9511 /assets/final/shaders/distort.wgsl | |
| parent | 698649d30129ba26a7ad9c13a874686640f43972 (diff) | |
feat: WGSL Uniform Buffer Validation & Consolidation (Task #75)
- Added to validate WGSL/C++ struct alignment.
- Integrated validation into .
- Standardized uniform usage in , , , .
- Renamed generic to specific names in WGSL and C++ to avoid collisions.
- Added and updated .
- handoff(Gemini): Completed Task #75.
Diffstat (limited to 'assets/final/shaders/distort.wgsl')
| -rw-r--r-- | assets/final/shaders/distort.wgsl | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/assets/final/shaders/distort.wgsl b/assets/final/shaders/distort.wgsl index cca01c4..4de8441 100644 --- a/assets/final/shaders/distort.wgsl +++ b/assets/final/shaders/distort.wgsl @@ -3,13 +3,21 @@ struct CommonUniforms { resolution: vec2<f32>, + _pad0: f32, + _pad1: f32, aspect_ratio: f32, time: f32, beat: f32, audio_intensity: f32, }; +struct DistortParams { + strength: f32, + speed: f32, +}; + @group(0) @binding(2) var<uniform> uniforms: CommonUniforms; +@group(0) @binding(3) var<uniform> params: DistortParams; @vertex fn vs_main(@builtin(vertex_index) i: u32) -> @builtin(position) vec4<f32> { var pos = array<vec2<f32>, 3>( @@ -22,6 +30,6 @@ struct CommonUniforms { @fragment fn fs_main(@builtin(position) p: vec4<f32>) -> @location(0) vec4<f32> { let uv = p.xy / uniforms.resolution; - let dist = 0.1 * uniforms.audio_intensity * sin(uv.y * 20.0 + uniforms.time * 5.0); + 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)); } |
