2024-02-01 08:38:21 +01:00
|
|
|
function Node_Blur_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
|
|
|
name = "Shape Blur";
|
|
|
|
|
|
|
|
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
|
|
|
|
inputs[| 1] = nodeValue("Blur Shape", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
|
|
|
|
|
|
|
|
inputs[| 2] = nodeValue("Blur mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
|
|
|
|
|
2024-03-14 14:35:19 +01:00
|
|
|
inputs[| 3] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
|
2024-02-01 08:38:21 +01:00
|
|
|
|
|
|
|
inputs[| 4] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
|
|
|
|
.setDisplay(VALUE_DISPLAY.slider);
|
|
|
|
|
|
|
|
inputs[| 5] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
|
|
|
|
active_index = 5;
|
|
|
|
|
|
|
|
inputs[| 6] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111)
|
|
|
|
.setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) });
|
|
|
|
|
|
|
|
inputs[| 7] = nodeValue("Mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
|
|
|
.setDisplay(VALUE_DISPLAY.enum_button, [ "Blur", "Max" ]);
|
|
|
|
|
2024-06-22 12:09:44 +02:00
|
|
|
__init_mask_modifier(3); // inputs 8, 9,
|
2024-02-01 08:38:21 +01:00
|
|
|
|
2024-06-22 12:09:44 +02:00
|
|
|
inputs[| 10] = nodeValue("Gamma Correction", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
|
2024-06-13 09:21:07 +02:00
|
|
|
|
2024-02-01 08:38:21 +01:00
|
|
|
input_display_list = [ 5, 6,
|
2024-06-22 12:09:44 +02:00
|
|
|
["Surfaces", true], 0, 3, 4, 8, 9,
|
|
|
|
["Blur", false], 7, 1, 2, 10,
|
2024-02-01 08:38:21 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
|
|
|
|
|
|
|
attribute_surface_depth();
|
|
|
|
attribute_oversample();
|
|
|
|
|
|
|
|
static step = function() { #region
|
|
|
|
__step_mask_modifier();
|
|
|
|
} #endregion
|
|
|
|
|
|
|
|
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
|
|
|
if(!is_surface(_data[0])) return _outSurf;
|
|
|
|
|
|
|
|
var _samp = struct_try_get(attributes, "oversample");
|
|
|
|
var _blur = _data[1];
|
|
|
|
var _mask = _data[2];
|
|
|
|
var _mode = _data[7];
|
2024-06-13 09:21:07 +02:00
|
|
|
var _gam = _data[9];
|
2024-02-01 08:38:21 +01:00
|
|
|
|
|
|
|
surface_set_shader(_outSurf, sh_blur_shape);
|
|
|
|
shader_set_f("dimension", surface_get_dimension(_data[0]));
|
|
|
|
shader_set_f("blurMaskDimension", surface_get_dimension(_blur));
|
|
|
|
var b = shader_set_surface("blurMask", _blur);
|
|
|
|
shader_set_i("sampleMode", _samp);
|
|
|
|
shader_set_i("mode", _mode);
|
2024-06-13 09:21:07 +02:00
|
|
|
shader_set_i("mode", _mode);
|
|
|
|
shader_set_i("gamma", _gam);
|
2024-02-01 08:38:21 +01:00
|
|
|
|
|
|
|
gpu_set_tex_filter_ext(b, true);
|
|
|
|
|
|
|
|
shader_set_i("useMask", is_surface(_mask));
|
|
|
|
shader_set_surface("mask", _mask);
|
|
|
|
|
|
|
|
draw_surface_safe(_data[0]);
|
|
|
|
surface_reset_shader();
|
|
|
|
|
|
|
|
__process_mask_modifier(_data);
|
|
|
|
_outSurf = mask_apply(_data[0], _outSurf, _data[3], _data[4]);
|
|
|
|
_outSurf = channel_apply(_data[0], _outSurf, _data[6]);
|
|
|
|
|
|
|
|
return _outSurf;
|
|
|
|
} #endregion
|
|
|
|
}
|