diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-08 22:44:37 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-08 22:44:37 +0100 |
| commit | e6c2e5418d67e9b4d12d2da74a81fc57e1147865 (patch) | |
| tree | b5879186fb6717b59a62a4e341425fea3d4e398f /assets/final/shaders/main_shader.wgsl | |
| parent | 1b89a26a750cc32725564a0c5186a437f372fd93 (diff) | |
feat(shaders): Standardize all shaders to use CommonUniforms
Define CommonUniforms struct with standard fields:
- resolution: vec2<f32>
- aspect_ratio: f32
- time: f32
- beat: f32
- audio_intensity: f32
Updated 14 shaders to use CommonUniforms:
- Replaced width/height with resolution
- Unified intensity/audio_peak → audio_intensity
- Moved effect-specific params to EffectParams struct
- visual_debug.wgsl now uses GlobalUniforms.view_proj
All shaders now have consistent uniform interface.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'assets/final/shaders/main_shader.wgsl')
| -rw-r--r-- | assets/final/shaders/main_shader.wgsl | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/assets/final/shaders/main_shader.wgsl b/assets/final/shaders/main_shader.wgsl index 7011159..5bb7d46 100644 --- a/assets/final/shaders/main_shader.wgsl +++ b/assets/final/shaders/main_shader.wgsl @@ -1,15 +1,17 @@ -struct Uniforms { - audio_peak: f32, +struct CommonUniforms { + resolution: vec2<f32>, aspect_ratio: f32, time: f32, + beat: f32, + audio_intensity: f32, }; -@group(0) @binding(0) var<uniform> uniforms: Uniforms; +@group(0) @binding(0) var<uniform> uniforms: CommonUniforms; @vertex fn vs_main(@builtin(vertex_index) i: u32) -> @builtin(position) vec4<f32> { let PI = 3.14159265; let num_sides = 7.0; - let scale = 0.5 + 0.3 * uniforms.audio_peak; + let scale = 0.5 + 0.3 * uniforms.audio_intensity; let tri_idx = f32(i / 3u); let sub_idx = i % 3u; if (sub_idx == 0u) { @@ -20,10 +22,10 @@ struct Uniforms { } @fragment fn fs_main() -> @location(0) vec4<f32> { - let h = uniforms.time * 2.0 + uniforms.audio_peak * 3.0; + let h = uniforms.time * 2.0 + uniforms.audio_intensity * 3.0; let r = sin(h) * 0.5 + 0.5; let g = sin(h + 2.0) * 0.9 + 0.3; let b = sin(h + 4.0) * 0.5 + 0.5; - let boost = uniforms.audio_peak * 0.5; + let boost = uniforms.audio_intensity * 0.5; return vec4<f32>(r + boost, g + boost, b + boost, 1.0); } |
