Draw some gridlines from the marching squares object

I kinda hate how I did this.
This commit is contained in:
Eryn Wells 2018-10-13 22:22:10 -07:00
parent 3399bbcd53
commit f77eef76eb
4 changed files with 70 additions and 6 deletions

View file

@ -231,10 +231,9 @@ public class Renderer: NSObject, MTKViewDelegate {
let encoder = buffer.makeRenderCommandEncoder(descriptor: pass) {
encoder.label = "Marching Squares Render"
encoder.setRenderPipelineState(pipeline)
encoder.setVertexBytes(pixelGeometry, length: pixelGeometry.count * MemoryLayout<Vertex>.stride, index: 0)
encoder.setVertexBuffer(field.marchingSquares.gridGeometry, offset: 0, index: 0)
encoder.setVertexBuffer(parametersBuffer, offset: 0, index: 1)
encoder.setTriangleFillMode(.lines)
encoder.drawPrimitives(type: .triangle, vertexStart: 0, vertexCount: 6)
encoder.drawPrimitives(type: .line, vertexStart: 0, vertexCount: field.marchingSquares.gridVertexCount)
encoder.endEncoding()
didEncode = true
}