2024-06-28 11:54:13 +02:00
|
|
|
function Node_Interlaced(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
|
|
|
name = "Interlace";
|
|
|
|
|
2024-09-01 06:30:34 +02:00
|
|
|
update_on_frame = true;
|
|
|
|
use_cache = CACHE_USE.manual;
|
|
|
|
clearCacheOnChange = false;
|
|
|
|
|
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
|
|
|
|
|
|
|
input_display_list = [ 1,
|
|
|
|
["Surface", false], 0, 2, 3, 4,
|
|
|
|
["Effects", false], 7, 8, 9,
|
|
|
|
];
|
|
|
|
|
|
|
|
attribute_surface_depth();
|
|
|
|
|
2024-09-01 06:30:34 +02:00
|
|
|
insp2UpdateTooltip = "Clear cache";
|
|
|
|
insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ];
|
|
|
|
|
|
|
|
static onInspector2Update = function() { clearCache(); }
|
|
|
|
|
|
|
|
static step = function() {
|
2024-06-28 11:54:13 +02:00
|
|
|
__step_mask_modifier();
|
2024-09-01 06:30:34 +02:00
|
|
|
}
|
2024-06-28 11:54:13 +02:00
|
|
|
|
2024-09-01 06:30:34 +02:00
|
|
|
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
2024-06-28 11:54:13 +02:00
|
|
|
var _surf = _data[0];
|
|
|
|
var _axis = _data[7];
|
|
|
|
var _size = _data[8];
|
|
|
|
var _invt = _data[9];
|
|
|
|
|
|
|
|
var _dim = surface_get_dimension(_surf);
|
2024-09-01 06:30:34 +02:00
|
|
|
var _prev = array_safe_get_fast(cached_output, CURRENT_FRAME - 1, noone);
|
2024-06-28 11:54:13 +02:00
|
|
|
|
|
|
|
surface_set_shader(_outSurf, sh_interlaced);
|
2024-09-01 06:30:34 +02:00
|
|
|
shader_set_i("useSurf", is_surface(_prev));
|
|
|
|
shader_set_surface("prevFrame", _prev);
|
|
|
|
|
2024-06-28 11:54:13 +02:00
|
|
|
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();
|
|
|
|
|
2024-09-01 06:30:34 +02:00
|
|
|
cacheCurrentFrame(_surf);
|
2024-06-28 11:54:13 +02:00
|
|
|
|
|
|
|
__process_mask_modifier(_data);
|
|
|
|
_outSurf = mask_apply(_data[0], _outSurf, _data[2], _data[3]);
|
|
|
|
_outSurf = channel_apply(_data[0], _outSurf, _data[4]);
|
|
|
|
|
|
|
|
return _outSurf;
|
2024-09-01 06:30:34 +02:00
|
|
|
}
|
2024-06-28 11:54:13 +02:00
|
|
|
}
|