summaryrefslogtreecommitdiff
path: root/common/shaders/heptagon.wgsl
diff options
context:
space:
mode:
Diffstat (limited to 'common/shaders/heptagon.wgsl')
-rw-r--r--common/shaders/heptagon.wgsl16
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);
}