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
},
"parameters": {
"axis": 1,
"l": 0.3,
"r": 0.15,
"sx": 0.25,
"sy": 0.25,
"sz": 0.5
"r": 0.2
},
"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": "",
"inputs": [
@ -26,6 +24,26 @@
}
],
"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",
"default": 0.25,

View File

@ -6,10 +6,7 @@
},
"parameters": {
"a": 30,
"r": 0,
"sx": 0.01,
"sy": 0.01,
"sz": 0.015
"axis": 2
},
"shader_model": {
"code": "",
@ -21,12 +18,45 @@
"name": "Cone",
"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"
}
],
"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,
"label": "Angle",
"max": 90,

View File

@ -5,14 +5,12 @@
"y": 0
},
"parameters": {
"l": 0.4,
"r": 0.2,
"sx": 0.25,
"sy": 0.25,
"sz": 0.5
"axis": 1,
"l": 0.25,
"r": 0.25
},
"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": "",
"inputs": [
@ -26,6 +24,26 @@
}
],
"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",
"default": 0.5,

View File

@ -6,13 +6,11 @@
},
"parameters": {
"R": 0.3,
"r": 0.1,
"sx": 0.1,
"sy": 0.1,
"sz": 0.02
"axis": 2,
"r": 0.15
},
"shader_model": {
"code": "vec2 $(name_uv)_q = vec2(length($uv.xy)-$R,$uv.z);\n",
"code": "vec2 $(name_uv)_q = vec2($axis);\n",
"global": "",
"inputs": [
@ -26,6 +24,26 @@
}
],
"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",
"default": 0.5,