mirror of
https://github.com/Relintai/material-maker.git
synced 2024-11-13 06:27:18 +01:00
124 lines
2.4 KiB
Plaintext
124 lines
2.4 KiB
Plaintext
{
|
|
"name": "transform",
|
|
"node_position": {
|
|
"x": 0,
|
|
"y": 0
|
|
},
|
|
"parameters": {
|
|
"repeat": false,
|
|
"rotate": 0,
|
|
"scale_x": 1,
|
|
"scale_y": 1,
|
|
"translate_x": 0,
|
|
"translate_y": 0
|
|
},
|
|
"shader_model": {
|
|
"code": "",
|
|
"global": "vec2 transform(vec2 uv, vec2 translate, float rotate, vec2 scale, bool repeat) {\n \tvec2 rv;\n\tuv -= translate;\n\tuv -= vec2(0.5);\n\trv.x = cos(rotate)*uv.x + sin(rotate)*uv.y;\n\trv.y = -sin(rotate)*uv.x + cos(rotate)*uv.y;\n\trv /= scale;\n\trv += vec2(0.5);\n if (repeat) {\n\t\treturn fract(rv);\n\t} else {\n\t\treturn clamp(rv, vec2(0.0), vec2(1.0));\n\t}\t\n}",
|
|
"inputs": [
|
|
{
|
|
"default": "vec4($uv, 0.0, 1.0)",
|
|
"label": "",
|
|
"name": "i",
|
|
"type": "rgba"
|
|
},
|
|
{
|
|
"default": "1.0",
|
|
"label": "",
|
|
"name": "tx",
|
|
"type": "f"
|
|
},
|
|
{
|
|
"default": "1.0",
|
|
"label": "",
|
|
"name": "ty",
|
|
"type": "f"
|
|
},
|
|
{
|
|
"default": "1.0",
|
|
"label": "",
|
|
"name": "r",
|
|
"type": "f"
|
|
},
|
|
{
|
|
"default": "1.0",
|
|
"label": "",
|
|
"name": "sx",
|
|
"type": "f"
|
|
},
|
|
{
|
|
"default": "1.0",
|
|
"label": "",
|
|
"name": "sy",
|
|
"type": "f"
|
|
}
|
|
],
|
|
"instance": "",
|
|
"name": "Transform",
|
|
"outputs": [
|
|
{
|
|
"rgba": "$i(transform($uv, vec2($translate_x*(2.0*$tx($uv)-1.0), $translate_y*(2.0*$ty($uv)-1.0)), $rotate*0.01745329251*(2.0*$r($uv)-1.0), vec2($scale_x*(2.0*$sx($uv)-1.0), $scale_y*(2.0*$sy($uv)-1.0)), $repeat))",
|
|
"type": "rgba"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"default": 0,
|
|
"label": "2:Translate X:",
|
|
"max": 1,
|
|
"min": -1,
|
|
"name": "translate_x",
|
|
"step": 0.005,
|
|
"type": "float",
|
|
"widget": "spinbox"
|
|
},
|
|
{
|
|
"default": 0,
|
|
"label": "Translate Y:",
|
|
"max": 1,
|
|
"min": -1,
|
|
"name": "translate_y",
|
|
"step": 0.005,
|
|
"type": "float",
|
|
"widget": "spinbox"
|
|
},
|
|
{
|
|
"default": 0,
|
|
"label": "Rotate:",
|
|
"max": 720,
|
|
"min": -720,
|
|
"name": "rotate",
|
|
"step": 0.005,
|
|
"type": "float",
|
|
"widget": "spinbox"
|
|
},
|
|
{
|
|
"default": 1,
|
|
"label": "Scale X:",
|
|
"max": 50,
|
|
"min": 0,
|
|
"name": "scale_x",
|
|
"step": 0.005,
|
|
"type": "float",
|
|
"widget": "spinbox"
|
|
},
|
|
{
|
|
"default": 1,
|
|
"label": "Scale Y:",
|
|
"max": 50,
|
|
"min": 0,
|
|
"name": "scale_y",
|
|
"step": 0.005,
|
|
"type": "float",
|
|
"widget": "spinbox"
|
|
},
|
|
{
|
|
"default": false,
|
|
"label": "Repeat:",
|
|
"name": "repeat",
|
|
"type": "boolean"
|
|
}
|
|
]
|
|
},
|
|
"type": "shader"
|
|
} |