From 44df75714984dc4e417e080572175cdf75e3eed0 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 10 Oct 2021 10:39:23 +0200 Subject: [PATCH] Add relevant thingd as comments from gradient.mmg to gradients.gd. --- .../mat_maker_gd/nodes/common/gradients.gd | 18 ++++ .../nodes/material_maker_nodes/gradient.mmg | 102 ------------------ 2 files changed, 18 insertions(+), 102 deletions(-) delete mode 100644 game/addons/mat_maker_gd/nodes/material_maker_nodes/gradient.mmg diff --git a/game/addons/mat_maker_gd/nodes/common/gradients.gd b/game/addons/mat_maker_gd/nodes/common/gradients.gd index 1d4e852c..b2caf78c 100644 --- a/game/addons/mat_maker_gd/nodes/common/gradients.gd +++ b/game/addons/mat_maker_gd/nodes/common/gradients.gd @@ -5,6 +5,24 @@ const Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd") #note: data : PoolRealArray -> pos, r, g, b, a, pos, r, g, b, a .... +#gradient.mmg + +#float $(name_uv)_r = 0.5+(cos($rotate*0.01745329251)*($uv.x-0.5)+sin($rotate*0.01745329251)*($uv.y-0.5))/(cos(abs(mod($rotate, 90.0)-45.0)*0.01745329251)*1.41421356237);" + +#output: $gradient(fract($(name_uv)_r*$repeat)) + +#repeat: default: 1, min: 1, max : 32, step: 1 +#rotate: default: 0, min: -180, max: 180, step: 0.1 + +#default: "interpolation": 1, +# "points": [{"a": 1,"b": 0,"g": 0,"pos": 0,"r": 0},{"a": 1,"b": 1,"g": 1,"pos": 1,"r": 1} ], + +#radial_gradient.mmg + +#circular_gradient.mmg + +#gradient.gd + static func radial_gradient_type_1(uv : Vector2, repeat : float, data : PoolRealArray) -> Color: return gradient_type_1(Commons.fractf(repeat * 1.41421356237* (Commons.fractv2(uv) - Vector2(0.5, 0.5)).length()), data) diff --git a/game/addons/mat_maker_gd/nodes/material_maker_nodes/gradient.mmg b/game/addons/mat_maker_gd/nodes/material_maker_nodes/gradient.mmg deleted file mode 100644 index e0758a2b..00000000 --- a/game/addons/mat_maker_gd/nodes/material_maker_nodes/gradient.mmg +++ /dev/null @@ -1,102 +0,0 @@ -{ - "name": "gradient", - "node_position": { - "x": 0, - "y": 0 - }, - "parameters": { - "gradient": { - "interpolation": 1, - "points": [ - { - "a": 1, - "b": 0, - "g": 0, - "pos": 0, - "r": 0 - }, - { - "a": 1, - "b": 1, - "g": 1, - "pos": 1, - "r": 1 - } - ], - "type": "Gradient" - }, - "repeat": 1, - "rotate": 0 - }, - "shader_model": { - "code": "float $(name_uv)_r = 0.5+(cos($rotate*0.01745329251)*($uv.x-0.5)+sin($rotate*0.01745329251)*($uv.y-0.5))/(cos(abs(mod($rotate, 90.0)-45.0)*0.01745329251)*1.41421356237);", - "global": "", - "inputs": [ - - ], - "instance": "", - "name": "Gradient", - "outputs": [ - { - "longdesc": "An image showing the gradient", - "rgba": "$gradient(fract($(name_uv)_r*$repeat))", - "shortdesc": "Output", - "type": "rgba" - } - ], - "parameters": [ - { - "control": "None", - "default": 1, - "label": "Repeat", - "longdesc": "Number of repetitions of the gradient", - "max": 32, - "min": 1, - "name": "repeat", - "shortdesc": "Repeat", - "step": 1, - "type": "float" - }, - { - "control": "Radius1.a", - "default": 0, - "label": "Rotate", - "longdesc": "Angle of the gradient pattern", - "max": 180, - "min": -180, - "name": "rotate", - "shortdesc": "Rotate", - "step": 0.1, - "type": "float" - }, - { - "default": { - "interpolation": 1, - "points": [ - { - "a": 1, - "b": 0, - "g": 0, - "pos": 0, - "r": 0 - }, - { - "a": 1, - "b": 1, - "g": 1, - "pos": 1, - "r": 1 - } - ], - "type": "Gradient" - }, - "label": "Gradient", - "longdesc": "Gradient to be spread on the image", - "name": "gradient", - "shortdesc": "Gradient", - "type": "gradient" - } - ] - }, - "type": "shader" -} \ No newline at end of file