diff options
| author | skal <pascal.massimino@gmail.com> | 2026-03-10 23:04:13 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-03-10 23:04:13 +0100 |
| commit | 3ead818d35df56e6efbe3397967befba8d4bdb5d (patch) | |
| tree | f91287d03dbec23d33db15b072e8580e5ebd530f /src/shaders | |
| parent | 2309fc50fe822a9c9ebd3013c3837cc47fb128aa (diff) | |
fix(effects): particle sync and heptagon SDF bugs
- particles: stagger respawn y by golden-ratio index offset to break
per-row synchronization (100 particles per row fell in lock-step)
- heptagon: fix swapped atan2(x,y)->atan2(y,x) and WGSL % truncation
for negative angles (broke SDF for entire lower half of shape)
handoff(Gemini): heptagon now correct; particles desynchronized
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/shaders')
| -rw-r--r-- | src/shaders/heptagon.wgsl | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/shaders/heptagon.wgsl b/src/shaders/heptagon.wgsl index a8a450f..2467527 100644 --- a/src/shaders/heptagon.wgsl +++ b/src/shaders/heptagon.wgsl @@ -8,7 +8,9 @@ fn sdf_heptagon(p: vec2f, r: f32) -> f32 { let an = 3.141593 / 7.0; // PI/7 for heptagon let acs = vec2f(cos(an), sin(an)); - let bn = (atan2(p.x, p.y) % (2.0 * an)) - an; + let two_an = 2.0 * an; + let angle = atan2(p.y, p.x); + let bn = ((angle % two_an) + two_an) % two_an - an; let q = length(p) * vec2f(cos(bn), abs(sin(bn))); return length(q - r * acs) * sign(q.x - r * acs.x); } |
