Pixel-Composer/scripts/node_blobify/node_blobify.gml

39 lines
1.0 KiB
Plaintext
Raw Normal View History

function Node_Blobify(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Blobify";
2024-08-18 06:16:20 +02:00
newInput(0, nodeValue_Surface("Surface in", self));
2024-08-18 06:16:20 +02:00
newInput(1, nodeValue_Bool("Active", self, true));
2024-08-18 09:13:41 +02:00
newInput(2, nodeValue_Int("Radius", self, 3))
.setValidator(VV_min(0));
2024-08-18 09:13:41 +02:00
newInput(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,
]
2024-08-08 06:57:51 +02:00
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
}