Pixel-Composer/scripts/node_glow/node_glow.gml

74 lines
2.6 KiB
Plaintext
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-03-14 14:35:19 +01:00
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
2023-02-14 05:32:32 +01:00
inputs[| 1] = nodeValue("Border", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 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
2023-02-14 05:32:32 +01:00
inputs[| 2] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 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-03-16 06:23:47 +01:00
inputs[| 3] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 4, 0.01 ]});
2022-01-13 05:24:03 +01:00
2023-02-14 05:32:32 +01:00
inputs[| 4] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white);
2024-03-14 14:35:19 +01:00
inputs[| 5] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
2023-02-14 05:32:32 +01:00
inputs[| 6] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
.setDisplay(VALUE_DISPLAY.slider);
2023-02-14 05:32:32 +01:00
inputs[| 7] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
active_index = 7;
2023-11-24 10:41:53 +01:00
__init_mask_modifier(5); // inputs 8, 9,
2024-03-16 06:23:47 +01:00
inputs[| 10] = nodeValue("Mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_button, [ "Greyscale", "Alpha" ]);
inputs[| 11] = nodeValue("Draw original", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
2024-05-17 05:19:11 +02:00
inputs[| 12] = nodeValue("Side", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_button, [ "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
2023-02-14 05:32:32 +01:00
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
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;
}
}