updated to Swift 3
This commit is contained in:
parent
474a32a19d
commit
14db3095d0
Binary file not shown.
|
|
@ -22,5 +22,4 @@ vertex Vertex vertex_func(constant Vertex *vertices [[buffer(0)]], constant Unif
|
||||||
|
|
||||||
fragment half4 fragment_func(Vertex vert [[stage_in]]) {
|
fragment half4 fragment_func(Vertex vert [[stage_in]]) {
|
||||||
return half4(vert.color);
|
return half4(vert.color);
|
||||||
// return half4(0.0, 1.0, 0.0, 1.0);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,6 @@ public class MetalView: NSObject, MTKViewDelegate {
|
||||||
let modelMatrix = matrix_multiply(matrix_multiply(rotatedX, rotatedY), scaled)
|
let modelMatrix = matrix_multiply(matrix_multiply(rotatedX, rotatedY), scaled)
|
||||||
let cameraPosition = vector_float3(0, 0, -3)
|
let cameraPosition = vector_float3(0, 0, -3)
|
||||||
let viewMatrix = translationMatrix(position: cameraPosition)
|
let viewMatrix = translationMatrix(position: cameraPosition)
|
||||||
// let aspect = Float(view.drawableSize.width / view.drawableSize.height)
|
|
||||||
// let projMatrix = projectionMatrix(0, far: 10, aspect: aspect, fovy: 1)
|
|
||||||
let projMatrix = projectionMatrix(near: 0, far: 10, aspect: 1, fovy: 1)
|
let projMatrix = projectionMatrix(near: 0, far: 10, aspect: 1, fovy: 1)
|
||||||
let modelViewProjectionMatrix = matrix_multiply(projMatrix, matrix_multiply(viewMatrix, modelMatrix))
|
let modelViewProjectionMatrix = matrix_multiply(projMatrix, matrix_multiply(viewMatrix, modelMatrix))
|
||||||
let bufferPointer = uniformBuffer.contents()
|
let bufferPointer = uniformBuffer.contents()
|
||||||
|
|
@ -93,7 +91,6 @@ public class MetalView: NSObject, MTKViewDelegate {
|
||||||
commandEncoder.setCullMode(.back)
|
commandEncoder.setCullMode(.back)
|
||||||
commandEncoder.setVertexBuffer(vertexBuffer, offset: 0, at: 0)
|
commandEncoder.setVertexBuffer(vertexBuffer, offset: 0, at: 0)
|
||||||
commandEncoder.setVertexBuffer(uniformBuffer, offset: 0, at: 1)
|
commandEncoder.setVertexBuffer(uniformBuffer, offset: 0, at: 1)
|
||||||
// commandEncoder.setTriangleFillMode(.lines)
|
|
||||||
commandEncoder.drawIndexedPrimitives(type: .triangle, indexCount: indexBuffer.length / MemoryLayout<UInt16>.size, indexType: MTLIndexType.uint16, indexBuffer: indexBuffer, indexBufferOffset: 0)
|
commandEncoder.drawIndexedPrimitives(type: .triangle, indexCount: indexBuffer.length / MemoryLayout<UInt16>.size, indexType: MTLIndexType.uint16, indexBuffer: indexBuffer, indexBufferOffset: 0)
|
||||||
commandEncoder.endEncoding()
|
commandEncoder.endEncoding()
|
||||||
commandBuffer.present(drawable)
|
commandBuffer.present(drawable)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<playground version='5.0' target-platform='osx'>
|
<playground version='5.0' target-platform='osx' executeOnSourceChanges='false'>
|
||||||
<timeline fileName='timeline.xctimeline'/>
|
<timeline fileName='timeline.xctimeline'/>
|
||||||
</playground>
|
</playground>
|
||||||
Binary file not shown.
Loading…
Reference in New Issue