mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-11-15 15:03:51 +01:00
46 lines
1.2 KiB
Plaintext
46 lines
1.2 KiB
Plaintext
function Node_Invert(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
|
name = "Invert";
|
|
|
|
newInput(0, nodeValue_Surface("Surface in", self));
|
|
|
|
newInput(1, nodeValue_Surface("Mask", self));
|
|
|
|
newInput(2, nodeValue_Float("Mix", self, 1))
|
|
.setDisplay(VALUE_DISPLAY.slider);
|
|
|
|
newInput(3, nodeValue_Bool("Active", self, true));
|
|
active_index = 3;
|
|
|
|
newInput(4, nodeValue_Toggle("Channel", self, 0b1111, { data: array_create(4, THEME.inspector_channel) }));
|
|
|
|
__init_mask_modifier(1); // inputs 5, 6
|
|
|
|
newInput(7, nodeValue_Bool("Include Alpha", self, false));
|
|
|
|
input_display_list = [ 3, 4, 7,
|
|
["Surfaces", true], 0, 1, 2, 5, 6,
|
|
]
|
|
|
|
newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone));
|
|
|
|
attribute_surface_depth();
|
|
|
|
static step = function() {
|
|
__step_mask_modifier();
|
|
}
|
|
|
|
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
|
|
|
surface_set_shader(_outSurf, sh_invert);
|
|
shader_set_i("alpha", _data[7]);
|
|
|
|
draw_surface_safe(_data[0]);
|
|
surface_reset_shader();
|
|
|
|
__process_mask_modifier(_data);
|
|
_outSurf = mask_apply(_data[0], _outSurf, _data[1], _data[2]);
|
|
_outSurf = channel_apply(_data[0], _outSurf, _data[4]);
|
|
|
|
return _outSurf;
|
|
}
|
|
} |