diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 919b9da38..4352fba63 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -283,7 +283,7 @@ {"name":"node_hlsl","order":13,"path":"scripts/node_hlsl/node_hlsl.yy",}, {"name":"sh_dither","order":28,"path":"shaders/sh_dither/sh_dither.yy",}, {"name":"__vec2","order":7,"path":"scripts/__vec2/__vec2.yy",}, - {"name":"node_region_fill","order":18,"path":"scripts/node_region_fill/node_region_fill.yy",}, + {"name":"node_region_fill","order":1,"path":"scripts/node_region_fill/node_region_fill.yy",}, {"name":"sh_mk_tile55_edge_r","order":7,"path":"shaders/sh_mk_tile55_edge_r/sh_mk_tile55_edge_r.yy",}, {"name":"sh_d3d_normal","order":18,"path":"shaders/sh_d3d_normal/sh_d3d_normal.yy",}, {"name":"s_node_text_file_read","order":13,"path":"sprites/s_node_text_file_read/s_node_text_file_read.yy",}, @@ -346,7 +346,7 @@ {"name":"o_dialog_textbox_autocomplete","order":7,"path":"objects/o_dialog_textbox_autocomplete/o_dialog_textbox_autocomplete.yy",}, {"name":"s_node_loop_input","order":14,"path":"sprites/s_node_loop_input/s_node_loop_input.yy",}, {"name":"node_strand_length_adjust","order":11,"path":"scripts/node_strand_length_adjust/node_strand_length_adjust.yy",}, - {"name":"node_blinker","order":17,"path":"scripts/node_blinker/node_blinker.yy",}, + {"name":"node_blinker","order":2,"path":"scripts/node_blinker/node_blinker.yy",}, {"name":"s_node_3d_transform_scene","order":22,"path":"sprites/s_node_3d_transform_scene/s_node_3d_transform_scene.yy",}, {"name":"fd_rectangle_add_material_surface","order":25,"path":"scripts/fd_rectangle_add_material_surface/fd_rectangle_add_material_surface.yy",}, {"name":"perlin_noise","order":5,"path":"scripts/perlin_noise/perlin_noise.yy",}, @@ -665,7 +665,7 @@ {"name":"s_node_pack_sprite","order":5,"path":"sprites/s_node_pack_sprite/s_node_pack_sprite.yy",}, {"name":"surface_valid","order":6,"path":"scripts/surface_valid/surface_valid.yy",}, {"name":"sh_blur_zoom","order":5,"path":"shaders/sh_blur_zoom/sh_blur_zoom.yy",}, - {"name":"node_isosurf","order":4,"path":"scripts/node_isosurf/node_isosurf.yy",}, + {"name":"node_isosurf","order":3,"path":"scripts/node_isosurf/node_isosurf.yy",}, {"name":"__add_node_item","order":13,"path":"scripts/__add_node_item/__add_node_item.yy",}, {"name":"node_VFX_renderer","order":2,"path":"scripts/node_VFX_renderer/node_VFX_renderer.yy",}, {"name":"s_node_pb_fx_stack","order":2,"path":"sprites/s_node_pb_fx_stack/s_node_pb_fx_stack.yy",}, @@ -710,6 +710,7 @@ {"name":"pack_bottom_left","order":2,"path":"scripts/pack_bottom_left/pack_bottom_left.yy",}, {"name":"o_dialog_lua_reference","order":5,"path":"objects/o_dialog_lua_reference/o_dialog_lua_reference.yy",}, {"name":"__node_custom","order":14,"path":"scripts/__node_custom/__node_custom.yy",}, + {"name":"node_surface_data","order":5,"path":"scripts/node_surface_data/node_surface_data.yy",}, {"name":"s_node_note","order":35,"path":"sprites/s_node_note/s_node_note.yy",}, {"name":"node_strand_gravity","order":4,"path":"scripts/node_strand_gravity/node_strand_gravity.yy",}, {"name":"palette_functions","order":3,"path":"scripts/palette_functions/palette_functions.yy",}, @@ -949,7 +950,6 @@ {"name":"o_dialog_file_name","order":1,"path":"objects/o_dialog_file_name/o_dialog_file_name.yy",}, {"name":"s_node_pb_layer","order":18,"path":"sprites/s_node_pb_layer/s_node_pb_layer.yy",}, {"name":"FirebaseREST_HTTP_Success_Firestore","order":19,"path":"scripts/FirebaseREST_HTTP_Success_Firestore/FirebaseREST_HTTP_Success_Firestore.yy",}, - {"name":"node_surface_from_color","order":1,"path":"scripts/node_surface_from_color/node_surface_from_color.yy",}, {"name":"s_node_pb_draw_rectangle","order":13,"path":"sprites/s_node_pb_draw_rectangle/s_node_pb_draw_rectangle.yy",}, {"name":"panel_animation","order":1,"path":"scripts/panel_animation/panel_animation.yy",}, {"name":"sh_pb_to_mask","order":7,"path":"shaders/sh_pb_to_mask/sh_pb_to_mask.yy",}, @@ -1039,7 +1039,7 @@ {"name":"s_node_tunnel_in","order":21,"path":"sprites/s_node_tunnel_in/s_node_tunnel_in.yy",}, {"name":"s_node_pb_draw_trapezoid","order":10,"path":"sprites/s_node_pb_draw_trapezoid/s_node_pb_draw_trapezoid.yy",}, {"name":"append_function","order":1,"path":"scripts/append_function/append_function.yy",}, - {"name":"node_3dsurf","order":5,"path":"scripts/node_3dsurf/node_3dsurf.yy",}, + {"name":"node_3dsurf","order":4,"path":"scripts/node_3dsurf/node_3dsurf.yy",}, {"name":"fd_rectangle_reset_target","order":17,"path":"scripts/fd_rectangle_reset_target/fd_rectangle_reset_target.yy",}, {"name":"node_fluid_sim_inline","order":12,"path":"scripts/node_fluid_sim_inline/node_fluid_sim_inline.yy",}, {"name":"node_rate_remap","order":3,"path":"scripts/node_rate_remap/node_rate_remap.yy",}, @@ -1476,7 +1476,7 @@ {"name":"node_array_composite","order":17,"path":"scripts/node_array_composite/node_array_composite.yy",}, {"name":"s_node_vfx_turb","order":5,"path":"sprites/s_node_vfx_turb/s_node_vfx_turb.yy",}, {"name":"o_dialog_l_system","order":1,"path":"objects/o_dialog_l_system/o_dialog_l_system.yy",}, - {"name":"node_surface_to_color","order":2,"path":"scripts/node_surface_to_color/node_surface_to_color.yy",}, + {"name":"node_surface_to_color","order":1,"path":"scripts/node_surface_to_color/node_surface_to_color.yy",}, {"name":"sh_shadow_cast_light_sep","order":1,"path":"shaders/sh_shadow_cast_light_sep/sh_shadow_cast_light_sep.yy",}, {"name":"node_audio_loudness","order":1,"path":"scripts/node_audio_loudness/node_audio_loudness.yy",}, {"name":"sh_FLIP_draw_droplet","order":1,"path":"shaders/sh_FLIP_draw_droplet/sh_FLIP_draw_droplet.yy",}, @@ -1513,7 +1513,7 @@ {"name":"s_node_rigidSim_deactivate","order":7,"path":"sprites/s_node_rigidSim_deactivate/s_node_rigidSim_deactivate.yy",}, {"name":"sh_blend_contrast","order":16,"path":"shaders/sh_blend_contrast/sh_blend_contrast.yy",}, {"name":"__node_3d_prim_cube","order":1,"path":"scripts/__node_3d_prim_cube/__node_3d_prim_cube.yy",}, - {"name":"node_surface_from_buffer","order":3,"path":"scripts/node_surface_from_buffer/node_surface_from_buffer.yy",}, + {"name":"node_surface_from_buffer","order":2,"path":"scripts/node_surface_from_buffer/node_surface_from_buffer.yy",}, {"name":"Obj_FirebaseFirestore_Collection_Listener","order":1,"path":"objects/Obj_FirebaseFirestore_Collection_Listener/Obj_FirebaseFirestore_Collection_Listener.yy",}, {"name":"s_node_fluidSim_add_collider","order":1,"path":"sprites/s_node_fluidSim_add_collider/s_node_fluidSim_add_collider.yy",}, {"name":"__node_3d_plane","order":4,"path":"scripts/__node_3d_plane/__node_3d_plane.yy",}, @@ -1767,7 +1767,7 @@ {"name":"rangeBox","order":9,"path":"scripts/rangeBox/rangeBox.yy",}, {"name":"s_node_array_copy","order":14,"path":"sprites/s_node_array_copy/s_node_array_copy.yy",}, {"name":"node_VFX_effect_accelerate","order":1,"path":"scripts/node_VFX_effect_accelerate/node_VFX_effect_accelerate.yy",}, - {"name":"node_flood_fill","order":10,"path":"scripts/node_flood_fill/node_flood_fill.yy",}, + {"name":"node_flood_fill","order":3,"path":"scripts/node_flood_fill/node_flood_fill.yy",}, {"name":"node_frame","order":1,"path":"scripts/node_frame/node_frame.yy",}, {"name":"s_node_scale_algo","order":7,"path":"sprites/s_node_scale_algo/s_node_scale_algo.yy",}, {"name":"sh_sdf_dist","order":4,"path":"shaders/sh_sdf_dist/sh_sdf_dist.yy",}, diff --git a/datafiles/data/Theme.zip b/datafiles/data/Theme.zip index f124e233b..87a38cd87 100644 Binary files a/datafiles/data/Theme.zip and b/datafiles/data/Theme.zip differ diff --git a/fonts/_f_sdf/_f_sdf.old.png b/fonts/_f_sdf/_f_sdf.old.png index 4ac727316..80d297367 100644 Binary files a/fonts/_f_sdf/_f_sdf.old.png and b/fonts/_f_sdf/_f_sdf.old.png differ diff --git a/fonts/_f_sdf/_f_sdf.png b/fonts/_f_sdf/_f_sdf.png index fe6c7bc6c..4c67875ac 100644 Binary files a/fonts/_f_sdf/_f_sdf.png and b/fonts/_f_sdf/_f_sdf.png differ diff --git a/fonts/_f_sdf_medium/_f_sdf_medium.old.png b/fonts/_f_sdf_medium/_f_sdf_medium.old.png index b3bc61874..fe74e967b 100644 Binary files a/fonts/_f_sdf_medium/_f_sdf_medium.old.png and b/fonts/_f_sdf_medium/_f_sdf_medium.old.png differ diff --git a/fonts/_f_sdf_medium/_f_sdf_medium.png b/fonts/_f_sdf_medium/_f_sdf_medium.png index 809e08a8e..624d7d59d 100644 Binary files a/fonts/_f_sdf_medium/_f_sdf_medium.png and b/fonts/_f_sdf_medium/_f_sdf_medium.png differ diff --git a/objects/o_dialog_palette/Create_0.gml b/objects/o_dialog_palette/Create_0.gml index 5ad96c280..f71f7099f 100644 --- a/objects/o_dialog_palette/Create_0.gml +++ b/objects/o_dialog_palette/Create_0.gml @@ -14,6 +14,11 @@ event_inherited(); index_dragging = -1; interactable = true; + index_drag_x = 0; index_drag_x_to = 0; + index_drag_y = 0; index_drag_y_to = 0; + index_drag_w = 0; index_drag_w_to = 0; + index_drag_h = 0; index_drag_h_to = 0; + setColor = function(color) { if(index_selecting == -1 || palette == 0) return; palette[index_selecting] = color; @@ -84,6 +89,10 @@ event_inherited(); palette = array_create(array_length(pal.palette)); for( var j = 0; j < array_length(pal.palette); j++ ) palette[j] = pal.palette[j]; + onApply(palette); + + index_selecting = 0; + selector.setColor(palette[index_selecting], false); } if(i >= 0 && mouse_press(mb_right, interactable && sFOCUS)) { diff --git a/objects/o_dialog_palette/Draw_64.gml b/objects/o_dialog_palette/Draw_64.gml index 83fd11424..af60247c1 100644 --- a/objects/o_dialog_palette/Draw_64.gml +++ b/objects/o_dialog_palette/Draw_64.gml @@ -52,8 +52,9 @@ if palette == 0 exit; var r = number_to_hex(color_get_red(cc)); var g = number_to_hex(color_get_green(cc)); var b = number_to_hex(color_get_blue(cc)); + var a = number_to_hex(color_get_alpha(cc)); - file_text_write_string(file, $"{r}{g}{b}\n"); + file_text_write_string(file, $"{r}{g}{b}{a}\n"); } file_text_close(file); __initPalette(); @@ -114,15 +115,40 @@ if palette == 0 exit; #endregion var hover = -1, hvx, hvy; + var _pd = ui(5); + for(var i = 0; i < row; i++) for(var j = 0; j < col; j++) { var index = i * col + j; if(index >= array_length(palette)) break; + var _p = palette[index]; + var _pa = _color_get_alpha(_p); var _kx = pl_x + j * ww; var _ky = pl_y + i * (pl_h + ui(6)); - draw_sprite_stretched_ext(THEME.color_picker_sample, index == index_selecting, _kx + ui(2), _ky, ww - ui(4), pl_h, _p, 1); + var _px = _kx + ui(2); + var _py = _ky; + var _pw = ww - ui(4); + var _ph = pl_h; + + if(index == index_dragging) { + index_drag_x_to = _px; + index_drag_y_to = _py; + index_drag_w_to = _pw; + index_drag_h_to = _ph; + continue; + } + + if(_pa < 1) { + draw_sprite_stretched_ext(THEME.palette_mask, 1, _px, _py, _pw, _ph - ui(8), _p, 1); + draw_sprite_stretched_ext(THEME.palette_mask, 1, _px, _py + _ph - ui(6), _pw, ui(6), c_black, 1); + draw_sprite_stretched_ext(THEME.palette_mask, 1, _px, _py + _ph - ui(6), _pw * _pa, ui(6), c_white, 1); + } else + draw_sprite_stretched_ext(THEME.palette_mask, 1, _px, _py, _pw, _ph, _p, 1); + + if(index == index_selecting) + draw_sprite_stretched_ext(THEME.palette_selecting, 0, _px - _pd, _py - _pd, _pw + _pd * 2, _ph + _pd * 2, c_white, 1); if(sHOVER && point_in_rectangle(mouse_mx, mouse_my, _kx, _ky, _kx + ww, _ky + pl_h)) { hover = index; @@ -132,26 +158,48 @@ if palette == 0 exit; } if(index_dragging > -1) { + index_drag_x = index_drag_x == 0? index_drag_x_to : lerp_float(index_drag_x, index_drag_x_to, 5); + index_drag_y = index_drag_y == 0? index_drag_y_to : lerp_float(index_drag_y, index_drag_y_to, 5); + index_drag_w = index_drag_w == 0? index_drag_w_to : lerp_float(index_drag_w, index_drag_w_to, 5); + index_drag_h = index_drag_h == 0? index_drag_h_to : lerp_float(index_drag_h, index_drag_h_to, 5); + + _px = index_drag_x; + _py = index_drag_y; + _pw = index_drag_w; + _ph = index_drag_h; + _p = palette[index_dragging]; + _pa = _color_get_alpha(_p); + + if(_pa < 1) { + draw_sprite_stretched_ext(THEME.palette_mask, 1, _px, _py, _pw, _ph - ui(8), _p, 1); + draw_sprite_stretched_ext(THEME.palette_mask, 1, _px, _py + _ph - ui(6), _pw, ui(6), c_black, 1); + draw_sprite_stretched_ext(THEME.palette_mask, 1, _px, _py + _ph - ui(6), _pw * _pa, ui(6), c_white, 1); + } else + draw_sprite_stretched_ext(THEME.palette_mask, 1, _px, _py, _pw, _ph, _p, 1); + draw_sprite_stretched_ext(THEME.palette_selecting, 0, _px - _pd, _py - _pd, _pw + _pd * 2, _ph + _pd * 2, c_white, 1); + if(hover > -1 && hover != index_dragging) { draw_set_color(COLORS.dialog_palette_divider); - if(hover < index_dragging) - draw_line_width(hvx - 1, hvy, hvx - 1, hvy + pl_h, 4); - else - draw_line_width(hvx + ww - 1, hvy, hvx + ww - 1, hvy + pl_h, 4); + var sx = hvx; + if(hover >= index_dragging) sx += ww; - if(mouse_release(mb_left)) { - var tt = palette[index_dragging]; + var tt = palette[index_dragging]; - array_delete(palette, index_dragging, 1); - array_insert(palette, hover, tt); - index_selecting = hover; + array_delete(palette, index_dragging, 1); + array_insert(palette, hover, tt); + index_selecting = hover; + index_dragging = hover; - onApply(palette); - } + onApply(palette); } if(mouse_release(mb_left)) - index_dragging = -1; + index_dragging = -1; + } else { + index_drag_x = 0; + index_drag_y = 0; + index_drag_w = 0; + index_drag_h = 0; } if(mouse_press(mb_left, sFOCUS) && hover > -1) { @@ -165,7 +213,7 @@ if palette == 0 exit; var by = pl_y - ui(2); if(array_length(palette) > 1) { - if(buttonInstant(THEME.button, bx, by, ui(28), ui(28), mouse_ui, interactable && sFOCUS, sHOVER, "", THEME.minus) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, interactable && sFOCUS, sHOVER, "", THEME.minus) == 2) { array_delete(palette, index_selecting, 1); index_selecting = clamp(index_selecting - 1, 0, array_length(palette) - 1); onApply(palette); @@ -175,14 +223,14 @@ if palette == 0 exit; } bx -= ui(32); - if(buttonInstant(THEME.button, bx, by, ui(28), ui(28), mouse_ui, interactable && sFOCUS, sHOVER, "", THEME.add) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, interactable && sFOCUS, sHOVER, "", THEME.add) == 2) { index_selecting = array_length(palette); palette[array_length(palette)] = c_black; onApply(palette); } bx = content_x + ui(18); - if(buttonInstant(THEME.button, bx, by, ui(28), ui(28), mouse_ui, interactable && sFOCUS, sHOVER, __txtx("palette_editor_load", "Load palette file") + " (.hex)", THEME.file) == 2) { + if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, interactable && sFOCUS, sHOVER, __txtx("palette_editor_load", "Load palette file") + " (.hex)", THEME.file) == 2) { var path = get_open_filename("HEX palette|*.hex", ""); key_release(); diff --git a/scripts/__VFX/__VFX.gml b/scripts/__VFX/__VFX.gml index ec2cdb481..b3a750733 100644 --- a/scripts/__VFX/__VFX.gml +++ b/scripts/__VFX/__VFX.gml @@ -309,7 +309,7 @@ function __part(_node) constructor { var cc = (col == -1)? c_white : col.eval(lifeRat); if(blend != c_white) cc = colorMultiply(blend, cc); - alp_draw = alp * (alp_fade == noone? 1 : alp_fade.get(lifeRat)); + alp_draw = alp * (alp_fade == noone? 1 : alp_fade.get(lifeRat)) * _color_get_alpha(cc); draw_surface_ext_safe(surface, _xx, _yy, scx, scy, drawrot, cc, alp_draw); } #endregion diff --git a/scripts/__node_3d_displace/__node_3d_displace.gml b/scripts/__node_3d_displace/__node_3d_displace.gml index b7fbea0dc..3050183a3 100644 --- a/scripts/__node_3d_displace/__node_3d_displace.gml +++ b/scripts/__node_3d_displace/__node_3d_displace.gml @@ -148,9 +148,9 @@ function __Node_3D_Displace(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr if(is_surface(_dspTex)) { var c = surface_getpixel(_dspTex, v.textures[_texI][0] * surface_get_width_safe(_dspTex), v.textures[_texI][1] * surface_get_height_safe(_dspTex)); - var r = color_get_red(c) / 255; - var g = color_get_green(c) / 255; - var b = color_get_blue(c) / 255; + var r = _color_get_red(c); + var g = _color_get_green(c); + var b = _color_get_blue(c); str = 0.2126 * r + 0.7152 * g + 0.0722 * b; } diff --git a/scripts/_node_VFX_spawner/_node_VFX_spawner.gml b/scripts/_node_VFX_spawner/_node_VFX_spawner.gml index 44494a177..4ee0d3444 100644 --- a/scripts/_node_VFX_spawner/_node_VFX_spawner.gml +++ b/scripts/_node_VFX_spawner/_node_VFX_spawner.gml @@ -157,7 +157,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co ["Spawn", true], 27, 16, 44, 1, 2, 3, 4, 30, 24, 5, ["Movement", true], 29, 6, 18, ["Physics", true], 7, 19, 33, 34, 35, 36, - ["Ground", true], 37, 38, 39, 40, + ["Ground", true, 37], 38, 39, 40, ["Rotation", true], 15, 8, 9, ["Scale", true], 10, 17, 11, ["Wiggles", true], 20, 41, 42, 43, @@ -455,7 +455,6 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co var _scatt = getInputData(24); var _dirAng = getInputData(29); var _turn = getInputData(34); - var _colGnd = getInputData(37); var _spwTyp = getInputData(16); inputs[| 6].setVisible(!_dirAng); @@ -467,10 +466,6 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co inputs[| 35].setVisible(_turn[0] != 0 && _turn[1] != 0); inputs[| 36].setVisible(_turn[0] != 0 && _turn[1] != 0); - inputs[| 38].setVisible(_colGnd); - inputs[| 39].setVisible(_colGnd); - inputs[| 40].setVisible(_colGnd); - inputs[| 22].setVisible(false); inputs[| 23].setVisible(false); inputs[| 26].setVisible(false); diff --git a/scripts/buttonPalette/buttonPalette.gml b/scripts/buttonPalette/buttonPalette.gml index 2648c9615..99fb591f6 100644 --- a/scripts/buttonPalette/buttonPalette.gml +++ b/scripts/buttonPalette/buttonPalette.gml @@ -96,18 +96,25 @@ function drawPalette(_pal, _x, _y, _w, _h, _a = 1) { #region var ww = _w / aa; var _x0 = _x; + var _in; for(var i = 0; i < aa; i++) { - if(!is_real(_pal[i])) continue; + if(!is_numeric(_pal[i])) continue; - var _in = 0; + if(i == 0) _in = 2; + else if(i == aa - 1) _in = 3; + else _in = 0; - if(i == 0) - _in = 2; - else if(i == aa - 1) - _in = 3; + var _ca = _color_get_alpha(_pal[i]); - draw_sprite_stretched_ext(THEME.palette_mask, _in, floor(_x0), _y, ceil(ww), _h, _pal[i], _a); + if(_ca == 1) { + draw_sprite_stretched_ext(THEME.palette_mask, _in, floor(_x0), _y, ceil(ww), _h, _pal[i], _a); + } else { + draw_sprite_stretched_ext(THEME.palette_mask, _in, floor(_x0), _y, ceil(ww), _h - ui(8), _pal[i], _a); + + draw_sprite_stretched_ext(THEME.palette_mask, 1, floor(_x0), _y + _h - ui(6), ceil(ww), ui(6), c_black, _a); + draw_sprite_stretched_ext(THEME.palette_mask, 1, floor(_x0), _y + _h - ui(6), ceil(ww) * _ca, ui(6), c_white, _a); + } _x0 += ww; } diff --git a/scripts/color_function/color_function.gml b/scripts/color_function/color_function.gml index fc8c08843..848b7418d 100644 --- a/scripts/color_function/color_function.gml +++ b/scripts/color_function/color_function.gml @@ -9,17 +9,34 @@ function colorFromRGBArray(arr) { #region return make_color_rgb(r, g, b); } #endregion -function color_get_alpha(color) { INLINE return (color & (0xFF << 24)) >> 24; } -function _color_get_alpha(color) { INLINE return is_real(color)? 1 : color_get_alpha(color) / 255; } +function color_get_alpha(color) { INLINE return is_real(color)? 255 : (color & (0xFF << 24)) >> 24; } +function _color_get_alpha(color) { INLINE return is_real(color)? 1 : color_get_alpha(color) / 255; } + function _color_get_red(color) { INLINE return color_get_red(color) / 255; } function _color_get_green(color) { INLINE return color_get_green(color) / 255; } function _color_get_blue(color) { INLINE return color_get_blue(color) / 255; } +function _color_get_hue(color) { INLINE return color_get_hue(color) / 255; } +function _color_get_saturation(color) { INLINE return color_get_saturation(color) / 255; } +function _color_get_value(color) { INLINE return color_get_value(color) / 255; } + function colorArrayFromReal(clr) { #region INLINE return [ _color_get_red(clr), _color_get_green(clr), _color_get_blue(clr) ]; } #endregion +function paletteToArray(_pal) { #region + var _colors = array_create(array_length(_pal) * 4); + for(var i = 0; i < array_length(_pal); i++) { + _colors[i * 4 + 0] = _color_get_red(_pal[i]); + _colors[i * 4 + 1] = _color_get_green(_pal[i]); + _colors[i * 4 + 2] = _color_get_blue(_pal[i]); + _colors[i * 4 + 3] = _color_get_alpha(_pal[i]); + } + + return _colors; +} #endregion + function colorBrightness(clr, normalize = true) { #region INLINE var r2 = color_get_red(clr) / (normalize? 255 : 1); diff --git a/scripts/distribution_function/distribution_function.gml b/scripts/distribution_function/distribution_function.gml index 61bb771a9..3ccc58292 100644 --- a/scripts/distribution_function/distribution_function.gml +++ b/scripts/distribution_function/distribution_function.gml @@ -54,9 +54,9 @@ function get_points_from_dist(distMap, amount, seed = 0, attempt = 8) { var cc = buffer_read(b, buffer_u32); if(cc == 0) pos[i] = 0; else { - var _x = color_get_red(cc) / 255; - var _y = color_get_green(cc) / 255; - var _v = color_get_blue(cc) / 255; + var _x = _color_get_red(cc); + var _y = _color_get_green(cc); + var _v = _color_get_blue(cc); pos[i] = [_x, _y, _v]; } } diff --git a/scripts/getGradientData/getGradientData.gml b/scripts/getGradientData/getGradientData.gml index 74416b731..23b106a26 100644 --- a/scripts/getGradientData/getGradientData.gml +++ b/scripts/getGradientData/getGradientData.gml @@ -2,10 +2,10 @@ function getGradientData(gradient, data) { var _grad_color = []; var _grad_time = []; for(var i = 0; i < ds_list_size(gradient); i++) { - _grad_color[i * 4 + 0] = color_get_red(gradient[| i].value) / 255; - _grad_color[i * 4 + 1] = color_get_green(gradient[| i].value) / 255; - _grad_color[i * 4 + 2] = color_get_blue(gradient[| i].value) / 255; - _grad_color[i * 4 + 3] = 1; + _grad_color[i * 4 + 0] = _color_get_red(gradient[| i].value); + _grad_color[i * 4 + 1] = _color_get_green(gradient[| i].value); + _grad_color[i * 4 + 2] = _color_get_blue(gradient[| i].value); + _grad_color[i * 4 + 3] = _color_get_alpha(gradient[| i].value); _grad_time[i] = gradient[| i].time; } diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index a580d7c19..825783a94 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -25,10 +25,10 @@ globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER, LATEST_VERSION; LATEST_VERSION = 11600; - VERSION = 11620; - SAVE_VERSION = 11620; - VERSION_STRING = "1.16.2.0"; - BUILD_NUMBER = 11620; + VERSION = 11630; + SAVE_VERSION = 11630; + VERSION_STRING = "1.16.3.0"; + BUILD_NUMBER = 11630; globalvar APPEND_MAP; APPEND_MAP = ds_map_create(); diff --git a/scripts/node_2d_light/node_2d_light.gml b/scripts/node_2d_light/node_2d_light.gml index 91a1464b0..e57c3a1e3 100644 --- a/scripts/node_2d_light/node_2d_light.gml +++ b/scripts/node_2d_light/node_2d_light.gml @@ -162,7 +162,7 @@ function Node_2D_light(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) shader_set_uniform_f(uniform_intn, _inten * _color_get_alpha(_color)); shader_set_uniform_f(uniform_band, _band); shader_set_uniform_f(uniform_attn, _attn); - shader_set_uniform_f_array_safe(uniform_colr, [ color_get_red(_color) / 255, color_get_green(_color) / 255, color_get_blue(_color) / 255 ]); + shader_set_uniform_f_array_safe(uniform_colr, [ _color_get_red(_color), _color_get_green(_color), _color_get_blue(_color) ]); switch(_shape) { case LIGHT_SHAPE_2D.point : diff --git a/scripts/node_atlas/node_atlas.gml b/scripts/node_atlas/node_atlas.gml index cacd51ada..a6c87f1e4 100644 --- a/scripts/node_atlas/node_atlas.gml +++ b/scripts/node_atlas/node_atlas.gml @@ -1,8 +1,6 @@ function Node_Atlas(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { name = "Pixel Expand"; - uniform_dim = shader_get_uniform(sh_atlas, "dimension"); - inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 1] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); @@ -15,17 +13,11 @@ function Node_Atlas(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con attribute_surface_depth(); static processData = function(_outSurf, _data, _output_index, _array_index) { #region - surface_set_target(_outSurf); - DRAW_CLEAR - BLEND_OVERRIDE; - shader_set(sh_atlas); - shader_set_uniform_f_array_safe(uniform_dim, [surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0])]); - draw_surface_safe(_data[0], 0, 0); - shader_reset(); - - BLEND_NORMAL; - surface_reset_target(); + surface_set_shader(_outSurf, sh_atlas); + shader_set_f("dimension", surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0])); + draw_surface_safe(_data[0]); + surface_reset_shader(); return _outSurf; } #endregion diff --git a/scripts/node_blinker/node_blinker.yy b/scripts/node_blinker/node_blinker.yy index 3f5f31beb..1548f6e5f 100644 --- a/scripts/node_blinker/node_blinker.yy +++ b/scripts/node_blinker/node_blinker.yy @@ -5,7 +5,7 @@ "isCompatibility": false, "isDnD": false, "parent": { - "name": "generator", - "path": "folders/nodes/data/generator.yy", + "name": "regions", + "path": "folders/nodes/data/generator/regions.yy", }, } \ No newline at end of file diff --git a/scripts/node_bloom/node_bloom.gml b/scripts/node_bloom/node_bloom.gml index c21080a7f..d32e027d9 100644 --- a/scripts/node_bloom/node_bloom.gml +++ b/scripts/node_bloom/node_bloom.gml @@ -1,13 +1,6 @@ function Node_Bloom(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { name = "Bloom"; - shader = sh_bloom_pass; - uniform_size = shader_get_uniform(shader, "size"); - uniform_tole = shader_get_uniform(shader, "tolerance"); - - uniform_umsk = shader_get_uniform(shader, "useMask"); - uniform_mask = shader_get_sampler_index(shader, "mask"); - inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 1] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3, "Bloom blur radius.") .setDisplay(VALUE_DISPLAY.slider, { range: [1, 32, 1] }); @@ -55,39 +48,26 @@ function Node_Bloom(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con var _mask = _data[4]; var pass1 = surface_create_valid(surface_get_width_safe(_outSurf), surface_get_height_safe(_outSurf), attrDepth()); - surface_set_target(pass1); - draw_clear_alpha(c_black, 1); - shader_set(shader); - shader_set_uniform_f(uniform_size, _size); - shader_set_uniform_f(uniform_tole, _tole); + surface_set_shader(pass1, sh_bloom_pass); + draw_clear_alpha(c_black, 1); + shader_set_f("size", _size); + shader_set_f("tolerance", _tole); - shader_set_uniform_i(uniform_umsk, is_surface(_mask)); - texture_set_stage(uniform_mask, surface_get_texture(_mask)); + shader_set_i("useMask", is_surface(_mask)); + shader_set_surface("mask", _mask); - draw_surface_safe(_data[0], 0, 0); - shader_reset(); - surface_reset_target(); + draw_surface_safe(_data[0]); + surface_reset_shader(); var pass1blur = surface_apply_gaussian(pass1, _size, true, c_black, 1); surface_free(pass1); - surface_set_target(_outSurf); - DRAW_CLEAR - BLEND_OVERRIDE; - - var uniform_foreground = shader_get_sampler_index(sh_blend_add_alpha_adj, "fore"); - var uniform_opacity = shader_get_uniform(sh_blend_add_alpha_adj, "opacity"); + surface_set_shader(_outSurf, sh_blend_add_alpha_adj); + shader_set_surface("fore", pass1blur); + shader_set_f("opacity", _stre); - shader_set(sh_blend_add_alpha_adj); - texture_set_stage(uniform_foreground, surface_get_texture(pass1blur)); - shader_set_uniform_f(uniform_opacity, _stre); - - draw_surface_safe(_data[0], 0, 0); - - shader_reset(); - - BLEND_NORMAL; - surface_reset_target(); + draw_surface_safe(_data[0]); + surface_reset_shader(); __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[5], _data[6]); diff --git a/scripts/node_blur_simple/node_blur_simple.gml b/scripts/node_blur_simple/node_blur_simple.gml index 540d4141a..d21e93bed 100644 --- a/scripts/node_blur_simple/node_blur_simple.gml +++ b/scripts/node_blur_simple/node_blur_simple.gml @@ -1,16 +1,6 @@ function Node_Blur_Simple(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { name = "Simple blur"; - shader = sh_blur_simple; - uniform_dim = shader_get_uniform(shader, "dimension"); - uniform_siz = shader_get_uniform(shader, "size"); - uniform_sam = shader_get_uniform(shader, "sampleMode"); - - uniform_umk = shader_get_uniform(shader, "useMask"); - uniform_msk = shader_get_sampler_index(shader, "mask"); - uniform_ovr = shader_get_uniform(shader, "overrideColor"); - uniform_ovc = shader_get_uniform(shader, "overColor"); - inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 1] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3) .setDisplay(VALUE_DISPLAY.slider, { range: [1, 32, 1] }); @@ -63,27 +53,19 @@ function Node_Blur_Simple(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou inputs[| 5].setVisible(_isovr); - surface_set_target(_outSurf); - DRAW_CLEAR - BLEND_OVERRIDE; + surface_set_shader(_outSurf, sh_blur_simple); + shader_set_f("dimension", surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0])); + shader_set_f("size", _size); + shader_set_i("sampleMode", _samp); - shader_set(shader); - shader_set_uniform_f(uniform_dim, surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0])); - shader_set_uniform_f(uniform_siz, _size); - shader_set_uniform_i(uniform_sam, _samp); + shader_set_i("overrideColor", _isovr); + shader_set_color("overColor", _overc); - shader_set_uniform_i(uniform_ovr, _isovr); - shader_set_uniform_f_array_safe(uniform_ovc, colToVec4(_overc)); - - shader_set_uniform_i(uniform_umk, is_surface(_mask)); - if(is_surface(_mask)) - texture_set_stage(uniform_msk, surface_get_texture(_mask)); + shader_set_i("useMask", is_surface(_mask)); + shader_set_surface("mask", _mask); - draw_surface_safe(_data[0], 0, 0); - shader_reset(); - - BLEND_NORMAL; - surface_reset_target(); + draw_surface_safe(_data[0]); + surface_reset_shader(); __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _msk, _mix); diff --git a/scripts/node_camera/node_camera.gml b/scripts/node_camera/node_camera.gml index 704532888..dd3b2cd0b 100644 --- a/scripts/node_camera/node_camera.gml +++ b/scripts/node_camera/node_camera.gml @@ -28,7 +28,8 @@ function Node_Camera(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co input_display_list = [ ["Background", true], 0, 4, 3, - ["Camera", false], 1, 2, 5, 6, 8, 7, + ["Camera", false], 1, 2, + ["Depth Of Field", true, 5], 6, 8, 7, ["Elements", true], ]; diff --git a/scripts/node_channels/node_channels.gml b/scripts/node_channels/node_channels.gml index 865705dba..cf5cc8fa1 100644 --- a/scripts/node_channels/node_channels.gml +++ b/scripts/node_channels/node_channels.gml @@ -8,9 +8,9 @@ function Node_RGB_Channel(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou inputs[| 2] = nodeValue("Keep Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); - outputs[| 0] = nodeValue("Red", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + outputs[| 0] = nodeValue("Red", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); outputs[| 1] = nodeValue("Green", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - outputs[| 2] = nodeValue("Blue", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + outputs[| 2] = nodeValue("Blue", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); outputs[| 3] = nodeValue("Alpha", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); attribute_surface_depth(); diff --git a/scripts/node_channels_hsv/node_channels_hsv.gml b/scripts/node_channels_hsv/node_channels_hsv.gml index d4271f5de..79986fbe4 100644 --- a/scripts/node_channels_hsv/node_channels_hsv.gml +++ b/scripts/node_channels_hsv/node_channels_hsv.gml @@ -3,13 +3,10 @@ function Node_HSV_Channel(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); - outputs[| 0] = nodeValue("Hue", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - + outputs[| 0] = nodeValue("Hue", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); outputs[| 1] = nodeValue("Saturation", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - - outputs[| 2] = nodeValue("Value", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); - - outputs[| 3] = nodeValue("Alpha", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + outputs[| 2] = nodeValue("Value", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + outputs[| 3] = nodeValue("Alpha", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); attribute_surface_depth(); diff --git a/scripts/node_chromatic_aberration/node_chromatic_aberration.gml b/scripts/node_chromatic_aberration/node_chromatic_aberration.gml index 679dbfd88..7c39fca39 100644 --- a/scripts/node_chromatic_aberration/node_chromatic_aberration.gml +++ b/scripts/node_chromatic_aberration/node_chromatic_aberration.gml @@ -30,19 +30,19 @@ function Node_Chromatic_Aberration(_x, _y, _group = noone) : Node_Processor(_x, attribute_surface_depth(); attribute_interpolation(); - static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { + static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region var pos = getInputData(1); var px = _x + pos[0] * _s; var py = _y + pos[1] * _s; inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); - } + } #endregion static step = function() { #region inputs[| 2].mappableStep(); } #endregion - static processData = function(_outSurf, _data, _output_index, _array_index) { + static processData = function(_outSurf, _data, _output_index, _array_index) { #region surface_set_shader(_outSurf, sh_chromatic_aberration); shader_set_interpolation(_data[0]); @@ -53,5 +53,5 @@ function Node_Chromatic_Aberration(_x, _y, _group = noone) : Node_Processor(_x, surface_reset_shader(); return _outSurf; - } + } #endregion } \ No newline at end of file diff --git a/scripts/node_color_adjustment/node_color_adjustment.gml b/scripts/node_color_adjustment/node_color_adjustment.gml index b5d038c85..3e92264ff 100644 --- a/scripts/node_color_adjustment/node_color_adjustment.gml +++ b/scripts/node_color_adjustment/node_color_adjustment.gml @@ -173,9 +173,9 @@ function Node_Color_adjust(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro for( var i = 0, n = array_length(_col); i < n; i++ ) { var _c = _col[i]; - var r = color_get_red(_c) / 255; - var g = color_get_green(_c) / 255; - var b = color_get_blue(_c) / 255; + var r = _color_get_red(_c); + var g = _color_get_green(_c); + var b = _color_get_blue(_c); _c = make_color_rgb( clamp((.5 + _con * 2 * (r - .5) + _bri) * _exp, 0, 1) * 255, @@ -183,9 +183,9 @@ function Node_Color_adjust(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro clamp((.5 + _con * 2 * (b - .5) + _bri) * _exp, 0, 1) * 255, ); - var h = color_get_hue(_c) / 255; - var s = color_get_saturation(_c) / 255; - var v = color_get_value(_c) / 255; + var h = _color_get_hue(_c); + var s = _color_get_saturation(_c); + var v = _color_get_value(_c); h = clamp(frac(h + _hue), -1, 1); if(h < 0) h = 1 + h; @@ -238,7 +238,7 @@ function Node_Color_adjust(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro shader_set_f_map_s("hue", _hue, _data[20], inputs[| 3]); shader_set_f_map_s("sat", _sat, _data[21], inputs[| 4]); shader_set_f_map_s("val", _val, _data[22], inputs[| 5]); - + shader_set_color("blend", _bl); shader_set_f_map_s("blendAmount", _bla * _color_get_alpha(_bl), _data[23], inputs[| 7]); shader_set_i("blendMode", _blm); diff --git a/scripts/node_color_mix/node_color_mix.gml b/scripts/node_color_mix/node_color_mix.gml index 648c3a439..0854a1800 100644 --- a/scripts/node_color_mix/node_color_mix.gml +++ b/scripts/node_color_mix/node_color_mix.gml @@ -9,7 +9,7 @@ function Node_Color_Mix(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) inputs[| 2] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) .setDisplay(VALUE_DISPLAY.slider); - inputs[| 3] = nodeValue("Mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 3] = nodeValue("Color space", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_button, [ "RGB", "HSV" ]); outputs[| 0] = nodeValue("Color", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, c_white); diff --git a/scripts/node_color_palette_replacement/node_color_palette_replacement.gml b/scripts/node_color_palette_replacement/node_color_palette_replacement.gml index df9ccc8bf..75aa597ba 100644 --- a/scripts/node_color_palette_replacement/node_color_palette_replacement.gml +++ b/scripts/node_color_palette_replacement/node_color_palette_replacement.gml @@ -54,21 +54,8 @@ function Node_Color_replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr var hrd = _data[6]; var msk = _data[7]; - var _colorFrom = array_create(array_length(fr) * 4); - for(var i = 0; i < array_length(fr); i++) { - _colorFrom[i * 4 + 0] = _color_get_red(fr[i]); - _colorFrom[i * 4 + 1] = _color_get_green(fr[i]); - _colorFrom[i * 4 + 2] = _color_get_blue(fr[i]); - _colorFrom[i * 4 + 3] = _color_get_alpha(fr[i]); - } - - var _colorTo = array_create(array_length(to) * 4); - for(var i = 0; i < array_length(to); i++) { - _colorTo[i * 4 + 0] = _color_get_red(to[i]); - _colorTo[i * 4 + 1] = _color_get_green(to[i]); - _colorTo[i * 4 + 2] = _color_get_blue(to[i]); - _colorTo[i * 4 + 3] = _color_get_alpha(to[i]); - } + var _colorFrom = paletteToArray(fr); + var _colorTo = paletteToArray(to); surface_set_shader(_outSurf, sh_palette_replace); shader_set_f("colorFrom", _colorFrom); diff --git a/scripts/node_convolution/node_convolution.gml b/scripts/node_convolution/node_convolution.gml index deabf42d4..e898aedd8 100644 --- a/scripts/node_convolution/node_convolution.gml +++ b/scripts/node_convolution/node_convolution.gml @@ -1,11 +1,6 @@ function Node_Convolution(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { name = "Convolution"; - shader = sh_convolution; - uniform_dim = shader_get_uniform(shader, "dimension"); - uniform_ker = shader_get_uniform(shader, "kernel"); - uniform_sam = shader_get_uniform(shader, "sampleMode"); - inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 1] = nodeValue("Kernel", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, array_create(9)) @@ -45,19 +40,13 @@ function Node_Convolution(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou var _ker = _data[1]; var _sam = struct_try_get(attributes, "oversample"); - surface_set_target(_outSurf); - DRAW_CLEAR - BLEND_OVERRIDE; - - shader_set(shader); - shader_set_uniform_f(uniform_dim, surface_get_width_safe(_outSurf), surface_get_height_safe(_outSurf)); - shader_set_uniform_f_array_safe(uniform_ker, _ker); - shader_set_uniform_i(uniform_sam, _sam); - draw_surface_safe(_data[0], 0, 0); - shader_reset(); - - BLEND_NORMAL; - surface_reset_target(); + surface_set_shader(_outSurf, sh_convolution); + shader_set_f("dimension", surface_get_width_safe(_outSurf), surface_get_height_safe(_outSurf)); + shader_set_f("kernel", _ker); + shader_set_i("sampleMode", _sam); + + draw_surface_safe(_data[0]); + surface_reset_shader(); __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[3], _data[4]); diff --git a/scripts/node_corner/node_corner.gml b/scripts/node_corner/node_corner.gml index c994f2afe..a157166f1 100644 --- a/scripts/node_corner/node_corner.gml +++ b/scripts/node_corner/node_corner.gml @@ -1,12 +1,6 @@ function Node_Corner(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { name = "Round corner"; - uniform_er_dim = shader_get_uniform(sh_corner_erode, "dimension"); - uniform_er_size = shader_get_uniform(sh_corner_erode, "size"); - - uniform_dim = shader_get_uniform(sh_corner, "dimension"); - uniform_rad = shader_get_uniform(sh_corner, "rad"); - inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 1] = nodeValue("Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 2) @@ -43,32 +37,21 @@ function Node_Corner(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co var temp = surface_create_valid(surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]), attrDepth()); - surface_set_target(temp); - DRAW_CLEAR - BLEND_OVERRIDE; + surface_set_shader(temp, sh_corner_erode); + shader_set_f("dimension", [surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0])]); + shader_set_f("size", wd); - shader_set(sh_corner_erode); - shader_set_uniform_f_array_safe(uniform_er_dim, [surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0])]); - shader_set_uniform_f(uniform_er_size, wd); - draw_surface_safe(_data[0], 0, 0); - - BLEND_NORMAL; - shader_reset(); - surface_reset_target(); + draw_surface_safe(_data[0]); + surface_reset_shader(); - surface_set_target(_outSurf); - DRAW_CLEAR - BLEND_OVERRIDE; - - shader_set(sh_corner); - shader_set_uniform_f_array_safe(uniform_dim, [surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0])]); - shader_set_uniform_f(uniform_rad, wd); + surface_set_shader(_outSurf, sh_corner); + shader_set_f("dimension", [surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0])]); + shader_set_f("rad", wd); shader_set_surface("original", _data[0]); - draw_surface_safe(temp, 0, 0); - BLEND_NORMAL; - shader_reset(); - surface_reset_target(); + draw_surface_safe(temp); + surface_reset_shader(); + surface_free(temp); __process_mask_modifier(_data); diff --git a/scripts/node_curve/node_curve.gml b/scripts/node_curve/node_curve.gml index dc552b30e..776e5d63c 100644 --- a/scripts/node_curve/node_curve.gml +++ b/scripts/node_curve/node_curve.gml @@ -1,19 +1,6 @@ function Node_Curve(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { name = "Curve"; - shader = sh_curve; - uniform_wcur = shader_get_uniform(shader, "w_curve"); - uniform_wamo = shader_get_uniform(shader, "w_amount"); - - uniform_rcur = shader_get_uniform(shader, "r_curve"); - uniform_ramo = shader_get_uniform(shader, "r_amount"); - - uniform_gcur = shader_get_uniform(shader, "g_curve"); - uniform_gamo = shader_get_uniform(shader, "g_amount"); - - uniform_bcur = shader_get_uniform(shader, "b_curve"); - uniform_bamo = shader_get_uniform(shader, "b_amount"); - inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 1] = nodeValue("Brightness", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_01); @@ -56,25 +43,21 @@ function Node_Curve(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con var _gcur = _data[3]; var _bcur = _data[4]; - surface_set_target(_outSurf); - DRAW_CLEAR - BLEND_OVERRIDE; - - shader_set(shader); - shader_set_uniform_f_array_safe(uniform_wcur, _wcur); - shader_set_uniform_i(uniform_wamo, array_length(_wcur)); - shader_set_uniform_f_array_safe(uniform_rcur, _rcur); - shader_set_uniform_i(uniform_ramo, array_length(_rcur)); - shader_set_uniform_f_array_safe(uniform_gcur, _gcur); - shader_set_uniform_i(uniform_gamo, array_length(_gcur)); - shader_set_uniform_f_array_safe(uniform_bcur, _bcur); - shader_set_uniform_i(uniform_bamo, array_length(_bcur)); + surface_set_shader(_outSurf, sh_curve); + shader_set_f("w_curve", _wcur); + shader_set_i("w_amount", array_length(_wcur)); + + shader_set_f("r_curve", _rcur); + shader_set_i("r_amount", array_length(_rcur)); + + shader_set_f("g_curve", _gcur); + shader_set_i("g_amount", array_length(_gcur)); + + shader_set_f("b_curve", _bcur); + shader_set_i("b_amount", array_length(_bcur)); - draw_surface_safe(_data[0], 0, 0); - shader_reset(); - - BLEND_NORMAL; - surface_reset_target(); + draw_surface_safe(_data[0]); + surface_reset_shader(); __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[5], _data[6]); diff --git a/scripts/node_dither/node_dither.gml b/scripts/node_dither/node_dither.gml index 9ad9a70bb..3d13f946a 100644 --- a/scripts/node_dither/node_dither.gml +++ b/scripts/node_dither/node_dither.gml @@ -1,22 +1,23 @@ function Node_Dither(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { - static dither2 = [ 0, 2, - 3, 1 ]; - static dither4 = [ 0, 8, 2, 10, - 12, 4, 14, 6, - 3, 11, 1, 9, - 15, 7, 13, 5]; - static dither8 = [ 0, 32, 8, 40, 2, 34, 10, 42, - 48, 16, 56, 24, 50, 18, 58, 26, - 12, 44, 4, 36, 14, 46, 6, 38, - 60, 28, 52, 20, 62, 30, 54, 22, - 3, 35, 11, 43, 1, 33, 9, 41, - 51, 19, 59, 27, 49, 17, 57, 25, - 15, 47, 7, 39, 13, 45, 5, 37, - 63, 31, 55, 23, 61, 29, 53, 21]; + static dither2 = [ 0, 2, + 3, 1 ]; + static dither4 = [ 0, 8, 2, 10, + 12, 4, 14, 6, + 3, 11, 1, 9, + 15, 7, 13, 5]; + static dither8 = [ 0, 32, 8, 40, 2, 34, 10, 42, + 48, 16, 56, 24, 50, 18, 58, 26, + 12, 44, 4, 36, 14, 46, 6, 38, + 60, 28, 52, 20, 62, 30, 54, 22, + 3, 35, 11, 43, 1, 33, 9, 41, + 51, 19, 59, 27, 49, 17, 57, 25, + 15, 47, 7, 39, 13, 45, 5, 37, + 63, 31, 55, 23, 61, 29, 53, 21]; name = "Dither"; inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 1] = nodeValue("Palette", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, DEF_PALETTE ) .setDisplay(VALUE_DISPLAY.palette); @@ -62,37 +63,30 @@ function Node_Dither(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co } #endregion static processData = function(_outSurf, _data, _output_index, _array_index) { - var _pal = _data[1]; - var _typ = _data[2]; - var _map = _data[3]; - var _con = _data[4]; + var _pal = _data[1]; + var _typ = _data[2]; + var _map = _data[3]; + var _con = _data[4]; var _conMap = _data[5]; + var _mode = _data[6]; - var _mode = _data[6]; - - var _colors = array_create(array_length(_pal) * 4); - for(var i = 0; i < array_length(_pal); i++) { - _colors[i * 4 + 0] = color_get_red(_pal[i]) / 255; - _colors[i * 4 + 1] = color_get_green(_pal[i]) / 255; - _colors[i * 4 + 2] = color_get_blue(_pal[i]) / 255; - _colors[i * 4 + 3] = 1; - } + var _colors = paletteToArray(_pal); shader = _mode? sh_alpha_hash : sh_dither; uniform_dither_size = shader_get_uniform(shader, "ditherSize"); uniform_dither = shader_get_uniform(shader, "dither"); - uniform_dim = shader_get_uniform(shader, "dimension"); - uniform_color = shader_get_uniform(shader, "palette"); - uniform_key = shader_get_uniform(shader, "keys"); + uniform_dim = shader_get_uniform(shader, "dimension"); + uniform_color = shader_get_uniform(shader, "palette"); + uniform_key = shader_get_uniform(shader, "keys"); uniform_constrast = shader_get_uniform(shader, "contrast"); uniform_con_map_use = shader_get_uniform(shader, "useConMap"); uniform_con_map = shader_get_sampler_index(shader, "conMap"); - - uniform_map_use = shader_get_uniform(shader, "useMap"); - uniform_map = shader_get_sampler_index(shader, "map"); - uniform_map_dim = shader_get_uniform(shader, "mapDimension"); + + uniform_map_use = shader_get_uniform(shader, "useMap"); + uniform_map = shader_get_sampler_index(shader, "map"); + uniform_map_dim = shader_get_uniform(shader, "mapDimension"); inputs[| 3].setVisible(_typ == 3); @@ -100,12 +94,7 @@ function Node_Dither(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co inputs[| 4].setVisible(_mode == 0); inputs[| 5].setVisible(_mode == 0); - surface_set_target(_outSurf); - DRAW_CLEAR - BLEND_OVERRIDE; - - shader_set(shader); - + surface_set_shader(_outSurf, shader); shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]) ] ); switch(_typ) { @@ -142,11 +131,8 @@ function Node_Dither(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co shader_set_uniform_i(uniform_key, array_length(_pal)); } - draw_surface_safe(_data[0], 0, 0); - shader_reset(); - - BLEND_NORMAL; - surface_reset_target(); + draw_surface_safe(_data[0]); + surface_reset_shader(); __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[7], _data[8]); diff --git a/scripts/node_find_pixel/node_find_pixel.gml b/scripts/node_find_pixel/node_find_pixel.gml index 9ed06d03c..8cb77a198 100644 --- a/scripts/node_find_pixel/node_find_pixel.gml +++ b/scripts/node_find_pixel/node_find_pixel.gml @@ -32,9 +32,9 @@ function Node_Find_Pixel(_x, _y, _group = noone) : Node_Processor(_x, _y, _group buffer_seek(_buff, buffer_seek_start, 0); var res = []; - var r = color_get_red(_col) / 255; - var g = color_get_green(_col) / 255; - var b = color_get_blue(_col) / 255; + var r = _color_get_red(_col); + var g = _color_get_green(_col); + var b = _color_get_blue(_col); for( var i = 0; i < _sh; i++ ) for( var j = 0; j < _sw; j++ ) { diff --git a/scripts/node_flood_fill/node_flood_fill.yy b/scripts/node_flood_fill/node_flood_fill.yy index a91c2751e..039698a71 100644 --- a/scripts/node_flood_fill/node_flood_fill.yy +++ b/scripts/node_flood_fill/node_flood_fill.yy @@ -5,7 +5,7 @@ "isCompatibility": false, "isDnD": false, "parent": { - "name": "generator", - "path": "folders/nodes/data/generator.yy", + "name": "regions", + "path": "folders/nodes/data/generator/regions.yy", }, } \ No newline at end of file diff --git a/scripts/node_gradient/node_gradient.gml b/scripts/node_gradient/node_gradient.gml index 18a2f2b88..a882c8298 100644 --- a/scripts/node_gradient/node_gradient.gml +++ b/scripts/node_gradient/node_gradient.gml @@ -4,7 +4,7 @@ function Node_Gradient(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF ) .setDisplay(VALUE_DISPLAY.vector); - inputs[| 1] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject([ cola(c_black), cola(c_white) ]) ); + inputs[| 1] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject([ c_black, c_white ]) ); inputs[| 2] = nodeValue("Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Linear", "Circular", "Radial" ]); diff --git a/scripts/node_image_animated/node_image_animated.gml b/scripts/node_image_animated/node_image_animated.gml index 09bb3a213..91997cc5c 100644 --- a/scripts/node_image_animated/node_image_animated.gml +++ b/scripts/node_image_animated/node_image_animated.gml @@ -72,7 +72,8 @@ function Node_Image_Animated(_x, _y, _group = noone) : Node(_x, _y, _group) cons input_display_list = [ ["Image", false], 0, 1, 8, - ["Animation", false], 5, 4, 6, 7, 2, 3, + ["Animation", false], 5, 4, 2, 3, + ["Custom Frame Order", false, 6], 7, ]; attribute_surface_depth(); @@ -152,7 +153,6 @@ function Node_Image_Animated(_x, _y, _group = noone) : Node(_x, _y, _group) cons var str = getInputData(2); var _cus = getInputData(6); - inputs[| 7].setVisible( _cus); inputs[| 2].setVisible(!_cus); inputs[| 3].setVisible(!_cus && !str); inputs[| 4].setVisible(!_cus && !str); diff --git a/scripts/node_image_gif/node_image_gif.gml b/scripts/node_image_gif/node_image_gif.gml index 183a0464e..8fafc94a9 100644 --- a/scripts/node_image_gif/node_image_gif.gml +++ b/scripts/node_image_gif/node_image_gif.gml @@ -60,7 +60,8 @@ function Node_Image_gif(_x, _y, _group = noone) : Node(_x, _y, _group) construct input_display_list = [ ["Image", false], 0, ["Output", false], 2, - ["Animation", false], 1, 3, 5, 4, 6, 7, + ["Animation", false], 1, 3, 4, 7, + ["Custom Frame Order", false, 5], 6, ]; attribute_surface_depth(); diff --git a/scripts/node_image_splice_sheet/node_image_splice_sheet.gml b/scripts/node_image_splice_sheet/node_image_splice_sheet.gml index b6ea6f3b3..17fd73894 100644 --- a/scripts/node_image_splice_sheet/node_image_splice_sheet.gml +++ b/scripts/node_image_splice_sheet/node_image_splice_sheet.gml @@ -68,7 +68,8 @@ function Node_Image_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) constru input_display_list = [ ["Sprite", false], 0, 1, 6, ["Sheet", false], 3, 10, 9, 4, 5, - ["Output", false], 7, 8, 12, 13, 14, 11 + ["Output", false], 7, 8, 11, + ["Filter Empty", true, 12], 13, 14, ]; outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); @@ -278,13 +279,11 @@ function Node_Image_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) constru static step = function() { #region var _out = getInputData(7); - var _filt = getInputData(12); var _flty = getInputData(13); inputs[| 11].setVisible(!_out); inputs[| 8].setVisible(!_out); - inputs[| 13].setVisible(_filt); - inputs[| 14].setVisible(_filt && _flty); + inputs[| 14].setVisible(_flty); } #endregion static spliceSprite = function() { #region diff --git a/scripts/node_level/node_level.gml b/scripts/node_level/node_level.gml index 50fa4d61e..28cee2187 100644 --- a/scripts/node_level/node_level.gml +++ b/scripts/node_level/node_level.gml @@ -1,18 +1,6 @@ function Node_Level(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { name = "Level"; - shader = sh_level; - uniform_wmin = shader_get_uniform(shader, "wmin"); - uniform_wmax = shader_get_uniform(shader, "wmax"); - uniform_rmin = shader_get_uniform(shader, "rmin"); - uniform_rmax = shader_get_uniform(shader, "rmax"); - uniform_gmin = shader_get_uniform(shader, "gmin"); - uniform_gmax = shader_get_uniform(shader, "gmax"); - uniform_bmin = shader_get_uniform(shader, "bmin"); - uniform_bmax = shader_get_uniform(shader, "bmax"); - uniform_amin = shader_get_uniform(shader, "amin"); - uniform_amax = shader_get_uniform(shader, "amax"); - inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 1] = nodeValue("White", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1]) @@ -117,27 +105,20 @@ function Node_Level(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con var _amin = min(_data[5][0], _data[5][1]); var _amax = max(_data[5][0], _data[5][1]); - surface_set_target(_outSurf); - DRAW_CLEAR - BLEND_OVERRIDE; - - shader_set(shader); - shader_set_uniform_f(uniform_wmin, _wmin); - shader_set_uniform_f(uniform_wmax, _wmax); - shader_set_uniform_f(uniform_rmin, _rmin); - shader_set_uniform_f(uniform_rmax, _rmax); - shader_set_uniform_f(uniform_gmin, _gmin); - shader_set_uniform_f(uniform_gmax, _gmax); - shader_set_uniform_f(uniform_bmin, _bmin); - shader_set_uniform_f(uniform_bmax, _bmax); - shader_set_uniform_f(uniform_amin, _amin); - shader_set_uniform_f(uniform_amax, _amax); + surface_set_shader(_outSurf, sh_level); + shader_set_f("wmin", _wmin); + shader_set_f("wmax", _wmax); + shader_set_f("rmin", _rmin); + shader_set_f("rmax", _rmax); + shader_set_f("gmin", _gmin); + shader_set_f("gmax", _gmax); + shader_set_f("bmin", _bmin); + shader_set_f("bmax", _bmax); + shader_set_f("amin", _amin); + shader_set_f("amax", _amax); - draw_surface_safe(_data[0], 0, 0); - shader_reset(); - - BLEND_NORMAL; - surface_reset_target(); + draw_surface_safe(_data[0]); + surface_reset_shader(); __process_mask_modifier(_data); _outSurf = mask_apply(_data[0], _outSurf, _data[6], _data[7]); diff --git a/scripts/node_line/node_line.gml b/scripts/node_line/node_line.gml index d6641e9c7..0c51e3b2a 100644 --- a/scripts/node_line/node_line.gml +++ b/scripts/node_line/node_line.gml @@ -305,14 +305,14 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons _pntData = points[pointAmo]; _pntData.x = _nx; _pntData.y = _ny; - _pntData.prog = _prog_total / _pathEnd; + _pntData.prog = (_prog_total - _pathStr) / (_pathEnd - _pathStr); _pntData.progCrop = _prog_curr / _pathLength; _pntData.weight = wght; } else { _pntData = { x: _nx, y: _ny, - prog: _prog_total / _pathEnd, + prog: (_prog_total - _pathStr) / (_pathEnd - _pathStr), progCrop: _prog_curr / _pathLength, weight: wght } diff --git a/scripts/node_outline/node_outline.gml b/scripts/node_outline/node_outline.gml index 500c33ba7..da2b6900d 100644 --- a/scripts/node_outline/node_outline.gml +++ b/scripts/node_outline/node_outline.gml @@ -54,17 +54,16 @@ function Node_Outline(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c input_display_list = [ 11, ["Surfaces", true], 0, 9, 10, 13, 14, ["Outline", false], 1, 15, 5, 8, 17, 12, - ["Render", false], 2, 3, 4, 16, 6, + ["Render", false], 2, 6, + ["Blend", true, 3], 4, 16, ]; attribute_surface_depth(); attribute_oversample(); static step = function() { #region - var blend = getInputData(3); var _side = getInputData(5); - inputs[| 4].setVisible(blend); inputs[| 12].setVisible(_side == 0); __step_mask_modifier(); diff --git a/scripts/node_palette_extract/node_palette_extract.gml b/scripts/node_palette_extract/node_palette_extract.gml index df8229134..2dcb2edfa 100644 --- a/scripts/node_palette_extract/node_palette_extract.gml +++ b/scripts/node_palette_extract/node_palette_extract.gml @@ -35,28 +35,28 @@ function Node_Palette_Extract(_x, _y, _group = noone) : Node_Processor(_x, _y, _ function sortPalette(pal) { #region array_sort(pal, function(c0, c1) { - var r0 = color_get_red(c0) / 255; - var r1 = color_get_red(c1) / 255; - var g0 = color_get_green(c0) / 255; - var g1 = color_get_green(c1) / 255; - var b0 = color_get_blue(c0) / 255; - var b1 = color_get_blue(c1) / 255; + var r0 = _color_get_red(c0); + var r1 = _color_get_red(c1); + var g0 = _color_get_green(c0); + var g1 = _color_get_green(c1); + var b0 = _color_get_blue(c0); + var b1 = _color_get_blue(c1); var l0 = sqrt( .241 * r0 + .691 * g0 + .068 * b0 ); var l1 = sqrt( .241 * r1 + .691 * g1 + .068 * b1 ); if(abs(l0 - l1) > 0.05) return l0 > l1; - var h0 = color_get_hue(c0) / 255; - var h1 = color_get_hue(c1) / 255; + var h0 = _color_get_hue(c0); + var h1 = _color_get_hue(c1); if(abs(h0 - h1) > 0.05) return h0 > h1; - var s0 = color_get_saturation(c0) / 255; - var s1 = color_get_saturation(c1) / 255; + var s0 = _color_get_saturation(c0); + var s1 = _color_get_saturation(c1); - var v0 = color_get_value(c0) / 255; - var v1 = color_get_value(c1) / 255; + var v0 = _color_get_value(c0); + var v1 = _color_get_value(c1); return s0 * v0 > s1 * v1; }) @@ -91,9 +91,9 @@ function Node_Palette_Extract(_x, _y, _group = noone) : Node_Processor(_x, _y, _ if(a == 0) continue; switch(_space) { - case 0 : col = [ color_get_red(c) / 255, color_get_green(c) / 255, color_get_blue(c) / 255, 0 ]; break; - case 1 : col = [ color_get_hue(c) / 255, color_get_saturation(c) / 255, color_get_value(c) / 255, 0 ]; break; - case 2 : col = [ color_get_hue(c) / 255, color_get_saturation(c) / 255, color_get_value(c) / 255, 0 ]; break; + case 0 : col = [ _color_get_red(c), _color_get_green(c), _color_get_blue(c), 0 ]; break; + case 1 : col = [ _color_get_hue(c), _color_get_saturation(c), _color_get_value(c), 0 ]; break; + case 2 : col = [ _color_get_hue(c), _color_get_saturation(c), _color_get_value(c), 0 ]; break; } array_push(colors, col); diff --git a/scripts/node_posterize/node_posterize.gml b/scripts/node_posterize/node_posterize.gml index 7950e4d74..c2df0f1f2 100644 --- a/scripts/node_posterize/node_posterize.gml +++ b/scripts/node_posterize/node_posterize.gml @@ -26,9 +26,9 @@ function Node_Posterize(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) ////////////////////////////////////////////////////////////////////////////////////////////////// - input_display_list = [ 5, - ["Effect settings", false], 0, 2, 1, 6, - ["Auto color", false], 3, 4, 7, + input_display_list = [ 5, 0, + ["Palette", false, 2], 1, 3, 4, 7, + ["Alpha", false, 6], ]; outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); @@ -50,13 +50,7 @@ function Node_Posterize(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) var _alp = _data[6]; if(_use_gra) { - var _colors = array_create(array_length(_gra) * 4); - for(var i = 0; i < array_length(_gra); i++) { - _colors[i * 4 + 0] = _color_get_red(_gra[i]); - _colors[i * 4 + 1] = _color_get_green(_gra[i]); - _colors[i * 4 + 2] = _color_get_blue(_gra[i]); - _colors[i * 4 + 3] = _color_get_alpha(_gra[i]); - } + var _colors = paletteToArray(_gra); surface_set_shader(_outSurf, sh_posterize_palette); shader_set_f("palette", _colors); diff --git a/scripts/node_region_fill/node_region_fill.gml b/scripts/node_region_fill/node_region_fill.gml index 84a4a94a9..f4ad382e0 100644 --- a/scripts/node_region_fill/node_region_fill.gml +++ b/scripts/node_region_fill/node_region_fill.gml @@ -16,17 +16,12 @@ function Node_Region_Fill(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou input_display_list = [ ["Surfaces", false], 0, 1, - ["Fill", false], 3, 4, 2, + ["Fill", false, 3], 4, 2, ]; temp_surface = [ surface_create(1, 1), surface_create(1, 1) ]; - static step = function() { - var _fill = getInputData(3); - - inputs[| 2].setVisible(_fill); - inputs[| 4].setVisible(_fill); - } + static step = function() {} static processData = function(_outSurf, _data, _output_index, _array_index) { var _surf = _data[0]; diff --git a/scripts/node_region_fill/node_region_fill.yy b/scripts/node_region_fill/node_region_fill.yy index f11f91190..0e6c419fb 100644 --- a/scripts/node_region_fill/node_region_fill.yy +++ b/scripts/node_region_fill/node_region_fill.yy @@ -5,7 +5,7 @@ "isCompatibility": false, "isDnD": false, "parent": { - "name": "generator", - "path": "folders/nodes/data/generator.yy", + "name": "regions", + "path": "folders/nodes/data/generator/regions.yy", }, } \ No newline at end of file diff --git a/scripts/node_scatter_points/node_scatter_points.gml b/scripts/node_scatter_points/node_scatter_points.gml index 3c2c47e40..3603b80e4 100644 --- a/scripts/node_scatter_points/node_scatter_points.gml +++ b/scripts/node_scatter_points/node_scatter_points.gml @@ -42,7 +42,7 @@ function Node_Scatter_Points(_x, _y, _group = noone) : Node(_x, _y, _group) cons input_display_list = [ ["Base", false], 5, 6, 7, ["Scatter", false], 0, 1, 4, 2, 3, - ["3D", true], 9, 10, 11 + ["3D", true, 9], 10, 11 ]; outputs[| 0] = nodeValue("Points", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [ ]) diff --git a/scripts/node_shadow_cast/node_shadow_cast.gml b/scripts/node_shadow_cast/node_shadow_cast.gml index 68ea902e4..ad1eb5ad6 100644 --- a/scripts/node_shadow_cast/node_shadow_cast.gml +++ b/scripts/node_shadow_cast/node_shadow_cast.gml @@ -1,31 +1,6 @@ function Node_Shadow_Cast(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { name = "Cast Shadow"; - shader = sh_shadow_cast; - uniform_dim = shader_get_uniform(shader, "dimension"); - uniform_lpos = shader_get_uniform(shader, "lightPos"); - uniform_prad = shader_get_uniform(shader, "pointLightRadius"); - uniform_lrad = shader_get_uniform(shader, "lightRadius"); - uniform_lden = shader_get_uniform(shader, "lightDensity"); - uniform_ltyp = shader_get_uniform(shader, "lightType"); - uniform_lamb = shader_get_uniform(shader, "lightAmb"); - uniform_lclr = shader_get_uniform(shader, "lightClr"); - uniform_lint = shader_get_uniform(shader, "lightInt"); - uniform_sol = shader_get_uniform(shader, "renderSolid"); - - uniform_band = shader_get_uniform(shader, "lightBand"); - uniform_attn = shader_get_uniform(shader, "lightAttn"); - - uniform_ao = shader_get_uniform(shader, "ao"); - uniform_ao_str = shader_get_uniform(shader, "aoStr"); - - uniform_bg_use = shader_get_uniform(shader, "bgUse"); - uniform_bg_thr = shader_get_uniform(shader, "bgThres"); - uniform_mask = shader_get_uniform(shader, "mask"); - - uniform_sld_use = shader_get_uniform(shader, "useSolid"); - uniform_solid = shader_get_sampler_index(shader, "solid"); - inputs[| 0] = nodeValue("Background", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 1] = nodeValue("Solid", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); @@ -91,10 +66,11 @@ function Node_Shadow_Cast(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou outputs[| 1] = nodeValue("Light mask", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ 17, - ["Surfaces", true], 0, 1, - ["Light", false], 5, 12, 8, 2, 3, 4, - ["Shadow caster", false], 10, 11, - ["Render", false], 13, 14, 7, 6, 9, 15, 16, + ["Surfaces", true], 0, 1, + ["Light", false], 5, 12, 8, 2, 3, 4, + ["BG Shadow Caster", true, 10], 11, + ["Render", false], 13, 14, 7, 6, 9, + ["Ambient Occlusion", false], 15, 16, ]; attribute_surface_depth(); @@ -137,40 +113,32 @@ function Node_Shadow_Cast(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou inputs[| 11].setVisible(_bg_use); if(!is_surface(_bg)) return _outSurf; - - surface_set_target(_outSurf); - DRAW_CLEAR - BLEND_OVERRIDE; - - shader_set(shader); - shader_set_uniform_f(uniform_dim, surface_get_width_safe(_bg), surface_get_height_safe(_bg)); - shader_set_uniform_f_array_safe(uniform_lpos, _pos); - shader_set_uniform_f_array_safe(uniform_lamb, colToVec4(_lamb)); - shader_set_uniform_f_array_safe(uniform_lclr, colToVec4(_lclr)); - shader_set_uniform_f(uniform_lrad, _rad); - shader_set_uniform_f(uniform_prad, _lrad); - shader_set_uniform_f(uniform_lden, _den); - shader_set_uniform_i(uniform_ltyp, _type); - shader_set_uniform_i(uniform_sol, _sol); - shader_set_uniform_f(uniform_lint, _int); - shader_set_uniform_f(uniform_band, _band); - shader_set_uniform_f(uniform_attn, _attn); - shader_set_uniform_f(uniform_ao, _ao); - shader_set_uniform_f(uniform_ao_str, _ao_str); + + surface_set_shader(_outSurf, sh_shadow_cast); + shader_set_f("dimension", surface_get_width_safe(_bg), surface_get_height_safe(_bg)); + shader_set_f("lightPos", _pos); + shader_set_color("lightAmb", _lamb); + shader_set_color("lightClr", _lclr); + shader_set_f("lightRadius", _rad); + shader_set_f("pointLightRadius", _lrad); + shader_set_f("lightDensity", _den); + shader_set_i("lightType", _type); + shader_set_i("renderSolid", _sol); + shader_set_f("lightInt", _int); + shader_set_f("lightBand", _band); + shader_set_f("lightAttn", _attn); + shader_set_f("ao", _ao); + shader_set_f("aoStr", _ao_str); - shader_set_uniform_i(uniform_mask, _output_index); - shader_set_uniform_i(uniform_bg_use, _bg_use); - shader_set_uniform_f(uniform_bg_thr, _bg_thr); + shader_set_i("mask", _output_index); + shader_set_i("bgUse", _bg_use); + shader_set_f("bgThres", _bg_thr); - shader_set_uniform_i(uniform_sld_use, is_surface(_solid)); - if(is_surface(_solid)) - texture_set_stage(uniform_solid, surface_get_texture(_solid)); + shader_set_i("useSolid", is_surface(_solid)); + shader_set_surface("solid", _solid); - draw_surface_safe(_bg, 0, 0); - shader_reset(); - - BLEND_NORMAL; - surface_reset_target(); + draw_surface_safe(_bg); + surface_reset_shader(); return _outSurf; } diff --git a/scripts/node_stack/node_stack.gml b/scripts/node_stack/node_stack.gml index c7f8d9bc8..8cbf8391e 100644 --- a/scripts/node_stack/node_stack.gml +++ b/scripts/node_stack/node_stack.gml @@ -1,5 +1,5 @@ function Node_Stack(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { - name = "Stack"; + name = "Stack"; inputs[| 0] = nodeValue("Axis", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Horizontal", "Vertical", "On top" ]) diff --git a/scripts/node_stripe/node_stripe.gml b/scripts/node_stripe/node_stripe.gml index 4b69d2b1e..44ca262a2 100644 --- a/scripts/node_stripe/node_stripe.gml +++ b/scripts/node_stripe/node_stripe.gml @@ -51,7 +51,8 @@ function Node_Stripe(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co input_display_list = [ ["Output", true], 0, ["Pattern", false], 1, 11, 10, 14, 2, 12, 4, 5, 13, - ["Render", false], 6, 7, 8, 9, 3 + ["Render", false], 3, + ["Random Colors", false, 6], 7, 8, 9, ]; attribute_surface_depth(); diff --git a/scripts/node_surface_data/node_surface_data.yy b/scripts/node_surface_data/node_surface_data.yy index 472e4c629..01fa45cd7 100644 --- a/scripts/node_surface_data/node_surface_data.yy +++ b/scripts/node_surface_data/node_surface_data.yy @@ -5,7 +5,7 @@ "isCompatibility": false, "isDnD": false, "parent": { - "name": "value", - "path": "folders/nodes/data/value.yy", + "name": "surface", + "path": "folders/nodes/data/value/surface.yy", }, } \ No newline at end of file diff --git a/scripts/node_threshold/node_threshold.gml b/scripts/node_threshold/node_threshold.gml index ac6342f10..91a45371b 100644 --- a/scripts/node_threshold/node_threshold.gml +++ b/scripts/node_threshold/node_threshold.gml @@ -46,20 +46,13 @@ function Node_Threshold(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) input_display_list = [ 6, 10, ["Surfaces", true], 0, 4, 5, 11, 12, - ["Threshold", false], 1, 2, 13, 3, 7, 8, 14, 9, + ["Brightness", true, 1], 2, 13, 3, + ["Alpha", true, 7], 8, 14, 9, ]; attribute_surface_depth(); static step = function() { #region - var _bright = getInputData(1); - inputs[| 2].setVisible(_bright); - inputs[| 3].setVisible(_bright); - - var _alpha = getInputData(7); - inputs[| 8].setVisible(_alpha); - inputs[| 9].setVisible(_alpha); - __step_mask_modifier(); inputs[| 2].mappableStep(); diff --git a/scripts/node_trail/node_trail.gml b/scripts/node_trail/node_trail.gml index 0e0162032..735c1c004 100644 --- a/scripts/node_trail/node_trail.gml +++ b/scripts/node_trail/node_trail.gml @@ -122,14 +122,14 @@ function Node_Trail(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { shader_set_f("alphaPrev", a0); shader_set_f("alphaCurr", a1); - shader_set_i("mode", 1); surface_set_target(temp_surface[0]); - draw_surface_safe(_currFrame); + shader_set_i("mode", 1); + draw_surface_safe(_currFrame); surface_reset_target(); - shader_set_i("mode", 0); surface_set_target(temp_surface[2]); - draw_surface_safe(_currFrame); + shader_set_i("mode", 0); + draw_surface_safe(_currFrame); surface_reset_target(); shader_reset(); @@ -138,16 +138,16 @@ function Node_Trail(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { surface_set_target(temp_surface[1]); shader_set(sh_trail_filler_pass2); shader_set_dim("dimension", _surf); - draw_surface_safe(temp_surface[0], 0, 0); + draw_surface_safe(temp_surface[0]); shader_reset(); surface_reset_target(); surface_set_shader(_outUV); - draw_surface_safe(temp_surface[1], 0, 0); + draw_surface_safe(temp_surface[1]); surface_reset_shader(); surface_set_shader(_outSurf); - draw_surface_safe(temp_surface[2], 0, 0); + draw_surface_safe(temp_surface[2]); surface_reset_shader(); } diff --git a/scripts/palette_functions/palette_functions.gml b/scripts/palette_functions/palette_functions.gml index 110d525c5..68b89badf 100644 --- a/scripts/palette_functions/palette_functions.gml +++ b/scripts/palette_functions/palette_functions.gml @@ -45,22 +45,32 @@ function loadPalette(path) { #region while(!file_text_eof(_t)) { var _w = file_text_readln(_t); + _w = string_trim(_w); + _w = string_replace_all(_w, "\t", " "); if(_w == "") continue; - + switch(ext) { case ".hex" : var _r = string_hexadecimal(string_copy(_w, 1, 2)); var _g = string_hexadecimal(string_copy(_w, 3, 2)); var _b = string_hexadecimal(string_copy(_w, 5, 2)); - - pal[_index++] = make_color_rgb(_r, _g, _b); + + if(string_length(_w) > 6) { + var _a = string_hexadecimal(string_copy(_w, 7, 2)); + pal[_index++] = make_color_rgba(_r, _g, _b, _a); + } else + pal[_index++] = make_color_rgb(_r, _g, _b); break; case ".gpl" : case ".pal" : if(string_char_at(_w, 1) == "#") break; - var _c = string_splice(_w, " "); - if(array_length(_c) >= 3) + var _c = string_splice(_w, " ", false); + _c = array_filter(_c, function(s) { return s != ""; }); + + if(array_length(_c) == 3) pal[_index++] = make_color_rgb(toNumber(_c[0]), toNumber(_c[1]), toNumber(_c[2])); + else if(array_length(_c) >= 4) + pal[_index++] = make_color_rgba(toNumber(_c[0]), toNumber(_c[1]), toNumber(_c[2]), toNumber(_c[3])); break; } } diff --git a/scripts/string_splice/string_splice.gml b/scripts/string_splice/string_splice.gml index 592776df7..c9f63f7cc 100644 --- a/scripts/string_splice/string_splice.gml +++ b/scripts/string_splice/string_splice.gml @@ -1,4 +1,4 @@ -function string_splice(str, delim = " ", keep = false) { +function string_splice(str, delim = " ", keep = false, empty = true) { var st = []; var ss = str; var sp; @@ -16,11 +16,11 @@ function string_splice(str, delim = " ", keep = false) { } if(!found) { //no delim left - array_push(st, ss); + if(empty || string_length(ss)) array_push(st, ss); break; } else { var _ss = string_copy(ss, 1, keep? sp : sp - 1); - array_push(st, _ss); + if(empty || string_length(ss)) array_push(st, _ss); } ss = string_copy(ss, sp + 1, string_length(ss) - sp); diff --git a/shaders/sh_gradient/sh_gradient.fsh b/shaders/sh_gradient/sh_gradient.fsh index 977609aff..ce69cda1f 100644 --- a/shaders/sh_gradient/sh_gradient.fsh +++ b/shaders/sh_gradient/sh_gradient.fsh @@ -159,6 +159,5 @@ void main() { } vec4 col = gradientEval(prog); - - gl_FragColor = vec4(col.rgb, texture2D( gm_BaseTexture, v_vTexcoord ).a); + gl_FragColor = vec4(col.rgb, col.a * texture2D( gm_BaseTexture, v_vTexcoord ).a); } diff --git a/shaders/sh_gradient_display/sh_gradient_display.fsh b/shaders/sh_gradient_display/sh_gradient_display.fsh index 5bff77832..3c9bab93e 100644 --- a/shaders/sh_gradient_display/sh_gradient_display.fsh +++ b/shaders/sh_gradient_display/sh_gradient_display.fsh @@ -79,5 +79,6 @@ vec4 gradientEval(in float prog) { } void main() { - gl_FragColor = gradientEval(v_vTexcoord.x); + vec4 col = gradientEval(v_vTexcoord.x); + gl_FragColor = vec4(col.rgb, 1.); } diff --git a/shaders/sh_interpret_number/sh_interpret_number.fsh b/shaders/sh_interpret_number/sh_interpret_number.fsh index 211fc92dd..675c148d0 100644 --- a/shaders/sh_interpret_number/sh_interpret_number.fsh +++ b/shaders/sh_interpret_number/sh_interpret_number.fsh @@ -89,10 +89,9 @@ void main() { gl_FragColor = vec4(0.); - if(mode == 0) { + if(mode == 0) gl_FragColor = vec4(vec3(grey), 1.); - } else if(mode == 1) { - vec4 color = gradientEval(grey); - gl_FragColor = color; - } + else if(mode == 1) + gl_FragColor = gradientEval(grey); + } diff --git a/shaders/sh_pixel_cloud/sh_pixel_cloud.fsh b/shaders/sh_pixel_cloud/sh_pixel_cloud.fsh index 8c9df1c5c..75df0969e 100644 --- a/shaders/sh_pixel_cloud/sh_pixel_cloud.fsh +++ b/shaders/sh_pixel_cloud/sh_pixel_cloud.fsh @@ -197,8 +197,9 @@ void main() { if(_new_pos.x >= 0. && _new_pos.x <= 1. && _new_pos.y >= 0. && _new_pos.y <= 1.) { _col = texture2D( gm_BaseTexture, _new_pos ); - _col.rgb *= gradientEval(str + frandom(_pos, 1.235) * randomAmount).rgb; - _col.a *= curveEval(str + frandom(_pos, 2.984) * randomAmount); + vec4 cc = gradientEval(str + frandom(_pos, 1.235) * randomAmount); + _col.rgb *= cc.rgb; + _col.a *= cc.a * curveEval(str + frandom(_pos, 2.984) * randomAmount); } gl_FragColor = _col;