Pixel-Composer/scripts/node_vignette/node_vignette.gml
2024-01-15 19:53:46 +07:00

41 lines
No EOL
1.4 KiB
Text

function Node_Vignette(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Vignette";
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
inputs[| 1] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
active_index = 1;
inputs[| 2] = nodeValue("Exposure", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 15);
inputs[| 3] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 2, 0.01 ] });
inputs[| 4] = nodeValue("Exponent", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.25)
.setDisplay(VALUE_DISPLAY.slider);
inputs[| 5] = nodeValue("Roundness", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
.setDisplay(VALUE_DISPLAY.slider);
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
input_display_list = [ 1,
["Surfaces", false], 0,
["Vignette", false], 5, 2, 3,
]
attribute_surface_depth();
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
surface_set_shader(_outSurf, sh_vignette);
shader_set_f("exposure", _data[2]);
shader_set_f("strength", _data[3]);
shader_set_f("amplitude", _data[4]);
shader_set_f("smoothness", _data[5]);
draw_surface_safe(_data[0], 0, 0);
surface_reset_shader();
return _outSurf;
} #endregion
}