Python/OpenCV proof of concept plus first native Swift port
Snapshot before the Python POC is removed. The POC (main.py, effects.py, panel.py, shaders.py, effects/*.glsl, flake.nix) is the reference for the native app under native/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
6591138bbf
27 changed files with 2076 additions and 0 deletions
13
native/effects/kaleidoscope.metal
Normal file
13
native/effects/kaleidoscope.metal
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
// Folds the picture into mirrored wedges around the centre.
|
||||
// order 90
|
||||
// slider segments 2.0 16.0 6.0
|
||||
// slider spin -2.0 2.0 0.2
|
||||
float4 effect(float2 uv, Inputs in) {
|
||||
float2 shape = float2(in.resolution.x / in.resolution.y, 1.0);
|
||||
float2 c = (uv - 0.5) * shape;
|
||||
float wedge = 6.2832 / floor(in.p.segments);
|
||||
float a = atan2(c.y, c.x) + in.time * in.p.spin;
|
||||
a = abs(a - wedge * floor(a / wedge) - wedge * 0.5) - 1.5708; // fold into one mirrored wedge, pointing up
|
||||
float2 from = float2(cos(a), sin(a)) * length(c) / shape + 0.5;
|
||||
return float4(in.image.sample(in.smp, from).rgb, 1.0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue