Pixel-Composer/scripts/node_glow/node_glow.gml

72 lines
2.1 KiB
Text
Raw Normal View History

2023-02-28 09:43:01 +01:00
function Node_Glow(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
2022-01-13 05:24:03 +01:00
name = "Glow";
2024-08-18 06:16:20 +02:00
newInput(0, nodeValue_Surface("Surface in", self));
2023-02-14 05:32:32 +01:00
2024-08-18 09:13:41 +02:00
newInput(1, nodeValue_Float("Border", self, 0))
2024-03-24 04:58:08 +01:00
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 4, 0.1] });
2022-01-13 05:24:03 +01:00
2024-08-18 09:13:41 +02:00
newInput(2, nodeValue_Float("Size", self, 3))
2024-03-24 04:58:08 +01:00
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 0.1] });
2022-01-13 05:24:03 +01:00
2024-08-18 09:13:41 +02:00
newInput(3, nodeValue_Float("Strength", self, 1))
2024-03-16 06:23:47 +01:00
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 4, 0.01 ]});
2022-01-13 05:24:03 +01:00
2024-11-23 08:31:15 +01:00
newInput(4, nodeValue_Color("Color", self, cola(c_white)));
2023-02-14 05:32:32 +01:00
2024-08-18 06:16:20 +02:00
newInput(5, nodeValue_Surface("Mask", self));
2023-02-14 05:32:32 +01:00
2024-08-18 09:13:41 +02:00
newInput(6, nodeValue_Float("Mix", self, 1))
.setDisplay(VALUE_DISPLAY.slider);
2023-02-14 05:32:32 +01:00
2024-08-18 06:16:20 +02:00
newInput(7, nodeValue_Bool("Active", self, true));
2023-02-14 05:32:32 +01:00
active_index = 7;
2023-11-24 10:41:53 +01:00
__init_mask_modifier(5); // inputs 8, 9,
2024-08-18 06:16:20 +02:00
newInput(10, nodeValue_Enum_Button("Mode", self, 0, [ "Greyscale", "Alpha" ]));
2024-03-16 06:23:47 +01:00
2024-08-18 06:16:20 +02:00
newInput(11, nodeValue_Bool("Draw original", self, true));
2024-05-17 05:19:11 +02:00
2024-08-18 06:16:20 +02:00
newInput(12, nodeValue_Enum_Button("Side", self, 0, [ "Outer", "Inner" ]));
2024-03-16 06:23:47 +01:00
2023-02-14 05:32:32 +01:00
input_display_list = [ 7,
2023-11-24 10:41:53 +01:00
["Surfaces", true], 0, 5, 6, 8, 9,
2024-05-17 05:19:11 +02:00
["Glow", false], 10, 12, 2, 3,
2024-03-16 06:23:47 +01:00
["Render", false], 4, 11,
2023-02-14 05:32:32 +01:00
]
2022-01-13 05:24:03 +01:00
2024-09-04 03:57:11 +02:00
newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone));
2023-02-14 05:32:32 +01:00
2023-03-19 09:17:39 +01:00
attribute_surface_depth();
2022-01-13 05:24:03 +01:00
2024-03-16 06:23:47 +01:00
static step = function() { __step_mask_modifier(); }
2023-11-24 10:41:53 +01:00
2023-08-17 16:56:54 +02:00
static processData = function(_outSurf, _data, _output_index, _array_index) {
2024-03-16 06:23:47 +01:00
var _border = _data[1];
var _size = _data[2];
var _strength = _data[3];
var _color = _data[4];
var _mode = _data[10];
var _render = _data[11];
2024-05-17 05:19:11 +02:00
var _side = _data[12];
2023-12-02 14:30:27 +01:00
2024-03-16 06:23:47 +01:00
surface_set_shader(_outSurf, sh_glow);
shader_set_dim("dimension", _data[0]);
shader_set_i("mode", _mode);
shader_set_f("border", _border);
shader_set_f("size", _size);
shader_set_f("strength", _strength);
shader_set_color("color", _color);
shader_set_i("render", _render);
2024-05-17 05:19:11 +02:00
shader_set_i("side", _side);
2024-03-16 06:23:47 +01:00
draw_surface_safe(_data[0]);
surface_reset_shader();
2022-01-13 05:24:03 +01:00
2023-11-24 10:41:53 +01:00
__process_mask_modifier(_data);
2023-02-14 05:32:32 +01:00
_outSurf = mask_apply(_data[0], _outSurf, _data[5], _data[6]);
2022-01-13 05:24:03 +01:00
return _outSurf;
}
}