diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-28 02:39:04 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-28 02:39:04 +0100 |
| commit | 472c2258dbeca000a454ea1781f09df63477563e (patch) | |
| tree | 98ac75c3824f19f4a598a807b3cb6aa13e8cb0c3 /common/shaders/heptagon.wgsl | |
| parent | 1c5a9fb7b8c704a59ec58894adf46d73d1615072 (diff) | |
replace wgsl type: vec4<f32> -> vec4f ..
Diffstat (limited to 'common/shaders/heptagon.wgsl')
| -rw-r--r-- | common/shaders/heptagon.wgsl | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/common/shaders/heptagon.wgsl b/common/shaders/heptagon.wgsl index 519dce5..a8a450f 100644 --- a/common/shaders/heptagon.wgsl +++ b/common/shaders/heptagon.wgsl @@ -5,29 +5,29 @@ // Standard v2 post-process layout (bindings 0,1 unused for scene effects) @group(0) @binding(2) var<uniform> uniforms: UniformsSequenceParams; -fn sdf_heptagon(p: vec2<f32>, r: f32) -> f32 { +fn sdf_heptagon(p: vec2f, r: f32) -> f32 { let an = 3.141593 / 7.0; // PI/7 for heptagon - let acs = vec2<f32>(cos(an), sin(an)); + let acs = vec2f(cos(an), sin(an)); let bn = (atan2(p.x, p.y) % (2.0 * an)) - an; - let q = length(p) * vec2<f32>(cos(bn), abs(sin(bn))); + let q = length(p) * vec2f(cos(bn), abs(sin(bn))); return length(q - r * acs) * sign(q.x - r * acs.x); } -@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> { +@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4f { let aspect = uniforms.aspect_ratio; - let uv = (in.uv * 2.0 - 1.0) * vec2<f32>(aspect, 1.0); + let uv = (in.uv * 2.0 - 1.0) * vec2f(aspect, 1.0); let rotation = uniforms.beat_time * 0.5; let c = cos(rotation); let s = sin(rotation); - let rot_uv = vec2<f32>( + let rot_uv = vec2f( uv.x * c - uv.y * s, uv.x * s + uv.y * c ); let dist = sdf_heptagon(rot_uv, 0.3); - let color = mix(vec3<f32>(0.2, 0.4, 0.8), vec3<f32>(1.0, 0.8, 0.2), + let color = mix(vec3f(0.2, 0.4, 0.8), vec3f(1.0, 0.8, 0.2), smoothstep(0.01, -0.01, dist)); - return vec4<f32>(color, 1.0); + return vec4f(color, 1.0); } |
