Pixel-Composer/scripts/node_blobify/node_blobify.gml
2024-08-08 11:57:51 +07:00

39 lines
1.0 KiB
Plaintext

function Node_Blobify(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Blobify";
inputs[0] = nodeValue_Surface("Surface in", self);
inputs[1] = nodeValue_Bool("Active", self, true);
inputs[2] = nodeValue_Int("Radius", self, 3)
.setValidator(VV_min(0));
inputs[3] = nodeValue_Float("Threshold", self, 0.5)
.setDisplay(VALUE_DISPLAY.slider);
active_index = 1;
input_display_list = [ 1,
["Surface", false], 0,
["Blobify", false], 2, 3,
]
outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone);
attribute_surface_depth();
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
var _rad = _data[2];
var _thr = _data[3];
surface_set_shader(_outSurf, sh_blobify);
shader_set_f("dimension", surface_get_dimension(_data[0]));
shader_set_f("radius", _rad);
shader_set_f("threshold", _thr);
draw_surface_safe(_data[0]);
surface_reset_shader();
return _outSurf;
} #endregion
}