Pixel-Composer/scripts/node_pixel_cloud/node_pixel_cloud.gml

70 lines
2.3 KiB
Text
Raw Normal View History

2023-02-28 09:43:01 +01:00
function Node_Pixel_Cloud(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
2022-01-14 02:44:58 +01:00
name = "Pixel Cloud";
2024-08-08 06:57:51 +02:00
inputs[0] = nodeValue_Surface("Surface in", self);
2022-01-14 02:44:58 +01:00
2024-08-08 06:57:51 +02:00
inputs[1] = nodeValue_Int("Seed", self, seed_random(6))
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[1].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
2022-01-14 02:44:58 +01:00
2024-08-08 06:57:51 +02:00
inputs[2] = nodeValue_Float("Strength", self, 0.1)
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 2, 0.01] });
2022-01-14 02:44:58 +01:00
2024-08-08 06:57:51 +02:00
inputs[3] = nodeValue_Surface("Strength map", self);
2022-01-14 02:44:58 +01:00
2024-08-08 06:57:51 +02:00
inputs[4] = nodeValue_Gradient("Color over lifetime", self, new gradientObject(cola(c_white)))
2024-01-22 10:26:25 +01:00
.setMappable(9);
2022-01-14 02:44:58 +01:00
2024-08-08 06:57:51 +02:00
inputs[5] = nodeValue_Float("Distance", self, 1);
2022-01-14 02:44:58 +01:00
2024-08-08 06:57:51 +02:00
inputs[6] = nodeValue("Alpha over lifetime", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_11);
2022-01-14 02:44:58 +01:00
2024-08-08 06:57:51 +02:00
inputs[7] = nodeValue_Float("Random blending", self, 0.1)
.setDisplay(VALUE_DISPLAY.slider);
2023-02-14 05:32:32 +01:00
2024-08-08 06:57:51 +02:00
inputs[8] = nodeValue_Bool("Active", self, true);
2023-02-14 05:32:32 +01:00
active_index = 8;
2023-12-23 09:39:55 +01:00
2024-01-22 10:26:25 +01:00
//////////////////////////////////////////////////////////////////////////////////////////////////
2024-08-08 06:57:51 +02:00
inputs[9] = nodeValueMap("Gradient map", self);
2024-01-22 10:26:25 +01:00
2024-08-08 06:57:51 +02:00
inputs[10] = nodeValueGradientRange("Gradient map range", self, inputs[4]);
2024-01-22 10:26:25 +01:00
//////////////////////////////////////////////////////////////////////////////////////////////////
2023-02-14 05:32:32 +01:00
input_display_list = [ 8,
2022-01-14 02:44:58 +01:00
["Input", true], 0, 1,
["Movement", false], 5, 2, 3,
2024-01-22 10:26:25 +01:00
["Color", true], 4, 9, 6, 7
2022-01-14 02:44:58 +01:00
]
2024-08-08 06:57:51 +02:00
outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone);
2022-01-14 02:44:58 +01:00
2023-03-19 09:17:39 +01:00
attribute_surface_depth();
2023-12-23 09:39:55 +01:00
static step = function() {
2024-08-08 06:57:51 +02:00
inputs[4].mappableStep();
2023-12-23 09:39:55 +01:00
}
static processData = function(_outSurf, _data, _output_index, _array_index) {
2022-01-14 02:44:58 +01:00
2023-12-23 09:39:55 +01:00
surface_set_shader(_outSurf, sh_pixel_cloud);
shader_set_f("seed" , _data[1]);
shader_set_f("strength", _data[2]);
shader_set_f("dist" , _data[5]);
shader_set_i("useMap", is_surface(_data[3]));
shader_set_surface("strengthMap", _data[3]);
2022-01-14 02:44:58 +01:00
2024-08-08 06:57:51 +02:00
shader_set_gradient(_data[4], _data[9], _data[10], inputs[4]);
2022-01-14 02:44:58 +01:00
2023-12-23 09:39:55 +01:00
shader_set_f("alpha_curve" , _data[6]);
shader_set_i("curve_amount", array_length(_data[6]));
shader_set_f("randomAmount", _data[7]);
2022-01-14 02:44:58 +01:00
draw_surface_safe(_data[0]);
2023-12-23 09:39:55 +01:00
surface_reset_shader();
2022-01-14 02:44:58 +01:00
return _outSurf;
}
}