{
	"name": "pattern",
	"node_position": {
		"x": 0,
		"y": 0
	},
	"parameters": {
		"mix": 0,
		"x_scale": 4,
		"x_wave": 0,
		"y_scale": 4,
		"y_wave": 0
	},
	"seed_int": 0,
	"shader_model": {
		"code": "",
		"global": [
			"float wave_constant(float x) {",
			"\treturn 1.0;",
			"}",
			"",
			"float wave_sine(float x) {",
			"\treturn 0.5-0.5*cos(3.14159265359*2.0*x);",
			"}",
			"",
			"float wave_triangle(float x) {",
			"\tx = fract(x);",
			"\treturn min(2.0*x, 2.0-2.0*x);",
			"}",
			"",
			"float wave_sawtooth(float x) {",
			"\treturn fract(x);",
			"}",
			"",
			"float wave_square(float x) {",
			"\treturn (fract(x) < 0.5) ? 0.0 : 1.0;",
			"}",
			"",
			"float wave_bounce(float x) {",
			"\tx = 2.0*(fract(x)-0.5);",
			"\treturn sqrt(1.0-x*x);",
			"}",
			"",
			"float mix_mul(float x, float y) {",
			"\treturn x*y;",
			"}",
			"",
			"float mix_add(float x, float y) {",
			"\treturn min(x+y, 1.0);",
			"}",
			"",
			"float mix_max(float x, float y) {",
			"\treturn max(x, y);",
			"}",
			"",
			"float mix_min(float x, float y) {",
			"\treturn min(x, y);",
			"}",
			"",
			"float mix_xor(float x, float y) {",
			"\treturn min(x+y, 2.0-x-y);",
			"}",
			"",
			"float mix_pow(float x, float y) {",
			"\treturn pow(x, y);",
			"}"
		],
		"inputs": [

		],
		"instance": "",
		"name": "Pattern",
		"outputs": [
			{
				"f": "mix_$(mix)(wave_$(x_wave)($(x_scale)*$uv.x), wave_$(y_wave)($(y_scale)*$uv.y))",
				"longdesc": "A grayscale image that combines the horizontal and vertical patterns",
				"shortdesc": "Output",
				"type": "f"
			}
		],
		"parameters": [
			{
				"default": 0,
				"label": "Combiner",
				"longdesc": "The operation used to combine the horizontal and the vertical patterns",
				"name": "mix",
				"shortdesc": "Combine",
				"type": "enum",
				"values": [
					{
						"name": "Multiply",
						"value": "mul"
					},
					{
						"name": "Add",
						"value": "add"
					},
					{
						"name": "Max",
						"value": "max"
					},
					{
						"name": "Min",
						"value": "min"
					},
					{
						"name": "Xor",
						"value": "xor"
					},
					{
						"name": "Pow",
						"value": "pow"
					}
				]
			},
			{
				"default": 5,
				"label": "X",
				"longdesc": "Pattern generated along the X axis",
				"name": "x_wave",
				"shortdesc": "X Pattern",
				"type": "enum",
				"values": [
					{
						"name": "Sine",
						"value": "sine"
					},
					{
						"name": "Triangle",
						"value": "triangle"
					},
					{
						"name": "Square",
						"value": "square"
					},
					{
						"name": "Sawtooth",
						"value": "sawtooth"
					},
					{
						"name": "Constant",
						"value": "constant"
					},
					{
						"name": "Bounce",
						"value": "bounce"
					}
				]
			},
			{
				"control": "None",
				"default": 4,
				"label": "2:",
				"longdesc": "Repetitions of the pattern along X axis",
				"max": 32,
				"min": 0,
				"name": "x_scale",
				"shortdesc": "X Repeat",
				"step": 1,
				"type": "float"
			},
			{
				"default": 5,
				"label": "Y",
				"longdesc": "Pattern generated along the Y axis",
				"name": "y_wave",
				"shortdesc": "Y Pattern",
				"type": "enum",
				"values": [
					{
						"name": "Sine",
						"value": "sine"
					},
					{
						"name": "Triangle",
						"value": "triangle"
					},
					{
						"name": "Square",
						"value": "square"
					},
					{
						"name": "Sawtooth",
						"value": "sawtooth"
					},
					{
						"name": "Constant",
						"value": "constant"
					},
					{
						"name": "Bounce",
						"value": "bounce"
					}
				]
			},
			{
				"control": "None",
				"default": 4,
				"label": "3:",
				"longdesc": "Repetitions of the pattern along Y axis",
				"max": 32,
				"min": 0,
				"name": "y_scale",
				"shortdesc": "Y Repeat",
				"step": 1,
				"type": "float"
			}
		],
		"shortdesc": "Pattern",
		"longdesc": "Generates pattern from common waveform shapes"
	},
	"type": "shader"
}