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

82 lines
1.4 KiB
Plaintext
Raw Normal View History

2019-11-06 08:30:36 +01:00
{
"name": "sdline",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"ax": -0.2568,
"ay": -0.2232,
"bx": 0.3,
"by": 0.3,
"r": 0
2019-11-06 08:30:36 +01:00
},
"shader_model": {
"code": "",
"global": "float sdLine( in vec2 p, in vec2 a, in vec2 b ) {\n vec2 pa = p-a, ba = b-a;\n float h = clamp( dot(pa,ba)/dot(ba,ba), 0.0, 1.0 );\n return length( pa - ba*h );\n}\n",
"inputs": [
],
"instance": "",
"name": "sdLine",
"outputs": [
{
"sdf2d": "sdLine($uv, vec2($ax+0.5, $ay+0.5), vec2($bx+0.5, $by+0.5))-$r",
"type": "sdf2d"
2019-11-06 08:30:36 +01:00
}
],
"parameters": [
{
"control": "P1.x",
2019-11-06 08:30:36 +01:00
"default": 0,
"label": "A X",
"max": 1,
"min": -1,
2019-11-06 08:30:36 +01:00
"name": "ax",
"step": 0.01,
"type": "float"
},
{
"control": "P1.y",
2019-11-06 08:30:36 +01:00
"default": 0,
"label": "A Y",
"max": 1,
"min": -1,
2019-11-06 08:30:36 +01:00
"name": "ay",
"step": 0.01,
"type": "float"
},
{
"control": "P2.x",
2019-11-06 08:30:36 +01:00
"default": 1,
"label": "B X",
"max": 1,
"min": -1,
2019-11-06 08:30:36 +01:00
"name": "bx",
"step": 0.01,
"type": "float"
},
{
"control": "P2.y",
2019-11-06 08:30:36 +01:00
"default": 1,
"label": "B Y",
"max": 1,
"min": -1,
2019-11-06 08:30:36 +01:00
"name": "by",
"step": 0.01,
"type": "float"
},
{
"control": "Radius1.r",
"default": 0,
"label": "Width",
"max": 1,
"min": 0,
"name": "r",
"step": 0.01,
"type": "float"
2019-11-06 08:30:36 +01:00
}
]
},
"type": "shader"
}