2023-05-03 21:42:17 +02:00
|
|
|
function Node_FXAA(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
|
|
|
name = "FXAA";
|
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(0, nodeValue_Surface("Surface in", self));
|
2023-05-03 21:42:17 +02:00
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(1, nodeValue_Bool("Active", self, true));
|
2023-06-17 14:30:49 +02:00
|
|
|
|
2024-08-18 09:13:41 +02:00
|
|
|
newInput(2, nodeValue_Float("Distance", self, 0.5))
|
2024-05-07 12:40:18 +02:00
|
|
|
.setDisplay(VALUE_DISPLAY.slider);
|
|
|
|
|
2024-08-18 09:13:41 +02:00
|
|
|
newInput(3, nodeValue_Float("Mix", self, 1))
|
2024-05-07 12:40:18 +02:00
|
|
|
.setDisplay(VALUE_DISPLAY.slider);
|
|
|
|
|
2023-06-17 14:30:49 +02:00
|
|
|
active_index = 1;
|
|
|
|
|
2023-05-03 21:42:17 +02:00
|
|
|
input_display_list = [
|
2023-06-17 14:30:49 +02:00
|
|
|
1, 0,
|
2024-05-07 12:40:18 +02:00
|
|
|
["Effect", false], 2, 3,
|
2023-05-03 21:42:17 +02:00
|
|
|
]
|
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone);
|
2023-05-03 21:42:17 +02:00
|
|
|
|
2024-08-29 04:45:38 +02:00
|
|
|
outputs[1] = nodeValue_Output("Mask", self, VALUE_TYPE.surface, noone);
|
|
|
|
|
2023-05-03 21:42:17 +02:00
|
|
|
attribute_surface_depth();
|
|
|
|
|
2024-08-29 04:45:38 +02:00
|
|
|
static processData = function(_outData, _data, _output_index, _array_index) {
|
|
|
|
|
|
|
|
var _dim = surface_get_dimension(_data[0]);
|
|
|
|
_outData[0] = surface_verify(_outData[0], _dim[0], _dim[1]);
|
|
|
|
_outData[1] = surface_verify(_outData[1], _dim[0], _dim[1]);
|
|
|
|
|
|
|
|
surface_set_target_ext(0, _outData[0]);
|
|
|
|
surface_set_target_ext(1, _outData[1]);
|
|
|
|
shader_set(sh_FXAA);
|
|
|
|
DRAW_CLEAR
|
|
|
|
BLEND_OVERRIDE
|
2023-05-03 21:42:17 +02:00
|
|
|
gpu_set_tex_filter(true);
|
2024-08-29 04:45:38 +02:00
|
|
|
shader_set_2("dimension", _dim);
|
2024-05-07 12:40:18 +02:00
|
|
|
shader_set_f("cornerDis", _data[2]);
|
|
|
|
shader_set_f("mixAmo", _data[3]);
|
|
|
|
|
2024-07-10 03:45:25 +02:00
|
|
|
draw_surface_safe(_data[0]);
|
2023-05-03 21:42:17 +02:00
|
|
|
gpu_set_tex_filter(false);
|
2024-08-29 04:45:38 +02:00
|
|
|
BLEND_NORMAL
|
|
|
|
shader_reset();
|
|
|
|
surface_reset_target();
|
2023-05-03 21:42:17 +02:00
|
|
|
|
2024-08-29 04:45:38 +02:00
|
|
|
return _outData;
|
|
|
|
}
|
2023-05-03 21:42:17 +02:00
|
|
|
}
|