2023-02-28 09:43:01 +01:00
|
|
|
function Node_Alpha_Hash(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
2023-01-01 02:06:02 +01:00
|
|
|
name = "Alpha hash";
|
|
|
|
|
|
|
|
shader = sh_alpha_hash;
|
|
|
|
uniform_dim = shader_get_uniform(shader, "dimension");
|
|
|
|
uniform_dit = shader_get_uniform(shader, "dither");
|
|
|
|
|
|
|
|
static dither8 = [ 0, 32, 8, 40, 2, 34, 10, 42,
|
|
|
|
48, 16, 56, 24, 50, 18, 58, 26,
|
|
|
|
12, 44, 4, 36, 14, 46, 6, 38,
|
|
|
|
60, 28, 52, 20, 62, 30, 54, 22,
|
|
|
|
3, 35, 11, 43, 1, 33, 9, 41,
|
|
|
|
51, 19, 59, 27, 49, 17, 57, 25,
|
|
|
|
15, 47, 7, 39, 13, 45, 5, 37,
|
|
|
|
63, 31, 55, 23, 61, 29, 53, 21];
|
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(0, nodeValue_Surface("Surface in", self));
|
2023-01-01 02:06:02 +01:00
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone);
|
2023-01-01 02:06:02 +01:00
|
|
|
|
2023-03-19 09:17:39 +01:00
|
|
|
attribute_surface_depth();
|
|
|
|
|
2023-09-14 16:29:39 +02:00
|
|
|
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
2023-01-01 02:06:02 +01:00
|
|
|
surface_set_target(_outSurf);
|
2023-03-19 09:17:39 +01:00
|
|
|
DRAW_CLEAR
|
2023-02-14 05:32:32 +01:00
|
|
|
BLEND_OVERRIDE;
|
2023-01-01 02:06:02 +01:00
|
|
|
|
|
|
|
shader_set(shader);
|
2023-09-08 21:37:36 +02:00
|
|
|
shader_set_uniform_f(uniform_dim, surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]));
|
2023-02-14 05:32:32 +01:00
|
|
|
shader_set_uniform_f_array_safe(uniform_dit, dither8);
|
2024-07-10 03:45:25 +02:00
|
|
|
draw_surface_safe(_data[0]);
|
2023-01-01 02:06:02 +01:00
|
|
|
shader_reset();
|
|
|
|
|
2023-02-14 05:32:32 +01:00
|
|
|
BLEND_NORMAL;
|
2023-01-01 02:06:02 +01:00
|
|
|
surface_reset_target();
|
|
|
|
|
|
|
|
return _outSurf;
|
2023-09-14 16:29:39 +02:00
|
|
|
} #endregion
|
2023-01-01 02:06:02 +01:00
|
|
|
}
|