Pixel-Composer/scripts/node_solid/node_solid.gml

58 lines
1.4 KiB
Plaintext
Raw Normal View History

2023-02-28 09:43:01 +01:00
function Node_Solid(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
2022-01-13 05:24:03 +01:00
name = "Solid";
2024-08-08 06:57:51 +02:00
inputs[0] = nodeValue_Dimension(self);
2022-01-13 05:24:03 +01:00
2024-08-08 06:57:51 +02:00
inputs[1] = nodeValue_Color("Color", self, cola(c_white));
2023-01-25 06:49:00 +01:00
2024-08-08 06:57:51 +02:00
inputs[2] = nodeValue_Bool("Empty", self, false);
2024-08-08 06:57:51 +02:00
inputs[3] = nodeValue_Surface("Mask", self);
2023-01-25 06:49:00 +01:00
2024-08-08 06:57:51 +02:00
inputs[4] = nodeValue_Bool("Use mask dimension", self, true);
2022-09-21 06:09:40 +02:00
2024-08-08 06:57:51 +02:00
outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone);
2022-09-21 06:09:40 +02:00
input_display_list = [
["Surfaces", false], 0, 3, 4,
["Solid", false], 1, 2,
2022-09-21 06:09:40 +02:00
];
2022-01-13 05:24:03 +01:00
2023-03-19 09:17:39 +01:00
attribute_surface_depth();
2023-03-26 07:13:36 +02:00
2023-08-17 16:56:54 +02:00
static processData = function(_outSurf, _data, _output_index, _array_index) {
2022-12-22 03:09:55 +01:00
var _dim = _data[0];
var _col = _data[1];
var _emp = _data[2];
var _msk = _data[3];
var _msd = _data[4];
2022-01-13 05:24:03 +01:00
var _maskUse = is_surface(_msk);
2024-08-08 06:57:51 +02:00
inputs[4].setVisible(_maskUse);
if(_maskUse && _msd) _dim = [ surface_get_width_safe(_msk), surface_get_height_safe(_msk) ];
2023-03-19 09:17:39 +01:00
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
2022-01-13 05:24:03 +01:00
2023-02-14 05:32:32 +01:00
if(_emp) {
surface_set_target(_outSurf);
2023-03-19 09:17:39 +01:00
DRAW_CLEAR
2023-02-14 05:32:32 +01:00
surface_reset_target();
return _outSurf;
}
if(_maskUse) {
surface_set_shader(_outSurf, sh_solid);
2024-01-08 08:10:50 +01:00
draw_surface_stretched_ext(_msk, 0, 0, _dim[0], _dim[1], _col, _color_get_alpha(_col));
surface_reset_shader();
return _outSurf;
}
surface_set_target(_outSurf);
draw_clear(_col);
2022-01-13 05:24:03 +01:00
surface_reset_target();
2022-12-22 03:09:55 +01:00
return _outSurf;
2022-01-13 05:24:03 +01:00
}
}