{
	"name": "sdf3d_repeat",
	"node_position": {
		"x": 0,
		"y": 0
	},
	"parameters": {
		"r": 0.3,
		"rx": 3,
		"ry": 3,
		"variations": false
	},
	"seed_int": 740522688,
	"shader_model": {
		"code": [
			"float $(name_uv)_seed = $variations ? rand(floor($uv.xy * vec2($rx, $ry) + 0.5)) + $seed : 0.0;",
			"vec2 $(name_uv)_in = $in.variation(repeat($uv, vec3(1.0/$rx, 1.0/$ry, 0.0), float($seed), $r), $(name_uv)_seed);"
		],
		"global": [
			"vec3 repeat(vec3 p, vec3 r, float seed, float randomness) {",
			"\tvec3 a = (rand3(floor(mod((p.xy+0.5*r.xy)/r.xy, 1.0/r.xy))+vec2(seed))-0.5)*6.28*randomness;",
			"\tp = mod(p+0.5*r,r)-0.5*r;",
			"\tvec3 rv;",
			"\tfloat c;",
			"\tfloat s;",
			"\tc = cos(a.x);",
			"\ts = sin(a.x);",
			"\trv.x = p.x;",
			"\trv.y = p.y*c+p.z*s;",
			"\trv.z = -p.y*s+p.z*c;",
			"\tc = cos(a.y);",
			"\ts = sin(a.y);",
			"\tp.x = rv.x*c+rv.z*s;",
			"\tp.y = rv.y;",
			"\tp.z = -rv.x*s+rv.z*c;",
			"\tc = cos(a.z);",
			"\ts = sin(a.z);",
			"\trv.x = p.x*c+p.y*s;",
			"\trv.y = -p.x*s+p.y*c;",
			"\trv.z = p.z;",
			"\treturn rv;",
			"}",
			""
		],
		"inputs": [
			{
				"default": "vec2(100, 0.0)",
				"function": true,
				"label": "",
				"longdesc": "The input shape, defined as a signed distance function",
				"name": "in",
				"shortdesc": "Input",
				"type": "sdf3dc"
			}
		],
		"instance": "",
		"longdesc": "Repeats its input shape on a grid.\nThis node does not support overlapping between instances.",
		"name": "Repeat",
		"outputs": [
			{
				"longdesc": "The shape generated by the repeat operation",
				"sdf3dc": "$(name_uv)_in",
				"shortdesc": "Output",
				"type": "sdf3dc"
			}
		],
		"parameters": [
			{
				"control": "None",
				"default": 4,
				"label": "X",
				"longdesc": "The number of columns in the grid",
				"max": 32,
				"min": 1,
				"name": "rx",
				"shortdesc": "Columns",
				"step": 1,
				"type": "float"
			},
			{
				"control": "None",
				"default": 4,
				"label": "Y",
				"longdesc": "The number of lines in the grid",
				"max": 32,
				"min": 1,
				"name": "ry",
				"shortdesc": "Lines",
				"step": 1,
				"type": "float"
			},
			{
				"control": "None",
				"default": 0.5,
				"label": "R",
				"longdesc": "The amount of random rotation on each instance of the input shape",
				"max": 1,
				"min": 0,
				"name": "r",
				"shortdesc": "Rotation",
				"step": 0.01,
				"type": "float"
			},
			{
				"default": false,
				"label": "Variations",
				"longdesc": "Check to repeat variations of the input",
				"name": "variations",
				"shortdesc": "Variations",
				"type": "boolean"
			}
		],
		"shortdesc": "Repeat"
	},
	"type": "shader"
}