Added Axis parameter to 3D primitives

This commit is contained in:
RodZill4 2020-04-04 07:16:45 +02:00
parent fd83287000
commit fe2c83a79a
4 changed files with 105 additions and 21 deletions

View File

@ -5,14 +5,12 @@
"y": 0 "y": 0
}, },
"parameters": { "parameters": {
"axis": 1,
"l": 0.3, "l": 0.3,
"r": 0.15, "r": 0.2
"sx": 0.25,
"sy": 0.25,
"sz": 0.5
}, },
"shader_model": { "shader_model": {
"code": "vec3 $(name_uv)_p = $uv;\n$(name_uv)_p.y -= clamp($(name_uv)_p.y, -$l, $l);\n", "code": "vec3 $(name_uv)_p = $uv;\n$(name_uv)_p.$axis -= clamp($(name_uv)_p.$axis, -$l, $l);\n",
"global": "", "global": "",
"inputs": [ "inputs": [
@ -26,6 +24,26 @@
} }
], ],
"parameters": [ "parameters": [
{
"default": 1,
"label": "Axis",
"name": "axis",
"type": "enum",
"values": [
{
"name": "X",
"value": "x"
},
{
"name": "Y",
"value": "y"
},
{
"name": "Z",
"value": "z"
}
]
},
{ {
"control": "Rect1.y", "control": "Rect1.y",
"default": 0.25, "default": 0.25,

View File

@ -6,10 +6,7 @@
}, },
"parameters": { "parameters": {
"a": 30, "a": 30,
"r": 0, "axis": 2
"sx": 0.01,
"sy": 0.01,
"sz": 0.015
}, },
"shader_model": { "shader_model": {
"code": "", "code": "",
@ -21,12 +18,45 @@
"name": "Cone", "name": "Cone",
"outputs": [ "outputs": [
{ {
"sdf3d": "dot(vec2(cos($a*0.01745329251),sin($a*0.01745329251)),vec2(length($uv.xz),$uv.y))", "sdf3d": "dot(vec2(cos($a*0.01745329251),sin($a*0.01745329251)),vec2($axis))",
"type": "sdf3d" "type": "sdf3d"
} }
], ],
"parameters": [ "parameters": [
{ {
"default": 5,
"label": "Axis",
"name": "axis",
"type": "enum",
"values": [
{
"name": "+X",
"value": "length($uv.yz),-$uv.x"
},
{
"name": "-X",
"value": "length($uv.yz),$uv.x"
},
{
"name": "+Y",
"value": "length($uv.xz),$uv.y"
},
{
"name": "-Y",
"value": "length($uv.xz),-$uv.y"
},
{
"name": "+Z",
"value": "length($uv.xy),-$uv.z"
},
{
"name": "-Z",
"value": "length($uv.xy),$uv.z"
}
]
},
{
"control": "None",
"default": 30, "default": 30,
"label": "Angle", "label": "Angle",
"max": 90, "max": 90,

View File

@ -5,14 +5,12 @@
"y": 0 "y": 0
}, },
"parameters": { "parameters": {
"l": 0.4, "axis": 1,
"r": 0.2, "l": 0.25,
"sx": 0.25, "r": 0.25
"sy": 0.25,
"sz": 0.5
}, },
"shader_model": { "shader_model": {
"code": "vec2 $(name_uv)_d = abs(vec2(length($uv.xz),$uv.y)) - vec2($r,$l);\n", "code": "vec2 $(name_uv)_d = abs(vec2($axis)) - vec2($r,$l);\n",
"global": "", "global": "",
"inputs": [ "inputs": [
@ -26,6 +24,26 @@
} }
], ],
"parameters": [ "parameters": [
{
"default": 1,
"label": "Axis",
"name": "axis",
"type": "enum",
"values": [
{
"name": "X",
"value": "length($uv.yz),$uv.x"
},
{
"name": "Y",
"value": "length($uv.xz),$uv.y"
},
{
"name": "Z",
"value": "length($uv.xy),$uv.z"
}
]
},
{ {
"control": "Rect1.y", "control": "Rect1.y",
"default": 0.5, "default": 0.5,

View File

@ -6,13 +6,11 @@
}, },
"parameters": { "parameters": {
"R": 0.3, "R": 0.3,
"r": 0.1, "axis": 2,
"sx": 0.1, "r": 0.15
"sy": 0.1,
"sz": 0.02
}, },
"shader_model": { "shader_model": {
"code": "vec2 $(name_uv)_q = vec2(length($uv.xy)-$R,$uv.z);\n", "code": "vec2 $(name_uv)_q = vec2($axis);\n",
"global": "", "global": "",
"inputs": [ "inputs": [
@ -26,6 +24,26 @@
} }
], ],
"parameters": [ "parameters": [
{
"default": 0,
"label": "Axis",
"name": "axis",
"type": "enum",
"values": [
{
"name": "X",
"value": "length($uv.yz)-$R,$uv.x"
},
{
"name": "Y",
"value": "length($uv.zx)-$R,$uv.y"
},
{
"name": "Z",
"value": "length($uv.xy)-$R,$uv.z"
}
]
},
{ {
"control": "Radius1.r", "control": "Radius1.r",
"default": 0.5, "default": 0.5,