Pixel-Composer/scripts/node_shard_noise/node_shard_noise.gml
2024-06-08 11:31:21 +07:00

57 lines
2.2 KiB
Plaintext

function Node_Shard_Noise(_x, _y, _group = noone) : Node_Shader_Generator(_x, _y, _group) constructor {
name = "Shard Noise";
shader = sh_noise_shard;
inputs[| 1] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ])
.setDisplay(VALUE_DISPLAY.vector)
.setUnitRef(function(index) { return getDimension(index); });
addShaderProp(SHADER_UNIFORM.float, "position");
inputs[| 2] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 4, 4 ])
.setDisplay(VALUE_DISPLAY.vector)
.setMappable(6);
addShaderProp(SHADER_UNIFORM.float, "scale");
inputs[| 3] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6))
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
addShaderProp(SHADER_UNIFORM.float, "seed");
inputs[| 4] = nodeValue("Sharpness", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 2, 0.01 ] })
.setMappable(7);
addShaderProp(SHADER_UNIFORM.float, "sharpness");
inputs[| 5] = nodeValue("Progress", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
.setMappable(8);
addShaderProp(SHADER_UNIFORM.float, "progress")
//////////////////////////////////////////////////////////////////////////////////
inputs[| 6] = nodeValueMap("Scale map", self); addShaderProp();
inputs[| 7] = nodeValueMap("Sharpness map", self); addShaderProp();
inputs[| 8] = nodeValueMap("Progress map", self); addShaderProp();
//////////////////////////////////////////////////////////////////////////////////
inputs[| 9] = nodeValue("Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
.setDisplay(VALUE_DISPLAY.rotation);
addShaderProp(SHADER_UNIFORM.float, "rotation");
input_display_list = [
["Output", true], 0, 3,
["Noise", false], 1, 9, 2, 6, 5, 8, 4, 7,
];
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
inputs[| 1].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
}
static step = function() {
inputs[| 2].mappableStep();
inputs[| 4].mappableStep();
inputs[| 5].mappableStep();
}
}