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

		],
		"instance": "",
		"longdesc": "Generates a truchet pattern",
		"name": "Truchet",
		"outputs": [
			{
				"f": "truchet$shape($uv*$size, vec2(float($seed)))",
				"longdesc": "Shows a greyscale 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"
}