 	let height: Int
 	let components: Int
 	var pixels: [Pixel]
-	var mode: TextureMode = .wrap
+	var mode: TextureMode = .clamp
 	var filtering: FilteringMode = .nearest
 	
 	init(path: String){

enum TextureMode {
	case clamp
	case wrap
}

enum FilteringMode {

	private subscript(a: Int, b: Int) -> Pixel {
		
		if mode == .clamp {
			return pixels[clamp(b, 0, height-1) * width + clamp(a, 0, width-1)]
		} else if mode == .wrap {
			let nb = b%height
			let na = a%width
			return pixels[(nb < 0 ? nb + height : nb) * width + (na < 0 ? na + width : na)]
		}
		return pixels[b*width+a]
	}
