mirror of
https://github.com/Relintai/material-maker.git
synced 2024-11-13 06:27:18 +01:00
Added 2d arc node (also useful to create torus arcs)
This commit is contained in:
parent
9b961e50c5
commit
d80e3caeb9
70
addons/material_maker/nodes/sdarc.mmg
Normal file
70
addons/material_maker/nodes/sdarc.mmg
Normal file
@ -0,0 +1,70 @@
|
||||
{
|
||||
"name": "sdarc",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"a1": 0,
|
||||
"a2": 0,
|
||||
"cx": 0,
|
||||
"cy": 0,
|
||||
"r": 0.4,
|
||||
"r1": 0.3,
|
||||
"r2": 0.1
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "float sdArc(vec2 p, vec2 sca, vec2 scb, float ra, float rb) {\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}",
|
||||
"inputs": [
|
||||
|
||||
],
|
||||
"instance": "",
|
||||
"name": "sdArc",
|
||||
"outputs": [
|
||||
{
|
||||
"sdf2d": "sdArc($uv-vec2(0.5), vec2(cos($a1*0.01745329251), sin($a1*0.01745329251)), vec2(cos($a2*0.01745329251), sin($a2*0.01745329251)), $r1, $r2)",
|
||||
"type": "sdf2d"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 0,
|
||||
"label": "Angle 1",
|
||||
"max": 180,
|
||||
"min": -180,
|
||||
"name": "a1",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"label": "Angle 2",
|
||||
"max": 180,
|
||||
"min": -180,
|
||||
"name": "a2",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"default": 0.5,
|
||||
"label": "Radius 1",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "r1",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"default": 0.1,
|
||||
"label": "Radius 2",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "r2",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
Loading…
Reference in New Issue
Block a user