Timeline update, noise color

This commit is contained in:
Tanasart 2023-04-07 21:25:27 +02:00
parent 2c3a1ada1a
commit cc86c309d8
34 changed files with 443 additions and 164 deletions

Binary file not shown.

View File

@ -25,10 +25,9 @@ event_inherited();
#region pages
page_current = 0;
page[0] = get_text("pref_pages_general", "General");
page[1] = get_text("pref_pages_nodes", "Node settings");
page[2] = get_text("pref_pages_appearance", "Appearances");
page[3] = get_text("pref_pages_theme", "Theme");
page[4] = get_text("pref_pages_hotkeys", "Hotkeys");
page[1] = get_text("pref_pages_appearance", "Appearances");
page[2] = get_text("pref_pages_theme", "Theme");
page[3] = get_text("pref_pages_hotkeys", "Hotkeys");
pref_global = ds_list_create();
@ -79,6 +78,15 @@ event_inherited();
})
]);
ds_list_add(pref_global, [
get_text("pref_mouse_wheel_speed", "Scroll speed"),
"mouse_wheel_speed",
new textBox(TEXTBOX_INPUT.number, function(val) {
PREF_MAP[? "mouse_wheel_speed"] = val;
PREF_SAVE();
})
]);
ds_list_add(pref_global, [
get_text("pref_keyboard_hold_start", "Keyboard hold start"),
"keyboard_repeat_start",
@ -201,20 +209,6 @@ event_inherited();
#endregion
#region //NODE
pref_node = ds_list_create();
ds_list_add(pref_node, [
get_text("pref_gravity", "Gravity"),
"physics_gravity",
new vectorBox(2, TEXTBOX_INPUT.number, function(index, val) {
PREF_MAP[? "physics_gravity"][index] = val;
physics_world_gravity(PREF_MAP[? "physics_gravity"][0], PREF_MAP[? "physics_gravity"][1]);
PREF_SAVE();
})
]);
#endregion
#region appearance
pref_appr = ds_list_create();

View File

@ -1,5 +1,3 @@
/// @description
event_inherited();
ds_list_destroy(pref_global);
ds_list_destroy(pref_node);
ds_list_destroy(pref_global);

View File

@ -31,7 +31,7 @@ if !ready exit;
page_current = i;
}
draw_text(dialog_x + ui(padding), yl + hg / 2, page[i]);
draw_text(dialog_x + ui(padding + 8), yl + hg / 2, page[i]);
yl += hg;
}
#endregion
@ -56,15 +56,11 @@ if !ready exit;
current_list = pref_global;
sp_pref.setActiveFocus(sHOVER, sFOCUS);
sp_pref.draw(px, py);
} else if(page_current == 1) {
current_list = pref_node;
sp_pref.setActiveFocus(sHOVER, sFOCUS);
sp_pref.draw(px, py);
} else if(page_current == 2) {
} else if(page_current == 1) {
current_list = pref_appr;
sp_pref.setActiveFocus(sHOVER, sFOCUS);
sp_pref.draw(px, py);
} else if(page_current == 3) {
} else if(page_current == 2) {
var _w = ui(200);
var _h = TEXTBOX_HEIGHT;
@ -87,7 +83,7 @@ if !ready exit;
sp_colors.setActiveFocus(sHOVER, sFOCUS);
sp_colors.draw(px, py + ui(40));
} else if(page_current == 4) {
} else if(page_current == 3) {
if(mouse_press(mb_left, sFOCUS))
hk_editing = noone;

View File

@ -35,8 +35,8 @@
VERSION = 1140;
SAVEFILE_VERSION = 1400;
COLLECTION_VERSION = 1140.083;
VERSION_STRING = "1.14.0pr8.3";
COLLECTION_VERSION = 1140.090;
VERSION_STRING = "1.14.0pr9";
globalvar NODES, NODE_MAP, APPEND_MAP, HOTKEYS, HOTKEY_CONTEXT, NODE_INSTANCES;

View File

@ -12,9 +12,12 @@ function mouse_release(mouse, focus = true) {
#region mouse global
globalvar MOUSE_WRAP, MOUSE_WRAPPING;
MOUSE_WRAP = false;
MOUSE_WRAPPING = false;
#macro SCROLL_SPEED PREF_MAP[? "mouse_wheel_speed"]
function setMouseWrap() {
MOUSE_WRAP = true;
}

View File

@ -279,6 +279,9 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const
return true;
}
insp1UpdateTooltip = get_text("panel_inspector_refresh", "Refresh");
insp1UpdateIcon = [ THEME.refresh, 1, COLORS._main_value_positive ];
static onInspector1Update = function() {
var path = inputs[| 0].getValue();
if(path == "") return;

View File

@ -90,6 +90,9 @@ function Node_CSV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const
return true;
}
insp1UpdateTooltip = get_text("panel_inspector_refresh", "Refresh");
insp1UpdateIcon = [ THEME.refresh, 1, COLORS._main_value_positive ];
static onInspector1Update = function() {
var path = inputs[| 0].getValue();
if(path == "") return;

View File

@ -476,7 +476,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
draw_sprite_stretched_ext(THEME.node_bg_name, 0, xx, yy, w * _s, ui(20), color, aa);
var cc = COLORS._main_text;
if(/*PREF_MAP[? "node_show_render_status"] && */!rendered)
if(PREF_MAP[? "node_show_render_status"] && !rendered)
cc = isRenderable()? COLORS._main_value_positive : COLORS._main_value_negative;
draw_set_text(f_p1, fa_left, fa_center, cc);
@ -1203,6 +1203,11 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
ds_list_add_map(_inputs, inputs[| i].serialize(scale, preset));
ds_map_add_list(_map, "inputs", _inputs);
var _outputs = ds_list_create();
for(var i = 0; i < ds_list_size(outputs); i++)
ds_list_add_map(_outputs, outputs[| i].serialize(scale, preset));
ds_map_add_list(_map, "outputs", _outputs);
var _trigger = ds_list_create();
ds_list_add_map(_trigger, inspectInput1.serialize(scale, preset));
ds_list_add_map(_trigger, inspectInput2.serialize(scale, preset));
@ -1271,6 +1276,14 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
inputs[| i].applyDeserialize(_inputs[| i], load_scale, preset);
}
if(ds_map_exists(load_map, "outputs")) {
var _outputs = load_map[? "outputs"];
for(var i = 0; i < ds_list_size(outputs); i++) {
if(outputs[| i] == noone) continue;
outputs[| i].applyDeserialize(_outputs[| i], load_scale, preset);
}
}
if(ds_map_exists(load_map, "inspectInputs")) {
var insInp = load_map[? "inspectInputs"];
inspectInput1.applyDeserialize(insInp[| 0], load_scale, preset);

View File

@ -79,6 +79,9 @@ function Node_Image(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
return false;
}
insp1UpdateTooltip = get_text("panel_inspector_refresh", "Refresh");
insp1UpdateIcon = [ THEME.refresh, 1, COLORS._main_value_positive ];
static onInspector1Update = function() {
var path = inputs[| 0].getValue();
if(path == "") return;

View File

@ -123,6 +123,9 @@ function Node_Image_Animated(_x, _y, _group = noone) : Node(_x, _y, _group) cons
return true;
}
insp1UpdateTooltip = get_text("panel_inspector_refresh", "Refresh");
insp1UpdateIcon = [ THEME.refresh, 1, COLORS._main_value_positive ];
static onInspector1Update = function() {
var path = inputs[| 0].getValue();
if(path == "") return;

View File

@ -61,6 +61,9 @@ function Node_Image_gif(_x, _y, _group = noone) : Node(_x, _y, _group) construct
return false;
}
insp1UpdateTooltip = get_text("panel_inspector_refresh", "Refresh");
insp1UpdateIcon = [ THEME.refresh, 1, COLORS._main_value_positive ];
static onInspector1Update = function() {
var path = inputs[| 0].getValue();
if(path == "") return;

View File

@ -81,6 +81,9 @@ function Node_Image_Sequence(_x, _y, _group = noone) : Node(_x, _y, _group) cons
return false;
}
insp1UpdateTooltip = get_text("panel_inspector_refresh", "Refresh");
insp1UpdateIcon = [ THEME.refresh, 1, COLORS._main_value_positive ];
static onInspector1Update = function() {
var path = inputs[| 0].getValue();
if(path == "") return;

View File

@ -69,6 +69,9 @@ function Node_Json_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons
return false;
}
insp1UpdateTooltip = get_text("panel_inspector_refresh", "Refresh");
insp1UpdateIcon = [ THEME.refresh, 1, COLORS._main_value_positive ];
static onInspector1Update = function() {
var path = inputs[| 0].getValue();
if(path == "") return;

View File

@ -1,36 +1,66 @@
function Node_Noise(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Noise";
shader = sh_noise;
uniform_sed = shader_get_uniform(shader, "seed");
inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 )
.setDisplay(VALUE_DISPLAY.vector);
inputs[| 1] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, irandom(99999));
inputs[| 2] = nodeValue("Color mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_button, [ "Greyscale", "RGB", "HSV" ]);
inputs[| 3] = nodeValue("Color R range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
.setDisplay(VALUE_DISPLAY.slider_range, [0, 1, .01]);
inputs[| 4] = nodeValue("Color G range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
.setDisplay(VALUE_DISPLAY.slider_range, [0, 1, .01]);
inputs[| 5] = nodeValue("Color B range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
.setDisplay(VALUE_DISPLAY.slider_range, [0, 1, .01]);
input_display_list = [
["Output", false], 0,
["Noise", false], 1,
["Noise", false], 1,
["Color", false], 2, 3, 4, 5,
];
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
attribute_surface_depth();
static step = function() {
var _col = inputs[| 2].getValue();
inputs[| 3].setVisible(_col != 0);
inputs[| 4].setVisible(_col != 0);
inputs[| 5].setVisible(_col != 0);
inputs[| 3].name = _col == 1? "Color R range" : "Color H range";
inputs[| 4].name = _col == 1? "Color G range" : "Color S range";
inputs[| 5].name = _col == 1? "Color B range" : "Color V range";
}
static process_data = function(_outSurf, _data, _output_index, _array_index) {
var _dim = _data[0];
var _sed = _data[1];
var _col = _data[2];
var _clr = _data[3];
var _clg = _data[4];
var _clb = _data[5];
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
surface_set_target(_outSurf);
shader_set(shader);
shader_set_uniform_f(uniform_sed, _sed);
surface_set_shader(_outSurf, sh_noise);
shader_set_f("seed", _sed);
shader_set_i("colored", _col);
shader_set_f("colorRanR", _clr);
shader_set_f("colorRanG", _clg);
shader_set_f("colorRanB", _clb);
draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], 0, c_white, 1);
shader_reset();
surface_reset_target();
surface_reset_shader();
return _outSurf;
}

View File

@ -30,11 +30,13 @@ function Node_Cellular(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
.setDisplay(VALUE_DISPLAY.slider, [-10., 10., 0.01])
.setVisible(false);
inputs[| 10] = nodeValue("Colored", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false)
input_display_list = [
["Output", false], 0,
["Noise", false], 4, 6, 3, 1, 2,
["Radial", false], 8, 9,
["Rendering", false], 5, 7
["Rendering", false], 5, 7, 10,
];
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
@ -55,10 +57,13 @@ function Node_Cellular(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
var _pat = _data[6];
var _mid = _data[7];
inputs[| 8].setVisible(_pat == 1);
inputs[| 9].setVisible(_pat == 1);
var _rad = _data[8];
var _sht = _data[9];
inputs[| 8].setVisible(_pat == 1);
inputs[| 9].setVisible(_pat == 1);
inputs[| 10].setVisible(_type == 2);
var _rad = _data[ 8];
var _sht = _data[ 9];
var _col = _data[10];
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
@ -81,6 +86,7 @@ function Node_Cellular(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
uniform_rad = shader_get_uniform(shader, "radiusScale");
uniform_sht = shader_get_uniform(shader, "radiusShatter");
uniform_col = shader_get_uniform(shader, "colored");
surface_set_target(_outSurf);
shader_set(shader);
@ -93,6 +99,7 @@ function Node_Cellular(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
shader_set_uniform_f(uniform_rad, _rad);
shader_set_uniform_f(uniform_sht, _sht);
shader_set_uniform_i(uniform_pat, _pat);
shader_set_uniform_i(uniform_col, _col);
draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], 0, c_white, 1);
shader_reset();
surface_reset_target();

View File

@ -1,16 +1,6 @@
function Node_Grid_Noise(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Grid Noise";
shader = sh_grid_noise;
uniform_dim = shader_get_uniform(shader, "dimension");
uniform_pos = shader_get_uniform(shader, "position");
uniform_sca = shader_get_uniform(shader, "scale");
uniform_sed = shader_get_uniform(shader, "seed");
uniform_shf = shader_get_uniform(shader, "shift");
uniform_shfax = shader_get_uniform(shader, "shiftAxis");
uniform_sam = shader_get_uniform(shader, "useSampler");
inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 )
.setDisplay(VALUE_DISPLAY.vector);
@ -31,10 +21,22 @@ function Node_Grid_Noise(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
inputs[| 6] = nodeValue("Shift axis", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_button, ["x", "y"]);
inputs[| 7] = nodeValue("Color mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_button, [ "Greyscale", "RGB", "HSV" ]);
inputs[| 8] = nodeValue("Color R range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
.setDisplay(VALUE_DISPLAY.slider_range, [0, 1, .01]);
inputs[| 9] = nodeValue("Color G range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
.setDisplay(VALUE_DISPLAY.slider_range, [0, 1, .01]);
inputs[| 10] = nodeValue("Color B range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
.setDisplay(VALUE_DISPLAY.slider_range, [0, 1, .01]);
input_display_list = [
["Output", false], 0,
["Noise", false], 3, 1, 2, 6, 4,
["Render", false], 5,
["Render", false], 5, 7, 8, 9, 10,
];
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
@ -54,25 +56,32 @@ function Node_Grid_Noise(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
var _sam = _data[5];
var _shfAx = _data[6];
var _col = _data[ 7];
var _clr = _data[ 8];
var _clg = _data[ 9];
var _clb = _data[10];
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
surface_set_target(_outSurf);
DRAW_CLEAR
shader_set(shader);
shader_set_uniform_f_array_safe(uniform_dim, _dim);
shader_set_uniform_f_array_safe(uniform_pos, _pos);
shader_set_uniform_f_array_safe(uniform_sca, _sca);
shader_set_uniform_i(uniform_sam, is_surface(_sam));
shader_set_uniform_f(uniform_shf, _shf);
shader_set_uniform_i(uniform_shfax, _shfAx);
shader_set_uniform_f(uniform_sed, _sed);
surface_set_shader(_outSurf, sh_grid_noise);
shader_set_f("dimension", _dim);
shader_set_f("position", _pos);
shader_set_f("scale", _sca);
shader_set_i("useSampler", is_surface(_sam));
shader_set_f("shift", _shf);
shader_set_i("shiftAxis", _shfAx);
shader_set_f("seed", _sed);
if(is_surface(_sam))
draw_surface_stretched_safe(_sam, 0, 0, _dim[0], _dim[1]);
else
draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], 0, c_white, 1);
shader_reset();
surface_reset_target();
shader_set_i("colored", _col);
shader_set_f("colorRanR", _clr);
shader_set_f("colorRanG", _clg);
shader_set_f("colorRanB", _clb);
if(is_surface(_sam))
draw_surface_stretched_safe(_sam, 0, 0, _dim[0], _dim[1]);
else
draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], 0, c_white, 1);
surface_reset_shader();
return _outSurf;
}

View File

@ -1,11 +1,6 @@
function Node_Noise_Simplex(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Simplex Noise";
shader = sh_simplex;
uniform_pos = shader_get_uniform(shader, "position");
uniform_sca = shader_get_uniform(shader, "scale");
uniform_itr = shader_get_uniform(shader, "iteration");
inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 )
.setDisplay(VALUE_DISPLAY.vector);
@ -18,32 +13,65 @@ function Node_Noise_Simplex(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
inputs[| 3] = nodeValue("Iteration", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1 )
.setDisplay(VALUE_DISPLAY.slider, [1, 16, 1]);
inputs[| 4] = nodeValue("Color mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_button, [ "Greyscale", "RGB", "HSV" ]);
inputs[| 5] = nodeValue("Color R range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
.setDisplay(VALUE_DISPLAY.slider_range, [0, 1, .01]);
inputs[| 6] = nodeValue("Color G range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
.setDisplay(VALUE_DISPLAY.slider_range, [0, 1, .01]);
inputs[| 7] = nodeValue("Color B range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
.setDisplay(VALUE_DISPLAY.slider_range, [0, 1, .01]);
input_display_list = [
["Output", false], 0,
["Noise", false], 1, 2, 3,
["Render", false], 4, 5, 6, 7,
];
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
attribute_surface_depth();
static step = function() {
var _col = inputs[| 4].getValue();
inputs[| 5].setVisible(_col != 0);
inputs[| 6].setVisible(_col != 0);
inputs[| 7].setVisible(_col != 0);
inputs[| 5].name = _col == 1? "Color R range" : "Color H range";
inputs[| 6].name = _col == 1? "Color G range" : "Color S range";
inputs[| 7].name = _col == 1? "Color B range" : "Color V range";
}
static process_data = function(_outSurf, _data, _output_index, _array_index) {
var _dim = _data[0];
var _pos = _data[1];
var _sca = _data[2];
var _itr = _data[3];
var _col = _data[4];
var _clr = _data[5];
var _clg = _data[6];
var _clb = _data[7];
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
surface_set_target(_outSurf);
shader_set(shader);
shader_set_uniform_f_array_safe(uniform_pos, _pos);
shader_set_uniform_f_array_safe(uniform_sca, _sca);
shader_set_uniform_i(uniform_itr, _itr);
surface_set_shader(_outSurf, sh_simplex);
shader_set_f("position", _pos);
shader_set_f("scale", _sca);
shader_set_i("iteration", _itr);
shader_set_i("colored", _col);
shader_set_f("colorRanR", _clr);
shader_set_f("colorRanG", _clg);
shader_set_f("colorRanB", _clb);
draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], 0, c_white, 1);
shader_reset();
surface_reset_target();
surface_reset_shader();
return _outSurf;
}

View File

@ -1,14 +1,6 @@
function Node_Perlin(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Perlin Noise";
shader = sh_perlin_tiled;
uniform_dim = shader_get_uniform(shader, "u_resolution");
uniform_pos = shader_get_uniform(shader, "position");
uniform_sca = shader_get_uniform(shader, "scale");
uniform_ite = shader_get_uniform(shader, "iteration");
uniform_sed = shader_get_uniform(shader, "seed");
uniform_til = shader_get_uniform(shader, "tile");
inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2 )
.setDisplay(VALUE_DISPLAY.vector);
@ -24,16 +16,41 @@ function Node_Perlin(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
inputs[| 4] = nodeValue("Tile", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
inputs[| 5] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, irandom(99999));
inputs[| 6] = nodeValue("Color mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_button, [ "Greyscale", "RGB", "HSV" ]);
inputs[| 7] = nodeValue("Color R range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
.setDisplay(VALUE_DISPLAY.slider_range, [0, 1, .01]);
inputs[| 8] = nodeValue("Color G range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
.setDisplay(VALUE_DISPLAY.slider_range, [0, 1, .01]);
inputs[| 9] = nodeValue("Color B range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
.setDisplay(VALUE_DISPLAY.slider_range, [0, 1, .01]);
input_display_list = [
["Surface", true], 0, 5,
["Noise", false], 1, 2, 3, 4,
["Surface", true], 0, 5,
["Noise", false], 1, 2, 3, 4,
["Render", false], 6, 7, 8, 9,
];
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
attribute_surface_depth();
static step = function() {
var _col = inputs[| 6].getValue();
inputs[| 7].setVisible(_col != 0);
inputs[| 8].setVisible(_col != 0);
inputs[| 9].setVisible(_col != 0);
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";
}
static process_data = function(_outSurf, _data, _output_index, _array_index) {
var _dim = _data[0];
var _pos = _data[1];
@ -42,19 +59,28 @@ function Node_Perlin(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
var _til = _data[4];
var _sed = _data[5];
var _col = _data[6];
var _clr = _data[7];
var _clg = _data[8];
var _clb = _data[9];
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
surface_set_target(_outSurf);
shader_set(shader);
shader_set_uniform_f_array_safe(uniform_dim, _dim);
shader_set_uniform_f_array_safe(uniform_pos, _pos);
shader_set_uniform_f_array_safe(uniform_sca, _sca);
shader_set_uniform_f(uniform_sed, _sed);
shader_set_uniform_i(uniform_til, _til);
shader_set_uniform_i(uniform_ite, _ite);
surface_set_shader(_outSurf, sh_perlin_tiled);
shader_set_f("u_resolution", _dim);
shader_set_f("position", _pos);
shader_set_f("scale", _sca);
shader_set_f("seed", _sed);
shader_set_i("tile", _til);
shader_set_i("iteration", _ite);
shader_set_i("colored", _col);
shader_set_f("colorRanR", _clr);
shader_set_f("colorRanG", _clg);
shader_set_f("colorRanB", _clb);
draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], 0, c_white, 1);
shader_reset();
surface_reset_target();
surface_reset_shader();
return _outSurf;
}

View File

@ -52,6 +52,9 @@ function Node_Text_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons
return false;
}
insp1UpdateTooltip = get_text("panel_inspector_refresh", "Refresh");
insp1UpdateIcon = [ THEME.refresh, 1, COLORS._main_value_positive ];
static onInspector1Update = function() {
var path = inputs[| 0].getValue();
if(path == "") return;

View File

@ -1362,22 +1362,22 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
var _angle = argument_count > 8? argument[ 8] : 0;
var _scale = argument_count > 9? argument[ 9] : 1;
var _spr = argument_count > 10? argument[10] : THEME.anchor_selector;
return preview_overlay_scalar(value_from != noone, active, _x, _y, _s, _mx, _my, _snx, _sny, _angle, _scale, _spr);
return preview_overlay_scalar(value_from == noone, active, _x, _y, _s, _mx, _my, _snx, _sny, _angle, _scale, _spr);
case VALUE_DISPLAY.rotation :
var _rad = argument_count > 8? argument[ 8] : 64;
return preview_overlay_rotation(value_from != noone, active, _x, _y, _s, _mx, _my, _snx, _sny, _rad);
return preview_overlay_rotation(value_from == noone, active, _x, _y, _s, _mx, _my, _snx, _sny, _rad);
case VALUE_DISPLAY.vector :
var _spr = argument_count > 8? argument[8] : THEME.anchor_selector;
var _sca = argument_count > 9? argument[9] : 1;
return preview_overlay_vector(value_from != noone, active, _x, _y, _s, _mx, _my, _snx, _sny, _spr);
return preview_overlay_vector(value_from == noone, active, _x, _y, _s, _mx, _my, _snx, _sny, _spr);
case VALUE_DISPLAY.area :
return preview_overlay_area(value_from != noone, active, _x, _y, _s, _mx, _my, _snx, _sny, display_data);
return preview_overlay_area(value_from == noone, active, _x, _y, _s, _mx, _my, _snx, _sny, display_data);
case VALUE_DISPLAY.puppet_control :
return preview_overlay_puppet(value_from != noone, active, _x, _y, _s, _mx, _my, _snx, _sny);
return preview_overlay_puppet(value_from == noone, active, _x, _y, _s, _mx, _my, _snx, _sny);
}
return -1;
@ -1528,8 +1528,12 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
static serialize = function(scale = false, preset = false) {
var _map = ds_map_create();
_map[? "on end"] = on_end;
_map[? "visible"] = visible;
if(connect_type == JUNCTION_CONNECT.output)
return _map;
_map[? "on end"] = on_end;
_map[? "unit"] = unit.mode;
_map[? "sep_axis"] = sep_axis;
_map[? "shift x"] = draw_line_shift_x;
@ -1559,9 +1563,12 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(_map == undefined) return;
if(_map == noone) return;
visible = ds_map_try_get(_map, "visible", visible);
if(connect_type == JUNCTION_CONNECT.output)
return;
//printIf(TESTING, " |- Applying deserialize to junction " + name + " of node " + node.name);
on_end = ds_map_try_get(_map, "on end", on_end);
visible = ds_map_try_get(_map, "visible", visible);
unit.mode = ds_map_try_get(_map, "unit", VALUE_UNIT.constant);
global_use = ds_map_try_get(_map, "global_use");
global_key = ds_map_try_get(_map, "global_key");

View File

@ -37,8 +37,10 @@ function Panel_Animation() : PanelContent() constructor {
ds_name_surface = surface_create_valid(tool_width - ui(16), 1);
timeline_scubbing = false;
timeline_scub_st = 0;
timeline_scale = 20;
timeline_scub_st = 0;
timeline_scale = 20;
timeline_separate = 5;
timeline_sep_line = 1;
_scrub_frame = -1;
timeline_shift = 0;
@ -415,7 +417,7 @@ function Panel_Animation() : PanelContent() constructor {
draw_sprite_stretched(THEME.ui_panel_bg, 1, 0, 0, bar_w, bar_h);
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, 0, 0, bar_total_w, bar_h, COLORS.panel_animation_timeline_blend, 1);
for(var i = 10; i <= ANIMATOR.frames_total; i += 10) {
for(var i = timeline_separate; i <= ANIMATOR.frames_total; i += timeline_separate) {
var bar_line_x = i * ui(timeline_scale) + timeline_shift;
draw_set_color(COLORS.panel_animation_frame_divider);
draw_line(bar_line_x, ui(12), bar_line_x, bar_h);
@ -508,14 +510,31 @@ function Panel_Animation() : PanelContent() constructor {
}
if(pHOVER && point_in_rectangle(mx, my, bar_x, 16, bar_x + bar_w, bar_y - 8)) {
if(mouse_wheel_down()) {
timeline_scale = max(timeline_scale - 1, 1);
timeline_shift_to = 0;
var sca = timeline_scale;
if(mouse_wheel_down()) timeline_scale = max(timeline_scale - 1 * SCROLL_SPEED, 1);
if(mouse_wheel_up()) timeline_scale = min(timeline_scale + 1 * SCROLL_SPEED, 24);
timeline_separate = 5;
timeline_sep_line = 1;
if(timeline_scale <= 10) {
timeline_separate = 10;
timeline_sep_line = 2;
}
if(timeline_scale <= 3) {
timeline_separate = 20;
timeline_sep_line = 5;
}
if(sca != timeline_scale) {
var mfb = (mx - bar_x - timeline_shift) / ui(timeline_scale);
var mfa = (mx - bar_x - timeline_shift) / ui(sca);
if(mouse_wheel_up()) {
timeline_scale = min(timeline_scale + 1, 24);
timeline_shift_to = 0;
timeline_shift_to = clamp(timeline_shift_to - (mfa - mfb) * timeline_scale,
-max(bar_total_w - bar_w + 32, 0), 0);
timeline_shift = timeline_shift_to;
}
if(mouse_press(mb_middle, pFOCUS)) {
@ -529,10 +548,8 @@ function Panel_Animation() : PanelContent() constructor {
}
if(pHOVER && point_in_rectangle(mx, my, bar_x, bar_y, bar_x + min(timeline_w, timeline_shift + bar_total_w), bar_y + bar_h)) { //preview
if(mouse_wheel_down())
timeline_shift_to = clamp(timeline_shift_to - 64, -max(bar_total_w - bar_w + 32, 0), 0);
if(mouse_wheel_up())
timeline_shift_to = clamp(timeline_shift_to + 64, -max(bar_total_w - bar_w + 32, 0), 0);
if(mouse_wheel_down()) timeline_shift_to = clamp(timeline_shift_to - 64 * SCROLL_SPEED, -max(bar_total_w - bar_w + 32, 0), 0);
if(mouse_wheel_up()) timeline_shift_to = clamp(timeline_shift_to + 64 * SCROLL_SPEED, -max(bar_total_w - bar_w + 32, 0), 0);
if(mouse_press(mb_left, pFOCUS)) {
timeline_scubbing = true;
@ -1119,9 +1136,9 @@ function Panel_Animation() : PanelContent() constructor {
#region scroll
dope_sheet_y = lerp_float(dope_sheet_y, dope_sheet_y_to, 4);
if(pHOVER && point_in_rectangle(mx, my, ui(8), ui(8), tool_width, ui(8) + dope_sheet_h)) {
if(mouse_wheel_down()) dope_sheet_y_to = clamp(dope_sheet_y_to - ui(32), -dope_sheet_y_max, 0);
if(mouse_wheel_up()) dope_sheet_y_to = clamp(dope_sheet_y_to + ui(32), -dope_sheet_y_max, 0);
if(pHOVER && point_in_rectangle(mx, my, ui(8), ui(8), bar_x, ui(8) + dope_sheet_h)) {
if(mouse_wheel_down()) dope_sheet_y_to = clamp(dope_sheet_y_to - ui(32) * SCROLL_SPEED, -dope_sheet_y_max, 0);
if(mouse_wheel_up()) dope_sheet_y_to = clamp(dope_sheet_y_to + ui(32) * SCROLL_SPEED, -dope_sheet_y_max, 0);
}
var scr_x = bar_x + dope_sheet_w + ui(4);
@ -1217,11 +1234,13 @@ function Panel_Animation() : PanelContent() constructor {
dope_sheet_y_max = max(0, dope_sheet_y_max - dope_sheet_h + ui(48));
for(var i = 10; i <= ANIMATOR.frames_total; i += 10) {
for(var i = timeline_sep_line; i <= ANIMATOR.frames_total; i += timeline_sep_line) {
var bar_line_x = i * ui(timeline_scale) + timeline_shift;
draw_set_color(COLORS.panel_animation_frame_divider);
draw_set_alpha(i % timeline_separate == 0? 1 : 0.1);
draw_line(bar_line_x, ui(16), bar_line_x, dope_sheet_h);
}
draw_set_alpha(1);
#endregion
#region stretch
@ -1497,7 +1516,7 @@ function Panel_Animation() : PanelContent() constructor {
draw_set_color(COLORS.panel_animation_timeline_top);
draw_rectangle(0, 0, bar_show_w, ui(16), false);
for(var i = 10; i <= ANIMATOR.frames_total; i += 10) {
for(var i = timeline_separate; i <= ANIMATOR.frames_total; i += timeline_separate) {
var bar_line_x = i * ui(timeline_scale) + timeline_shift;
draw_set_text(f_p2, fa_right, fa_top, COLORS._main_text_sub);
draw_text(bar_line_x - ui(2), 0, string(i));

View File

@ -542,8 +542,8 @@ function Panel(_parent, _x, _y, _w, _h) constructor {
tab_width = max(0, tab_width - w + ui(32));
if(point_in_rectangle(msx, msy, 0, 0, w, tab_height)) {
if(mouse_wheel_up()) tab_x_to = clamp(tab_x_to + ui(64), -tab_width, 0);
if(mouse_wheel_down()) tab_x_to = clamp(tab_x_to - ui(64), -tab_width, 0);
if(mouse_wheel_up()) tab_x_to = clamp(tab_x_to + ui(64) * SCROLL_SPEED, -tab_width, 0);
if(mouse_wheel_down()) tab_x_to = clamp(tab_x_to - ui(64) * SCROLL_SPEED, -tab_width, 0);
}
if(tab_holding) {

View File

@ -524,8 +524,8 @@ function Panel_Preview() : PanelContent() constructor {
if(pHOVER && my > h - toolbar_height - prev_size - ui(16) && my > toolbar_height) {
canvas_hover = false;
if(mouse_wheel_down()) preview_x_to = clamp(preview_x_to - prev_size, - preview_x_max, 0);
if(mouse_wheel_up()) preview_x_to = clamp(preview_x_to + prev_size, - preview_x_max, 0);
if(mouse_wheel_down()) preview_x_to = clamp(preview_x_to - prev_size * SCROLL_SPEED, - preview_x_max, 0);
if(mouse_wheel_up()) preview_x_to = clamp(preview_x_to + prev_size * SCROLL_SPEED, - preview_x_max, 0);
}
preview_x_max = 0;
@ -710,8 +710,8 @@ function Panel_Preview() : PanelContent() constructor {
tol_max_w = max(0, tol_max_w - w);
if(point_in_rectangle(mx, my, 0, 0, w, toolbar_height)) {
if(mouse_wheel_up()) tool_x_to = clamp(tool_x_to + ui(64), -tol_max_w, 0);
if(mouse_wheel_down()) tool_x_to = clamp(tool_x_to - ui(64), -tol_max_w, 0);
if(mouse_wheel_up()) tool_x_to = clamp(tool_x_to + ui(64) * SCROLL_SPEED, -tol_max_w, 0);
if(mouse_wheel_down()) tool_x_to = clamp(tool_x_to - ui(64) * SCROLL_SPEED, -tol_max_w, 0);
}
} else { //color sampler
var cx = ui(10);

View File

@ -107,14 +107,14 @@ function Panel_Workspace() : PanelContent() constructor {
if(hori) {
scroll_max = max(ww - w + ui(16), 0);
if(pHOVER) {
if(mouse_wheel_down()) scroll_to = clamp(scroll_to - ui(128), -scroll_max, 0);
if(mouse_wheel_up()) scroll_to = clamp(scroll_to + ui(128), -scroll_max, 0);
if(mouse_wheel_down()) scroll_to = clamp(scroll_to - ui(128) * SCROLL_SPEED, -scroll_max, 0);
if(mouse_wheel_up()) scroll_to = clamp(scroll_to + ui(128) * SCROLL_SPEED, -scroll_max, 0);
}
} else {
scroll_max = max(hh - h + ui(16), 0);
if(pHOVER) {
if(mouse_wheel_down()) scroll_to = clamp(scroll_to - ui(32), -scroll_max, 0);
if(mouse_wheel_up()) scroll_to = clamp(scroll_to + ui(32), -scroll_max, 0);
if(mouse_wheel_down()) scroll_to = clamp(scroll_to - ui(32) * SCROLL_SPEED, -scroll_max, 0);
if(mouse_wheel_up()) scroll_to = clamp(scroll_to + ui(32) * SCROLL_SPEED, -scroll_max, 0);
}
}
}

View File

@ -8,6 +8,8 @@
PREF_MAP[? "path_resolution"] = 32;
PREF_MAP[? "double_click_delay"] = 0.25;
PREF_MAP[? "mouse_wheel_speed"] = 1.00;
PREF_MAP[? "keyboard_repeat_start"] = 0.50;
PREF_MAP[? "keyboard_repeat_speed"] = 0.10;

View File

@ -60,8 +60,8 @@ function scrollPane(_w, _h, ondraw) : widget() constructor {
draw_surface_safe(surface, x, y);
if(hover && !key_mod_press(SHIFT)) {
if(mouse_wheel_down()) scroll_y_to -= scroll_step;
if(mouse_wheel_up()) scroll_y_to += scroll_step;
if(mouse_wheel_down()) scroll_y_to -= scroll_step * SCROLL_SPEED;
if(mouse_wheel_up()) scroll_y_to += scroll_step * SCROLL_SPEED;
}
if(abs(content_h) > 0) {

View File

@ -1,4 +1,5 @@
function shellOpenExplorer(path) {
var _windir = environment_get_variable("WINDIR") + "/explorer.exe";
path = string_replace_all(path, "/", "\\");
execute_shell(_windir, path);
}

View File

@ -531,8 +531,8 @@ function textBox(_input, _onModify, _extras = noone) : textInput(_input, _onModi
if(key_mod_press(CTRL)) amo *= 10;
if(key_mod_press(ALT)) amo /= 10;
if(mouse_wheel_down()) onModify(toNumber(_text) + amo);
if(mouse_wheel_up()) onModify(toNumber(_text) - amo);
if(mouse_wheel_down()) onModify(toNumber(_text) + amo * SCROLL_SPEED);
if(mouse_wheel_up()) onModify(toNumber(_text) - amo * SCROLL_SPEED);
}
} else if(!hide)
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, boxColor, 0.5 + 0.5 * interactable);

View File

@ -13,6 +13,7 @@ uniform float middle;
uniform float radiusScale;
uniform float radiusShatter;
uniform int pattern;
uniform int colored;
#define TAU 6.283185307179586
@ -24,6 +25,13 @@ float random (in vec2 st) {
return fract(sin(dot(st.xy, vec2(12.9898, 78.233))) * 43758.5453123);
}
vec3 colorNoise(in vec2 st) {
float randR = random(st);
float randG = random(st + vec2(1.7227, 4.55529));
float randB = random(st + vec2(6.9950, 6.82063));
return vec3(randR, randG, randB);
}
void main() {
vec2 pos = position / dimension;
@ -72,6 +80,10 @@ void main() {
}
}
float c = middle + (random(mp) - middle) * contrast;
gl_FragColor = vec4(vec3(c), 1.0);
if(colored == 0) {
float c = middle + (random(mp) - middle) * contrast;
gl_FragColor = vec4(vec3(c), 1.0);
} else if(colored == 1) {
gl_FragColor = vec4(colorNoise(mp), 1.);
}
}

View File

@ -10,9 +10,19 @@ uniform vec2 scale;
uniform float seed;
uniform float shift;
uniform int shiftAxis;
uniform int useSampler;
uniform int colored;
uniform vec2 colorRanR;
uniform vec2 colorRanG;
uniform vec2 colorRanB;
vec3 hsv2rgb(vec3 c) {
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
float randomSeed (in vec2 st, float _seed) {
return fract(sin(dot(st.xy + vec2(5.0654, 9.684), vec2(12.9898, 78.233))) * (43758.5453123 + _seed));
}
@ -36,9 +46,23 @@ void main() {
}
if(useSampler == 0) {
vec2 i = floor(pos);
float n = random(i);
gl_FragColor = vec4(vec3(n), 1.0);
vec2 n = floor(pos);
if(colored == 0) {
gl_FragColor = vec4(vec3(random(n)), 1.0);
} else if(colored == 1) {
float randR = colorRanR[0] + random(n) * (colorRanR[1] - colorRanR[0]);
float randG = colorRanG[0] + random(n + vec2(1.7227, 4.55529)) * (colorRanG[1] - colorRanG[0]);
float randB = colorRanB[0] + random(n + vec2(6.9950, 6.82063)) * (colorRanB[1] - colorRanB[0]);
gl_FragColor = vec4(randR, randG, randB, 1.0);
} else if(colored == 2) {
float randH = colorRanR[0] + random(n) * (colorRanR[1] - colorRanR[0]);
float randS = colorRanG[0] + random(n + vec2(1.7227, 4.55529)) * (colorRanG[1] - colorRanG[0]);
float randV = colorRanB[0] + random(n + vec2(6.9950, 6.82063)) * (colorRanB[1] - colorRanB[0]);
gl_FragColor = vec4(hsv2rgb(vec3(randH, randS, randV)), 1.0);
}
} else {
vec2 samPos = floor(pos) / scale + 0.5 / scale;
gl_FragColor = texture2D( gm_BaseTexture, samPos );

View File

@ -7,13 +7,41 @@ varying vec4 v_vColour;
uniform vec2 dimension;
uniform float seed;
uniform int colored;
uniform vec2 colorRanR;
uniform vec2 colorRanG;
uniform vec2 colorRanB;
vec3 hsv2rgb(vec3 c) {
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
float random (in vec2 st, float seed) {
return fract(sin(dot(st.xy + seed, vec2(1892.9898, 78.23453))) * 437.54123);
}
void main() {
float n0 = random(v_vTexcoord, floor(seed) / 5000.);
float n1 = random(v_vTexcoord, (floor(seed) + 1.) / 5000.);
float n = mix(n0, n1, fract(seed));
gl_FragColor = vec4(vec3(n), 1.0);
float frandom (in vec2 st) {
float n0 = random(st, floor(seed) / 5000.);
float n1 = random(st, (floor(seed) + 1.) / 5000.);
return mix(n0, n1, fract(seed));
}
void main() {
if(colored == 0)
gl_FragColor = vec4(vec3(frandom(v_vTexcoord)), 1.0);
else if(colored == 1) {
float randR = colorRanR[0] + frandom(v_vTexcoord) * (colorRanR[1] - colorRanR[0]);
float randG = colorRanG[0] + frandom(v_vTexcoord + vec2(1.7227, 4.55529)) * (colorRanG[1] - colorRanG[0]);
float randB = colorRanB[0] + frandom(v_vTexcoord + vec2(6.9950, 6.82063)) * (colorRanB[1] - colorRanB[0]);
gl_FragColor = vec4(randR, randG, randB, 1.0);
} else if(colored == 2) {
float randH = colorRanR[0] + frandom(v_vTexcoord) * (colorRanR[1] - colorRanR[0]);
float randS = colorRanG[0] + frandom(v_vTexcoord + vec2(1.7227, 4.55529)) * (colorRanG[1] - colorRanG[0]);
float randV = colorRanB[0] + frandom(v_vTexcoord + vec2(6.9950, 6.82063)) * (colorRanB[1] - colorRanB[0]);
gl_FragColor = vec4(hsv2rgb(vec3(randH, randS, randV)), 1.0);
}
}

View File

@ -11,6 +11,17 @@ uniform int iteration;
uniform float seed;
uniform int tile;
uniform int colored;
uniform vec2 colorRanR;
uniform vec2 colorRanG;
uniform vec2 colorRanB;
vec3 hsv2rgb(vec3 c) {
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
float random (in vec2 st, float seed) {
return fract(sin(dot(st.xy + vec2(21.4564, 46.8564), vec2(12.9898, 78.233))) * (43758.5453123 + seed));
}
@ -36,11 +47,11 @@ float noise (in vec2 st, in vec2 scale) {
return mix(mix(a, b, u.x), mix(c, d, u.x), u.y);
}
void main() {
vec2 pos = (v_vTexcoord + position) * scale;
float perlin(in vec2 st) {
float amp = pow(2., float(iteration) - 1.) / (pow(2., float(iteration)) - 1.);
float n = 0.;
vec2 sc = scale;
float n = 0.;
vec2 pos = st;
vec2 sc = scale;
for(int i = 0; i < iteration; i++) {
n += noise(pos, sc) * amp;
@ -50,5 +61,24 @@ void main() {
pos *= 2.;
}
gl_FragColor = vec4(vec3(n), 1.0);
return n;
}
void main() {
if(colored == 0) {
vec2 pos = (v_vTexcoord + position) * scale;
gl_FragColor = vec4(vec3(perlin(pos)), 1.0);
} else if(colored == 1) {
float randR = colorRanR[0] + perlin((v_vTexcoord + position) * scale) * (colorRanR[1] - colorRanR[0]);
float randG = colorRanG[0] + perlin((v_vTexcoord + position + vec2(1.7227, 4.55529)) * scale) * (colorRanG[1] - colorRanG[0]);
float randB = colorRanB[0] + perlin((v_vTexcoord + position + vec2(6.9950, 6.82063)) * scale) * (colorRanB[1] - colorRanB[0]);
gl_FragColor = vec4(randR, randG, randB, 1.0);
} else if(colored == 2) {
float randH = colorRanR[0] + perlin((v_vTexcoord + position) * scale) * (colorRanR[1] - colorRanR[0]);
float randS = colorRanG[0] + perlin((v_vTexcoord + position + vec2(1.7227, 4.55529)) * scale) * (colorRanG[1] - colorRanG[0]);
float randV = colorRanB[0] + perlin((v_vTexcoord + position + vec2(6.9950, 6.82063)) * scale) * (colorRanB[1] - colorRanB[0]);
gl_FragColor = vec4(hsv2rgb(vec3(randH, randS, randV)), 1.0);
}
}

View File

@ -22,6 +22,17 @@ vec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
vec4 permute(vec4 x) { return mod289(((x * 34.0) + 10.0) * x); }
vec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }
uniform int colored;
uniform vec2 colorRanR;
uniform vec2 colorRanG;
uniform vec2 colorRanB;
vec3 hsv2rgb(vec3 c) {
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
float snoise(vec3 vec) {
vec3 v = vec * 4.;
@ -100,8 +111,8 @@ float snoise(vec3 vec) {
return n;
}
void main() {
vec2 p = ((v_vTexcoord + position.xy) / scale) * 2.0 - 1.0;
float simplex(in vec2 st) {
vec2 p = ((st + position.xy) / scale) * 2.0 - 1.0;
float _z = 1. + position.z;
vec3 xyz = vec3(p, _z);
@ -115,6 +126,23 @@ void main() {
xyz *= 2.;
}
gl_FragColor = vec4(vec3(n), 1.);
return n;
}
void main() {
if(colored == 0) {
gl_FragColor = vec4(vec3(simplex(v_vTexcoord)), 1.0);
} else if(colored == 1) {
float randR = colorRanR[0] + simplex(v_vTexcoord) * (colorRanR[1] - colorRanR[0]);
float randG = colorRanG[0] + simplex(v_vTexcoord + vec2(1.7227, 4.55529)) * (colorRanG[1] - colorRanG[0]);
float randB = colorRanB[0] + simplex(v_vTexcoord + vec2(6.9950, 6.82063)) * (colorRanB[1] - colorRanB[0]);
gl_FragColor = vec4(randR, randG, randB, 1.0);
} else if(colored == 2) {
float randH = colorRanR[0] + simplex(v_vTexcoord) * (colorRanR[1] - colorRanR[0]);
float randS = colorRanG[0] + simplex(v_vTexcoord + vec2(1.7227, 4.55529)) * (colorRanG[1] - colorRanG[0]);
float randV = colorRanB[0] + simplex(v_vTexcoord + vec2(6.9950, 6.82063)) * (colorRanB[1] - colorRanB[0]);
gl_FragColor = vec4(hsv2rgb(vec3(randH, randS, randV)), 1.0);
}
}