Use the simd types where I can

This commit is contained in:
Eryn Wells 2018-10-07 19:32:29 -07:00
parent edce32e021
commit 8f1e1335bd
9 changed files with 107 additions and 144 deletions

View file

@ -20,8 +20,8 @@ public protocol RendererDelegate {
}
struct Vertex {
let position: Point
let textureCoordinate: Point
let position: Float2
let textureCoordinate: Float2
}
public class Renderer: NSObject, MTKViewDelegate {
@ -101,13 +101,13 @@ public class Renderer: NSObject, MTKViewDelegate {
// Two triangles, plus texture coordinates.
let points: [Vertex] = [
Vertex(position: Point(x: 1, y: -1), textureCoordinate: Point(x: 1, y: 0)),
Vertex(position: Point(x: -1, y: -1), textureCoordinate: Point(x: 0, y: 0)),
Vertex(position: Point(x: -1, y: 1), textureCoordinate: Point(x: 0, y: 1)),
Vertex(position: Float2(x: 1, y: -1), textureCoordinate: Float2(x: 1, y: 0)),
Vertex(position: Float2(x: -1, y: -1), textureCoordinate: Float2(x: 0, y: 0)),
Vertex(position: Float2(x: -1, y: 1), textureCoordinate: Float2(x: 0, y: 1)),
Vertex(position: Point(x: 1, y: -1), textureCoordinate: Point(x: 1, y: 0)),
Vertex(position: Point(x: -1, y: 1), textureCoordinate: Point(x: 0, y: 1)),
Vertex(position: Point(x: 1, y: 1), textureCoordinate: Point(x: 1, y: 1))
Vertex(position: Float2(x: 1, y: -1), textureCoordinate: Float2(x: 1, y: 0)),
Vertex(position: Float2(x: -1, y: 1), textureCoordinate: Float2(x: 0, y: 1)),
Vertex(position: Float2(x: 1, y: 1), textureCoordinate: Float2(x: 1, y: 1))
]
field.update()