Pixel-Composer/scripts/node_interlaced/node_interlaced.gml

70 lines
2.0 KiB
Plaintext
Raw Normal View History

2024-06-28 11:54:13 +02:00
function Node_Interlaced(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Interlace";
2024-08-18 06:16:20 +02:00
newInput(0, nodeValue_Surface("Surface in", self));
2024-06-28 11:54:13 +02:00
2024-08-18 06:16:20 +02:00
newInput(1, nodeValue_Bool("Active", self, true));
2024-06-28 11:54:13 +02:00
active_index = 1;
2024-08-18 06:16:20 +02:00
newInput(2, nodeValue_Surface("Mask", self));
2024-06-28 11:54:13 +02:00
2024-08-18 09:13:41 +02:00
newInput(3, nodeValue_Float("Mix", self, 1))
2024-06-28 11:54:13 +02:00
.setDisplay(VALUE_DISPLAY.slider);
2024-08-18 06:16:20 +02:00
newInput(4, nodeValue_Toggle("Channel", self, 0b1111, { data: array_create(4, THEME.inspector_channel) }));
2024-06-28 11:54:13 +02:00
__init_mask_modifier(2); // inputs 5, 6
2024-08-18 06:16:20 +02:00
newInput(7, nodeValue_Enum_Button("Axis", self, 0, [ "X", "Y" ]));
2024-06-28 11:54:13 +02:00
2024-08-18 06:16:20 +02:00
newInput(8, nodeValue_Float("Size", self, 1));
2024-06-28 11:54:13 +02:00
2024-08-18 06:16:20 +02:00
newInput(9, nodeValue_Bool("Invert", self, false));
2024-06-28 11:54:13 +02:00
2024-08-08 06:57:51 +02:00
outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone);
2024-06-28 11:54:13 +02:00
temp_surface = [ ];
input_display_list = [ 1,
["Surface", false], 0, 2, 3, 4,
["Effects", false], 7, 8, 9,
];
attribute_surface_depth();
static step = function() { #region
__step_mask_modifier();
} #endregion
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
var _surf = _data[0];
var _axis = _data[7];
var _size = _data[8];
var _invt = _data[9];
var _dim = surface_get_dimension(_surf);
surface_set_shader(_outSurf, sh_interlaced);
2024-07-22 10:21:57 +02:00
shader_set_i("useSurf", CURRENT_FRAME >= 1);
2024-06-28 11:54:13 +02:00
shader_set_surface("prevFrame", array_safe_get(temp_surface, _array_index));
shader_set_2("dimension", _dim);
shader_set_i("axis", _axis);
shader_set_i("invert", _invt);
shader_set_f("size", _size);
draw_surface_safe(_surf);
surface_reset_shader();
temp_surface[_array_index] = surface_verify(array_safe_get(temp_surface, _array_index), _dim[0], _dim[1]);
surface_set_shader(temp_surface[_array_index], noone);
draw_surface_safe(_surf);
surface_reset_shader();
__process_mask_modifier(_data);
_outSurf = mask_apply(_data[0], _outSurf, _data[2], _data[3]);
_outSurf = channel_apply(_data[0], _outSurf, _data[4]);
return _outSurf;
} #endregion
}