2024-01-29 14:33:55 +01:00
|
|
|
function Node_Edge_Shade(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
|
|
|
name = "Edge Shade";
|
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(0, nodeValue_Surface("Surface in", self));
|
2024-01-29 14:33:55 +01:00
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(1, nodeValue_Bool("Active", self, true));
|
2024-01-29 14:33:55 +01:00
|
|
|
active_index = 1;
|
|
|
|
|
2024-08-18 09:13:41 +02:00
|
|
|
newInput(2, nodeValue_Gradient("Colors", self, new gradientObject( [ cola(c_black), cola(c_white) ] )))
|
2024-01-29 14:33:55 +01:00
|
|
|
.setMappable(3);
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(3, nodeValueMap("Gradient map", self));
|
2024-01-29 14:33:55 +01:00
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(4, nodeValueGradientRange("Gradient map range", self, inputs[2]));
|
2024-01-29 14:33:55 +01:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2024-09-04 03:57:11 +02:00
|
|
|
newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone));
|
2024-01-29 14:33:55 +01:00
|
|
|
|
|
|
|
input_display_list = [ 1,
|
|
|
|
["Surfaces", false], 0,
|
|
|
|
["Effects", false], 2, 3, 4,
|
|
|
|
]
|
|
|
|
|
|
|
|
temp_surface = array_create(3);
|
|
|
|
|
|
|
|
attribute_surface_depth();
|
|
|
|
|
|
|
|
static step = function() { #region
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[2].mappableStep();
|
2024-01-29 14:33:55 +01:00
|
|
|
} #endregion
|
|
|
|
|
|
|
|
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
|
|
|
var _surf = _data[0];
|
|
|
|
|
|
|
|
var _dim = surface_get_dimension(_surf);
|
|
|
|
|
|
|
|
for( var i = 0, n = array_length(temp_surface); i < n; i++ )
|
|
|
|
temp_surface[i] = surface_verify(temp_surface[i], _dim[0], _dim[1]);
|
|
|
|
|
|
|
|
surface_set_shader(temp_surface[0], sh_edge_shade_convert);
|
|
|
|
shader_set_f("dimension", _dim);
|
|
|
|
|
|
|
|
draw_surface_safe(_data[0]);
|
|
|
|
surface_reset_shader();
|
|
|
|
|
|
|
|
surface_set_shader(temp_surface[1], sh_edge_shade_extract);
|
|
|
|
shader_set_f("dimension", _dim);
|
|
|
|
|
|
|
|
draw_surface_safe(temp_surface[0]);
|
|
|
|
surface_reset_shader();
|
|
|
|
|
|
|
|
surface_set_shader(_outSurf, sh_edge_shade_apply);
|
|
|
|
shader_set_f("dimension", _dim);
|
2024-08-08 06:57:51 +02:00
|
|
|
shader_set_gradient(_data[2], _data[3], _data[4], inputs[2]);
|
2024-01-29 14:33:55 +01:00
|
|
|
|
|
|
|
draw_surface_safe(temp_surface[1]);
|
|
|
|
surface_reset_shader();
|
|
|
|
|
|
|
|
return _outSurf;
|
|
|
|
} #endregion
|
|
|
|
}
|