 		} catch let error {
 			fatalError(error.localizedDescription)
 		}
-		
-		var uniforms = MapUniforms(mvpMatrix: simd_float4x4(), color: simd_float4(), highlighted: simd_int1())
-		uniformBuffer = device.makeBuffer(bytes: &uniforms, length: MemoryLayout.stride(ofValue: uniforms), options: .storageModeShared)!
-		uniformBuffer.label = "RegionRenderer uniform block"
 	}
 	
 	func renderWorld(visibleSet: Set<Int>, inProjection projection: simd_float4x4, inEncoder encoder: MTLRenderCommandEncoder) {

		for primitive in renderPrimitives {
			uniforms.color = SIMD4<Float>(primitive.color.r, primitive.color.g, primitive.color.b, 1.0)
			uniforms.highlighted = AppDelegate.sharedUIState.selected(primitive.ownerHash) ? 1 : 0
			uniformBuffer.contents().copyMemory(from: &uniforms, byteCount: MemoryLayout<MapUniforms>.stride)

			encoder.setVertexBuffer(uniformBuffer, offset: 0, index: 1)
			render(primitive: primitive, into: encoder)
		}
		


class RegionRenderer {
	let pipeline: MTLRenderPipelineState
	
	init(withDevice device: MTLDevice, pixelFormat: MTLPixelFormat) {
		let shaderLib = device.makeDefaultLibrary()!
