diff --git a/particles/particle.playground/Contents.swift b/particles/particle.playground/Contents.swift index 694d377..912110b 100644 --- a/particles/particle.playground/Contents.swift +++ b/particles/particle.playground/Contents.swift @@ -2,7 +2,7 @@ import MetalKit import PlaygroundSupport -let frame = NSRect(x: 0, y: 0, width: 400, height: 400) +let frame = NSRect(x: 0, y: 0, width: 400, height: 800) let delegate = MetalView() let view = MTKView(frame: frame, device: delegate.device) view.delegate = delegate diff --git a/particles/particle.playground/Resources/Shaders.metal b/particles/particle.playground/Resources/Shaders.metal index 0da8ea0..230648a 100644 --- a/particles/particle.playground/Resources/Shaders.metal +++ b/particles/particle.playground/Resources/Shaders.metal @@ -14,10 +14,12 @@ float distanceToParticle(float2 point, Particle p) { kernel void compute(texture2d output [[texture(0)]], constant float &time [[buffer(0)]], uint2 gid [[thread_position_in_grid]]) { - int width = output.get_width(); - int height = output.get_height(); + float width = output.get_width(); + float height = output.get_height(); float2 uv = float2(gid) / float2(width, height); - float2 center = float2(0.5, time); + float aspect = width / height; + uv.x *= aspect; + float2 center = float2(aspect / 2, time); float radius = 0.05; float stop = 1 - radius; if (time >= stop) { center.y = stop; } diff --git a/particles/particle.playground/playground.xcworkspace/xcuserdata/mhorga.xcuserdatad/UserInterfaceState.xcuserstate b/particles/particle.playground/playground.xcworkspace/xcuserdata/mhorga.xcuserdatad/UserInterfaceState.xcuserstate index b1d57fa..861773a 100644 Binary files a/particles/particle.playground/playground.xcworkspace/xcuserdata/mhorga.xcuserdatad/UserInterfaceState.xcuserstate and b/particles/particle.playground/playground.xcworkspace/xcuserdata/mhorga.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/particles/particle.playground/timeline.xctimeline b/particles/particle.playground/timeline.xctimeline deleted file mode 100644 index bf468af..0000000 --- a/particles/particle.playground/timeline.xctimeline +++ /dev/null @@ -1,6 +0,0 @@ - - - - -