mirror of
https://github.com/Relintai/material-maker.git
synced 2024-12-23 21:16:54 +01:00
74 lines
1.6 KiB
Plaintext
74 lines
1.6 KiB
Plaintext
{
|
|
"name": "sdarc",
|
|
"node_position": {
|
|
"x": 0,
|
|
"y": 0
|
|
},
|
|
"parameters": {
|
|
"a1": 135,
|
|
"a2": 45,
|
|
"cx": 0,
|
|
"cy": 0,
|
|
"r": 0.4,
|
|
"r1": 0.3,
|
|
"r2": 0.1
|
|
},
|
|
"shader_model": {
|
|
"code": "",
|
|
"global": "float sdArc(vec2 p, float a1, float a2, float ra, float rb) {\n\tfloat amid = 0.5*(a1+a2)+1.6+3.14*step(a1, a2);\n\tfloat alength = 0.5*(a1-a2)-1.6+3.14*step(a1, a2);\n\tvec2 sca = vec2(cos(amid), sin(amid));\n\tvec2 scb = vec2(cos(alength), sin(alength));\n p *= mat2(vec2(sca.x,sca.y),vec2(-sca.y,sca.x));\n p.x = abs(p.x);\n float k = (scb.y*p.x>scb.x*p.y) ? dot(p.xy,scb) : length(p.xy);\n return sqrt( dot(p,p) + ra*ra - 2.0*ra*k ) - rb;\n}\n",
|
|
"inputs": [
|
|
|
|
],
|
|
"instance": "",
|
|
"name": "sdArc",
|
|
"outputs": [
|
|
{
|
|
"sdf2d": "sdArc($uv-vec2(0.5), mod($a1, 360.0)*0.01745329251, mod($a2, 360.0)*0.01745329251, $r1, $r2)",
|
|
"type": "sdf2d"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"control": "Angle1.a",
|
|
"default": 0,
|
|
"label": "Angle 1",
|
|
"max": 180,
|
|
"min": -180,
|
|
"name": "a1",
|
|
"step": 1,
|
|
"type": "float"
|
|
},
|
|
{
|
|
"control": "Angle2.a",
|
|
"default": 0,
|
|
"label": "Angle 2",
|
|
"max": 180,
|
|
"min": -180,
|
|
"name": "a2",
|
|
"step": 1,
|
|
"type": "float"
|
|
},
|
|
{
|
|
"control": "Radius1.r",
|
|
"default": 0.5,
|
|
"label": "Radius 1",
|
|
"max": 1,
|
|
"min": 0,
|
|
"name": "r1",
|
|
"step": 0.01,
|
|
"type": "float"
|
|
},
|
|
{
|
|
"control": "Radius11.r",
|
|
"default": 0.1,
|
|
"label": "Radius 2",
|
|
"max": 1,
|
|
"min": 0,
|
|
"name": "r2",
|
|
"step": 0.01,
|
|
"type": "float"
|
|
}
|
|
]
|
|
},
|
|
"type": "shader"
|
|
} |