Pixel-Composer/scripts/node_curve_hsv/node_curve_hsv.gml

63 lines
1.8 KiB
Plaintext
Raw Normal View History

2024-06-02 13:56:11 +02:00
function Node_Curve_HSV(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "HSV Curve";
2024-08-18 06:16:20 +02:00
newInput(0, nodeValue_Surface("Surface in", self));
2024-06-02 13:56:11 +02:00
2024-08-20 10:15:53 +02:00
newInput(1, nodeValue("Hue", self, CONNECT_TYPE.input, VALUE_TYPE.curve, CURVE_DEF_01));
2024-06-02 13:56:11 +02:00
2024-08-20 10:15:53 +02:00
newInput(2, nodeValue("Saturation", self, CONNECT_TYPE.input, VALUE_TYPE.curve, CURVE_DEF_01));
2024-06-02 13:56:11 +02:00
2024-08-20 10:15:53 +02:00
newInput(3, nodeValue("Value", self, CONNECT_TYPE.input, VALUE_TYPE.curve, CURVE_DEF_01));
2024-06-02 13:56:11 +02:00
2024-08-18 06:16:20 +02:00
newInput(4, nodeValue_Surface("Mask", self));
2024-06-02 13:56:11 +02:00
2024-08-18 09:13:41 +02:00
newInput(5, nodeValue_Float("Mix", self, 1))
2024-06-02 13:56:11 +02:00
.setDisplay(VALUE_DISPLAY.slider);
2024-08-18 06:16:20 +02:00
newInput(6, nodeValue_Bool("Active", self, true));
2024-06-02 13:56:11 +02:00
active_index = 6;
2024-08-18 06:16:20 +02:00
newInput(7, nodeValue_Toggle("Channel", self, 0b1111, { data: array_create(4, THEME.inspector_channel) }));
2024-06-02 13:56:11 +02:00
__init_mask_modifier(4); // inputs 8, 9,
2024-08-08 06:57:51 +02:00
outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone);
2024-06-02 13:56:11 +02:00
input_display_list = [ 6, 7,
["Surfaces", true], 0, 4, 5, 8, 9,
["Curve", false], 1, 2, 3,
];
attribute_surface_depth();
static step = function() { #region
__step_mask_modifier();
} #endregion
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
var _hcur = _data[1];
var _scur = _data[2];
var _vcur = _data[3];
surface_set_shader(_outSurf, sh_curve_hsv);
shader_set_f("h_curve", _hcur);
shader_set_i("h_amount", array_length(_hcur));
shader_set_f("s_curve", _scur);
shader_set_i("s_amount", array_length(_scur));
shader_set_f("v_curve", _vcur);
shader_set_i("v_amount", array_length(_vcur));
draw_surface_safe(_data[0]);
surface_reset_shader();
__process_mask_modifier(_data);
_outSurf = mask_apply(_data[0], _outSurf, _data[4], _data[5]);
_outSurf = channel_apply(_data[0], _outSurf, _data[7]);
return _outSurf;
} #endregion
}