{
	"name": "truchet",
	"node_position": {
		"x": 0,
		"y": 0
	},
	"parameters": {
		"shape": 0,
		"size": 4
	},
	"seed_int": 0,
	"shader_model": {
		"code": "",
		"global": [
			"float truchet1(vec2 uv, vec2 seed) {",
			"\tvec2 i = floor(uv);",
			"\tvec2 f = fract(uv)-vec2(0.5);",
			"\treturn 1.0-abs(abs((2.0*step(rand(i+seed), 0.5)-1.0)*f.x+f.y)-0.5);",
			"}",
			"",
			"float truchet2(vec2 uv, vec2 seed) {",
			"\tvec2 i = floor(uv);",
			"\tvec2 f = fract(uv);",
			"\tfloat random = step(rand(i+seed), 0.5);",
			"\tf.x *= 2.0*random-1.0;",
			"\tf.x += 1.0-random;",
			"\treturn 1.0-min(abs(length(f)-0.5), abs(length(1.0-f)-0.5));",
			"}",
			""
		],
		"inputs": [

		],
		"instance": "",
		"longdesc": "Generates a truchet pattern",
		"name": "Truchet",
		"outputs": [
			{
				"f": "truchet$shape($uv*$size, vec2(float($seed)))",
				"longdesc": "Shows a grayscale image of the truchet pattern.",
				"shortdesc": "Output",
				"type": "f"
			}
		],
		"parameters": [
			{
				"default": 0,
				"label": "Shape",
				"longdesc": "The base shape of each tile of the truchet pattern",
				"name": "shape",
				"shortdesc": "Shape",
				"type": "enum",
				"values": [
					{
						"name": "Line",
						"value": "1"
					},
					{
						"name": "Circle",
						"value": "2"
					}
				]
			},
			{
				"control": "None",
				"default": 4,
				"label": "Size",
				"longdesc": "The number of rows and columns of the truchet pattern",
				"max": 64,
				"min": 2,
				"name": "size",
				"shortdesc": "Size",
				"step": 1,
				"type": "float"
			}
		],
		"shortdesc": "Truchet pattern"
	},
	"type": "shader"
}