Pixel-Composer/scripts/node_combine_hsv/node_combine_hsv.gml

39 lines
1.3 KiB
Text
Raw Normal View History

2023-02-28 09:43:01 +01:00
function Node_Combine_HSV(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
2022-12-27 04:00:50 +01:00
name = "HSV Combine";
shader = sh_combine_hsv;
uniform_h = shader_get_sampler_index(shader, "samH");
uniform_s = shader_get_sampler_index(shader, "samS");
uniform_v = shader_get_sampler_index(shader, "samV");
2023-02-14 05:32:32 +01:00
inputs[| 0] = nodeValue("Hue", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
inputs[| 1] = nodeValue("Saturation", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
inputs[| 2] = nodeValue("Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
2022-12-27 04:00:50 +01:00
2023-02-14 05:32:32 +01:00
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
2022-12-27 04:00:50 +01:00
2023-03-19 09:17:39 +01:00
attribute_surface_depth();
2023-01-01 02:06:02 +01:00
static process_data = function(_outSurf, _data, _output_index, _array_index) {
2022-12-27 04:00:50 +01:00
var _h = _data[0];
var _s = _data[1];
var _v = _data[2];
surface_set_target(_outSurf);
2023-03-19 09:17:39 +01:00
DRAW_CLEAR
2023-02-14 05:32:32 +01:00
BLEND_OVERRIDE;
2022-12-27 04:00:50 +01:00
shader_set(shader);
texture_set_stage(uniform_h, surface_get_texture(_h));
texture_set_stage(uniform_s, surface_get_texture(_s));
texture_set_stage(uniform_v, surface_get_texture(_v));
draw_sprite_ext(s_fx_pixel, 0, 0, 0, surface_get_width(_outSurf), surface_get_width(_outSurf), 0, c_white, 1);
shader_reset();
2023-02-14 05:32:32 +01:00
BLEND_NORMAL;
2022-12-27 04:00:50 +01:00
surface_reset_target();
return _outSurf;
}
}