Pixel-Composer/scripts/node_vignette/node_vignette.gml

41 lines
1.2 KiB
Text
Raw Normal View History

2024-01-12 05:03:35 +01:00
function Node_Vignette(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Vignette";
2024-08-18 06:16:20 +02:00
newInput(0, nodeValue_Surface("Surface in", self));
2024-01-12 05:03:35 +01:00
2024-08-18 06:16:20 +02:00
newInput(1, nodeValue_Bool("Active", self, true));
2024-01-12 05:03:35 +01:00
active_index = 1;
2024-08-18 06:16:20 +02:00
newInput(2, nodeValue_Float("Exposure", self, 15));
2024-01-12 05:03:35 +01:00
2024-08-18 09:13:41 +02:00
newInput(3, nodeValue_Float("Strength", self, 1))
2024-01-12 05:03:35 +01:00
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 2, 0.01 ] });
2024-08-18 09:13:41 +02:00
newInput(4, nodeValue_Float("Exponent", self, 0.25))
2024-01-12 05:03:35 +01:00
.setDisplay(VALUE_DISPLAY.slider);
2024-08-18 09:13:41 +02:00
newInput(5, nodeValue_Float("Roundness", self, 0))
2024-01-15 13:53:46 +01:00
.setDisplay(VALUE_DISPLAY.slider);
2024-08-08 06:57:51 +02:00
outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone);
2024-01-12 05:03:35 +01:00
input_display_list = [ 1,
["Surfaces", false], 0,
2024-01-15 13:53:46 +01:00
["Vignette", false], 5, 2, 3,
2024-01-12 05:03:35 +01:00
]
attribute_surface_depth();
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
surface_set_shader(_outSurf, sh_vignette);
2024-01-15 13:53:46 +01:00
shader_set_f("exposure", _data[2]);
2024-01-12 05:03:35 +01:00
shader_set_f("strength", _data[3]);
shader_set_f("amplitude", _data[4]);
2024-01-15 13:53:46 +01:00
shader_set_f("smoothness", _data[5]);
2024-01-12 05:03:35 +01:00
draw_surface_safe(_data[0]);
2024-01-12 05:03:35 +01:00
surface_reset_shader();
return _outSurf;
} #endregion
}