Skip to content

Commit

Permalink
updated to Swift 3
Browse files Browse the repository at this point in the history
  • Loading branch information
mhorga committed Nov 29, 2016
1 parent 474a32a commit 14db309
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 5 deletions.
Binary file not shown.
1 change: 0 additions & 1 deletion ch09/chapter09.playground/Resources/Shaders.metal
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ vertex Vertex vertex_func(constant Vertex *vertices [[buffer(0)]], constant Unif

fragment half4 fragment_func(Vertex vert [[stage_in]]) {
return half4(vert.color);
// return half4(0.0, 1.0, 0.0, 1.0);
}
3 changes: 0 additions & 3 deletions ch09/chapter09.playground/Sources/MetalView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ public class MetalView: NSObject, MTKViewDelegate {
let modelMatrix = matrix_multiply(matrix_multiply(rotatedX, rotatedY), scaled)
let cameraPosition = vector_float3(0, 0, -3)
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 modelViewProjectionMatrix = matrix_multiply(projMatrix, matrix_multiply(viewMatrix, modelMatrix))
let bufferPointer = uniformBuffer.contents()
Expand All @@ -93,7 +91,6 @@ public class MetalView: NSObject, MTKViewDelegate {
commandEncoder.setCullMode(.back)
commandEncoder.setVertexBuffer(vertexBuffer, offset: 0, at: 0)
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.endEncoding()
commandBuffer.present(drawable)
Expand Down
2 changes: 1 addition & 1 deletion ch09/chapter09.playground/contents.xcplayground
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?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'/>
</playground>
Binary file not shown.

0 comments on commit 14db309

Please sign in to comment.