Comments from sdf3d_circle_repeat.mmg.

This commit is contained in:
Relintai 2021-10-12 13:07:06 +02:00
parent 4ee9c69d15
commit 33e8a8adb0
2 changed files with 26 additions and 51 deletions

View File

@ -169,6 +169,16 @@ const Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd")
#in1, vec2, default:vec2(100, 0.0), (sdf3d input)
#in2, vec2, default:vec2(100, 0.0), (sdf3d input)
#----------------------
#sdf3d_circle_repeat.mmg
#Outputs:
#Output (sdf3dc) - The shape generated by the boolean operation
#$in(circle_repeat_transform($uv, $c))
#Inputs:
#count, float, min: 1, max: 32, default:5, step:1
static func raymarch(uv : Vector2) -> Color:
var d : Vector2 = sdf3d_raymarch(uv);
@ -505,6 +515,22 @@ static func rotate3d(p : Vector3, a : Vector3) -> Vector3:
#todo
return Vector3()
#vec3 circle_repeat_transform(vec3 p, float count) {
# float r = 6.28/count;float pa = atan(p.x, p.y);
# float a = mod(pa+0.5*r, r)-0.5*r;
# vec3 rv;
# float c = cos(a-pa);
# float s = sin(a-pa);
# rv.x = p.x*c+p.y*s;
# rv.y = -p.x*s+p.y*c;
# rv.z = p.z;
# return rv;
#}
static func circle_repeat_transform(p : Vector3, count : float) -> Vector3:
#todo
return Vector3()
#todo this needs to be solved
static func sdf3d_input(p : Vector3) -> Vector2:
return sdf3d_sphere(p, 0.5)

View File

@ -1,51 +0,0 @@
{
"name": "sdf3d_circle_repeat",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"c": 5
},
"shader_model": {
"code": "",
"global": "vec3 circle_repeat_transform(vec3 p, float count) {\n\tfloat r = 6.28/count;\n\tfloat pa = atan(p.x, p.y);\n\tfloat a = mod(pa+0.5*r, r)-0.5*r;\n\tvec3 rv;\n\tfloat c = cos(a-pa);\n\tfloat s = sin(a-pa);\n\trv.x = p.x*c+p.y*s;\n\trv.y = -p.x*s+p.y*c;\n\trv.z = p.z;\n\treturn rv;\n}\n",
"inputs": [
{
"default": "vec2(100, 0.0)",
"label": "",
"longdesc": "The input shape, defined as a signed distance function",
"name": "in",
"shortdesc": "Input",
"type": "sdf3dc"
}
],
"instance": "",
"longdesc": "Repeats its input shape around a circle",
"name": "Circle Repeat",
"outputs": [
{
"longdesc": "The shape generated by the repeat operation",
"sdf3dc": "$in(circle_repeat_transform($uv, $c))",
"shortdesc": "Output",
"type": "sdf3dc"
}
],
"parameters": [
{
"control": "None",
"default": 4,
"label": "",
"longdesc": "The number of repetitions of the input shape around the circle",
"max": 32,
"min": 1,
"name": "c",
"shortdesc": "Count",
"step": 1,
"type": "float"
}
],
"shortdesc": "Circle Repeat"
},
"type": "shader"
}