2023-02-28 09:43:01 +01:00
|
|
|
function Node_Atlas(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
2023-01-25 06:49:00 +01:00
|
|
|
name = "Pixel Expand";
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[0] = nodeValue_Surface("Surface in", self);
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[1] = nodeValue_Bool("Active", self, true);
|
2023-02-14 05:32:32 +01:00
|
|
|
active_index = 1;
|
2024-04-11 05:51:13 +02:00
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[2] = nodeValue_Enum_Scroll("Method", self, 0, [ "Radial", "Scan" ]);
|
2023-02-14 05:32:32 +01:00
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone);
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2024-04-11 05:51:13 +02:00
|
|
|
input_display_list = [ 1, 0, 2 ];
|
|
|
|
|
|
|
|
temp_surface = array_create(2);
|
2023-04-08 20:06:27 +02: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
|
2024-04-11 05:51:13 +02:00
|
|
|
var _surf = _data[0];
|
|
|
|
var _meth = _data[2];
|
|
|
|
var _dim = surface_get_dimension(_data[0]);
|
|
|
|
|
|
|
|
for( var i = 0; i < 2; i++ ) temp_surface[i] = surface_verify(temp_surface[i], _dim[0], _dim[1]);
|
|
|
|
|
|
|
|
if(_meth == 0) {
|
|
|
|
var _bg = 0;
|
2024-04-27 14:10:39 +02:00
|
|
|
var _itr = ceil(max(_dim[0], _dim[1]) / 16);
|
2024-04-11 05:51:13 +02:00
|
|
|
|
|
|
|
surface_set_shader(temp_surface[!_bg]);
|
|
|
|
draw_surface_safe(_surf);
|
|
|
|
surface_reset_shader();
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2024-04-11 05:51:13 +02:00
|
|
|
repeat(_itr) {
|
|
|
|
surface_set_shader(temp_surface[_bg], sh_atlas);
|
|
|
|
shader_set_f("dimension", _dim);
|
2024-07-10 03:45:25 +02:00
|
|
|
draw_surface_safe(temp_surface[!_bg]);
|
2024-04-11 05:51:13 +02:00
|
|
|
surface_reset_shader();
|
|
|
|
|
|
|
|
_bg = !_bg;
|
|
|
|
}
|
|
|
|
|
|
|
|
surface_set_shader(_outSurf);
|
|
|
|
draw_surface_safe(temp_surface[!_bg]);
|
|
|
|
surface_reset_shader();
|
|
|
|
|
|
|
|
} else if(_meth == 1) {
|
|
|
|
|
|
|
|
surface_set_shader(temp_surface[0], sh_atlas_scan);
|
|
|
|
shader_set_f("dimension", _dim);
|
|
|
|
shader_set_f("iteration", _dim[0]);
|
|
|
|
shader_set_i("axis", 0);
|
|
|
|
|
|
|
|
draw_surface_safe(_surf);
|
|
|
|
surface_reset_shader();
|
|
|
|
|
|
|
|
surface_set_shader(temp_surface[1], sh_atlas_scan);
|
|
|
|
shader_set_f("dimension", _dim);
|
|
|
|
shader_set_f("iteration", _dim[1]);
|
|
|
|
shader_set_i("axis", 1);
|
|
|
|
|
|
|
|
draw_surface_safe(temp_surface[0]);
|
|
|
|
surface_reset_shader();
|
|
|
|
|
|
|
|
surface_set_shader(_outSurf);
|
|
|
|
draw_surface_safe(temp_surface[1]);
|
|
|
|
surface_reset_shader();
|
|
|
|
}
|
2022-01-13 05:24:03 +01:00
|
|
|
|
|
|
|
return _outSurf;
|
2023-09-14 16:29:39 +02:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|