2023-11-15 14:42:53 +01:00
|
|
|
function Node_Perlin_Extra(_x, _y, _group = noone) : Node_Shader_Generator(_x, _y, _group) constructor {
|
2023-11-16 06:08:24 +01:00
|
|
|
name = "Extra Perlins";
|
2023-11-15 14:42:53 +01:00
|
|
|
shader = sh_perlin_extra;
|
|
|
|
|
2024-08-18 09:13:41 +02:00
|
|
|
newInput(1, nodeValue_Vec2("Position", self, [ 0, 0 ]))
|
2023-11-15 14:42:53 +01:00
|
|
|
.setUnitRef(function(index) { return getDimension(index); });
|
|
|
|
addShaderProp(SHADER_UNIFORM.float, "position");
|
|
|
|
|
2024-08-18 09:13:41 +02:00
|
|
|
newInput(2, nodeValue_Vec2("Scale", self, [ 4, 4 ]))
|
2023-12-23 12:59:21 +01:00
|
|
|
.setMappable(13);
|
2023-11-15 14:42:53 +01:00
|
|
|
addShaderProp(SHADER_UNIFORM.float, "scale");
|
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(3, nodeValue_Int("Iteration", self, 2));
|
2023-11-15 14:42:53 +01:00
|
|
|
addShaderProp(SHADER_UNIFORM.integer, "iteration");
|
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(4, nodeValue_Bool("Tile", self, true, "Tiling only works with integer scale, and some effect type doesn't support tiling."));
|
2023-11-15 14:42:53 +01:00
|
|
|
addShaderProp(SHADER_UNIFORM.integer, "tile");
|
|
|
|
|
2024-11-07 07:59:04 +01:00
|
|
|
newInput(5, nodeValueSeed(self));
|
2023-11-15 14:42:53 +01:00
|
|
|
addShaderProp(SHADER_UNIFORM.float, "seed");
|
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(6, nodeValue_Enum_Button("Color mode", self, 0, [ "Greyscale", "RGB", "HSV" ]));
|
2023-11-15 14:42:53 +01:00
|
|
|
addShaderProp(SHADER_UNIFORM.integer, "colored");
|
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(7, nodeValue_Slider_Range("Color R range", self, [ 0, 1 ]));
|
2023-11-15 14:42:53 +01:00
|
|
|
addShaderProp(SHADER_UNIFORM.float, "colorRanR");
|
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(8, nodeValue_Slider_Range("Color G range", self, [ 0, 1 ]));
|
2023-11-15 14:42:53 +01:00
|
|
|
addShaderProp(SHADER_UNIFORM.float, "colorRanG");
|
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(9, nodeValue_Slider_Range("Color B range", self, [ 0, 1 ]));
|
2023-11-15 14:42:53 +01:00
|
|
|
addShaderProp(SHADER_UNIFORM.float, "colorRanB");
|
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(10, nodeValue_Enum_Scroll("Noise type", self, 0, [ "Absolute worley", "Fluid", "Noisy", "Camo", "Blocky", "Max", "Vine" ]));
|
2023-11-15 14:42:53 +01:00
|
|
|
addShaderProp(SHADER_UNIFORM.integer, "type");
|
|
|
|
|
2024-08-18 09:13:41 +02:00
|
|
|
newInput(11, nodeValue_Float("Parameter A", self, 0))
|
2023-12-23 12:59:21 +01:00
|
|
|
.setDisplay(VALUE_DISPLAY.slider)
|
|
|
|
.setMappable(14);
|
2023-11-16 06:08:24 +01:00
|
|
|
addShaderProp(SHADER_UNIFORM.float, "paramA");
|
|
|
|
|
2024-08-18 09:13:41 +02:00
|
|
|
newInput(12, nodeValue_Float("Parameter B", self, 1))
|
2023-12-23 12:59:21 +01:00
|
|
|
.setMappable(15);
|
2023-11-16 06:08:24 +01:00
|
|
|
addShaderProp(SHADER_UNIFORM.float, "paramB");
|
2023-11-16 02:49:52 +01:00
|
|
|
|
2023-12-23 12:59:21 +01:00
|
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(13, nodeValueMap("Scale map", self)); addShaderProp();
|
2023-12-23 12:59:21 +01:00
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(14, nodeValueMap("Parameter A map", self)); addShaderProp();
|
2023-12-23 12:59:21 +01:00
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(15, nodeValueMap("Parameter B map", self)); addShaderProp();
|
2023-12-23 12:59:21 +01:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(16, nodeValue_Rotation("Rotation", self, 0));
|
2024-03-31 05:36:11 +02:00
|
|
|
addShaderProp(SHADER_UNIFORM.float, "rotation");
|
|
|
|
|
2023-11-15 14:42:53 +01:00
|
|
|
input_display_list = [
|
|
|
|
["Output", true], 0, 5,
|
2024-03-31 05:36:11 +02:00
|
|
|
["Noise", false], 10, 1, 16, 2, 13, 3, 4, 11, 14, 12, 15,
|
2023-11-15 14:42:53 +01:00
|
|
|
["Render", false], 6, 7, 8, 9,
|
|
|
|
];
|
|
|
|
|
2024-03-31 05:36:11 +02:00
|
|
|
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
2024-07-02 12:18:32 +02:00
|
|
|
var _hov = false;
|
2024-08-08 06:57:51 +02:00
|
|
|
var hv = inputs[1].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny); _hov |= hv;
|
2024-07-02 12:18:32 +02:00
|
|
|
|
|
|
|
return _hov;
|
2024-03-31 05:36:11 +02:00
|
|
|
}
|
|
|
|
|
2023-11-15 14:42:53 +01:00
|
|
|
static step = function() { #region
|
|
|
|
var _col = getInputData(6);
|
2023-11-16 06:08:24 +01:00
|
|
|
var _typ = getInputData(10);
|
2023-11-15 14:42:53 +01:00
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[7].setVisible(_col != 0);
|
|
|
|
inputs[8].setVisible(_col != 0);
|
|
|
|
inputs[9].setVisible(_col != 0);
|
2023-11-15 14:42:53 +01:00
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[7].name = _col == 1? "Color R range" : "Color H range";
|
|
|
|
inputs[8].name = _col == 1? "Color G range" : "Color S range";
|
|
|
|
inputs[9].name = _col == 1? "Color B range" : "Color V range";
|
2023-11-16 06:08:24 +01:00
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[11].setVisible(_typ > 0);
|
|
|
|
inputs[12].setVisible(false);
|
2023-12-23 12:59:21 +01:00
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[ 2].mappableStep();
|
|
|
|
inputs[11].mappableStep();
|
|
|
|
inputs[12].mappableStep();
|
2023-11-15 14:42:53 +01:00
|
|
|
} #endregion
|
|
|
|
}
|