diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 9c74f2d7b..4e4b83a20 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -337,6 +337,7 @@ {"name":"node_rigid_activation","order":7,"path":"scripts/node_rigid_activation/node_rigid_activation.yy",}, {"name":"s_node_image_gif","order":4,"path":"sprites/s_node_image_gif/s_node_image_gif.yy",}, {"name":"node_VFX_effect_wind","order":7,"path":"scripts/node_VFX_effect_wind/node_VFX_effect_wind.yy",}, + {"name":"node_shape_map","order":7,"path":"scripts/node_shape_map/node_shape_map.yy",}, {"name":"s_node_tunnel_out","order":22,"path":"sprites/s_node_tunnel_out/s_node_tunnel_out.yy",}, {"name":"__background_set_element","order":3,"path":"scripts/__background_set_element/__background_set_element.yy",}, {"name":"s_node_3d_obj","order":3,"path":"sprites/s_node_3d_obj/s_node_3d_obj.yy",}, @@ -498,6 +499,7 @@ {"name":"s_node_fluidSim_domain","order":6,"path":"sprites/s_node_fluidSim_domain/s_node_fluidSim_domain.yy",}, {"name":"s_node_displace","order":17,"path":"sprites/s_node_displace/s_node_displace.yy",}, {"name":"sh_region_fill_map","order":4,"path":"shaders/sh_region_fill_map/sh_region_fill_map.yy",}, + {"name":"sh_region_fill_rg_map","order":7,"path":"shaders/sh_region_fill_rg_map/sh_region_fill_rg_map.yy",}, {"name":"sh_polar","order":1,"path":"shaders/sh_polar/sh_polar.yy",}, {"name":"s_node_warp_mesh","order":10,"path":"sprites/s_node_warp_mesh/s_node_warp_mesh.yy",}, {"name":"sh_pixel_cloud","order":4,"path":"shaders/sh_pixel_cloud/sh_pixel_cloud.yy",}, @@ -549,6 +551,7 @@ {"name":"__node_3d_object","order":4,"path":"scripts/__node_3d_object/__node_3d_object.yy",}, {"name":"s_node_pixel_find","order":13,"path":"sprites/s_node_pixel_find/s_node_pixel_find.yy",}, {"name":"s_biterator_canvas_cover","order":16,"path":"sprites/s_biterator_canvas_cover/s_biterator_canvas_cover.yy",}, + {"name":"s_node_profile","order":47,"path":"sprites/s_node_profile/s_node_profile.yy",}, {"name":"sh_noise_grid_tri","order":3,"path":"shaders/sh_noise_grid_tri/sh_noise_grid_tri.yy",}, {"name":"globals","order":2,"path":"scripts/globals/globals.yy",}, {"name":"s_node_noise_perlin","order":11,"path":"sprites/s_node_noise_perlin/s_node_noise_perlin.yy",}, @@ -614,6 +617,7 @@ {"name":"s_node_pb_draw_ellipse","order":15,"path":"sprites/s_node_pb_draw_ellipse/s_node_pb_draw_ellipse.yy",}, {"name":"text_file","order":5,"path":"scripts/text_file/text_file.yy",}, {"name":"node_armature_pose","order":3,"path":"scripts/node_armature_pose/node_armature_pose.yy",}, + {"name":"sh_region_fill_inner_remove","order":8,"path":"shaders/sh_region_fill_inner_remove/sh_region_fill_inner_remove.yy",}, {"name":"s_node_pb_draw_diamond","order":29,"path":"sprites/s_node_pb_draw_diamond/s_node_pb_draw_diamond.yy",}, {"name":"node_3d_transform_scene","order":4,"path":"scripts/node_3d_transform_scene/node_3d_transform_scene.yy",}, {"name":"sh_trail_filler_pass1","order":29,"path":"shaders/sh_trail_filler_pass1/sh_trail_filler_pass1.yy",}, @@ -1058,6 +1062,7 @@ {"name":"Obj_FirebaseFirestore_Collection_Query_options_value_path","order":12,"path":"objects/Obj_FirebaseFirestore_Collection_Query_options_value_path/Obj_FirebaseFirestore_Collection_Query_options_value_path.yy",}, {"name":"sh_posterize","order":10,"path":"shaders/sh_posterize/sh_posterize.yy",}, {"name":"s_node_mirror","order":3,"path":"sprites/s_node_mirror/s_node_mirror.yy",}, + {"name":"s_node_shape_map","order":21,"path":"sprites/s_node_shape_map/s_node_shape_map.yy",}, {"name":"s_node_stagger","order":6,"path":"sprites/s_node_stagger/s_node_stagger.yy",}, {"name":"s_node_blur_simple","order":3,"path":"sprites/s_node_blur_simple/s_node_blur_simple.yy",}, {"name":"theme_definition","order":14,"path":"scripts/theme_definition/theme_definition.yy",}, @@ -1108,6 +1113,7 @@ {"name":"ase_object","order":7,"path":"scripts/ase_object/ase_object.yy",}, {"name":"node_rigid_object","order":1,"path":"scripts/node_rigid_object/node_rigid_object.yy",}, {"name":"__node_template","order":17,"path":"scripts/__node_template/__node_template.yy",}, + {"name":"sh_shape_map_polygon","order":15,"path":"shaders/sh_shape_map_polygon/sh_shape_map_polygon.yy",}, {"name":"node_reaction_diffusion","order":25,"path":"scripts/node_reaction_diffusion/node_reaction_diffusion.yy",}, {"name":"node_pb_box_transform","order":9,"path":"scripts/node_pb_box_transform/node_pb_box_transform.yy",}, {"name":"areaBox","order":13,"path":"scripts/areaBox/areaBox.yy",}, @@ -1205,7 +1211,9 @@ {"name":"s_node_hlsl","order":32,"path":"sprites/s_node_hlsl/s_node_hlsl.yy",}, {"name":"sh_outline","order":9,"path":"shaders/sh_outline/sh_outline.yy",}, {"name":"s_node_strandSim_break","order":8,"path":"sprites/s_node_strandSim_break/s_node_strandSim_break.yy",}, + {"name":"console_commands","order":45,"path":"scripts/console_commands/console_commands.yy",}, {"name":"s_node_scatter_point","order":4,"path":"sprites/s_node_scatter_point/s_node_scatter_point.yy",}, + {"name":"node_path_profile","order":10,"path":"scripts/node_path_profile/node_path_profile.yy",}, {"name":"Obj_FirebaseFirestore_Collection_Query_NotEqual","order":9,"path":"objects/Obj_FirebaseFirestore_Collection_Query_NotEqual/Obj_FirebaseFirestore_Collection_Query_NotEqual.yy",}, {"name":"node_gradient_output","order":5,"path":"scripts/node_gradient_output/node_gradient_output.yy",}, {"name":"display_refresh","order":17,"path":"scripts/display_refresh/display_refresh.yy",}, @@ -1879,6 +1887,7 @@ {"name":"node_pb","order":5,"path":"scripts/node_pb/node_pb.yy",}, {"name":"panel_test","order":10,"path":"scripts/panel_test/panel_test.yy",}, {"name":"o_dialog_warning","order":10,"path":"objects/o_dialog_warning/o_dialog_warning.yy",}, + {"name":"sh_shape_map_circle","order":14,"path":"shaders/sh_shape_map_circle/sh_shape_map_circle.yy",}, {"name":"s_node_group_output","order":15,"path":"sprites/s_node_group_output/s_node_group_output.yy",}, {"name":"node_path_l_system","order":10,"path":"scripts/node_path_l_system/node_path_l_system.yy",}, {"name":"panel_gradient","order":2,"path":"scripts/panel_gradient/panel_gradient.yy",}, @@ -1898,6 +1907,7 @@ {"name":"hotkey_data","order":16,"path":"scripts/hotkey_data/hotkey_data.yy",}, {"name":"s_node_group_input","order":16,"path":"sprites/s_node_group_input/s_node_group_input.yy",}, {"name":"sample_projects","order":6,"path":"scripts/sample_projects/sample_projects.yy",}, + {"name":"sh_region_fill_coordinate_init","order":6,"path":"shaders/sh_region_fill_coordinate_init/sh_region_fill_coordinate_init.yy",}, {"name":"__matrix3","order":5,"path":"scripts/__matrix3/__matrix3.yy",}, {"name":"sh_blink_replace","order":1,"path":"shaders/sh_blink_replace/sh_blink_replace.yy",}, {"name":"draw_fit","order":11,"path":"scripts/draw_fit/draw_fit.yy",}, @@ -1997,6 +2007,7 @@ {"name":"debug","order":10,"path":"scripts/debug/debug.yy",}, {"name":"node_shadow_cast","order":14,"path":"scripts/node_shadow_cast/node_shadow_cast.yy",}, {"name":"node_strand_render","order":5,"path":"scripts/node_strand_render/node_strand_render.yy",}, + {"name":"sh_path_fill_profile","order":24,"path":"shaders/sh_path_fill_profile/sh_path_fill_profile.yy",}, {"name":"s_node_3d_obj_combine","order":5,"path":"sprites/s_node_3d_obj_combine/s_node_3d_obj_combine.yy",}, {"name":"s_node_wav_file_read","order":16,"path":"sprites/s_node_wav_file_read/s_node_wav_file_read.yy",}, {"name":"o_dialog_assetbox","order":4,"path":"objects/o_dialog_assetbox/o_dialog_assetbox.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index b45467c1d..e6b393d99 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -535,6 +535,7 @@ {"id":{"name":"s_node_color","path":"sprites/s_node_color/s_node_color.yy",},}, {"id":{"name":"s_node_image_gif","path":"sprites/s_node_image_gif/s_node_image_gif.yy",},}, {"id":{"name":"node_VFX_effect_wind","path":"scripts/node_VFX_effect_wind/node_VFX_effect_wind.yy",},}, + {"id":{"name":"node_shape_map","path":"scripts/node_shape_map/node_shape_map.yy",},}, {"id":{"name":"s_node_tunnel_out","path":"sprites/s_node_tunnel_out/s_node_tunnel_out.yy",},}, {"id":{"name":"__background_set_element","path":"scripts/__background_set_element/__background_set_element.yy",},}, {"id":{"name":"s_node_3d_obj","path":"sprites/s_node_3d_obj/s_node_3d_obj.yy",},}, @@ -720,6 +721,7 @@ {"id":{"name":"s_node_fluidSim_domain","path":"sprites/s_node_fluidSim_domain/s_node_fluidSim_domain.yy",},}, {"id":{"name":"s_node_displace","path":"sprites/s_node_displace/s_node_displace.yy",},}, {"id":{"name":"sh_region_fill_map","path":"shaders/sh_region_fill_map/sh_region_fill_map.yy",},}, + {"id":{"name":"sh_region_fill_rg_map","path":"shaders/sh_region_fill_rg_map/sh_region_fill_rg_map.yy",},}, {"id":{"name":"sh_polar","path":"shaders/sh_polar/sh_polar.yy",},}, {"id":{"name":"s_node_warp_mesh","path":"sprites/s_node_warp_mesh/s_node_warp_mesh.yy",},}, {"id":{"name":"sh_pixel_cloud","path":"shaders/sh_pixel_cloud/sh_pixel_cloud.yy",},}, @@ -776,6 +778,7 @@ {"id":{"name":"__node_3d_object","path":"scripts/__node_3d_object/__node_3d_object.yy",},}, {"id":{"name":"s_node_pixel_find","path":"sprites/s_node_pixel_find/s_node_pixel_find.yy",},}, {"id":{"name":"s_biterator_canvas_cover","path":"sprites/s_biterator_canvas_cover/s_biterator_canvas_cover.yy",},}, + {"id":{"name":"s_node_profile","path":"sprites/s_node_profile/s_node_profile.yy",},}, {"id":{"name":"sh_noise_grid_tri","path":"shaders/sh_noise_grid_tri/sh_noise_grid_tri.yy",},}, {"id":{"name":"globals","path":"scripts/globals/globals.yy",},}, {"id":{"name":"s_node_noise_perlin","path":"sprites/s_node_noise_perlin/s_node_noise_perlin.yy",},}, @@ -851,6 +854,7 @@ {"id":{"name":"s_node_pb_draw_ellipse","path":"sprites/s_node_pb_draw_ellipse/s_node_pb_draw_ellipse.yy",},}, {"id":{"name":"text_file","path":"scripts/text_file/text_file.yy",},}, {"id":{"name":"node_armature_pose","path":"scripts/node_armature_pose/node_armature_pose.yy",},}, + {"id":{"name":"sh_region_fill_inner_remove","path":"shaders/sh_region_fill_inner_remove/sh_region_fill_inner_remove.yy",},}, {"id":{"name":"s_node_pb_draw_diamond","path":"sprites/s_node_pb_draw_diamond/s_node_pb_draw_diamond.yy",},}, {"id":{"name":"node_3d_transform_scene","path":"scripts/node_3d_transform_scene/node_3d_transform_scene.yy",},}, {"id":{"name":"sh_trail_filler_pass1","path":"shaders/sh_trail_filler_pass1/sh_trail_filler_pass1.yy",},}, @@ -1355,6 +1359,7 @@ {"id":{"name":"Obj_FirebaseFirestore_Collection_Query_options_value_path","path":"objects/Obj_FirebaseFirestore_Collection_Query_options_value_path/Obj_FirebaseFirestore_Collection_Query_options_value_path.yy",},}, {"id":{"name":"sh_posterize","path":"shaders/sh_posterize/sh_posterize.yy",},}, {"id":{"name":"s_node_mirror","path":"sprites/s_node_mirror/s_node_mirror.yy",},}, + {"id":{"name":"s_node_shape_map","path":"sprites/s_node_shape_map/s_node_shape_map.yy",},}, {"id":{"name":"draw_enable_alphablend","path":"scripts/draw_enable_alphablend/draw_enable_alphablend.yy",},}, {"id":{"name":"s_node_stagger","path":"sprites/s_node_stagger/s_node_stagger.yy",},}, {"id":{"name":"s_node_blur_simple","path":"sprites/s_node_blur_simple/s_node_blur_simple.yy",},}, @@ -1414,6 +1419,7 @@ {"id":{"name":"ase_object","path":"scripts/ase_object/ase_object.yy",},}, {"id":{"name":"node_rigid_object","path":"scripts/node_rigid_object/node_rigid_object.yy",},}, {"id":{"name":"__node_template","path":"scripts/__node_template/__node_template.yy",},}, + {"id":{"name":"sh_shape_map_polygon","path":"shaders/sh_shape_map_polygon/sh_shape_map_polygon.yy",},}, {"id":{"name":"node_reaction_diffusion","path":"scripts/node_reaction_diffusion/node_reaction_diffusion.yy",},}, {"id":{"name":"node_pb_box_transform","path":"scripts/node_pb_box_transform/node_pb_box_transform.yy",},}, {"id":{"name":"areaBox","path":"scripts/areaBox/areaBox.yy",},}, @@ -1519,8 +1525,10 @@ {"id":{"name":"sh_outline","path":"shaders/sh_outline/sh_outline.yy",},}, {"id":{"name":"node_mk_flare","path":"scripts/node_mk_flare/node_mk_flare.yy",},}, {"id":{"name":"s_node_strandSim_break","path":"sprites/s_node_strandSim_break/s_node_strandSim_break.yy",},}, + {"id":{"name":"console_commands","path":"scripts/console_commands/console_commands.yy",},}, {"id":{"name":"s_node_scatter_point","path":"sprites/s_node_scatter_point/s_node_scatter_point.yy",},}, {"id":{"name":"node_checkerboard","path":"scripts/node_checkerboard/node_checkerboard.yy",},}, + {"id":{"name":"node_path_profile","path":"scripts/node_path_profile/node_path_profile.yy",},}, {"id":{"name":"Obj_FirebaseFirestore_Collection_Query_NotEqual","path":"objects/Obj_FirebaseFirestore_Collection_Query_NotEqual/Obj_FirebaseFirestore_Collection_Query_NotEqual.yy",},}, {"id":{"name":"node_gradient_output","path":"scripts/node_gradient_output/node_gradient_output.yy",},}, {"id":{"name":"display_refresh","path":"scripts/display_refresh/display_refresh.yy",},}, @@ -2296,6 +2304,7 @@ {"id":{"name":"panel_test","path":"scripts/panel_test/panel_test.yy",},}, {"id":{"name":"panel_collections_settings","path":"scripts/panel_collections_settings/panel_collections_settings.yy",},}, {"id":{"name":"o_dialog_warning","path":"objects/o_dialog_warning/o_dialog_warning.yy",},}, + {"id":{"name":"sh_shape_map_circle","path":"shaders/sh_shape_map_circle/sh_shape_map_circle.yy",},}, {"id":{"name":"s_node_group_output","path":"sprites/s_node_group_output/s_node_group_output.yy",},}, {"id":{"name":"node_path_l_system","path":"scripts/node_path_l_system/node_path_l_system.yy",},}, {"id":{"name":"panel_gradient","path":"scripts/panel_gradient/panel_gradient.yy",},}, @@ -2318,6 +2327,7 @@ {"id":{"name":"s_node_group_input","path":"sprites/s_node_group_input/s_node_group_input.yy",},}, {"id":{"name":"sample_projects","path":"scripts/sample_projects/sample_projects.yy",},}, {"id":{"name":"load_function","path":"scripts/load_function/load_function.yy",},}, + {"id":{"name":"sh_region_fill_coordinate_init","path":"shaders/sh_region_fill_coordinate_init/sh_region_fill_coordinate_init.yy",},}, {"id":{"name":"__matrix3","path":"scripts/__matrix3/__matrix3.yy",},}, {"id":{"name":"sh_blink_replace","path":"shaders/sh_blink_replace/sh_blink_replace.yy",},}, {"id":{"name":"draw_fit","path":"scripts/draw_fit/draw_fit.yy",},}, @@ -2436,6 +2446,7 @@ {"id":{"name":"debug","path":"scripts/debug/debug.yy",},}, {"id":{"name":"node_shadow_cast","path":"scripts/node_shadow_cast/node_shadow_cast.yy",},}, {"id":{"name":"node_strand_render","path":"scripts/node_strand_render/node_strand_render.yy",},}, + {"id":{"name":"sh_path_fill_profile","path":"shaders/sh_path_fill_profile/sh_path_fill_profile.yy",},}, {"id":{"name":"s_node_3d_obj_combine","path":"sprites/s_node_3d_obj_combine/s_node_3d_obj_combine.yy",},}, {"id":{"name":"s_node_wav_file_read","path":"sprites/s_node_wav_file_read/s_node_wav_file_read.yy",},}, {"id":{"name":"o_dialog_assetbox","path":"objects/o_dialog_assetbox/o_dialog_assetbox.yy",},}, diff --git a/fonts/_f_sdf/_f_sdf.old.png b/fonts/_f_sdf/_f_sdf.old.png index 8ec22ab00..42328961b 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 84d3e9ce0..fe2e6c1c6 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 14a29a262..d2191c850 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 ffbddf141..3b69f5e1c 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_run_shell/Create_0.gml b/objects/o_dialog_run_shell/Create_0.gml index 2ba33a06f..42092ec24 100644 --- a/objects/o_dialog_run_shell/Create_0.gml +++ b/objects/o_dialog_run_shell/Create_0.gml @@ -29,7 +29,7 @@ event_inherited(); draw_set_font(f_p0); _hh += string_height_ext(ctxt[2], -1, dialog_w - ui(48)); - dialog_h = _hh + ui(120); + dialog_h = _hh + ui(124); dialog_y = WIN_H / 2 - dialog_h / 2; } #endregion \ No newline at end of file diff --git a/objects/o_dialog_run_shell/Draw_64.gml b/objects/o_dialog_run_shell/Draw_64.gml index 8ba50e37a..27eb29bee 100644 --- a/objects/o_dialog_run_shell/Draw_64.gml +++ b/objects/o_dialog_run_shell/Draw_64.gml @@ -16,13 +16,13 @@ if !ready exit; #endregion #region text - var py = dialog_y + ui(16); + var py = dialog_y + ui(20); var txt = __txt($"Running shell script"); draw_set_text(f_h5, fa_left, fa_top, COLORS._main_text); draw_text(dialog_x + ui(24), py, txt); py += line_get_height(, 8); - draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text); + draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text_sub); draw_text_ext(dialog_x + ui(24), py, ctxt[0], -1, dialog_w - ui(48)); py += string_height_ext(ctxt[0], -1, dialog_w - ui(48)) + ui(16); @@ -33,7 +33,7 @@ if !ready exit; draw_text_ext(dialog_x + ui(32), py, ctxt[1], -1, dialog_w - ui(64)); py += _hh + ui(16); - draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text); + draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text_sub); draw_text_ext(dialog_x + ui(24), py, ctxt[2], -1, dialog_w - ui(48)); py += string_height_ext(ctxt[2], -1, dialog_w - ui(48)); diff --git a/objects/o_main/Alarm_1.gml b/objects/o_main/Alarm_1.gml index 48085def5..c1d3e2658 100644 --- a/objects/o_main/Alarm_1.gml +++ b/objects/o_main/Alarm_1.gml @@ -2,6 +2,6 @@ #region prefload __migration_check(); - if(!file_exists_empty(file_open_parameter) && PREFERENCES.show_splash) + if(!file_exists_empty(PROGRAM_ARGUMENTS._path) && PREFERENCES.show_splash) dialogCall(o_dialog_splash); #endregion \ No newline at end of file diff --git a/objects/o_main/Create_0.gml b/objects/o_main/Create_0.gml index 507ebcc60..eeb7906e5 100644 --- a/objects/o_main/Create_0.gml +++ b/objects/o_main/Create_0.gml @@ -215,7 +215,6 @@ #endregion #region parameter - file_open_parameter = ""; minimized = false; _modified = false; #endregion @@ -312,73 +311,111 @@ //instance_create_depth(0, 0, -32000, FLIP_Domain); #endregion +#region server + globalvar TCP_SERVER, TCP_PORT, TCP_CLIENTS; + TCP_SERVER = false; + TCP_PORT = noone; + TCP_CLIENTS = []; + +#endregion + #region arguments #macro IS_CMD PROGRAM_ARGUMENTS._cmd alarm[1] = 2; - globalvar PROGRAM_ARGUMENTS; + globalvar PROGRAM_ARGUMENTS, CLI_EXPORT_AMOUNT; + PROGRAM_ARGUMENTS = { + _path : "", _cmd : false, _run : false, + _rendering : false, _exporting : [], _persist : false, + _trusted: false, + _lua: true, }; - //.\PixelComposer.exe "D:/Project/MakhamDev/LTS-PixelComposer/TEST/terminal/outline.pxc" --h -image "D:/Project/MakhamDev/LTS-PixelComposer/TEST/terminal/05.png" - PROGRAM_ARGUMENTS._path = "D:/Project/MakhamDev/LTS-PixelComposer/TEST/terminal/moveup.pxc"; - PROGRAM_ARGUMENTS.image = "D:/Project/MakhamDev/LTS-PixelComposer/TEST/terminal/05.png"; - PROGRAM_ARGUMENTS._cmd = true; - PROGRAM_ARGUMENTS._run = true; + CLI_EXPORT_AMOUNT = 0; var paramCount = parameter_count(); var paramType = "_path"; + var useTCP = false; for( var i = 0; i < paramCount; i++ ) { var param = parameter_string(i); //print($" >>> params {i}: {param}"); - if(string_starts_with(param, "--")) { + if(string_starts_with(param, "-")) { switch(param) { + case "-c" : case "--crashed" : if(PREFERENCES.show_crash_dialog) run_in(1, function() { dialogCall(o_dialog_crashed); }); break; - case "--h" : + case "-h" : + case "--headless" : PROGRAM_ARGUMENTS._cmd = true; - PROGRAM_ARGUMENTS._run = true; break; - case "--p" : PROGRAM_ARGUMENTS._persist = true; break; + case "-p" : + case "--persist" : + PROGRAM_ARGUMENTS._persist = true; + break; + + case "-t" : + case "--trusted" : + PROGRAM_ARGUMENTS._trusted = true; + break; + + case "-s" : + case "--server" : + PROGRAM_ARGUMENTS._persist = true; + useTCP = true; + break; + + case "-sl" : + case "--skiplua" : + PROGRAM_ARGUMENTS._lua = false; + break; + + default : + paramType = string_trim(param, ["-"]); + break; } - } else if(string_starts_with(param, "-")) { - paramType = string_trim(param, ["-"]); - } else if(paramType == "_path") { var path = param; path = string_replace_all(path, "\n", ""); path = string_replace_all(path, "\"", ""); - + if(file_exists_empty(path) && filename_ext(path) == ".pxc") PROGRAM_ARGUMENTS._path = path; - } else { - PROGRAM_ARGUMENTS[$ paramType] = param; - } + } else + PROGRAM_ARGUMENTS[$ paramType] = cmd_path(param); } - if(struct_has(PROGRAM_ARGUMENTS, "_path")) { - var path = PROGRAM_ARGUMENTS._path; - - if(PROJECT == noone || PROJECT.path != path) { - file_open_parameter = path; - - run_in(1, function() { load_file_path(file_open_parameter); }); - } - } - - if(PROGRAM_ARGUMENTS._cmd) + if(IS_CMD) { draw_enable_drawevent(false); + log_console($"Running PixelComposer {VERSION_STRING}"); + + PROGRAM_ARGUMENTS._run = true; + PROGRAM_ARGUMENTS._rendering = true; + } + + if(file_exists_empty(PROGRAM_ARGUMENTS._path)) { + run_in(1, function() { load_file_path(PROGRAM_ARGUMENTS._path); }); + + } else if(IS_CMD) + game_end(); + + if(useTCP && struct_has(PROGRAM_ARGUMENTS, "port")) { + TCP_PORT = PROGRAM_ARGUMENTS.port; + TCP_SERVER = network_create_server_raw(network_socket_tcp, TCP_PORT, 32); + + log_console($"Open port: {TCP_PORT}"); + } #endregion \ No newline at end of file diff --git a/objects/o_main/Other_2.gml b/objects/o_main/Other_2.gml index 1aba75d85..ffac4ec75 100644 --- a/objects/o_main/Other_2.gml +++ b/objects/o_main/Other_2.gml @@ -65,22 +65,23 @@ log_message("DIRECTORY", DIRECTORY); PREF_APPLY(); - var t0 = get_timer(); - var t = get_timer(); + var t0 = get_timer(); + var t = get_timer(); + var _lua = PROGRAM_ARGUMENTS._lua; __initPatreon(); log_message("SESSION", $"> init Patreon | complete in {get_timer() - t}"); t = get_timer(); if(!IS_CMD) { __initTheme(); log_message("SESSION", $"> init Theme | complete in {get_timer() - t}"); t = get_timer(); } if(!IS_CMD) { __initLocale(); log_message("SESSION", $"> init Locale | complete in {get_timer() - t}"); t = get_timer(); } if(!IS_CMD) { loadFonts(); log_message("SESSION", $"> init Font | complete in {get_timer() - t}"); t = get_timer(); } - __initProject(); log_message("SESSION", $"> init Project | complete in {get_timer() - t}"); t = get_timer(); + if(!IS_CMD) { __initProject(); log_message("SESSION", $"> init Project | complete in {get_timer() - t}"); t = get_timer(); } if(!IS_CMD) { __initAction(); log_message("SESSION", $"> init Action | complete in {get_timer() - t}"); t = get_timer(); } __initSurfaceFormat(); log_message("SESSION", $"> init SurfaceFormat | complete in {get_timer() - t}"); t = get_timer(); if(!IS_CMD) { __initCollection(); log_message("SESSION", $"> init Collection | complete in {get_timer() - t}"); t = get_timer(); } if(!IS_CMD) { __initAssets(); log_message("SESSION", $"> init Assets | complete in {get_timer() - t}"); t = get_timer(); } if(!IS_CMD) { __initPresets(); log_message("SESSION", $"> init Presets | complete in {get_timer() - t}"); t = get_timer(); } - __initFontFolder(); log_message("SESSION", $"> init FontFolder | complete in {get_timer() - t}"); t = get_timer(); - __initLua(); log_message("SESSION", $"> init Lua | complete in {get_timer() - t}"); t = get_timer(); + if(!IS_CMD) { __initFontFolder(); log_message("SESSION", $"> init FontFolder | complete in {get_timer() - t}"); t = get_timer(); } + if(_lua) { __initLua(); log_message("SESSION", $"> init Lua | complete in {get_timer() - t}"); t = get_timer(); } if(!IS_CMD) { __initNodeData(); log_message("SESSION", $"> init NodeData | complete in {get_timer() - t}"); t = get_timer(); } __initNodes(); log_message("SESSION", $"> init Nodes | complete in {get_timer() - t}"); t = get_timer(); if(!IS_CMD) { __initSteamUGC(); log_message("SESSION", $"> init SteamUGC | complete in {get_timer() - t}"); t = get_timer(); } diff --git a/objects/o_main/Other_68.gml b/objects/o_main/Other_68.gml index 12e70eb33..d28b79156 100644 --- a/objects/o_main/Other_68.gml +++ b/objects/o_main/Other_68.gml @@ -1,6 +1,28 @@ /// @description var _id = async_load[? "id"]; +if(_id == TCP_SERVER) { + var t = async_load[? "type"]; + + if (t == network_type_connect) { + var sock = ds_map_find_value(async_load, "socket"); + array_push(TCP_CLIENTS, sock); + log_console($"Client connected: {sock}"); + + } else if (t == network_type_disconnect) { + var sock = ds_map_find_value(async_load, "socket"); + array_remove(TCP_CLIENTS, sock); + log_console($"Client disconnected: {sock}"); + + } else if (t == network_type_data) { + var _buffer = ds_map_find_value(async_load, "buffer"); + var cmd_type = buffer_read(_buffer, buffer_string ); + cmd_submit(cmd_type); + } + + exit; +} + if(!ds_map_exists(PORT_MAP, _id)) exit; var nodeTarget = PORT_MAP[? _id]; nodeTarget.asyncPackets(async_load); \ No newline at end of file diff --git a/objects/o_main/Other_70.gml b/objects/o_main/Other_70.gml index 6b8eaf564..ba96f4117 100644 --- a/objects/o_main/Other_70.gml +++ b/objects/o_main/Other_70.gml @@ -1,5 +1,4 @@ -/// @description Insert description here -// You can write your code in this editor +/// @description Firebase if (async_load[? "type"] == "FirebaseFirestore_Collection_Query") { PATREON_MAIL_CALLBACK(async_load); diff --git a/objects/o_main/Other_75.gml b/objects/o_main/Other_75.gml index d8c98c21f..0e33c29ef 100644 --- a/objects/o_main/Other_75.gml +++ b/objects/o_main/Other_75.gml @@ -1,5 +1,5 @@ /// @description -var ev_id = async_load[? "id"]; +var ev_id = async_load[? "id"]; var ev_type = async_load[? "event_type"]; if(ev_type == "file_drop") { diff --git a/objects/o_main/Step_1.gml b/objects/o_main/Step_1.gml index 445c20657..15dd6b306 100644 --- a/objects/o_main/Step_1.gml +++ b/objects/o_main/Step_1.gml @@ -109,18 +109,25 @@ _HOVERING_ELEMENT = noone; PROJECT.animator.frame_progress = false; } else { - if(UPDATE & RENDER_TYPE.full) { + if(UPDATE & RENDER_TYPE.full) Render(); - } else if(UPDATE & RENDER_TYPE.partial) + else if(UPDATE & RENDER_TYPE.partial) Render(true); } } } - if(IS_CMD && PROGRAM_ARGUMENTS._run == false && array_empty(PROGRAM_ARGUMENTS._exporting) && !PROGRAM_ARGUMENTS._persist) - game_end(); + if(PROGRAM_ARGUMENTS._rendering && PROGRAM_ARGUMENTS._run == false && array_empty(PROGRAM_ARGUMENTS._exporting)) { + log_console($"Export {CLI_EXPORT_AMOUNT} {CLI_EXPORT_AMOUNT > 1? "files" : "file"} completed"); + + if(PROGRAM_ARGUMENTS._persist) { + PROGRAM_ARGUMENTS._rendering = false; + cli_wait(); + } else + game_end(); + } UPDATE = RENDER_TYPE.none; #endregion @@ -224,4 +231,14 @@ _HOVERING_ELEMENT = noone; USE_DEPTH = false; #endregion +#region cmd + var _resPath = program_directory + "in"; + + if(file_exists(_resPath)) { + var cmd = file_read_all(_resPath); + cmd_submit(cmd); + file_delete(_resPath); + } +#endregion + //if(global.cache_call) print($"CACHE called: {global.cache_call} | hit: {global.cache_hit} ({global.cache_hit / global.cache_call * 100}%)"); \ No newline at end of file diff --git a/scripts/__VFX/__VFX.gml b/scripts/__VFX/__VFX.gml index 035e1ae5b..fab1c2945 100644 --- a/scripts/__VFX/__VFX.gml +++ b/scripts/__VFX/__VFX.gml @@ -339,8 +339,8 @@ function __part(_node) constructor { scy_history[life_incr - 1] = scy; var _xx, _yy; - var s_w = (_useS? surface_get_width(surface) : 1) * scx; - var s_h = (_useS? surface_get_height(surface) : 1) * scy; + var s_w = (_useS? surface_get_width_safe(surface) : 1) * scx; + var s_h = (_useS? surface_get_height_safe(surface) : 1) * scy; var _pp = point_rotate(-s_w / 2, -s_h / 2, 0, 0, rot); _xx = drawx + _pp[0]; @@ -376,7 +376,7 @@ function __part(_node) constructor { switch(render_type) { case PARTICLE_RENDER_TYPE.surface : - if(_useS) draw_surface_ext(surface, _xx, _yy, scx, scy, drawrot, cc, alp_draw); + if(_useS) draw_surface_ext_safe(surface, _xx, _yy, scx, scy, drawrot, cc, alp_draw); else { var ss = round(min(scx, scy)); if(round(ss) == 0) return; diff --git a/scripts/console_commands/console_commands.gml b/scripts/console_commands/console_commands.gml new file mode 100644 index 000000000..92575d33a --- /dev/null +++ b/scripts/console_commands/console_commands.gml @@ -0,0 +1,145 @@ +globalvar CMD_COLOR; + +CMD_COLOR = { + HEADER : "\033[95m", + OKBLUE : "\033[94m", + OKCYAN : "\033[96m", + OKGREEN : "\033[92m", + WARNING : "\033[93m", + FAIL : "\033[91m", + ENDC : "\033[0m", + BOLD : "\033[1m", +} + +function cmd_submit(command) { #region + if(command == "") return; + array_push(CMD, cmdLineIn(command)); + array_push(CMDIN, command); + + var cmd = string_splice(command, " ", false, false); + var cmd_type = cmd[0]; + cmd_type = string_trim(cmd_type); + + switch(cmd_type) { + case "f": + case "flag": + if(array_length(cmd) < 2) { + var _txt = $"[Error] `flag` not enough argument."; + array_push(CMD, cmdLine(_txt, COLORS._main_value_negative) ); + log_console(_txt, true); + break; + } + var flg = cmd[1]; + global.FLAG[$ flg] = !global.FLAG[$ flg]; + + var _txt = $"Toggled debug flag: {flg} = {global.FLAG[$ flg]? "True" : "False"}"; + array_push(CMD, cmdLine(_txt, COLORS._main_value_positive) ); + log_console(_txt, true); + break; + + case "s": + case "set": + if(array_length(cmd) < 3) { + var _txt = $"[Error] `set` not enough argument."; + array_push(CMD, cmdLine(_txt, COLORS._main_value_negative) ); + log_console(_txt, true); + break; + } + + var key = string_trim(cmd[1]); + var val = string_trim(cmd[2]); + var glb = PROJECT.globalNode; + + if(glb.inputExist(key)) { + for( var i = 0; i < ds_list_size(glb.inputs); i++ ) { + var _inp = glb.inputs[| i]; + if(_inp.name != key) continue; + + if(_inp.type == VALUE_TYPE.text || _inp.type == VALUE_TYPE.path) { + _inp.setValue(val); + PROGRAM_ARGUMENTS[$ key] = val; + } else { + var v = evaluateFunction(val); + _inp.setValue(v); + PROGRAM_ARGUMENTS[$ key] = v; + } + break; + } + } else + PROGRAM_ARGUMENTS[$ key] = val; + + var _txt = $"Set global variable: {key} = {val}"; + array_push(CMD, cmdLine(_txt, COLORS._main_value_positive) ); + log_console(_txt, true); + break; + + case "r": + case "render": + PROGRAM_ARGUMENTS._run = true; + PROGRAM_ARGUMENTS._rendering = true; + CLI_EXPORT_AMOUNT = 0; + break; + + case "x": + case "exit": + game_end(); + break; + + default: + if(struct_has(FUNCTIONS, cmd[0])) { + var _f = FUNCTIONS[$ cmd[0]]; + var _vars = string_splice(array_safe_get(cmd, 1, ""), ","); + var _args = []; + + for( var i = 0, n = array_length(_f.args); i < n; i++ ) { + var _arg = _f.args[i]; + var _def = _arg.fn? _arg.def() : _arg.def; + + if(i < array_length(_vars) && _vars[i] != "") { + if(is_real(_def)) _args[i] = toNumber(_vars[i]); + else _args[i] = _vars[i]; + } else + _args[i] = _def; + } + + callFunction(cmd[0], _args); + cli_wait(); + break; + } + + var _txt = $"[Error] \"{cmd_type}\" command not found."; + array_push(CMD, cmdLine(_txt, COLORS._main_value_negative) ); + log_console(_txt, true); + break; + } +} #endregion + +function cmd_path(path) { #region + var params = string_splice(path, ";"); + var vals = []; + + for( var j = 0, n = array_length(params); j < n; j++ ) { + var _p = params[j]; + + if(filename_drive(_p) == "") { + array_push(vals, _p); + continue; + } + + var _f = file_find_first(_p, 0); + var _dir = filename_dir(_p) + "/"; + + while (_f != "") { + var _pf = _f; + + array_push(vals, _dir + _f); + + _f = file_find_next(); + if(_pf == _f) break; + } + + file_find_close(); + } + + return vals; +} #endregion \ No newline at end of file diff --git a/scripts/console_commands/console_commands.yy b/scripts/console_commands/console_commands.yy new file mode 100644 index 000000000..4d1f48be7 --- /dev/null +++ b/scripts/console_commands/console_commands.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "console_commands", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "functions", + "path": "folders/functions.yy", + }, +} \ No newline at end of file diff --git a/scripts/debug/debug.gml b/scripts/debug/debug.gml index 841f9fdc2..b25162fa5 100644 --- a/scripts/debug/debug.gml +++ b/scripts/debug/debug.gml @@ -24,6 +24,19 @@ function __log(title, str, fname = "log/log.txt") { #region file_text_close(f); } #endregion +function log_console(str, wait = false) { #region + INLINE + show_debug_message($"CLI: {str}"); + if(wait) cli_wait(); + return; +} #endregion + +function cli_wait() { #region + INLINE + show_debug_message("WAIT"); + return; +} #endregion + function log_message(title, str, icon = noone, flash = false, write = true) { #region if(TEST_ERROR) return; if(IS_CMD) { show_debug_message($"{title}: {str}"); return; } @@ -82,27 +95,30 @@ function setException() { #region if(OS == os_macosx) return noone; exception_unhandled_handler(function(ex) { - var path = string(DIRECTORY) + "prev_crash.pxc"; - if(!SAVING && !TESTING) SAVE_AT(PROJECT, path); - - var tt = "\n-------------------------- OH NO --------------------------\n\n"; + var path = $"{DIRECTORY}prev_crash.pxc"; + if(!SAVING && !TESTING && !IS_CMD) SAVE_AT(PROJECT, path); + + var tt = ""; + tt += "\n-------------------------- OH NO --------------------------\n\n"; tt += "\n" + ex.longMessage; tt += "\n" + ex.script; tt += "\n-------------------------- STACK TRACE --------------------------\n\n"; - for( var i = 0, n = array_length(ex.stacktrace); i < n; i++ ) { + for( var i = 0, n = array_length(ex.stacktrace); i < n; i++ ) tt += ex.stacktrace[i] + "\n"; - } tt += "\n---------------------------- :( ----------------------------\n"; var path = $"{env_user()}crash_log.txt"; file_text_write_all(path, tt); clipboard_set_text(tt); - show_debug_message(tt); + + if(IS_CMD) { + show_debug_message($"[ERROR BEGIN]\n{tt}\n[ERROR END]"); + return 0; + } else + show_debug_message(tt); var rep = $"{APP_LOCATION}report\\PXC crash reporter.exe"; - //if(OS == os_macosx) rep = $"{program_directory}PXC_crash_reporter.app"; - var pid = shell_execute(rep, DIRECTORY); print($"{rep} [{file_exists(rep)}]: {pid}"); diff --git a/scripts/file_functions/file_functions.gml b/scripts/file_functions/file_functions.gml index 994c0ef87..d82ca6b1f 100644 --- a/scripts/file_functions/file_functions.gml +++ b/scripts/file_functions/file_functions.gml @@ -1,11 +1,11 @@ function file_exists_empty(path) { INLINE return path != "" && file_exists(path); } -function file_copy_override(src, dest) { +function file_copy_override(src, dest) { #region if(file_exists_empty(dest)) file_delete(dest); file_copy(src, dest); -} +} #endregion -function filepath_resolve(path) { +function filepath_resolve(path) { #region INLINE var _path = path; @@ -13,12 +13,26 @@ function filepath_resolve(path) { _path = string_replace_all(_path, "%APP%/", APP_LOCATION); return _path; -} +} #endregion -function get_open_filenames_compat(ext, sel) { +function get_open_filenames_compat(ext, sel) { #region INLINE - //return get_open_filenames(ext, sel); if(OS == os_windows) return get_open_filenames(ext, sel); return get_open_filename(ext, sel); -} \ No newline at end of file +} #endregion + +function file_get_modify_s(path) { #region + INLINE + + if(!file_exists(path)) return 0; + + var _y = file_datetime_modified_year(path); + var _m = file_datetime_modified_month(path); + var _d = file_datetime_modified_day(path); + var _h = file_datetime_modified_hour(path); + var _n = file_datetime_modified_minute(path); + var _s = file_datetime_modified_second(path); + + return ((((_y * 12 + _m) * 31 + _d) * 24 + _h) * 60 + _n) * 60 + _s; +} #endregion \ No newline at end of file diff --git a/scripts/load_function/load_function.gml b/scripts/load_function/load_function.gml index 4c6c9f68d..6334da0d1 100644 --- a/scripts/load_function/load_function.gml +++ b/scripts/load_function/load_function.gml @@ -28,12 +28,16 @@ function LOAD_PATH(path, readonly = false, safe_mode = false) { #region var _PROJECT = PROJECT; PROJECT = new Project(); - if(_PROJECT.path == "" && !_PROJECT.modified) { + if(_PROJECT == noone) { + PROJECTS = [ PROJECT ]; + + } else if(_PROJECT.path == "" && !_PROJECT.modified) { var ind = array_find(PROJECTS, _PROJECT); if(ind == -1) ind = 0; PROJECTS[ind] = PROJECT; if(!IS_CMD) PANEL_GRAPH.setProject(PROJECT); + } else { if(!IS_CMD) { var graph = new Panel_Graph(PROJECT); @@ -250,6 +254,8 @@ function LOAD_AT(path, readonly = false, override = false) { #region PROJECT.modified = false; log_message("FILE", "load " + path, THEME.noti_icon_file_load); + log_console("Loaded project: " + path); + if(!IS_CMD) PANEL_MENU.setNotiIcon(THEME.noti_icon_file_load); refreshNodeMap(); diff --git a/scripts/node_argument/node_argument.gml b/scripts/node_argument/node_argument.gml index a86d03658..99327ef6c 100644 --- a/scripts/node_argument/node_argument.gml +++ b/scripts/node_argument/node_argument.gml @@ -10,33 +10,42 @@ function Node_Argument(_x, _y, _group = noone) : Node(_x, _y, _group) constructo inputs[| 1] = nodeValue("Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "String", "Number" ]); + inputs[| 2] = nodeValue("Default value", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, ""); + outputs[| 0] = nodeValue("Value", self, JUNCTION_CONNECT.output, VALUE_TYPE.text, ""); - static step = function() { + static step = function() { #region var typ = getInputData(1); switch(typ) { - case 0 : outputs[| 0].setType(VALUE_TYPE.text); break; - case 1 : outputs[| 0].setType(VALUE_TYPE.float); break; + case 0 : + inputs[| 2].setType(VALUE_TYPE.text); + outputs[| 0].setType(VALUE_TYPE.text); + break; + case 1 : + inputs[| 2].setType(VALUE_TYPE.float); + outputs[| 0].setType(VALUE_TYPE.float); + break; } - } + } #endregion - static update = function() { + static update = function() { #region var tag = getInputData(0); var typ = getInputData(1); - var val = struct_try_get(PROGRAM_ARGUMENTS, tag, ""); + var def = getInputData(2); + var val = struct_try_get(PROGRAM_ARGUMENTS, tag, def); switch(typ) { case 0 : outputs[| 0].setValue(val); break; case 1 : outputs[| 0].setValue(toNumber(val)); break; } - } + } #endregion - static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { + static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region var bbox = drawGetBbox(xx, yy, _s); var tag = getInputData(0); draw_set_text(f_sdf, fa_center, fa_center, COLORS._main_text); - draw_text_bbox(bbox, $"-{tag}"); - } + draw_text_bbox(bbox, $"--{tag}"); + } #endregion } \ No newline at end of file diff --git a/scripts/node_attributes/node_attributes.gml b/scripts/node_attributes/node_attributes.gml index 26b59a085..b4ceee841 100644 --- a/scripts/node_attributes/node_attributes.gml +++ b/scripts/node_attributes/node_attributes.gml @@ -9,7 +9,8 @@ global.SURFACE_OVERSAMPLE = [ "Empty", "Clamp", - "Repeat" + "Repeat", + "Black" ]; function __initSurfaceFormat() { diff --git a/scripts/node_displacement/node_displacement.gml b/scripts/node_displacement/node_displacement.gml index 738dbcb32..1c335d9d7 100644 --- a/scripts/node_displacement/node_displacement.gml +++ b/scripts/node_displacement/node_displacement.gml @@ -19,7 +19,7 @@ function Node_Displace(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) - Linear: Displace along a line. - Vector: Use red as X displacement, green as Y displacement. - Angle: Use red as angle, green as distance.") - .setDisplay(VALUE_DISPLAY.enum_button, [ "Linear", "Vector", "Angle" ]); + .setDisplay(VALUE_DISPLAY.enum_button, [ "Linear", "Vector", "Angle", "Gradient" ]); inputs[| 6] = nodeValue("Iterate", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, @"If not set, then strength value is multiplied directly to the displacement. If set, then strength value control how many times the effect applies on itself."); @@ -74,9 +74,11 @@ If set, then strength value control how many times the effect applies on itself. var _mode = getInputData(5); var _sep = getInputData(16); + var _dsp2 = (_mode == 1 || _mode == 2) && _sep; + inputs[| 2].setVisible(_mode == 0); - inputs[| 16].setVisible(_mode); - inputs[| 17].setVisible(_mode && _sep); + inputs[| 16].setVisible(_mode == 1 || _mode == 2); + inputs[| 17].setVisible(_dsp2, _dsp2); if(_mode == 1 && _sep) { inputs[| 1].setName("Displace X"); diff --git a/scripts/node_export/node_export.gml b/scripts/node_export/node_export.gml index 6d5060db3..be22091c2 100644 --- a/scripts/node_export/node_export.gml +++ b/scripts/node_export/node_export.gml @@ -584,6 +584,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor p = pathString(array_safe_get(path, i), i); else p = pathString(path, i); + CLI_EXPORT_AMOUNT++; } p = save_surface(_surf, p); @@ -600,13 +601,15 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor var p = path; if(is_array(path)) p = path[0]; - if(form == NODE_EXPORT_FORMAT.animation) + if(form == NODE_EXPORT_FORMAT.animation) { p = $"{directory}/{string_lead_zero(CURRENT_FRAME, 5)}.png"; - else + } else { p = pathString(p); + CLI_EXPORT_AMOUNT++; + } p = save_surface(surf, p); - + if(form != NODE_EXPORT_FORMAT.animation && !IS_CMD) { var noti = log_message("EXPORT", $"Export image as {p}", THEME.noti_icon_tick, COLORS._main_value_positive, false); noti.path = filename_dir(p); @@ -675,6 +678,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor } updatedOutTrigger.setValue(true); + CLI_EXPORT_AMOUNT++; } #endregion insp1UpdateTooltip = "Export"; @@ -696,7 +700,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor } #endregion static doInspectorAction = function() { #region - if(!PROGRAM_ARGUMENTS._cmd && (LOADING || APPENDING)) return; + if(!IS_CMD && (LOADING || APPENDING)) return; var path = getInputData(1); if(path == "") return; diff --git a/scripts/node_grid/node_grid.gml b/scripts/node_grid/node_grid.gml index 2abcae5dd..810f247a0 100644 --- a/scripts/node_grid/node_grid.gml +++ b/scripts/node_grid/node_grid.gml @@ -41,17 +41,13 @@ function Node_Grid(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons inputs[| 12] = nodeValue("Anti aliasing", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); - ////////////////////////////////////////////////////////////////////////////////// + inputs[| 13] = nodeValueMap("Scale map", self); - inputs[| 13] = nodeValueMap("Scale map", self); + inputs[| 14] = nodeValueMap("Gap map", self); - inputs[| 14] = nodeValueMap("Gap map", self); + inputs[| 15] = nodeValueMap("Angle map", self); - inputs[| 15] = nodeValueMap("Angle map", self); - - inputs[| 16] = nodeValueMap("Shift map", self); - - ////////////////////////////////////////////////////////////////////////////////// + inputs[| 16] = nodeValueMap("Shift map", self); inputs[| 17] = nodeValue("Truchet", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); @@ -59,14 +55,10 @@ function Node_Grid(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons inputs[| 19] = nodeValue("Flip horizontal", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) .setDisplay(VALUE_DISPLAY.slider); - - ////////////////////////////////////////////////////////////////////////////////// - inputs[| 20] = nodeValueMap("Gradient map", self); + inputs[| 20] = nodeValueMap("Gradient map", self); - inputs[| 21] = nodeValueGradientRange("Gradient map range", self, inputs[| 5]); - - ////////////////////////////////////////////////////////////////////////////////// + inputs[| 21] = nodeValueGradientRange("Gradient map range", self, inputs[| 5]); inputs[| 22] = nodeValue("Flip vertical", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) .setDisplay(VALUE_DISPLAY.slider); diff --git a/scripts/node_guide/node_guide.gml b/scripts/node_guide/node_guide.gml index 4d7d8b698..9b3768d64 100644 --- a/scripts/node_guide/node_guide.gml +++ b/scripts/node_guide/node_guide.gml @@ -144,9 +144,8 @@ function __generate_node_data() { #region } #endregion +global.NODE_GUIDE = {}; function __initNodeData() { - global.NODE_GUIDE = {}; - var nodeDir = DIRECTORY + "Nodes/"; directory_verify(nodeDir); diff --git a/scripts/node_image/node_image.gml b/scripts/node_image/node_image.gml index 2ec016456..dd5c66e95 100644 --- a/scripts/node_image/node_image.gml +++ b/scripts/node_image/node_image.gml @@ -26,8 +26,7 @@ function Node_Image(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { color = COLORS.node_blend_input; inputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "") - .setDisplay(VALUE_DISPLAY.path_load, { filter: "image|*.png;*.jpg" }) - .rejectArray(); + .setDisplay(VALUE_DISPLAY.path_load, { filter: "image|*.png;*.jpg" }); inputs[| 1] = nodeValue("Padding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0, 0, 0]) .setDisplay(VALUE_DISPLAY.padding); @@ -38,8 +37,8 @@ function Node_Image(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { attribute_surface_depth(); - spr = noone; - path_current = ""; + spr = []; + path_current = []; first_update = false; @@ -54,12 +53,13 @@ function Node_Image(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { return false; } #endregion - function updatePaths(path) { #region + function createSprite(path) { #region path = try_get_path(path); - if(path == -1) return false; + if(path == -1) return noone; - var ext = string_lower(filename_ext(path)); - var _name = string_replace(filename_name(path), filename_ext(path), ""); + var spr; + var ext = string_lower(filename_ext(path)); + var _name = filename_name_only(path); switch(ext) { case ".png": @@ -67,23 +67,34 @@ function Node_Image(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { case ".jpeg": case ".gif": setDisplayName(_name); - outputs[| 1].setValue(path); - if(spr) sprite_delete(spr); spr = sprite_add(path, 1, false, false, 0, 0); - if(path_current == "") - first_update = true; - path_current = path; - if(spr == -1) { noti_warning($"Image node: File not a valid image."); - return false; + break; } - return true; + return spr; + } + + return noone; + } #endregion + + function updatePaths(path, index = 0) { #region + if(array_empty(path_current)) first_update = true; + path_current = path; + + for( var i = 0, n = array_length(spr); i < n; i++ ) + sprite_delete(spr[i]); + + if(!is_array(path)) path = [ path ]; + + spr = []; + for( var i = 0, n = array_length(path); i < n; i++ ) { + var s = createSprite(path[i]); + if(s) array_push(spr, s); } - return false; } #endregion insp1UpdateTooltip = __txt("Refresh"); @@ -92,7 +103,7 @@ function Node_Image(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { static onInspector1Update = function() { #region var path = getInputData(0); if(path == "") return; - updatePaths(path); + update(); } #endregion @@ -100,42 +111,60 @@ function Node_Image(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { var path = getInputData(0); var pad = getInputData(1); - if(path == "") return; - if(path_current != path) updatePaths(path); + outputs[| 1].setValue(path); + if(path_current != path) + updatePaths(path); - if(!spr || !sprite_exists(spr)) return; - - var ww = sprite_get_width(spr) + pad[0] + pad[2]; - var hh = sprite_get_height(spr) + pad[1] + pad[3]; + if(array_empty(spr)) return; + var _arr = is_array(spr); var _outsurf = outputs[| 0].getValue(); - _outsurf = surface_verify(_outsurf, ww, hh, attrDepth()); - outputs[| 0].setValue(_outsurf); - surface_set_shader(_outsurf, noone); - draw_sprite(spr, 0, pad[2], pad[1]); - surface_reset_shader(); + if(!is_array(_outsurf)) _outsurf = [ _outsurf ]; - if(!first_update) return; - first_update = false; + for( var i = 0, n = array_length(spr); i < n; i++ ) { + var _spr = spr[i]; + + if(!sprite_exists(_spr)) continue; + + var ww = sprite_get_width(_spr) + pad[0] + pad[2]; + var hh = sprite_get_height(_spr) + pad[1] + pad[3]; + + var _surf = array_safe_get(_outsurf, i); + _surf = surface_verify(_surf, ww, hh, attrDepth()); + + surface_set_shader(_surf, noone); + draw_sprite(_spr, 0, pad[2], pad[1]); + surface_reset_shader(); + + _outsurf[i] = _surf; + } - if(LOADING || APPENDING) return; - if(string_pos("strip", display_name) == 0) return; + outputs[| 0].setValue(_arr? _outsurf : _outsurf[0]); - var sep_pos = string_pos("strip", display_name) + 5; - var sep = string_copy(display_name, sep_pos, string_length(display_name) - sep_pos + 1); - var amo = toNumber(string_digits(sep)); + #region splice + if(!first_update) return; + first_update = false; - if(amo) { - var ww = sprite_get_width(spr) / amo; - var hh = sprite_get_height(spr); + if(LOADING || APPENDING) return; + if(string_pos("strip", display_name) == 0) return; + + var sep_pos = string_pos("strip", display_name) + 5; + var sep = string_copy(display_name, sep_pos, string_length(display_name) - sep_pos + 1); + var amo = toNumber(string_digits(sep)); + + if(amo == 0) return; + + var ww = sprite_get_width(spr[0]) / amo; + var hh = sprite_get_height(spr[0]); var _splice = nodeBuild("Node_Image_Sheet", x + w + 64, y); _splice.inputs[| 0].setFrom(outputs[| 0], false); - _splice.inputs[| 1].setValue([ww, hh]); + _splice.inputs[| 1].setValue([ ww, hh ]); _splice.inputs[| 2].setValue(amo); _splice.inputs[| 3].setValue([ amo, 1 ]); _splice.inspector1Update(); - } + + #endregion } #endregion } \ No newline at end of file diff --git a/scripts/node_path_profile/node_outline.yy b/scripts/node_path_profile/node_outline.yy new file mode 100644 index 000000000..86468bc09 --- /dev/null +++ b/scripts/node_path_profile/node_outline.yy @@ -0,0 +1,12 @@ +{ + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "process", + "path": "folders/nodes/data/process.yy", + }, + "resourceVersion": "1.0", + "name": "node_outline", + "tags": [], + "resourceType": "GMScript", +} \ No newline at end of file diff --git a/scripts/node_path_profile/node_path_profile.gml b/scripts/node_path_profile/node_path_profile.gml new file mode 100644 index 000000000..d0181c7f0 --- /dev/null +++ b/scripts/node_path_profile/node_path_profile.gml @@ -0,0 +1,84 @@ +function Node_Path_Profile(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { + name = "Profile"; + + inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF ) + .setDisplay(VALUE_DISPLAY.vector); + + inputs[| 1] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.pathnode, noone ) + .setVisible(true, true); + + inputs[| 2] = nodeValue("Resolution", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 64 ); + + inputs[| 3] = nodeValue("Side", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) + .setDisplay(VALUE_DISPLAY.enum_button, [ "L", "R", "T", "D" ]); + + inputs[| 4] = nodeValue("Mirror", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false ); + + inputs[| 5] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white ); + + inputs[| 6] = nodeValue("Anti Aliasing", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false ); + + inputs[| 7] = nodeValue("Background", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false ); + + inputs[| 8] = nodeValue("BG Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black ); + + outputs[| 0] = nodeValue("Output", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone ); + + input_display_list = [ 0, + [ "Profile", false ], 1, 2, + [ "Render", false ], 3, 5, 4, 6, + [ "Background", false, 7 ], 8, + ]; + + brush_prev = noone; + brush_next_dist = 0; + + temp_surface = [ surface_create(1, 1) ]; + + static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region + var _path = getInputData(1); + if(_path) _path.drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny); + } #endregion + + static processData = function(_outSurf, _data, _output_index, _array_index = 0) { #region + var _dim = _data[0]; + var _path = _data[1]; + var _res = _data[2]; _res = max(_res, 2); + var _side = _data[3]; + var _mirr = _data[4]; + var _colr = _data[5]; + var _aa = _data[6]; + var _bg = _data[7]; + var _bgC = _data[8]; + + if(_path == noone) return; + + var _points = array_create(_res * 2); + var _p = new __vec2(); + + for( var i = 0; i < _res; i++ ) { + _p = _path.getPointRatio(i / _res, 0, _p); + + _points[i * 2 + 0] = _p.x; + _points[i * 2 + 1] = _p.y; + } + + surface_set_shader(_outSurf, sh_path_fill_profile, true, _bg? BLEND.alphamulp : BLEND.over); + if(_bg) draw_clear_alpha(_bgC, color_get_alpha(_bgC)); + + shader_set_f("dimension", _dim); + shader_set_f("path", _points); + shader_set_i("pathLength", _res); + shader_set_i("side", _side); + shader_set_i("mirror", _mirr); + shader_set_i("aa", _aa); + shader_set_color("color", _colr); + shader_set_i("bg", _bg); + shader_set_color("bgColor",_bgC); + + draw_sprite_stretched(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1]); + surface_reset_shader(); + + return _outSurf; + } #endregion +} \ No newline at end of file diff --git a/scripts/node_path_profile/node_path_profile.yy b/scripts/node_path_profile/node_path_profile.yy new file mode 100644 index 000000000..615fb8aea --- /dev/null +++ b/scripts/node_path_profile/node_path_profile.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "node_path_profile", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "drawer", + "path": "folders/nodes/data/generator/drawer.yy", + }, +} \ No newline at end of file diff --git a/scripts/node_region_fill/node_region_fill.gml b/scripts/node_region_fill/node_region_fill.gml index 48f4bc157..5cfb2ca3c 100644 --- a/scripts/node_region_fill/node_region_fill.gml +++ b/scripts/node_region_fill/node_region_fill.gml @@ -12,33 +12,37 @@ function Node_Region_Fill(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou inputs[| 4] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, irandom_range(10000, 99999)); - inputs[| 5] = nodeValue("Target Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, cola(c_black, 0)); + inputs[| 5] = nodeValue("Target Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white); inputs[| 6] = nodeValue("Inner only", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Only fill regions with surrounding pixels."); - inputs[| 7] = nodeValue("Draw original", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + inputs[| 7] = nodeValue("Draw original", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_scroll, [ "None", "Above", "Behind" ]); inputs[| 8] = nodeValue("Fill type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Random", "Color map" ]); + .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Random", "Color map", "Texture map" ]); inputs[| 9] = nodeValue("Color map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); + inputs[| 10] = nodeValue("Texture map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ 4, ["Surfaces", false], 0, 1, - ["Fill", false, 3], 5, 8, 2, 9, 6, + ["Fill", false], 5, 8, 2, 9, 10, 6, ["Render", false], 7, ]; temp_surface = array_create(3); - static step = function() { + static step = function() { #region var _filt = getInputData(8); - inputs[| 2].setVisible(_filt == 0); - inputs[| 9].setVisible(_filt == 1, _filt == 1); - } + inputs[| 2].setVisible(_filt == 0); + inputs[| 9].setVisible(_filt == 1, _filt == 1); + inputs[| 10].setVisible(_filt == 2, _filt == 2); + } #endregion static processData = function(_outSurf, _data, _output_index, _array_index) { var _surf = _data[0]; @@ -52,94 +56,117 @@ function Node_Region_Fill(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou var _rnbg = _data[7]; var _filt = _data[8]; var _cmap = _data[9]; + var _tmap = _data[10]; - var _sw = surface_get_width_safe(_surf); - var _sh = surface_get_height_safe(_surf) + var _sw = surface_get_width_safe(_surf); + var _sh = surface_get_height_safe(_surf) for( var i = 0, n = array_length(temp_surface); i < n; i++ ) { temp_surface[i] = surface_verify(temp_surface[i], _sw, _sh); surface_clear(temp_surface[i]); } - surface_set_shader(temp_surface[1], sh_region_fill_init); - shader_set_color("targetColor", _targ); + #region filter color + surface_set_shader(temp_surface[1], sh_region_fill_init); + shader_set_color("targetColor", _targ); - draw_surface_safe(_surf); - surface_reset_shader(); + draw_surface_safe(_surf); + surface_reset_shader(); + #endregion - var base = 0; - var amo = _sw; + #region inner region + var base = 0; + var amo = _sw; + + if(_innr) { + repeat( amo ) { + surface_set_shader(temp_surface[base], sh_region_fill_inner); + shader_set_f("dimension", _sw, _sh); + + draw_surface_safe(temp_surface[!base]); + surface_reset_shader(); + + base = !base; + } + + surface_set_shader(temp_surface[2], sh_region_fill_inner_remove); + draw_surface_safe(temp_surface[!base]); + surface_reset_shader(); + + } else { + surface_set_shader(temp_surface[2], sh_region_fill_inner_remove); + draw_surface_safe(temp_surface[1]); + surface_reset_shader(); + } + + surface_set_shader(temp_surface[base], sh_region_fill_coordinate_init); + draw_surface_safe(temp_surface[2]); + surface_reset_shader(); + #endregion + + #region coordinate + base = !base; + var amo = _sw + _sh; - if(_innr) { repeat( amo ) { - surface_set_shader(temp_surface[base], sh_region_fill_inner); - shader_set_f("dimension", _sw, _sh); + surface_set_shader(temp_surface[base], sh_region_fill_coordinate); + shader_set_f("dimension", _sw, _sh); + shader_set_surface("base", temp_surface[2]); draw_surface_safe(temp_surface[!base]); surface_reset_shader(); base = !base; } - } - var amo = _sw + _sh; - - repeat( amo ) { - surface_set_shader(temp_surface[base], sh_region_fill_coordinate); + surface_set_shader(temp_surface[base], sh_region_fill_border); shader_set_f("dimension", _sw, _sh); - + shader_set_surface("original", _surf); + draw_surface_safe(temp_surface[!base]); surface_reset_shader(); + #endregion + + var _pal = []; + for( var i = 0, n = array_length(_colr); i < n; i++ ) + array_append(_pal, colToVec4(_colr[i])); + + surface_set_target(_outSurf); + DRAW_CLEAR - base = !base; - } - - surface_set_shader(temp_surface[base], sh_region_fill_border); - shader_set_f("dimension", _sw, _sh); - shader_set_surface("original", _surf); - - draw_surface_safe(temp_surface[!base]); - surface_reset_shader(); - - if(_fill) { - var _pal = []; - for( var i = 0, n = array_length(_colr); i < n; i++ ) - array_append(_pal, colToVec4(_colr[i])); - - surface_set_shader(_outSurf); - switch(_filt) { - case 0 : - shader_set(sh_region_fill_color); + if(_rnbg == 2) draw_surface_safe(_surf); // render original + switch(_filt) { + case 0 : + shader_set(sh_region_fill_color); shader_set_f("colors", _pal); shader_set_f("seed", _seed); shader_set_f("colorAmount", array_length(_colr)); draw_surface_safe(temp_surface[base]); - break; + shader_reset(); + break; - case 1 : - shader_set(sh_region_fill_map); - + case 1 : + shader_set(sh_region_fill_map); shader_set_surface("colorMap", _cmap); draw_surface_safe(temp_surface[base]); - break; - } - - if(_rnbg) { shader_reset(); - shader_set(sh_sample); - draw_surface_safe(_surf); - } - surface_reset_shader(); - } else { - surface_set_shader(_outSurf); - draw_surface_safe(temp_surface[base]); - if(_rnbg) - draw_surface_safe(_surf); - surface_reset_shader(); - } + break; + + case 2 : + shader_set(sh_region_fill_rg_map); + shader_set_surface("textureMap", _tmap); + + draw_surface_safe(temp_surface[base]); + shader_reset(); + break; + } + + if(_rnbg == 1) draw_surface_safe(_surf); // render original + + surface_reset_target(); return _outSurf; } diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index 8f5342b4f..a98022e00 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -32,7 +32,7 @@ function NodeObject(_name, _spr, _node, _create, tooltip = "", tags = []) constr static setVersion = function(version) { #region INLINE - if(!IS_CMD) return self; + if(IS_CMD) return self; new_node = version >= LATEST_VERSION; @@ -49,7 +49,7 @@ function NodeObject(_name, _spr, _node, _create, tooltip = "", tags = []) constr static setIcon = function(icon) { #region INLINE - if(!IS_CMD) return self; + if(IS_CMD) return self; self.icon = icon; return self; @@ -57,7 +57,7 @@ function NodeObject(_name, _spr, _node, _create, tooltip = "", tags = []) constr static isDeprecated = function() { #region INLINE - if(!IS_CMD) return self; + if(IS_CMD) return self; deprecated = true; return self; @@ -65,7 +65,7 @@ function NodeObject(_name, _spr, _node, _create, tooltip = "", tags = []) constr static hideRecent = function() { #region INLINE - if(!IS_CMD) return self; + if(IS_CMD) return self; show_in_recent = false; return self; @@ -73,7 +73,7 @@ function NodeObject(_name, _spr, _node, _create, tooltip = "", tags = []) constr static hideGlobal = function() { #region INLINE - if(!IS_CMD) return self; + if(IS_CMD) return self; show_in_global = false; return self; @@ -81,7 +81,7 @@ function NodeObject(_name, _spr, _node, _create, tooltip = "", tags = []) constr static patreonExtra = function() { #region INLINE - if(!IS_CMD) return self; + if(IS_CMD) return self; is_patreon_extra = true; @@ -510,7 +510,8 @@ function __initNodes() { var filter = ds_list_create(); #region addNodeCatagory("Filter", filter); - addNodeObject(filter, "Lovify", s_node_lovify, "Node_Lovify", [1, Node_Lovify]).setIcon(s_lovify_icon); + //ds_list_add(filter, "Seasonal"); + //addNodeObject(filter, "Lovify", s_node_lovify, "Node_Lovify", [1, Node_Lovify],, "Add love to your image.").setIcon(s_lovify_icon); ds_list_add(filter, "Combines"); addNodeObject(filter, "Blend", s_node_blend, "Node_Blend", [0, Node_create_Blend], ["normal", "add", "subtract", "multiply", "screen", "maxx", "minn"], "Blend 2 images using different blendmodes."); @@ -538,6 +539,7 @@ function __initNodes() { addNodeObject(filter, "Displace", s_node_displace, "Node_Displace", [1, Node_Displace], ["distort"], "Distort image using another image as a map."); addNodeObject(filter, "Texture Remap", s_node_texture_map, "Node_Texture_Remap", [1, Node_Texture_Remap],, "Remap image using texture map. Where red channel control x position and green channel control y position."); addNodeObject(filter, "Time Remap", s_node_time_map, "Node_Time_Remap", [1, Node_Time_Remap],, "Remap image using texture as time map. Where brighter pixel means using pixel from an older frame."); + addNodeObject(filter, "Shape Map", s_node_shape_map, "Node_Shape_Map", [1, Node_Shape_Map]).setVersion(11660); addNodeObject(filter, "Morph Surface", s_node_morph_surface, "Node_Morph_Surface", [1, Node_Morph_Surface],, "Morph pixel between two surfaces.").setVersion(1141); ds_list_add(filter, "Effects"); @@ -655,7 +657,8 @@ function __initNodes() { addNodeObject(generator, "Random Shape", s_node_random_shape, "Node_Random_Shape", [1, Node_Random_Shape],, "Generate random shape, use for testing purposes.").setVersion(1147); addNodeObject(generator, "Pixel Builder", s_node_pixel_builder, "Node_Pixel_Builder", [1, Node_Pixel_Builder]).setVersion(11540); addNodeObject(generator, "Bar / Graph", s_node_bar_graph, "Node_Plot_Linear", [1, Node_Plot_Linear], ["graph", "waveform", "bar chart", "plot"], "Plot graph or bar chart from array of number.").setVersion(1144); - + addNodeObject(generator, "Profile", s_node_profile, "Node_Path_Profile", [1, Node_Path_Profile]).setVersion(11660); + ds_list_add(generator, "Noises"); addNodeObject(generator, "Noise", s_node_noise, "Node_Noise", [1, Node_Noise],, "Generate white noise."); addNodeObject(generator, "Perlin Noise", s_node_noise_perlin, "Node_Perlin", [1, Node_Perlin],, "Generate perlin noise."); diff --git a/scripts/node_scatter/node_scatter.gml b/scripts/node_scatter/node_scatter.gml index c48e32ada..b895348a2 100644 --- a/scripts/node_scatter/node_scatter.gml +++ b/scripts/node_scatter/node_scatter.gml @@ -28,7 +28,7 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c inputs[| 5] = nodeValue("Area", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ DEF_SURF_W / 2, DEF_SURF_H / 2, DEF_SURF_W / 2, DEF_SURF_H / 2, AREA_SHAPE.rectangle ]) .setDisplay(VALUE_DISPLAY.area, { onSurfaceSize }); - inputs[| 6] = nodeValue("Distribution", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 6] = nodeValue("Distribution", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 5) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Area", "Border", "Map", "Direct Data", "Path", "Full image + Tile" ]); inputs[| 7] = nodeValue("Point at center", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Rotate each copy to face the spawn center."); @@ -100,12 +100,18 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c inputs[| 31] = nodeValue("Auto amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); - inputs[| 32] = nodeValue("Twisting", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + inputs[| 32] = nodeValue("Rotate per radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) .setDisplay(VALUE_DISPLAY.rotation); inputs[| 33] = nodeValue("Random position", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector_range); + inputs[| 34] = nodeValue("Scale per radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) + .setDisplay(VALUE_DISPLAY.vector); + + inputs[| 35] = nodeValue("Angle range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 360 ]) + .setDisplay(VALUE_DISPLAY.rotation_range); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); outputs[| 1] = nodeValue("Atlas data", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, []) @@ -114,11 +120,11 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c input_display_list = [ ["Surfaces", true], 0, 1, 15, 10, 24, 25, 26, 27, - ["Scatter", false], 6, 5, 13, 14, 17, 9, 31, 2, 30, + ["Scatter", false], 6, 5, 13, 14, 17, 9, 31, 2, 30, 35, ["Path", false], 19, 20, 21, 22, ["Position", false], 33, ["Rotation", false], 7, 4, 32, - ["Scale", false], 3, 8, + ["Scale", false], 3, 8, 34, ["Render", false], 18, 11, 28, 12, 16, 23, ]; @@ -183,6 +189,8 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c inputs[| 30].setVisible(false); inputs[| 31].setVisible(false); inputs[| 32].setVisible(false); + inputs[| 34].setVisible(false); + inputs[| 35].setVisible(false); if(_dis == 0 && _sct == 0) { if(_are[AREA_INDEX.shape] == AREA_SHAPE.elipse) { @@ -192,6 +200,9 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c inputs[| 30].setVisible(!_aut); inputs[| 31].setVisible( true); inputs[| 32].setVisible(!_aut); + inputs[| 34].setVisible(!_aut); + inputs[| 35].setVisible(!_aut); + } else { inputs[| 2].setVisible(false); inputs[| 30].setVisible( true); @@ -251,6 +262,8 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c var uniAut = _data[31]; var uniRot = _data[32]; var posWig = _data[33]; + var uniSca = _data[34]; + var cirRng = _data[35]; var _in_w, _in_h; @@ -359,6 +372,9 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c var sp = noone, _x = 0, _y = 0; var _v = noone; + var _scx = _scaUniX? _scale[0] : random_range(_scale[0], _scale[1]); + var _scy = _scaUniY? _scale[2] : random_range(_scale[2], _scale[3]); + switch(_dist) { #region position case NODE_SCATTER_DIST.area : if(_scat == 0) { @@ -382,12 +398,15 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c _x = sp[0]; _y = sp[1]; } else { - var _ang = _acol * 360 / uniAmo[0]; + var _ang = cirRng[0] + _acol * (cirRng[1] - cirRng[0]) / uniAmo[0]; var _rad = uniAmo[1] == 1? 0.5 : _arow / (uniAmo[1] - 1); _ang += _arow * uniRot; _x += _axc + lengthdir_x(_rad * _aw, _ang); _y += _ayc + lengthdir_y(_rad * _ah, _ang); + + _scx += _arow * uniSca[0]; + _scy += _arow * uniSca[1]; } } } else { @@ -448,9 +467,10 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c if(_wigX) _x += random_range(posWig[0], posWig[1]); if(_wigY) _y += random_range(posWig[2], posWig[3]); - var _scx = _scaUniX? _scale[0] : random_range(_scale[0], _scale[1]); - var _scy = _scaUniY? _scale[2] : random_range(_scale[2], _scale[3]); - if(_unis) _scy = _scx; + if(_unis) { + _scy = max(_scx, _scy); + _scx = _scy; + } if(vSca && _v != noone) { _scx *= _v; @@ -508,8 +528,8 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c var sh = dim[1]; if(_r == 0) { - _x -= sw / 2; - _y -= sh / 2; + _x -= sw * _scx / 2; + _y -= sh * _scy / 2; } else { _p = point_rotate(_x - sw / 2 * _scx, _y - sh * _scy / 2, _x, _y, _r, _p); _x = _p[0]; diff --git a/scripts/node_shape_map/node_alpha_to_grey.yy b/scripts/node_shape_map/node_alpha_to_grey.yy new file mode 100644 index 000000000..fde448fca --- /dev/null +++ b/scripts/node_shape_map/node_alpha_to_grey.yy @@ -0,0 +1,12 @@ +{ + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "filter", + "path": "folders/nodes/data/filter.yy", + }, + "resourceVersion": "1.0", + "name": "node_alpha_to_grey", + "tags": [], + "resourceType": "GMScript", +} \ No newline at end of file diff --git a/scripts/node_shape_map/node_bw.yy b/scripts/node_shape_map/node_bw.yy new file mode 100644 index 000000000..6d2681493 --- /dev/null +++ b/scripts/node_shape_map/node_bw.yy @@ -0,0 +1,12 @@ +{ + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "filter", + "path": "folders/nodes/data/filter.yy", + }, + "resourceVersion": "1.0", + "name": "node_bw", + "tags": [], + "resourceType": "GMScript", +} \ No newline at end of file diff --git a/scripts/node_shape_map/node_color_adjustment.yy b/scripts/node_shape_map/node_color_adjustment.yy new file mode 100644 index 000000000..8df16cc8c --- /dev/null +++ b/scripts/node_shape_map/node_color_adjustment.yy @@ -0,0 +1,12 @@ +{ + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "filter", + "path": "folders/nodes/data/filter.yy", + }, + "resourceVersion": "1.0", + "name": "node_color_adjustment", + "tags": [], + "resourceType": "GMScript", +} \ No newline at end of file diff --git a/scripts/node_shape_map/node_color_replacement.yy b/scripts/node_shape_map/node_color_replacement.yy new file mode 100644 index 000000000..024aa6a80 --- /dev/null +++ b/scripts/node_shape_map/node_color_replacement.yy @@ -0,0 +1,12 @@ +{ + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "process", + "path": "folders/nodes/data/process.yy", + }, + "resourceVersion": "1.0", + "name": "node_color_replacement", + "tags": [], + "resourceType": "GMScript", +} \ No newline at end of file diff --git a/scripts/node_shape_map/node_greyscale.yy b/scripts/node_shape_map/node_greyscale.yy new file mode 100644 index 000000000..ee372977e --- /dev/null +++ b/scripts/node_shape_map/node_greyscale.yy @@ -0,0 +1,12 @@ +{ + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "filter", + "path": "folders/nodes/data/filter.yy", + }, + "resourceVersion": "1.0", + "name": "node_greyscale", + "tags": [], + "resourceType": "GMScript", +} \ No newline at end of file diff --git a/scripts/node_shape_map/node_outline.yy b/scripts/node_shape_map/node_outline.yy new file mode 100644 index 000000000..86468bc09 --- /dev/null +++ b/scripts/node_shape_map/node_outline.yy @@ -0,0 +1,12 @@ +{ + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "process", + "path": "folders/nodes/data/process.yy", + }, + "resourceVersion": "1.0", + "name": "node_outline", + "tags": [], + "resourceType": "GMScript", +} \ No newline at end of file diff --git a/scripts/node_shape_map/node_shape_map.gml b/scripts/node_shape_map/node_shape_map.gml new file mode 100644 index 000000000..820815c79 --- /dev/null +++ b/scripts/node_shape_map/node_shape_map.gml @@ -0,0 +1,78 @@ +function Node_Shape_Map(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { + name = "Shape Map"; + + 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); + active_index = 1; + + inputs[| 2] = nodeValue("Shape", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_scroll, [ new scrollItem("Circle", s_node_shape_type, 1), + new scrollItem("Polygon", s_node_shape_type, 2), ]); + + inputs[| 3] = nodeValue("Map Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 4, 1 ]) + .setDisplay(VALUE_DISPLAY.vector); + + inputs[| 4] = nodeValue("Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5); + + inputs[| 5] = nodeValue("Sides", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4); + + inputs[| 6] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 2, 0.01 ] }); + + inputs[| 7] = nodeValue("Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.rotation); + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 1, + ["Surfaces", true], 0, + ["Shape", false], 2, 4, 5, 6, 7, + ["Mapping", false], 3, + ]; + + attribute_surface_depth(); + attribute_oversample(); + attribute_interpolation(); + + static step = function() { #region + var _shape = getInputData(2); + + inputs[| 5].setVisible(_shape == 1); + } #endregion + + static processData = function(_outSurf, _data, _output_index, _array_index) { #region + var _shape = _data[2]; + var _scale = _data[3]; + var _radius = _data[4]; + var _sides = _data[5]; + var _sca = _data[6]; + var _rot = _data[7]; + + var _dim = surface_get_dimension(_data[0]); + + if(_shape == 0) { + surface_set_shader(_outSurf, sh_shape_map_circle); + shader_set_interpolation(_data[0]); + shader_set_f("scale", _scale); + shader_set_f("txScale", _sca); + shader_set_f("angle", _rot); + + draw_surface_safe(_data[0]); + surface_reset_shader(); + + } else if(_shape == 1) { + surface_set_shader(_outSurf, sh_shape_map_polygon); + shader_set_interpolation(_data[0]); + shader_set_f("sides", _sides); + shader_set_f("scale", _scale); + shader_set_f("txScale", _sca); + shader_set_f("angle", _rot); + + draw_surface_safe(_data[0]); + surface_reset_shader(); + } + + return _outSurf; + } #endregion +} \ No newline at end of file diff --git a/scripts/node_shape_map/node_shape_map.yy b/scripts/node_shape_map/node_shape_map.yy new file mode 100644 index 000000000..bf8f7507a --- /dev/null +++ b/scripts/node_shape_map/node_shape_map.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "node_shape_map", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "warps", + "path": "folders/nodes/data/filter/warps.yy", + }, +} \ No newline at end of file diff --git a/scripts/node_shell/node_shell.gml b/scripts/node_shell/node_shell.gml index 958085c41..3328ba868 100644 --- a/scripts/node_shell/node_shell.gml +++ b/scripts/node_shell/node_shell.gml @@ -12,11 +12,9 @@ function Node_Shell(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { insp1UpdateTooltip = "Run"; insp1UpdateIcon = [ THEME.sequence_control, 1, COLORS._main_value_positive ]; - trusted = false; + trusted = PROGRAM_ARGUMENTS._trusted; - static onValueUpdate = function() { - trusted = false; - } + static onValueUpdate = function() { trusted = false; } static onInspector1Update = function() { update(); } diff --git a/scripts/node_simple_shape/node_simple_shape.gml b/scripts/node_simple_shape/node_simple_shape.gml index 2da771055..0848eca0c 100644 --- a/scripts/node_simple_shape/node_simple_shape.gml +++ b/scripts/node_simple_shape/node_simple_shape.gml @@ -66,13 +66,16 @@ function Node_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con inputs[| 19] = nodeValue("Shape Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) .setDisplay(VALUE_DISPLAY.rotation); + inputs[| 20] = nodeValue("Level", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ]) + .setDisplay(VALUE_DISPLAY.slider_range); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ ["Output", false], 0, 6, ["Transform", false], 15, 3, 16, 17, 19, ["Shape", false], 14, 2, 9, 4, 13, 5, 7, 8, - ["Render", true], 10, 12, 18, + ["Render", true], 10, 12, 20, 18, ["Background", true, 1], 11, ]; @@ -113,6 +116,7 @@ function Node_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con var _posTyp = _data[15]; var _tile = _data[18]; var _rotat = _data[19]; + var _level = _data[20]; var _center = [ 0, 0 ]; var _scale = [ 0, 0 ]; @@ -307,6 +311,7 @@ function Node_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con shader_set_f("bgColor", _bgcol); shader_set_i("aa", _aa); shader_set_i("drawDF", _df); + shader_set_f("dfLevel", _level); shader_set_i("tile", _tile); shader_set_f("corner", _corner); diff --git a/scripts/node_wrap_mesh/node_wrap_mesh.gml b/scripts/node_wrap_mesh/node_wrap_mesh.gml index b4525d0b5..0c2db7b5b 100644 --- a/scripts/node_wrap_mesh/node_wrap_mesh.gml +++ b/scripts/node_wrap_mesh/node_wrap_mesh.gml @@ -654,6 +654,15 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) data.tris[i].initSurface(is_array(_inSurf)? _inSurf[0] : _inSurf); triggerRender(); + + if(loadPin != noone) { + for( var i = 0, n = array_length(loadPin); i < n; i++ ) { + var ind = loadPin[i]; + if(ind < array_length(points)) + points[ind].pin = true; + } + loadPin = noone; + } } #endregion static Control_affectPoint = function(c, p) { #region @@ -811,14 +820,5 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) static postLoad = function() { #region will_triangluate = true; - - if(loadPin == noone) return; - - for( var i = 0, n = array_length(loadPin); i < n; i++ ) { - var ind = loadPin[i]; - if(ind < array_length(points)) - points[ind].pin = true; - } - loadPin = noone; } #endregion } \ No newline at end of file diff --git a/scripts/panel_console/panel_console.gml b/scripts/panel_console/panel_console.gml index a1f1dfa62..8ad1eb401 100644 --- a/scripts/panel_console/panel_console.gml +++ b/scripts/panel_console/panel_console.gml @@ -22,51 +22,6 @@ function Panel_Console() : PanelContent() constructor { scroll_y = 0; prevFocus = false; - static submit_command = function() { #region - if(command == "") return; - array_push(CMD, cmdLineIn(command)); - array_push(CMDIN, command); - - var cmd = string_splice(command, " ", false, false); - - switch(cmd[0]) { - case "flag": - if(array_length(cmd) < 2) { - array_push(CMD, cmdLine($"Error: \"{cmd[0]}\" not enough argument.", COLORS._main_value_negative) ); - break; - } - var flg = cmd[1]; - global.FLAG[$ flg] = !global.FLAG[$ flg]; - - array_push(CMD, cmdLine($"Toggled debug flag: {flg} = {global.FLAG[$ flg]? "True" : "False"}", COLORS._main_value_positive) ); - break; - default: - if(struct_has(FUNCTIONS, cmd[0])) { - var _f = FUNCTIONS[$ cmd[0]]; - var _vars = string_splice(array_safe_get(cmd, 1, ""), ","); - var _args = []; - - for( var i = 0, n = array_length(_f.args); i < n; i++ ) { - var _arg = _f.args[i]; - var _def = _arg.fn? _arg.def() : _arg.def; - - if(i < array_length(_vars) && _vars[i] != "") { - if(is_real(_def)) _args[i] = toNumber(_vars[i]); - else _args[i] = _vars[i]; - } else - _args[i] = _def; - } - - callFunction(cmd[0], _args); - } else - array_push(CMD, cmdLine($"Error: \"{cmd[0]}\" command not found.", COLORS._main_value_negative) ); - break; - } - - command = ""; - keyboard_string = ""; - } #endregion - function drawHistory(_y) { #region var _x = ui(32 + 8); var _w = w - ui(16 + 32); @@ -149,7 +104,11 @@ function Panel_Console() : PanelContent() constructor { if(pFOCUS) { if(keyboard_check_pressed(vk_enter)) { - submit_command(); + cmd_submit(command); + + command = ""; + keyboard_string = ""; + } else if(keyboard_check_pressed(vk_up)) { cmd_index = max(0, cmd_index - 1); diff --git a/shaders/sh_bevel/sh_bevel.fsh b/shaders/sh_bevel/sh_bevel.fsh index 2366a4689..c0441f04d 100644 --- a/shaders/sh_bevel/sh_bevel.fsh +++ b/shaders/sh_bevel/sh_bevel.fsh @@ -21,11 +21,16 @@ vec4 sampleTexture(vec2 pos) { #region if(sampleMode == 0) return vec4(0.); - if(sampleMode == 1) + + else if(sampleMode == 1) return texture2D(gm_BaseTexture, clamp(pos, 0., 1.)); - if(sampleMode == 2) + + else if(sampleMode == 2) return texture2D(gm_BaseTexture, fract(pos)); + else if(sampleMode == 3) + return vec4(vec3(0.), 1.); + return vec4(0.); } #endregion diff --git a/shaders/sh_bevel_highp/sh_bevel_highp.fsh b/shaders/sh_bevel_highp/sh_bevel_highp.fsh index b418d4a77..6487982a9 100644 --- a/shaders/sh_bevel_highp/sh_bevel_highp.fsh +++ b/shaders/sh_bevel_highp/sh_bevel_highp.fsh @@ -21,11 +21,16 @@ vec4 sampleTexture(vec2 pos) { #region if(sampleMode == 0) return vec4(0.); - if(sampleMode == 1) + + else if(sampleMode == 1) return texture2D(gm_BaseTexture, clamp(pos, 0., 1.)); - if(sampleMode == 2) + + else if(sampleMode == 2) return texture2D(gm_BaseTexture, fract(pos)); + else if(sampleMode == 3) + return vec4(vec3(0.), 1.); + return vec4(0.); } #endregion diff --git a/shaders/sh_blur_directional/sh_blur_directional.fsh b/shaders/sh_blur_directional/sh_blur_directional.fsh index d11c44d34..0b908db86 100644 --- a/shaders/sh_blur_directional/sh_blur_directional.fsh +++ b/shaders/sh_blur_directional/sh_blur_directional.fsh @@ -22,11 +22,16 @@ vec4 sampleTexture(vec2 pos) { #region if(sampleMode == 0) return vec4(0.); - if(sampleMode == 1) - return texture2D(gm_BaseTexture, clamp(pos, 0., 1.)); - if(sampleMode == 2) + + else if(sampleMode == 1) + return texture2D(gm_BaseTexture, clamp(pos, 0., 1.));\ + + else if(sampleMode == 2) return texture2D(gm_BaseTexture, fract(pos)); + else if(sampleMode == 3) + return vec4(vec3(0.), 1.); + return vec4(0.); } #endregion diff --git a/shaders/sh_blur_gaussian/sh_blur_gaussian.fsh b/shaders/sh_blur_gaussian/sh_blur_gaussian.fsh index 8d744af70..b4439b635 100644 --- a/shaders/sh_blur_gaussian/sh_blur_gaussian.fsh +++ b/shaders/sh_blur_gaussian/sh_blur_gaussian.fsh @@ -20,11 +20,16 @@ vec4 sampleTexture(vec2 pos) { if(sampleMode == 0) return vec4(0.); - if(sampleMode == 1) + + else if(sampleMode == 1) return texture2D(gm_BaseTexture, clamp(pos, 0., 1.)); - if(sampleMode == 2) + + else if(sampleMode == 2) return texture2D(gm_BaseTexture, fract(pos)); + else if(sampleMode == 3) + return vec4(vec3(0.), 1.); + return vec4(0.); } diff --git a/shaders/sh_blur_radial/sh_blur_radial.fsh b/shaders/sh_blur_radial/sh_blur_radial.fsh index 659d7ea9d..2273fcabf 100644 --- a/shaders/sh_blur_radial/sh_blur_radial.fsh +++ b/shaders/sh_blur_radial/sh_blur_radial.fsh @@ -69,11 +69,16 @@ vec4 sampleTexture(vec2 pos) { #region if(sampleMode == 0) return vec4(0.); - if(sampleMode == 1) + + else if(sampleMode == 1) return texture2Dintp(gm_BaseTexture, clamp(pos, 0., 1.)); - if(sampleMode == 2) + + else if(sampleMode == 2) return texture2Dintp(gm_BaseTexture, fract(pos)); + else if(sampleMode == 3) + return vec4(vec3(0.), 1.); + return vec4(0.); } #endregion diff --git a/shaders/sh_blur_shape/sh_blur_shape.fsh b/shaders/sh_blur_shape/sh_blur_shape.fsh index 5040e0913..a8235e3a2 100644 --- a/shaders/sh_blur_shape/sh_blur_shape.fsh +++ b/shaders/sh_blur_shape/sh_blur_shape.fsh @@ -29,11 +29,16 @@ vec4 sampleTexture(vec2 pos) { #region if(sampleMode == 0) return vec4(0.); - if(sampleMode == 1) + + else if(sampleMode == 1) return texture2D(gm_BaseTexture, clamp(pos, 0., 1.)); - if(sampleMode == 2) + + else if(sampleMode == 2) return texture2D(gm_BaseTexture, fract(pos)); + else if(sampleMode == 3) + return vec4(vec3(0.), 1.); + return vec4(0.); } #endregion diff --git a/shaders/sh_blur_simple/sh_blur_simple.fsh b/shaders/sh_blur_simple/sh_blur_simple.fsh index 0f265febc..93032fadb 100644 --- a/shaders/sh_blur_simple/sh_blur_simple.fsh +++ b/shaders/sh_blur_simple/sh_blur_simple.fsh @@ -26,11 +26,16 @@ vec4 sampleTexture(vec2 pos) { if(sampleMode == 0) return vec4(0.); - if(sampleMode == 1) + + else if(sampleMode == 1) return texture2D(gm_BaseTexture, clamp(pos, 0., 1.)); - if(sampleMode == 2) + + else if(sampleMode == 2) return texture2D(gm_BaseTexture, fract(pos)); + else if(sampleMode == 3) + return vec4(vec3(0.), 1.); + return vec4(0.); } diff --git a/shaders/sh_blur_slope/sh_blur_slope.fsh b/shaders/sh_blur_slope/sh_blur_slope.fsh index 3b13861d1..caa4e2b0e 100644 --- a/shaders/sh_blur_slope/sh_blur_slope.fsh +++ b/shaders/sh_blur_slope/sh_blur_slope.fsh @@ -68,9 +68,10 @@ vec4 sampleTexture(sampler2D texture, vec2 pos) { #region return texture2Dintp(texture, pos); if(sampleMode == 0) return vec4(0.); - if(sampleMode == 1) return texture2Dintp(texture, clamp(pos, 0., 1.)); - if(sampleMode == 2) return texture2Dintp(texture, fract(pos)); - + else if(sampleMode == 1) return texture2Dintp(texture, clamp(pos, 0., 1.)); + else if(sampleMode == 2) return texture2Dintp(texture, fract(pos)); + else if(sampleMode == 3) return vec4(vec3(0.), 1.); + return vec4(0.); } #endregion diff --git a/shaders/sh_blur_zoom/sh_blur_zoom.fsh b/shaders/sh_blur_zoom/sh_blur_zoom.fsh index 3d2bb03d1..3bdb4c4ca 100644 --- a/shaders/sh_blur_zoom/sh_blur_zoom.fsh +++ b/shaders/sh_blur_zoom/sh_blur_zoom.fsh @@ -46,11 +46,16 @@ vec4 sampleTexture(vec2 pos) { #region if(sampleMode == 0) return vec4(0.); - if(sampleMode == 1) + + else if(sampleMode == 1) return texture2D(gm_BaseTexture, clamp(pos, 0., 1.)); - if(sampleMode == 2) + + else if(sampleMode == 2) return texture2D(gm_BaseTexture, fract(pos)); + else if(sampleMode == 3) + return vec4(vec3(0.), 1.); + return vec4(0.); } #endregion diff --git a/shaders/sh_camera/sh_camera.fsh b/shaders/sh_camera/sh_camera.fsh index bac4e97d5..e24b37002 100644 --- a/shaders/sh_camera/sh_camera.fsh +++ b/shaders/sh_camera/sh_camera.fsh @@ -28,10 +28,13 @@ vec4 sampleTexture(sampler2D samp, vec2 pos) { if(sampleMode == 0) return vec4(0.); + else if(sampleMode == 1) return texture2D(samp, fract(pos)); + else if(sampleMode == 2) return texture2D(samp, vec2(fract(pos.x), pos.y)); + else if(sampleMode == 3) return texture2D(samp, vec2(pos.x, fract(pos.y))); diff --git a/shaders/sh_convolution/sh_convolution.fsh b/shaders/sh_convolution/sh_convolution.fsh index d86039832..db3819989 100644 --- a/shaders/sh_convolution/sh_convolution.fsh +++ b/shaders/sh_convolution/sh_convolution.fsh @@ -14,11 +14,16 @@ vec4 sampleTexture(vec2 pos) { if(sampleMode == 0) return vec4(0.); - if(sampleMode == 1) + + else if(sampleMode == 1) return texture2D(gm_BaseTexture, clamp(pos, 0., 1.)); - if(sampleMode == 2) + + else if(sampleMode == 2) return texture2D(gm_BaseTexture, fract(pos)); + else if(sampleMode == 3) + return vec4(vec3(0.), 1.); + return vec4(0.); } diff --git a/shaders/sh_dilate/sh_dilate.fsh b/shaders/sh_dilate/sh_dilate.fsh index 40dcf0aba..c9b81a1d4 100644 --- a/shaders/sh_dilate/sh_dilate.fsh +++ b/shaders/sh_dilate/sh_dilate.fsh @@ -70,11 +70,16 @@ vec4 sampleTexture(vec2 pos) { #region if(sampleMode == 0) return vec4(0.); - if(sampleMode == 1) + + else if(sampleMode == 1) return texture2Dintp(gm_BaseTexture, clamp(pos, 0., 1.)); - if(sampleMode == 2) + + else if(sampleMode == 2) return texture2Dintp(gm_BaseTexture, fract(pos)); + else if(sampleMode == 3) + return vec4(vec3(0.), 1.); + return vec4(0.); } #endregion diff --git a/shaders/sh_displace/sh_displace.fsh b/shaders/sh_displace/sh_displace.fsh index 040bb6f6a..a372a7886 100644 --- a/shaders/sh_displace/sh_displace.fsh +++ b/shaders/sh_displace/sh_displace.fsh @@ -72,24 +72,35 @@ float bright(in vec4 col) { return dot(col.rgb, vec3(0.2126, 0.7152, 0.0722)) * if(sampleMode == 0) return vec4(0.); - if(sampleMode == 1) + + else if(sampleMode == 1) return texture2Dintp(gm_BaseTexture, clamp(pos, 0., 1.)); - if(sampleMode == 2) + + else if(sampleMode == 2) return texture2Dintp(gm_BaseTexture, fract(pos)); - + + else if(sampleMode == 3) + return vec4(vec3(0.), 1.); + return vec4(0.); } #endregion /////////////// SAMPLING /////////////// vec2 shiftMap(in vec2 pos, in float str) { #region + vec2 tx = 1. / dimension; vec4 disP = texture2Dintp( map, pos ); + vec2 raw_displace = displace * tx; + vec2 sam_pos; - vec2 raw_displace = displace / dimension; float _str; vec2 _disp; - if(mode == 1) { + if(mode == 0) { + _str = (bright(disP) - middle) * str; + sam_pos = pos + _str * raw_displace; + + } else if(mode == 1) { if(sepAxis == 0) _disp = vec2(disP.r - middle, disP.g - middle) * vec2((disP.r + disP.g + disP.b) / 3. - middle) * str; else if(sepAxis == 1) { @@ -100,6 +111,7 @@ vec2 shiftMap(in vec2 pos, in float str) { #region } sam_pos = pos + _disp; + } else if(mode == 2) { float _ang; @@ -114,10 +126,15 @@ vec2 shiftMap(in vec2 pos, in float str) { #region } sam_pos = pos + _str * vec2(cos(_ang), sin(_ang)); - } else { - _str = (bright(disP) - middle) * str; - sam_pos = pos + _str * raw_displace; + } else if(mode == 3) { + vec4 d0 = texture2Dintp( map, pos + vec2( tx.x, 0.) ); float h0 = (d0.r + d0.g + d0.b) / 3.; + vec4 d1 = texture2Dintp( map, pos - vec2( 0., tx.y) ); float h1 = (d1.r + d1.g + d1.b) / 3.; + vec4 d2 = texture2Dintp( map, pos - vec2( tx.x, 0.) ); float h2 = (d2.r + d2.g + d2.b) / 3.; + vec4 d3 = texture2Dintp( map, pos + vec2( 0., tx.y) ); float h3 = (d3.r + d3.g + d3.b) / 3.; + + vec2 grad = vec2( h0 - h2, h3 - h1 ) - middle; + sam_pos = pos + grad * str; } return sam_pos; @@ -154,7 +171,7 @@ void main() { #region for(float i = 0.; i < stMax; i++) { if(i >= stren) break; - samPos = shiftMap(samPos, 1.); + samPos = shiftMap(samPos, min(1., stren - i)); ncol = blend(ccol, sampleTexture( samPos )); } } else { diff --git a/shaders/sh_edge_detect/sh_edge_detect.fsh b/shaders/sh_edge_detect/sh_edge_detect.fsh index 24f3c9c99..62fc5c40a 100644 --- a/shaders/sh_edge_detect/sh_edge_detect.fsh +++ b/shaders/sh_edge_detect/sh_edge_detect.fsh @@ -14,11 +14,16 @@ vec4 sampleTexture(vec2 pos) { if(sampleMode == 0) return vec4(0.); - if(sampleMode == 1) + + else if(sampleMode == 1) return texture2D(gm_BaseTexture, clamp(pos, 0., 1.)); - if(sampleMode == 2) + + else if(sampleMode == 2) return texture2D(gm_BaseTexture, fract(pos)); + else if(sampleMode == 3) + return vec4(vec3(0.), 1.); + return vec4(0.); } diff --git a/shaders/sh_local_analyze/sh_local_analyze.fsh b/shaders/sh_local_analyze/sh_local_analyze.fsh index 295efec11..dd93baaa8 100644 --- a/shaders/sh_local_analyze/sh_local_analyze.fsh +++ b/shaders/sh_local_analyze/sh_local_analyze.fsh @@ -17,11 +17,16 @@ vec4 sampleTexture(vec2 pos) { #region if(sampleMode == 0) return vec4(0.); - if(sampleMode == 1) + + else if(sampleMode == 1) return texture2D(gm_BaseTexture, clamp(pos, 0., 1.)); - if(sampleMode == 2) + + else if(sampleMode == 2) return texture2D(gm_BaseTexture, fract(pos)); + else if(sampleMode == 3) + return vec4(vec3(0.), 1.); + return vec4(0.); } #endregion diff --git a/shaders/sh_noise_grid_hex/sh_noise_grid_hex.fsh b/shaders/sh_noise_grid_hex/sh_noise_grid_hex.fsh index d19a0f196..e243ea25e 100644 --- a/shaders/sh_noise_grid_hex/sh_noise_grid_hex.fsh +++ b/shaders/sh_noise_grid_hex/sh_noise_grid_hex.fsh @@ -18,11 +18,16 @@ vec4 sampleTexture(vec2 pos) { if(sampleMode == 0) return vec4(0.); - if(sampleMode == 1) + + else if(sampleMode == 1) return texture2D(gm_BaseTexture, clamp(pos, 0., 1.)); - if(sampleMode == 2) + + else if(sampleMode == 2) return texture2D(gm_BaseTexture, fract(pos)); + else if(sampleMode == 3) + return vec4(vec3(0.), 1.); + return vec4(0.); } diff --git a/shaders/sh_noise_grid_tri/sh_noise_grid_tri.fsh b/shaders/sh_noise_grid_tri/sh_noise_grid_tri.fsh index 57ab82255..77ba4d346 100644 --- a/shaders/sh_noise_grid_tri/sh_noise_grid_tri.fsh +++ b/shaders/sh_noise_grid_tri/sh_noise_grid_tri.fsh @@ -18,11 +18,16 @@ vec4 sampleTexture(vec2 pos) { if(sampleMode == 0) return vec4(0.); - if(sampleMode == 1) + + else if(sampleMode == 1) return texture2D(gm_BaseTexture, clamp(pos, 0., 1.)); - if(sampleMode == 2) + + else if(sampleMode == 2) return texture2D(gm_BaseTexture, fract(pos)); + else if(sampleMode == 3) + return vec4(vec3(0.), 1.); + return vec4(0.); } diff --git a/shaders/sh_outline/sh_outline.fsh b/shaders/sh_outline/sh_outline.fsh index 596ae62e6..408b24aa4 100644 --- a/shaders/sh_outline/sh_outline.fsh +++ b/shaders/sh_outline/sh_outline.fsh @@ -38,11 +38,16 @@ vec4 sampleTexture(vec2 pos) { #region if(sampleMode == 0) return vec4(0.); - if(sampleMode == 1) + + else if(sampleMode == 1) return texture2D(gm_BaseTexture, clamp(pos, 0., 1.)); - if(sampleMode == 2) + + else if(sampleMode == 2) return texture2D(gm_BaseTexture, fract(pos)); + else if(sampleMode == 3) + return vec4(vec3(0.), 1.); + return vec4(0.); } #endregion diff --git a/shaders/sh_path_fill_profile/sh_path_fill_profile.fsh b/shaders/sh_path_fill_profile/sh_path_fill_profile.fsh new file mode 100644 index 000000000..3c21d9131 --- /dev/null +++ b/shaders/sh_path_fill_profile/sh_path_fill_profile.fsh @@ -0,0 +1,63 @@ +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +#define MAXPATH 1024 + +uniform vec4 color; +uniform vec4 bgColor; +uniform vec2 dimension; +uniform vec2 path[MAXPATH]; +uniform int pathLength; +uniform int side; +uniform int mirror; +uniform int aa; +uniform int bg; + +void main() { + vec2 px = v_vTexcoord * dimension; + vec2 dm = dimension; + float it = 0.; + float ds = 999999.; + + gl_FragColor = vec4(0.); + + if(side > 1) { + px = px.yx; + dm = dm.yx; + } + if(mirror == 1 && px.x < dm.x / 2.) px.x = dm.x - px.x; + if(side == 1 || side == 3) px.x = 1. - px.x; + + for(int i = 1; i < MAXPATH; i++) { + if(i >= pathLength) break; + + vec2 p0 = path[i - 1]; + vec2 p1 = path[i]; + + if(side > 1) { + p0 = p0.yx; + p1 = p1.yx; + } + + if(side == 1 || side == 3) { + p0.x = 1. - p0.x; + p1.x = 1. - p1.x; + } + + if(p0.x < px.x && p1.x < px.x) continue; + if(p0.y < px.y && p1.y < px.y) continue; + if(p0.y > px.y && p1.y > px.y) continue; + + float _s = (p1.x - p0.x) / (p1.y - p0.y); + float _x = p0.x + _s * (px.y - p0.y); + + if(_x > px.x) it++; + + ds = min(ds, abs(px.x - _x)); + } + + if(mod(it, 2.) == 1.) { + gl_FragColor = color; + if(aa == 1) gl_FragColor.a *= min(1., ds); + } +} diff --git a/shaders/sh_path_fill_profile/sh_path_fill_profile.vsh b/shaders/sh_path_fill_profile/sh_path_fill_profile.vsh new file mode 100644 index 000000000..3900c20f4 --- /dev/null +++ b/shaders/sh_path_fill_profile/sh_path_fill_profile.vsh @@ -0,0 +1,19 @@ +// +// Simple passthrough vertex shader +// +attribute vec3 in_Position; // (x,y,z) +//attribute vec3 in_Normal; // (x,y,z) unused in this shader. +attribute vec4 in_Colour; // (r,g,b,a) +attribute vec2 in_TextureCoord; // (u,v) + +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +void main() +{ + vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0); + gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos; + + v_vColour = in_Colour; + v_vTexcoord = in_TextureCoord; +} diff --git a/shaders/sh_path_fill_profile/sh_path_fill_profile.yy b/shaders/sh_path_fill_profile/sh_path_fill_profile.yy new file mode 100644 index 000000000..52031f689 --- /dev/null +++ b/shaders/sh_path_fill_profile/sh_path_fill_profile.yy @@ -0,0 +1,10 @@ +{ + "resourceType": "GMShader", + "resourceVersion": "1.0", + "name": "sh_path_fill_profile", + "parent": { + "name": "generator", + "path": "folders/shader/generator.yy", + }, + "type": 1, +} \ No newline at end of file diff --git a/shaders/sh_polar/sh_polar.fsh b/shaders/sh_polar/sh_polar.fsh index 7337adb44..c89b9b236 100644 --- a/shaders/sh_polar/sh_polar.fsh +++ b/shaders/sh_polar/sh_polar.fsh @@ -13,9 +13,9 @@ uniform sampler2D blendSurf; #region /////////////// SAMPLING /////////////// -const float PI = 3.14159265358979323846; -uniform int interpolation; -uniform vec2 sampleDimension; +const float PI = 3.14159265358979323846; +uniform int interpolation; +uniform vec2 sampleDimension; const int RSIN_RADIUS = 1; diff --git a/shaders/sh_region_fill_border/sh_region_fill_border.fsh b/shaders/sh_region_fill_border/sh_region_fill_border.fsh index a64007fad..ffab226f6 100644 --- a/shaders/sh_region_fill_border/sh_region_fill_border.fsh +++ b/shaders/sh_region_fill_border/sh_region_fill_border.fsh @@ -1,15 +1,10 @@ varying vec2 v_vTexcoord; varying vec4 v_vColour; -#define ITERATION 8. +#define ITERATION 2. -uniform vec2 dimension; uniform sampler2D original; - -vec4 sample ( vec2 position ) { - if(position.x < 0. || position.y < 0. || position.x > 1. || position.y > 1.) return vec4(0.); - return texture2D( gm_BaseTexture, position ); -} +uniform vec2 dimension; void main() { vec2 tx = 1. / dimension; @@ -18,14 +13,16 @@ void main() { gl_FragColor = c; if(c.a == 1.) return; - if(o.a == 0.) return; - + float minD = ITERATION; for( float i = 1.; i < ITERATION; i++ ) { if(i >= minD) break; - vec4 s = sample( v_vTexcoord + vec2(tx.x * i, 0.) ); + vec2 x = v_vTexcoord + vec2(tx.x * i, 0.); + if(x.x < 0. || x.y < 0. || x.x > 1. || x.y > 1.) break; + + vec4 s = texture2D( gm_BaseTexture, x ); if(s.a == 0.) continue; gl_FragColor = s; @@ -35,7 +32,10 @@ void main() { for( float i = 1.; i < ITERATION; i++ ) { if(i >= minD) break; - vec4 s = sample( v_vTexcoord - vec2(tx.x * i, 0.) ); + vec2 x = v_vTexcoord - vec2(tx.x * i, 0.); + if(x.x < 0. || x.y < 0. || x.x > 1. || x.y > 1.) break; + + vec4 s = texture2D( gm_BaseTexture, x ); if(s.a == 0.) continue; gl_FragColor = s; @@ -45,7 +45,10 @@ void main() { for( float i = 1.; i < ITERATION; i++ ) { if(i >= minD) break; - vec4 s = sample( v_vTexcoord + vec2(0., tx.y * i) ); + vec2 x = v_vTexcoord + vec2(0., tx.y * i); + if(x.x < 0. || x.y < 0. || x.x > 1. || x.y > 1.) break; + + vec4 s = texture2D( gm_BaseTexture, x ); if(s.a == 0.) continue; gl_FragColor = s; @@ -55,7 +58,10 @@ void main() { for( float i = 1.; i < ITERATION; i++ ) { if(i >= minD) break; - vec4 s = sample( v_vTexcoord - vec2(0., tx.y * i) ); + vec2 x = v_vTexcoord - vec2(0., tx.y * i); + if(x.x < 0. || x.y < 0. || x.x > 1. || x.y > 1.) break; + + vec4 s = texture2D( gm_BaseTexture, x ); if(s.a == 0.) continue; gl_FragColor = s; diff --git a/shaders/sh_region_fill_coordinate/sh_region_fill_coordinate.fsh b/shaders/sh_region_fill_coordinate/sh_region_fill_coordinate.fsh index 5912e7c89..0e44d1c75 100644 --- a/shaders/sh_region_fill_coordinate/sh_region_fill_coordinate.fsh +++ b/shaders/sh_region_fill_coordinate/sh_region_fill_coordinate.fsh @@ -1,60 +1,89 @@ -// -// Simple passthrough fragment shader -// varying vec2 v_vTexcoord; varying vec4 v_vColour; -#define ITERATION 8. +#define ITERATION 4. +uniform sampler2D base; uniform vec2 dimension; -uniform float step; -vec4 less ( vec4 a, vec4 b ) { - if(b.xy == vec2(0.)) return a; - if(a.xy == vec2(0.)) return b; +vec2 less ( vec2 a, vec2 b ) { #region + if(b == vec2(0.)) return a; + if(a == vec2(0.)) return b; if(a.y < b.y) return a; else if(a.y > b.y) return b; else return a.x < b.x? a : b; -} +} #endregion -vec4 sample ( vec2 position ) { - if(position.x < 0. || position.y < 0. || position.x > 1. || position.y > 1.) return vec4(1.); - return texture2D( gm_BaseTexture, position ); -} +vec2 more ( vec2 a, vec2 b ) { #region + if(b == vec2(0.)) return a; + if(a == vec2(0.)) return b; + + if(a.y > b.y) return a; + else if(a.y < b.y) return b; + else return a.x > b.x? a : b; +} #endregion void main() { vec2 tx = 1. / dimension; - vec4 c = texture2D( gm_BaseTexture, v_vTexcoord ); + vec4 c = texture2D( gm_BaseTexture, v_vTexcoord ); + vec4 b = texture2D( base, v_vTexcoord ); + + gl_FragColor = vec4(0.); + + if(b.a == 0.) return; + gl_FragColor = c; - if(c.a == 0.) return; - if(c.b == 1.) { - gl_FragColor = vec4(0.); - return; + for( float i = 1.; i < ITERATION; i++ ) { + vec2 x = v_vTexcoord + vec2(tx.x * i, 0); + if(x.x < 0. || x.y < 0. || x.x > 1. || x.y > 1.) break; + + vec4 s = texture2D( gm_BaseTexture, x ); + vec4 b = texture2D( base, x ); + + if(b.a == 0.) break; + + gl_FragColor.xy = less( gl_FragColor.xy, s.xy ); + gl_FragColor.zw = more( gl_FragColor.zw, s.zw ); } for( float i = 1.; i < ITERATION; i++ ) { - vec4 s = sample( v_vTexcoord + vec2(tx.x * i, 0) ); - if(s.a == 0.) break; - gl_FragColor = less( gl_FragColor, s ); + vec2 x = v_vTexcoord - vec2(tx.x * i, 0); + if(x.x < 0. || x.y < 0. || x.x > 1. || x.y > 1.) break; + + vec4 s = texture2D( gm_BaseTexture, x ); + vec4 b = texture2D( base, x ); + + if(b.a == 0.) break; + + gl_FragColor.xy = less( gl_FragColor.xy, s.xy ); + gl_FragColor.zw = more( gl_FragColor.zw, s.zw ); } for( float i = 1.; i < ITERATION; i++ ) { - vec4 s = sample( v_vTexcoord - vec2(tx.x * i, 0) ); - if(s.a == 0.) break; - gl_FragColor = less( gl_FragColor, s ); + vec2 x = v_vTexcoord + vec2(0, tx.y * i); + if(x.x < 0. || x.y < 0. || x.x > 1. || x.y > 1.) break; + + vec4 s = texture2D( gm_BaseTexture, x ); + vec4 b = texture2D( base, x ); + + if(b.a == 0.) break; + + gl_FragColor.xy = less( gl_FragColor.xy, s.xy ); + gl_FragColor.zw = more( gl_FragColor.zw, s.zw ); } for( float i = 1.; i < ITERATION; i++ ) { - vec4 s = sample( v_vTexcoord + vec2(0, tx.y * i) ); - if(s.a == 0.) break; - gl_FragColor = less( gl_FragColor, s ); - } - - for( float i = 1.; i < ITERATION; i++ ) { - vec4 s = sample( v_vTexcoord - vec2(0, tx.y * i) ); - if(s.a == 0.) break; - gl_FragColor = less( gl_FragColor, s ); + vec2 x = v_vTexcoord - vec2(0, tx.y * i); + if(x.x < 0. || x.y < 0. || x.x > 1. || x.y > 1.) break; + + vec4 s = texture2D( gm_BaseTexture, x ); + vec4 b = texture2D( base, x ); + + if(b.a == 0.) break; + + gl_FragColor.xy = less( gl_FragColor.xy, s.xy ); + gl_FragColor.zw = more( gl_FragColor.zw, s.zw ); } } diff --git a/shaders/sh_region_fill_coordinate_init/sh_region_fill_coordinate_init.fsh b/shaders/sh_region_fill_coordinate_init/sh_region_fill_coordinate_init.fsh new file mode 100644 index 000000000..5c36835e7 --- /dev/null +++ b/shaders/sh_region_fill_coordinate_init/sh_region_fill_coordinate_init.fsh @@ -0,0 +1,13 @@ +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +void main() { + vec4 c = texture2D( gm_BaseTexture, v_vTexcoord ); + + if(c.rgb == vec3(0.)) { + gl_FragColor = vec4(0.); + return; + } + + gl_FragColor = vec4(v_vTexcoord, v_vTexcoord); +} \ No newline at end of file diff --git a/shaders/sh_region_fill_coordinate_init/sh_region_fill_coordinate_init.vsh b/shaders/sh_region_fill_coordinate_init/sh_region_fill_coordinate_init.vsh new file mode 100644 index 000000000..3900c20f4 --- /dev/null +++ b/shaders/sh_region_fill_coordinate_init/sh_region_fill_coordinate_init.vsh @@ -0,0 +1,19 @@ +// +// Simple passthrough vertex shader +// +attribute vec3 in_Position; // (x,y,z) +//attribute vec3 in_Normal; // (x,y,z) unused in this shader. +attribute vec4 in_Colour; // (r,g,b,a) +attribute vec2 in_TextureCoord; // (u,v) + +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +void main() +{ + vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0); + gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos; + + v_vColour = in_Colour; + v_vTexcoord = in_TextureCoord; +} diff --git a/shaders/sh_region_fill_coordinate_init/sh_region_fill_coordinate_init.yy b/shaders/sh_region_fill_coordinate_init/sh_region_fill_coordinate_init.yy new file mode 100644 index 000000000..8cfb352c0 --- /dev/null +++ b/shaders/sh_region_fill_coordinate_init/sh_region_fill_coordinate_init.yy @@ -0,0 +1,10 @@ +{ + "resourceType": "GMShader", + "resourceVersion": "1.0", + "name": "sh_region_fill_coordinate_init", + "parent": { + "name": "region", + "path": "folders/shader/generator/region.yy", + }, + "type": 1, +} \ No newline at end of file diff --git a/shaders/sh_region_fill_init/sh_region_fill_init.fsh b/shaders/sh_region_fill_init/sh_region_fill_init.fsh index 6c8d99a58..09b7f42c7 100644 --- a/shaders/sh_region_fill_init/sh_region_fill_init.fsh +++ b/shaders/sh_region_fill_init/sh_region_fill_init.fsh @@ -7,7 +7,7 @@ void main() { vec4 c = texture2D( gm_BaseTexture, v_vTexcoord ); if(targetColor.a == 0.) - gl_FragColor = c.a == 0.? vec4(v_vTexcoord, 0., 1.) : vec4(0.); + gl_FragColor = c.a == 0.? vec4(1., 0., 0., 1.) : vec4(0.); else - gl_FragColor = targetColor == c? vec4(v_vTexcoord, 0., 1.) : vec4(0.); + gl_FragColor = targetColor == c? vec4(1., 0., 0., 1.) : vec4(0.); } diff --git a/shaders/sh_region_fill_inner_remove/sh_region_fill_inner_remove.fsh b/shaders/sh_region_fill_inner_remove/sh_region_fill_inner_remove.fsh new file mode 100644 index 000000000..630d29a48 --- /dev/null +++ b/shaders/sh_region_fill_inner_remove/sh_region_fill_inner_remove.fsh @@ -0,0 +1,10 @@ +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +void main() { + vec4 c = texture2D( gm_BaseTexture, v_vTexcoord ); + gl_FragColor = vec4(1.); + + if(c.b == 1.) gl_FragColor = vec4(0.); + if(c.a == 0.) gl_FragColor = vec4(0.); +} diff --git a/shaders/sh_region_fill_inner_remove/sh_region_fill_inner_remove.vsh b/shaders/sh_region_fill_inner_remove/sh_region_fill_inner_remove.vsh new file mode 100644 index 000000000..3900c20f4 --- /dev/null +++ b/shaders/sh_region_fill_inner_remove/sh_region_fill_inner_remove.vsh @@ -0,0 +1,19 @@ +// +// Simple passthrough vertex shader +// +attribute vec3 in_Position; // (x,y,z) +//attribute vec3 in_Normal; // (x,y,z) unused in this shader. +attribute vec4 in_Colour; // (r,g,b,a) +attribute vec2 in_TextureCoord; // (u,v) + +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +void main() +{ + vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0); + gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos; + + v_vColour = in_Colour; + v_vTexcoord = in_TextureCoord; +} diff --git a/shaders/sh_region_fill_inner_remove/sh_region_fill_inner_remove.yy b/shaders/sh_region_fill_inner_remove/sh_region_fill_inner_remove.yy new file mode 100644 index 000000000..fede39eb4 --- /dev/null +++ b/shaders/sh_region_fill_inner_remove/sh_region_fill_inner_remove.yy @@ -0,0 +1,10 @@ +{ + "resourceType": "GMShader", + "resourceVersion": "1.0", + "name": "sh_region_fill_inner_remove", + "parent": { + "name": "region", + "path": "folders/shader/generator/region.yy", + }, + "type": 1, +} \ No newline at end of file diff --git a/shaders/sh_region_fill_rg_map/sh_region_fill_rg_map.fsh b/shaders/sh_region_fill_rg_map/sh_region_fill_rg_map.fsh new file mode 100644 index 000000000..b99478e2d --- /dev/null +++ b/shaders/sh_region_fill_rg_map/sh_region_fill_rg_map.fsh @@ -0,0 +1,17 @@ +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +uniform sampler2D textureMap; + +void main() { + vec4 c = texture2D( gm_BaseTexture, v_vTexcoord ); + + if(c.rgb == vec3(0.)) { + gl_FragColor = vec4(0.); + return; + } + + vec2 t = (v_vTexcoord - c.xy) / (c.zw - c.xy); + gl_FragColor = texture2D( textureMap, t ); + gl_FragColor = vec4( t, 0., 1. ); +} diff --git a/shaders/sh_region_fill_rg_map/sh_region_fill_rg_map.vsh b/shaders/sh_region_fill_rg_map/sh_region_fill_rg_map.vsh new file mode 100644 index 000000000..3900c20f4 --- /dev/null +++ b/shaders/sh_region_fill_rg_map/sh_region_fill_rg_map.vsh @@ -0,0 +1,19 @@ +// +// Simple passthrough vertex shader +// +attribute vec3 in_Position; // (x,y,z) +//attribute vec3 in_Normal; // (x,y,z) unused in this shader. +attribute vec4 in_Colour; // (r,g,b,a) +attribute vec2 in_TextureCoord; // (u,v) + +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +void main() +{ + vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0); + gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos; + + v_vColour = in_Colour; + v_vTexcoord = in_TextureCoord; +} diff --git a/shaders/sh_region_fill_rg_map/sh_region_fill_rg_map.yy b/shaders/sh_region_fill_rg_map/sh_region_fill_rg_map.yy new file mode 100644 index 000000000..6f8abd170 --- /dev/null +++ b/shaders/sh_region_fill_rg_map/sh_region_fill_rg_map.yy @@ -0,0 +1,10 @@ +{ + "resourceType": "GMShader", + "resourceVersion": "1.0", + "name": "sh_region_fill_rg_map", + "parent": { + "name": "region", + "path": "folders/shader/generator/region.yy", + }, + "type": 1, +} \ No newline at end of file diff --git a/shaders/sh_shape/sh_shape.fsh b/shaders/sh_shape/sh_shape.fsh index 9b3f140c5..56ad6cca9 100644 --- a/shaders/sh_shape/sh_shape.fsh +++ b/shaders/sh_shape/sh_shape.fsh @@ -7,9 +7,11 @@ uniform int shape; uniform int bg; uniform int aa; uniform int sides; -uniform int drawDF; uniform int tile; +uniform int drawDF; +uniform vec2 dfLevel; + uniform float rotation; uniform float angle; uniform float inner; @@ -150,9 +152,10 @@ void main() { else if(shape == 8) d = sdCrescent( coord, inner, outer, angle ); else if(shape == 9) d = sdDonut( coord, inner ); - if(drawDF == 1) + if(drawDF == 1) { color = -d; - else if(aa == 0) + color = (color - dfLevel.x) / (dfLevel.y - dfLevel.x); + } else if(aa == 0) color = step(d, 0.0); else color = smoothstep(0.02, -0.02, d); diff --git a/shaders/sh_shape_map_circle/sh_shape_map_circle.fsh b/shaders/sh_shape_map_circle/sh_shape_map_circle.fsh new file mode 100644 index 000000000..2b8566512 --- /dev/null +++ b/shaders/sh_shape_map_circle/sh_shape_map_circle.fsh @@ -0,0 +1,69 @@ +#define PI 3.141592653589793 +#define TAU 6.283185307179586 + +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +uniform vec2 scale; +uniform float txScale; +uniform float angle; + +#region /////////////// SAMPLING /////////////// + + uniform int interpolation; + uniform vec2 sampleDimension; + + const int RSIN_RADIUS = 1; + + float sinc ( float x ) { return x == 0.? 1. : sin(x * PI) / (x * PI); } + + vec4 texture2D_rsin( sampler2D texture, vec2 uv ) { + vec2 tx = 1.0 / sampleDimension; + vec2 p = uv * sampleDimension - vec2(0.5); + + vec4 sum = vec4(0.0); + float weights = 0.; + + for (int x = -RSIN_RADIUS; x <= RSIN_RADIUS; x++) + for (int y = -RSIN_RADIUS; y <= RSIN_RADIUS; y++) { + float a = length(vec2(float(x), float(y))) / float(RSIN_RADIUS); + if(a > 1.) continue; + float w = sinc(a * PI * tx.x) * sinc(a * PI * tx.y); + vec2 offset = vec2(float(x), float(y)) * tx; + vec4 sample = texture2D(texture, (p + offset + vec2(0.5)) / sampleDimension); + sum += w * sample; + weights += w; + } + + return sum / weights; + } + + vec4 texture2D_bicubic( sampler2D texture, vec2 uv ) { + uv = uv * sampleDimension + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + uv = iuv + fuv * fuv * (3.0 - 2.0 * fuv); + uv = (uv - 0.5) / sampleDimension; + return texture2D( texture, uv ); + } + + vec4 texture2Dintp( sampler2D texture, vec2 uv ) { + if(interpolation == 2) return texture2D_bicubic( texture, uv ); + else if(interpolation == 3) return texture2D_rsin( texture, uv ); + return texture2D( texture, uv ); + } + +#endregion /////////////// SAMPLING /////////////// + +void main() { + gl_FragColor = vec4(0.); + + vec2 cPos = v_vTexcoord - 0.5; + float dist = length(cPos) * 2. / txScale; + if(dist > 1.) return; + + float ang = ((atan(cPos.y, cPos.x) + radians(angle)) / PI + 1.) / 2.; + vec2 tx = fract(vec2(ang, dist) * scale); + + gl_FragColor = texture2Dintp( gm_BaseTexture, tx ); +} diff --git a/shaders/sh_shape_map_circle/sh_shape_map_circle.vsh b/shaders/sh_shape_map_circle/sh_shape_map_circle.vsh new file mode 100644 index 000000000..3900c20f4 --- /dev/null +++ b/shaders/sh_shape_map_circle/sh_shape_map_circle.vsh @@ -0,0 +1,19 @@ +// +// Simple passthrough vertex shader +// +attribute vec3 in_Position; // (x,y,z) +//attribute vec3 in_Normal; // (x,y,z) unused in this shader. +attribute vec4 in_Colour; // (r,g,b,a) +attribute vec2 in_TextureCoord; // (u,v) + +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +void main() +{ + vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0); + gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos; + + v_vColour = in_Colour; + v_vTexcoord = in_TextureCoord; +} diff --git a/shaders/sh_shape_map_circle/sh_shape_map_circle.yy b/shaders/sh_shape_map_circle/sh_shape_map_circle.yy new file mode 100644 index 000000000..64e273ee4 --- /dev/null +++ b/shaders/sh_shape_map_circle/sh_shape_map_circle.yy @@ -0,0 +1,10 @@ +{ + "resourceType": "GMShader", + "resourceVersion": "1.0", + "name": "sh_shape_map_circle", + "parent": { + "name": "warp", + "path": "folders/shader/filter/warp.yy", + }, + "type": 1, +} \ No newline at end of file diff --git a/shaders/sh_shape_map_polygon/sh_shape_map_polygon.fsh b/shaders/sh_shape_map_polygon/sh_shape_map_polygon.fsh new file mode 100644 index 000000000..7fc1987fb --- /dev/null +++ b/shaders/sh_shape_map_polygon/sh_shape_map_polygon.fsh @@ -0,0 +1,78 @@ +#define PI 3.141592653589793 +#define TAU 6.283185307179586 + +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +uniform vec2 scale; +uniform float sides; +uniform float txScale; +uniform float angle; + +#region /////////////// SAMPLING /////////////// + + uniform int interpolation; + uniform vec2 sampleDimension; + + const int RSIN_RADIUS = 1; + + float sinc ( float x ) { return x == 0.? 1. : sin(x * PI) / (x * PI); } + + vec4 texture2D_rsin( sampler2D texture, vec2 uv ) { + vec2 tx = 1.0 / sampleDimension; + vec2 p = uv * sampleDimension - vec2(0.5); + + vec4 sum = vec4(0.0); + float weights = 0.; + + for (int x = -RSIN_RADIUS; x <= RSIN_RADIUS; x++) + for (int y = -RSIN_RADIUS; y <= RSIN_RADIUS; y++) { + float a = length(vec2(float(x), float(y))) / float(RSIN_RADIUS); + if(a > 1.) continue; + float w = sinc(a * PI * tx.x) * sinc(a * PI * tx.y); + vec2 offset = vec2(float(x), float(y)) * tx; + vec4 sample = texture2D(texture, (p + offset + vec2(0.5)) / sampleDimension); + sum += w * sample; + weights += w; + } + + return sum / weights; + } + + vec4 texture2D_bicubic( sampler2D texture, vec2 uv ) { + uv = uv * sampleDimension + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + uv = iuv + fuv * fuv * (3.0 - 2.0 * fuv); + uv = (uv - 0.5) / sampleDimension; + return texture2D( texture, uv ); + } + + vec4 texture2Dintp( sampler2D texture, vec2 uv ) { + if(interpolation == 2) return texture2D_bicubic( texture, uv ); + else if(interpolation == 3) return texture2D_rsin( texture, uv ); + return texture2D( texture, uv ); + } + +#endregion /////////////// SAMPLING /////////////// + +void main() { + gl_FragColor = vec4(0.); + + vec2 st = (v_vTexcoord - 0.5) * 2. / txScale; + + float a = atan(st.y, st.x) + PI + radians(angle); + float r = TAU / sides; + + float d = cos(floor(.5 + a / r) * r - a) * length(st); + if(sides == 3.) d *= sqrt(3.); + + float x = 1. - (a + r / 2.) / TAU; + float y = d; + + if(y < 0. || y > 1.) return; + + vec2 tx = vec2(x, y); + + gl_FragColor = texture2Dintp( gm_BaseTexture, fract(tx * scale) ); +} diff --git a/shaders/sh_shape_map_polygon/sh_shape_map_polygon.vsh b/shaders/sh_shape_map_polygon/sh_shape_map_polygon.vsh new file mode 100644 index 000000000..d4b316559 --- /dev/null +++ b/shaders/sh_shape_map_polygon/sh_shape_map_polygon.vsh @@ -0,0 +1,18 @@ +// +// Simple passthrough vertex shader +// +attribute vec3 in_Position; // (x,y,z) +//attribute vec3 in_Normal; // (x,y,z) unused in this shader. +attribute vec4 in_Colour; // (r,g,b,a) +attribute vec2 in_TextureCoord; // (u,v) + +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +void main() { + vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0); + gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos; + + v_vColour = in_Colour; + v_vTexcoord = in_TextureCoord; +} diff --git a/shaders/sh_shape_map_polygon/sh_shape_map_polygon.yy b/shaders/sh_shape_map_polygon/sh_shape_map_polygon.yy new file mode 100644 index 000000000..7546549b0 --- /dev/null +++ b/shaders/sh_shape_map_polygon/sh_shape_map_polygon.yy @@ -0,0 +1,10 @@ +{ + "resourceType": "GMShader", + "resourceVersion": "1.0", + "name": "sh_shape_map_polygon", + "parent": { + "name": "warp", + "path": "folders/shader/filter/warp.yy", + }, + "type": 1, +} \ No newline at end of file diff --git a/shaders/sh_skew/sh_skew.fsh b/shaders/sh_skew/sh_skew.fsh index ca591de53..5c901bc5d 100644 --- a/shaders/sh_skew/sh_skew.fsh +++ b/shaders/sh_skew/sh_skew.fsh @@ -67,11 +67,16 @@ vec4 sampleTexture(vec2 pos) { #region if(sampleMode == 0) return vec4(0.); - if(sampleMode == 1) + + else if(sampleMode == 1) return texture2Dintp(gm_BaseTexture, clamp(pos, 0., 1.)); - if(sampleMode == 2) + + else if(sampleMode == 2) return texture2Dintp(gm_BaseTexture, fract(pos)); + else if(sampleMode == 3) + return vec4(vec3(0.), 1.); + return vec4(0.); } #endregion diff --git a/shaders/sh_spherize/sh_spherize.fsh b/shaders/sh_spherize/sh_spherize.fsh index b21aa4d59..706cef44a 100644 --- a/shaders/sh_spherize/sh_spherize.fsh +++ b/shaders/sh_spherize/sh_spherize.fsh @@ -72,11 +72,16 @@ vec4 sampleTexture(vec2 pos) { #region if(sampleMode == 0) return vec4(0.); - if(sampleMode == 1) + + else if(sampleMode == 1) return texture2Dintp(gm_BaseTexture, clamp(pos, 0., 1.)); - if(sampleMode == 2) + + else if(sampleMode == 2) return texture2Dintp(gm_BaseTexture, fract(pos)); + else if(sampleMode == 3) + return vec4(vec3(0.), 1.); + return vec4(0.); } #endregion diff --git a/shaders/sh_twirl/sh_twirl.fsh b/shaders/sh_twirl/sh_twirl.fsh index d2dfeb15d..7dcda3297 100644 --- a/shaders/sh_twirl/sh_twirl.fsh +++ b/shaders/sh_twirl/sh_twirl.fsh @@ -70,11 +70,16 @@ vec4 sampleTexture(vec2 pos) { #region if(sampleMode == 0) return vec4(0.); - if(sampleMode == 1) + + else if(sampleMode == 1) return texture2Dintp(gm_BaseTexture, clamp(pos, 0., 1.)); - if(sampleMode == 2) + + else if(sampleMode == 2) return texture2Dintp(gm_BaseTexture, fract(pos)); + else if(sampleMode == 3) + return vec4(vec3(0.), 1.); + return vec4(0.); } #endregion diff --git a/shaders/sh_warp_4points/sh_warp_4points.fsh b/shaders/sh_warp_4points/sh_warp_4points.fsh index 11b777b24..1952a72f6 100644 --- a/shaders/sh_warp_4points/sh_warp_4points.fsh +++ b/shaders/sh_warp_4points/sh_warp_4points.fsh @@ -1,6 +1,3 @@ -// -// Perspective transform -// varying vec2 v_vTexcoord; varying vec4 v_vColour; @@ -10,57 +7,55 @@ uniform vec2 p2; uniform vec2 p3; uniform vec2 dimension; -/////////////// SAMPLING /////////////// +#region /////////////// SAMPLING /////////////// -const float PI = 3.14159265358979323846; -uniform int interpolation; -uniform vec2 sampleDimension; + const float PI = 3.14159265358979323846; + uniform int interpolation; + uniform vec2 sampleDimension; -const int RSIN_RADIUS = 1; + const int RSIN_RADIUS = 1; -float sinc ( float x ) { return x == 0.? 1. : sin(x * PI) / (x * PI); } + float sinc ( float x ) { return x == 0.? 1. : sin(x * PI) / (x * PI); } -vec4 texture2D_rsin( sampler2D texture, vec2 uv ) { - vec2 tx = 1.0 / sampleDimension; - vec2 p = uv * sampleDimension - vec2(0.5); + vec4 texture2D_rsin( sampler2D texture, vec2 uv ) { + vec2 tx = 1.0 / sampleDimension; + vec2 p = uv * sampleDimension - vec2(0.5); - vec4 sum = vec4(0.0); - float weights = 0.; + vec4 sum = vec4(0.0); + float weights = 0.; - for (int x = -RSIN_RADIUS; x <= RSIN_RADIUS; x++) - for (int y = -RSIN_RADIUS; y <= RSIN_RADIUS; y++) { - float a = length(vec2(float(x), float(y))) / float(RSIN_RADIUS); - if(a > 1.) continue; - float w = sinc(a * PI * tx.x) * sinc(a * PI * tx.y); - vec2 offset = vec2(float(x), float(y)) * tx; - vec4 sample = texture2D(texture, (p + offset + vec2(0.5)) / sampleDimension); - sum += w * sample; - weights += w; - } + for (int x = -RSIN_RADIUS; x <= RSIN_RADIUS; x++) + for (int y = -RSIN_RADIUS; y <= RSIN_RADIUS; y++) { + float a = length(vec2(float(x), float(y))) / float(RSIN_RADIUS); + if(a > 1.) continue; + float w = sinc(a * PI * tx.x) * sinc(a * PI * tx.y); + vec2 offset = vec2(float(x), float(y)) * tx; + vec4 sample = texture2D(texture, (p + offset + vec2(0.5)) / sampleDimension); + sum += w * sample; + weights += w; + } - return sum / weights; -} + return sum / weights; + } -vec4 texture2D_bicubic( sampler2D texture, vec2 uv ) { - uv = uv * sampleDimension + 0.5; - vec2 iuv = floor( uv ); - vec2 fuv = fract( uv ); - uv = iuv + fuv * fuv * (3.0 - 2.0 * fuv); - uv = (uv - 0.5) / sampleDimension; - return texture2D( texture, uv ); -} + vec4 texture2D_bicubic( sampler2D texture, vec2 uv ) { + uv = uv * sampleDimension + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + uv = iuv + fuv * fuv * (3.0 - 2.0 * fuv); + uv = (uv - 0.5) / sampleDimension; + return texture2D( texture, uv ); + } -vec4 texture2Dintp( sampler2D texture, vec2 uv ) { - if(interpolation == 2) return texture2D_bicubic( texture, uv ); - else if(interpolation == 3) return texture2D_rsin( texture, uv ); - return texture2D( texture, uv ); -} + vec4 texture2Dintp( sampler2D texture, vec2 uv ) { + if(interpolation == 2) return texture2D_bicubic( texture, uv ); + else if(interpolation == 3) return texture2D_rsin( texture, uv ); + return texture2D( texture, uv ); + } -/////////////// SAMPLING /////////////// +#endregion /////////////// SAMPLING /////////////// -float unmix( float st, float ed, float val) { - return (val - st) / (ed - st); -} +float unmix( float st, float ed, float val) { return (val - st) / (ed - st); } // 2 1 // 3 0 @@ -71,35 +66,37 @@ void main() { float u, v; vec2 uv; - if (abs(p3.y - p0.y) < 1. / dimension.y && abs(p2.y - p1.y) < 1. / dimension.y) { // trapezoid edge case - float t = (py - p2.y) / (p3.y - p2.y); + #region linear interpolation + if (abs(p3.y - p0.y) < 1. / dimension.y && abs(p2.y - p1.y) < 1. / dimension.y) { // trapezoid edge case + float t = (py - p2.y) / (p3.y - p2.y); - u = unmix(mix(p3.x, p2.x, 1. - t), mix(p0.x, p1.x, 1. - t), px); - v = t; - uv = vec2(u, v); - } else if(abs(p2.x - p3.x) < 1. / dimension.x && abs(p1.x - p0.x) < 1. / dimension.x) { // trapezoid edge case - float t = (px - p2.x) / (p1.x - p2.x); + u = unmix(mix(p3.x, p2.x, 1. - t), mix(p0.x, p1.x, 1. - t), px); + v = t; + uv = vec2(u, v); + } else if(abs(p2.x - p3.x) < 1. / dimension.x && abs(p1.x - p0.x) < 1. / dimension.x) { // trapezoid edge case + float t = (px - p2.x) / (p1.x - p2.x); - u = t; - v = unmix(mix(p1.y, p2.y, 1. - t), mix(p0.y, p3.y, 1. - t), py); - uv = vec2(u, v); - } else { - vec2 A = (p3 - p0) - (p2 - p1); - vec2 B = (p0 - p1); - vec2 C = (p2 - p1); - vec2 D = p1; + u = t; + v = unmix(mix(p1.y, p2.y, 1. - t), mix(p0.y, p3.y, 1. - t), py); + uv = vec2(u, v); + } else { + vec2 A = (p3 - p0) - (p2 - p1); + vec2 B = (p0 - p1); + vec2 C = (p2 - p1); + vec2 D = p1; - float c1 = (B.y * C.x) + (A.y * D.x) - (B.x * C.y) - (A.x * D.y); - float c2 = (B.y * D.x) - (B.x * D.y); + float c1 = (B.y * C.x) + (A.y * D.x) - (B.x * C.y) - (A.x * D.y); + float c2 = (B.y * D.x) - (B.x * D.y); - float _A = (A.y * C.x) - (A.x * C.y); - float _B = (A.x * py) + c1 - (A.y * px); - float _C = (B.x * py) + c2 - (B.y * px); + float _A = (A.y * C.x) - (A.x * C.y); + float _B = (A.x * py) + c1 - (A.y * px); + float _C = (B.x * py) + c2 - (B.y * px); - u = A == vec2(0.)? 0. : (-_B - sqrt(_B * _B - 4.0 * _A * _C)) / (_A * 2.0); - v = (u * A.x + B.x) == 0.? 0. : (px - (u * C.x) - D.x) / (u * A.x + B.x); - uv = vec2(1. - u, v); - } + u = A == vec2(0.)? 0. : (-_B - sqrt(_B * _B - 4.0 * _A * _C)) / (_A * 2.0); + v = (u * A.x + B.x) == 0.? 0. : (px - (u * C.x) - D.x) / (u * A.x + B.x); + uv = vec2(1. - u, v); + } + #endregion if(uv.x >= 0. && uv.y >= 0. && uv.x <= 1. && uv.y <= 1.) gl_FragColor = texture2Dintp( gm_BaseTexture, uv ); diff --git a/sprites/s_node_profile/0cf255a2-572f-4968-a930-cd4c48df41ee.png b/sprites/s_node_profile/0cf255a2-572f-4968-a930-cd4c48df41ee.png new file mode 100644 index 000000000..38b7e8c48 Binary files /dev/null and b/sprites/s_node_profile/0cf255a2-572f-4968-a930-cd4c48df41ee.png differ diff --git a/sprites/s_node_profile/layers/0cf255a2-572f-4968-a930-cd4c48df41ee/a43912f9-916d-4be8-8b43-2307f712d2f9.png b/sprites/s_node_profile/layers/0cf255a2-572f-4968-a930-cd4c48df41ee/a43912f9-916d-4be8-8b43-2307f712d2f9.png new file mode 100644 index 000000000..38b7e8c48 Binary files /dev/null and b/sprites/s_node_profile/layers/0cf255a2-572f-4968-a930-cd4c48df41ee/a43912f9-916d-4be8-8b43-2307f712d2f9.png differ diff --git a/sprites/s_node_profile/s_node_profile.yy b/sprites/s_node_profile/s_node_profile.yy new file mode 100644 index 000000000..c80593e45 --- /dev/null +++ b/sprites/s_node_profile/s_node_profile.yy @@ -0,0 +1,74 @@ +{ + "resourceType": "GMSprite", + "resourceVersion": "1.0", + "name": "s_node_profile", + "bbox_bottom": 60, + "bbox_left": 13, + "bbox_right": 57, + "bbox_top": 2, + "bboxMode": 0, + "collisionKind": 1, + "collisionTolerance": 0, + "DynamicTexturePage": false, + "edgeFiltering": false, + "For3D": false, + "frames": [ + {"resourceType":"GMSpriteFrame","resourceVersion":"1.1","name":"0cf255a2-572f-4968-a930-cd4c48df41ee",}, + ], + "gridX": 0, + "gridY": 0, + "height": 64, + "HTile": false, + "layers": [ + {"resourceType":"GMImageLayer","resourceVersion":"1.0","name":"a43912f9-916d-4be8-8b43-2307f712d2f9","blendMode":0,"displayName":"default","isLocked":false,"opacity":100.0,"visible":true,}, + ], + "nineSlice": null, + "origin": 4, + "parent": { + "name": "generator", + "path": "folders/nodes/icons/generator.yy", + }, + "preMultiplyAlpha": false, + "sequence": { + "resourceType": "GMSequence", + "resourceVersion": "1.4", + "name": "s_node_profile", + "autoRecord": true, + "backdropHeight": 768, + "backdropImageOpacity": 0.5, + "backdropImagePath": "", + "backdropWidth": 1366, + "backdropXOffset": 0.0, + "backdropYOffset": 0.0, + "events": {"resourceType":"KeyframeStore","resourceVersion":"1.0","Keyframes":[],}, + "eventStubScript": null, + "eventToFunction": {}, + "length": 1.0, + "lockOrigin": false, + "moments": {"resourceType":"KeyframeStore","resourceVersion":"1.0","Keyframes":[],}, + "playback": 1, + "playbackSpeed": 30.0, + "playbackSpeedType": 0, + "showBackdrop": true, + "showBackdropImage": false, + "timeUnits": 1, + "tracks": [ + {"resourceType":"GMSpriteFramesTrack","resourceVersion":"1.0","name":"frames","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"resourceType":"KeyframeStore","resourceVersion":"1.0","Keyframes":[ + {"resourceType":"Keyframe","resourceVersion":"1.0","Channels":{"0":{"resourceType":"SpriteFrameKeyframe","resourceVersion":"1.0","Id":{"name":"0cf255a2-572f-4968-a930-cd4c48df41ee","path":"sprites/s_node_profile/s_node_profile.yy",},},},"Disabled":false,"id":"b64c5522-de0b-43df-b928-cd65547241cb","IsCreationKey":false,"Key":0.0,"Length":1.0,"Stretch":false,}, + ],},"modifiers":[],"spriteId":null,"trackColour":0,"tracks":[],"traits":0,}, + ], + "visibleRange": null, + "volume": 1.0, + "xorigin": 32, + "yorigin": 32, + }, + "swatchColours": null, + "swfPrecision": 2.525, + "textureGroupId": { + "name": "Default", + "path": "texturegroups/Default", + }, + "type": 0, + "VTile": false, + "width": 64, +} \ No newline at end of file diff --git a/sprites/s_node_shape/s_node_shape.yy b/sprites/s_node_shape/s_node_shape.yy index 930dd2c12..ccb43c160 100644 --- a/sprites/s_node_shape/s_node_shape.yy +++ b/sprites/s_node_shape/s_node_shape.yy @@ -57,7 +57,7 @@ {"resourceType":"Keyframe","resourceVersion":"1.0","Channels":{"0":{"resourceType":"SpriteFrameKeyframe","resourceVersion":"1.0","Id":{"name":"bc7f828c-c657-4859-bd0c-6eade2e905ae","path":"sprites/s_node_shape/s_node_shape.yy",},},},"Disabled":false,"id":"39df5d82-f9f6-41ca-bc62-78aff76d79fe","IsCreationKey":false,"Key":0.0,"Length":1.0,"Stretch":false,}, ],},"modifiers":[],"spriteId":null,"trackColour":0,"tracks":[],"traits":0,}, ], - "visibleRange": {"x":0.0,"y":0.0,}, + "visibleRange": null, "volume": 1.0, "xorigin": 32, "yorigin": 32, diff --git a/sprites/s_node_shape_map/3a1558e4-dcab-4286-a87d-ddcdc8664932.png b/sprites/s_node_shape_map/3a1558e4-dcab-4286-a87d-ddcdc8664932.png new file mode 100644 index 000000000..f8956ae5f Binary files /dev/null and b/sprites/s_node_shape_map/3a1558e4-dcab-4286-a87d-ddcdc8664932.png differ diff --git a/sprites/s_node_shape_map/layers/3a1558e4-dcab-4286-a87d-ddcdc8664932/280972b9-8c17-4887-afa8-c159d4cb5f06.png b/sprites/s_node_shape_map/layers/3a1558e4-dcab-4286-a87d-ddcdc8664932/280972b9-8c17-4887-afa8-c159d4cb5f06.png new file mode 100644 index 000000000..f8956ae5f Binary files /dev/null and b/sprites/s_node_shape_map/layers/3a1558e4-dcab-4286-a87d-ddcdc8664932/280972b9-8c17-4887-afa8-c159d4cb5f06.png differ diff --git a/sprites/s_node_shape_map/s_node_shape_map.yy b/sprites/s_node_shape_map/s_node_shape_map.yy new file mode 100644 index 000000000..748a6d82d --- /dev/null +++ b/sprites/s_node_shape_map/s_node_shape_map.yy @@ -0,0 +1,74 @@ +{ + "resourceType": "GMSprite", + "resourceVersion": "1.0", + "name": "s_node_shape_map", + "bbox_bottom": 63, + "bbox_left": 0, + "bbox_right": 63, + "bbox_top": 0, + "bboxMode": 0, + "collisionKind": 1, + "collisionTolerance": 0, + "DynamicTexturePage": false, + "edgeFiltering": false, + "For3D": false, + "frames": [ + {"resourceType":"GMSpriteFrame","resourceVersion":"1.1","name":"3a1558e4-dcab-4286-a87d-ddcdc8664932",}, + ], + "gridX": 0, + "gridY": 0, + "height": 64, + "HTile": false, + "layers": [ + {"resourceType":"GMImageLayer","resourceVersion":"1.0","name":"280972b9-8c17-4887-afa8-c159d4cb5f06","blendMode":0,"displayName":"default","isLocked":false,"opacity":100.0,"visible":true,}, + ], + "nineSlice": null, + "origin": 4, + "parent": { + "name": "transform", + "path": "folders/nodes/icons/transform.yy", + }, + "preMultiplyAlpha": false, + "sequence": { + "resourceType": "GMSequence", + "resourceVersion": "1.4", + "name": "s_node_shape_map", + "autoRecord": true, + "backdropHeight": 768, + "backdropImageOpacity": 0.5, + "backdropImagePath": "", + "backdropWidth": 1366, + "backdropXOffset": 0.0, + "backdropYOffset": 0.0, + "events": {"resourceType":"KeyframeStore","resourceVersion":"1.0","Keyframes":[],}, + "eventStubScript": null, + "eventToFunction": {}, + "length": 1.0, + "lockOrigin": false, + "moments": {"resourceType":"KeyframeStore","resourceVersion":"1.0","Keyframes":[],}, + "playback": 1, + "playbackSpeed": 30.0, + "playbackSpeedType": 0, + "showBackdrop": true, + "showBackdropImage": false, + "timeUnits": 1, + "tracks": [ + {"resourceType":"GMSpriteFramesTrack","resourceVersion":"1.0","name":"frames","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"resourceType":"KeyframeStore","resourceVersion":"1.0","Keyframes":[ + {"resourceType":"Keyframe","resourceVersion":"1.0","Channels":{"0":{"resourceType":"SpriteFrameKeyframe","resourceVersion":"1.0","Id":{"name":"3a1558e4-dcab-4286-a87d-ddcdc8664932","path":"sprites/s_node_shape_map/s_node_shape_map.yy",},},},"Disabled":false,"id":"851bc476-0e61-4cc0-b0cb-12d8038a9377","IsCreationKey":false,"Key":0.0,"Length":1.0,"Stretch":false,}, + ],},"modifiers":[],"spriteId":null,"trackColour":0,"tracks":[],"traits":0,}, + ], + "visibleRange": null, + "volume": 1.0, + "xorigin": 32, + "yorigin": 32, + }, + "swatchColours": null, + "swfPrecision": 2.525, + "textureGroupId": { + "name": "Default", + "path": "texturegroups/Default", + }, + "type": 0, + "VTile": false, + "width": 64, +} \ No newline at end of file