2024-06-12 13:06:14 +02:00
|
|
|
function Node_MK_Fracture(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
|
|
|
name = "MK Fracture";
|
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[0] = nodeValue_Surface("Surface in", self);
|
2024-06-12 13:06:14 +02:00
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[1] = nodeValue_Vector("Subdivision", self, [ 4, 4 ]);
|
2024-06-12 13:06:14 +02:00
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[2] = nodeValue_Float("Progress", self, 0.5)
|
2024-06-13 07:19:25 +02:00
|
|
|
.setDisplay(VALUE_DISPLAY.slider)
|
|
|
|
.setMappable(3);
|
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[3] = nodeValueMap("Progress map", self);
|
2024-06-13 07:19:25 +02:00
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[4] = nodeValue_Vector("Movement", self, [ 0, 0 ])
|
2024-06-13 07:19:25 +02:00
|
|
|
.setMappable(9, true);
|
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[5] = nodeValue_Rotation("Rotation", self, 180)
|
2024-06-13 07:19:25 +02:00
|
|
|
.setMappable(10);
|
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[6] = nodeValue_Float("Scale", self, 0.)
|
2024-06-13 07:19:25 +02:00
|
|
|
.setDisplay(VALUE_DISPLAY.slider);
|
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[7] = nodeValue_Float("Alpha", self, 1.)
|
2024-06-13 07:19:25 +02:00
|
|
|
.setDisplay(VALUE_DISPLAY.slider);
|
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[8] = nodeValue_Float("Gravity", self, 0.);
|
2024-06-13 07:19:25 +02:00
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[9] = nodeValueMap("Movement map", self);
|
2024-06-13 07:19:25 +02:00
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[10] = nodeValueMap("Rotation map", self);
|
2024-06-13 07:19:25 +02:00
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[11] = nodeValue_Float("Brick Shift", self, 0.)
|
2024-06-13 07:19:25 +02:00
|
|
|
.setDisplay(VALUE_DISPLAY.slider);
|
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[12] = nodeValue_Float("Skew", self, 0.)
|
2024-06-13 07:19:25 +02:00
|
|
|
.setDisplay(VALUE_DISPLAY.slider, { range : [ -1, 1, 0.01 ] });
|
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[13] = nodeValue_Enum_Button("Brick Axis", self, 0, [ "X", "Y" ]);
|
2024-06-13 07:19:25 +02:00
|
|
|
|
2024-06-12 13:06:14 +02:00
|
|
|
input_display_list = [ new Inspector_Sprite(s_MKFX), 0,
|
2024-06-13 07:19:25 +02:00
|
|
|
["Fracture", false], 1, 2, 13, 11, 12,
|
|
|
|
["Physics", false], 3, 4, 9, 8, 5, 10, 6,
|
|
|
|
["Render", false], 7,
|
2024-06-12 13:06:14 +02:00
|
|
|
];
|
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone);
|
2024-06-12 13:06:14 +02:00
|
|
|
|
|
|
|
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
|
|
|
|
|
|
|
|
} #endregion
|
|
|
|
|
2024-06-13 07:19:25 +02:00
|
|
|
static step = function() { #region
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[2].mappableStep();
|
|
|
|
inputs[4].mappableStep();
|
2024-06-13 07:19:25 +02:00
|
|
|
} #endregion
|
|
|
|
|
2024-06-12 13:06:14 +02:00
|
|
|
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
|
|
|
var _surf = _data[0];
|
2024-06-13 07:19:25 +02:00
|
|
|
var _dim = surface_get_dimension(_surf);
|
2024-06-12 13:06:14 +02:00
|
|
|
|
2024-06-13 07:19:25 +02:00
|
|
|
surface_set_shader(_outSurf, sh_mk_fracture);
|
2024-06-12 13:06:14 +02:00
|
|
|
DRAW_CLEAR
|
|
|
|
|
2024-06-13 07:19:25 +02:00
|
|
|
shader_set_f("dimension", _dim);
|
|
|
|
shader_set_f("subdivision", _data[ 1]);
|
2024-08-08 06:57:51 +02:00
|
|
|
shader_set_f_map("progress", _data[ 2], _data[3], inputs[2]);
|
|
|
|
shader_set_f_map("movement", _data[ 4], _data[9], inputs[4]);
|
2024-06-13 07:19:25 +02:00
|
|
|
shader_set_f("gravity", _data[ 8]);
|
2024-08-08 06:57:51 +02:00
|
|
|
shader_set_f("rotation", _data[ 5], _data[10], inputs[5]);
|
2024-06-13 07:19:25 +02:00
|
|
|
shader_set_f("scale", _data[ 6]);
|
|
|
|
shader_set_f("alpha", _data[ 7]);
|
|
|
|
shader_set_i("axis", _data[13]);
|
|
|
|
shader_set_f("brickShift", _data[11]);
|
|
|
|
shader_set_f("skew", _data[12]);
|
2024-06-13 02:38:14 +02:00
|
|
|
|
2024-06-13 07:19:25 +02:00
|
|
|
draw_surface_safe(_surf);
|
|
|
|
surface_reset_shader();
|
2024-06-12 13:06:14 +02:00
|
|
|
|
|
|
|
return _outSurf;
|
|
|
|
}
|
|
|
|
}
|