Skip to content

Commit

Permalink
updated to Swift 4
Browse files Browse the repository at this point in the history
  • Loading branch information
Marius Horga committed Oct 3, 2017
1 parent 1b040d7 commit bc61d4f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion particles/particle.playground/Contents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions particles/particle.playground/Resources/Shaders.metal
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ float distanceToParticle(float2 point, Particle p) {
kernel void compute(texture2d<float, access::write> 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; }
Expand Down
Binary file not shown.
6 changes: 0 additions & 6 deletions particles/particle.playground/timeline.xctimeline

This file was deleted.

0 comments on commit bc61d4f

Please sign in to comment.