material-maker/addons/material_maker/nodes/sdcirclerepeat.mmg

51 lines
1.3 KiB
Plaintext
Raw Normal View History

{
"name": "sdcirclerepeat",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"c": 6
},
"shader_model": {
"code": "",
"global": "vec2 circle_repeat_transform_2d(vec2 p, float count) {\n\tfloat r = 6.28/count;\n\tfloat pa = atan(p.x, p.y);\n\tfloat a = mod(pa+0.5*r, r)-0.5*r;\n\tvec2 rv;\n\tfloat c = cos(a-pa);\n\tfloat s = sin(a-pa);\n\trv.x = p.x*c+p.y*s;\n\trv.y = -p.x*s+p.y*c;\n\treturn rv;\n}\n",
"inputs": [
{
"default": "0.0",
"label": "",
2020-10-05 21:03:19 +02:00
"longdesc": "The input shape, defined as a signed distance function",
"name": "in",
2020-10-05 21:03:19 +02:00
"shortdesc": "Input",
"type": "sdf2d"
}
],
"instance": "",
"longdesc": "Repeats its input shape around a circle",
"name": "Circle Repeat",
"outputs": [
{
2020-10-05 21:03:19 +02:00
"longdesc": "The shape generated by the repeat operation",
"sdf2d": "$in(circle_repeat_transform_2d($uv-vec2(0.5), $c)+vec2(0.5))",
2020-10-05 21:03:19 +02:00
"shortdesc": "Output",
"type": "sdf2d"
}
],
"parameters": [
{
"control": "None",
"default": 4,
"label": "",
2020-10-05 21:03:19 +02:00
"longdesc": "The number of repetitions of the input shape around the circle",
"max": 32,
"min": 1,
"name": "c",
2020-10-05 21:03:19 +02:00
"shortdesc": "Count",
"step": 1,
"type": "float"
}
2020-10-05 21:03:19 +02:00
],
"shortdesc": "Circle Repeat"
},
"type": "shader"
}