{
	"name": "kaleidoscope",
	"node_position": {
		"x": 0,
		"y": 0
	},
	"parameters": {
		"count": 5,
		"offset": 0,
		"variations": false
	},
	"seed_int": 1204686787,
	"shader_model": {
		"code": "vec3 $(name_uv)_kal = kal_rotate($uv, $count, $offset, $seed);",
		"global": [
			"vec3 kal_rotate(vec2 uv, float count, float offset, float seed) {",
			"\tfloat pi = 3.14159265359;",
			"\toffset *= pi/180.0;",
			"\toffset += pi*(1.0/count+0.5);",
			"\tuv -= vec2(0.5);",
			"\tfloat l = length(uv);",
			"\tfloat angle = atan(uv.y, uv.x)+offset;",
			"\tangle += (1.0-sign(angle))*pi;",
			"\tfloat a = mod(angle, 2.0*pi/count)-offset;",
			"\treturn vec3(vec2(0.5)+l*vec2(cos(a), sin(a)), (rand(vec2(seed))+floor(0.5*angle*count/pi))/count);",
			"}"
		],
		"inputs": [
			{
				"default": "vec4($uv, 0, 1)",
				"function": true,
				"label": "",
				"longdesc": "The input image",
				"name": "i#",
				"shortdesc": "Input#",
				"type": "rgba"
			}
		],
		"instance": "",
		"longdesc": "Replicated an angle of the input image several times around the center.",
		"name": "Kaleidoscope",
		"outputs": [
			{
				"longdesc": "Shows the transformed image",
				"rgba": "$i#.variation($(name_uv)_kal.xy, $variations ? $(name_uv)_kal.z : 0.0)",
				"shortdesc": "Output#",
				"type": "rgba"
			}
		],
		"parameters": [
			{
				"control": "None",
				"default": 5,
				"label": "",
				"longdesc": "The number of replications of an angle of the input",
				"max": 10,
				"min": 2,
				"name": "count",
				"shortdesc": "Count",
				"step": 1,
				"type": "float"
			},
			{
				"control": "None",
				"default": 0,
				"label": "",
				"longdesc": "The angular offset of the replicated angle of the input",
				"max": 180,
				"min": -180,
				"name": "offset",
				"shortdesc": "Offset",
				"step": 0.1,
				"type": "float"
			},
			{
				"default": false,
				"label": "Variations",
				"name": "variations",
				"type": "boolean"
			}
		],
		"shortdesc": "Kaleidoscope"
	},
	"type": "shader"
}