diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 4dd014069..489e424fd 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -584,6 +584,7 @@ {"name":"sh_fd_advect_material_rgba_16_glsl","order":4,"path":"shaders/sh_fd_advect_material_rgba_16_glsl/sh_fd_advect_material_rgba_16_glsl.yy",}, {"name":"node_padding","order":9,"path":"scripts/node_padding/node_padding.yy",}, {"name":"node_VFX_group","order":3,"path":"scripts/node_VFX_group/node_VFX_group.yy",}, + {"name":"node_FLIP_destroy","order":11,"path":"scripts/node_FLIP_destroy/node_FLIP_destroy.yy",}, {"name":"libborderless","order":1,"path":"extensions/libborderless/libborderless.yy",}, {"name":"node_dynasurf_in","order":4,"path":"scripts/node_dynasurf_in/node_dynasurf_in.yy",}, {"name":"s_node_vfx_attract","order":8,"path":"sprites/s_node_vfx_attract/s_node_vfx_attract.yy",}, @@ -1981,6 +1982,7 @@ {"name":"sh_solid","order":5,"path":"shaders/sh_solid/sh_solid.yy",}, {"name":"panel_animation_scaler","order":1,"path":"scripts/panel_animation_scaler/panel_animation_scaler.yy",}, {"name":"wav_file_object","order":2,"path":"scripts/wav_file_object/wav_file_object.yy",}, + {"name":"s_node_fluidSim_destroy_fluid","order":14,"path":"sprites/s_node_fluidSim_destroy_fluid/s_node_fluidSim_destroy_fluid.yy",}, {"name":"node_pb_fx_intersect","order":5,"path":"scripts/node_pb_fx_intersect/node_pb_fx_intersect.yy",}, {"name":"fd_rectangle_get_material_time_step","order":13,"path":"scripts/fd_rectangle_get_material_time_step/fd_rectangle_get_material_time_step.yy",}, {"name":"node_vector3","order":17,"path":"scripts/node_vector3/node_vector3.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 4d947de8e..a97920f8a 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -816,6 +816,7 @@ {"id":{"name":"panel_inspector","path":"scripts/panel_inspector/panel_inspector.yy",},}, {"id":{"name":"node_padding","path":"scripts/node_padding/node_padding.yy",},}, {"id":{"name":"node_VFX_group","path":"scripts/node_VFX_group/node_VFX_group.yy",},}, + {"id":{"name":"node_FLIP_destroy","path":"scripts/node_FLIP_destroy/node_FLIP_destroy.yy",},}, {"id":{"name":"libborderless","path":"extensions/libborderless/libborderless.yy",},}, {"id":{"name":"node_dynasurf_in","path":"scripts/node_dynasurf_in/node_dynasurf_in.yy",},}, {"id":{"name":"s_node_vfx_attract","path":"sprites/s_node_vfx_attract/s_node_vfx_attract.yy",},}, @@ -2410,6 +2411,7 @@ {"id":{"name":"sh_solid","path":"shaders/sh_solid/sh_solid.yy",},}, {"id":{"name":"panel_animation_scaler","path":"scripts/panel_animation_scaler/panel_animation_scaler.yy",},}, {"id":{"name":"wav_file_object","path":"scripts/wav_file_object/wav_file_object.yy",},}, + {"id":{"name":"s_node_fluidSim_destroy_fluid","path":"sprites/s_node_fluidSim_destroy_fluid/s_node_fluidSim_destroy_fluid.yy",},}, {"id":{"name":"node_pb_fx_intersect","path":"scripts/node_pb_fx_intersect/node_pb_fx_intersect.yy",},}, {"id":{"name":"timer_function","path":"scripts/timer_function/timer_function.yy",},}, {"id":{"name":"fd_rectangle_get_material_time_step","path":"scripts/fd_rectangle_get_material_time_step/fd_rectangle_get_material_time_step.yy",},}, diff --git a/fonts/_f_sdf/_f_sdf.old.png b/fonts/_f_sdf/_f_sdf.old.png index 1b1619a4d..957c28a13 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 3714ea1f9..0c5247358 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 13fa165d5..d883a5457 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 0ab09a1c3..956824541 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/FLIP_Domain/Create_0.gml b/objects/FLIP_Domain/Create_0.gml index 656ce1ca8..44e30390e 100644 --- a/objects/FLIP_Domain/Create_0.gml +++ b/objects/FLIP_Domain/Create_0.gml @@ -34,7 +34,7 @@ function init(width, height, particleSize, density, maxParticles) { #region domain init particlePos = array_create(maxParticles * 2); - particleHist = array_create(maxParticles * 2); + particleHist = array_create(maxParticles * 2 * TOTAL_FRAMES); particleLife = array_create(maxParticles); obstracles = []; numParticles = 0; @@ -73,7 +73,7 @@ function update() { #region FLIP_setQuality( domain, iteration, numPressureIters, numParticleIters); FLIP_setGravity( domain, g); FLIP_setViscosity( domain, viscosity); - FLIP_setFriction( domain, power(1 - friction, 0.025)); + FLIP_setFriction( domain, friction); FLIP_setFlipRatio( domain, flipRatio); FLIP_setVelocityDamping( domain, velocityDamping); FLIP_setOverRelaxation( domain, overRelaxation); @@ -94,8 +94,20 @@ function step() { #region //FLIP_simulate_solveIncompressibility(domain); //FLIP_simulate_transferVelocities(domain, 0); } - } else + } else { FLIP_simulate(domain, dt); + + //FLIP_setTimeStep(domain, dt); + //repeat(iteration) { + // FLIP_simulate_integrateParticles(domain); + // FLIP_simulate_pushParticlesApart(domain); + // FLIP_simulate_handleParticleCollisions(domain); + // FLIP_simulate_transferVelocities(domain, 1); + // FLIP_simulate_updateParticleDensity(domain); + // FLIP_simulate_solveIncompressibility(domain); + // FLIP_simulate_transferVelocities(domain, 0); + //} + } FLIP_setParticleBuffer(domain, aPosBuff, aLifeBuff); @@ -103,7 +115,7 @@ function step() { #region buffer_seek(particleLifeBuff, buffer_seek_start, 0); for(var i = 0; i < maxParticles * 2; i++) { - particleHist[i] = particlePos[i]; + particleHist[maxParticles * 2 * CURRENT_FRAME + i] = particlePos[i]; particlePos[i] = buffer_read(particlePosBuff, buffer_f64); } diff --git a/objects/o_main/Draw_75.gml b/objects/o_main/Draw_75.gml index c6ef82bd5..3a2081e6f 100644 --- a/objects/o_main/Draw_75.gml +++ b/objects/o_main/Draw_75.gml @@ -12,11 +12,11 @@ if(winMan_isMinimized()) exit; if(is_method(content)) content = content(); switch(type) { - case VALUE_TYPE.float : - case VALUE_TYPE.integer : - case VALUE_TYPE.text : - case VALUE_TYPE.struct : - case VALUE_TYPE.path : + case VALUE_TYPE.float : + case VALUE_TYPE.integer : + case VALUE_TYPE.text : + case VALUE_TYPE.struct : + case VALUE_TYPE.path : draw_tooltip_text(string_real(content)); break; @@ -28,7 +28,7 @@ if(winMan_isMinimized()) exit; draw_tooltip_text("[" + __txt("Curve Object") + "]"); break; - case VALUE_TYPE.color : + case VALUE_TYPE.color : draw_tooltip_color(content); break; diff --git a/scripts/draw_connect_linear/draw_connect_linear.gml b/scripts/draw_connect_linear/draw_connect_linear.gml index ffe2265e5..9c76359d1 100644 --- a/scripts/draw_connect_linear/draw_connect_linear.gml +++ b/scripts/draw_connect_linear/draw_connect_linear.gml @@ -6,7 +6,7 @@ function draw_line_feedback(x0, y0, x1, y1, th, c1, c0, _s) { #region var cr = 12 / 2 * _s; var cx = max(x0, x1); - var cy = y0 - cr; + var cy = (cx == x0? y0 : y1) - cr; var ox, oy, nx, ny; draw_set_color(c0); @@ -24,7 +24,7 @@ function draw_line_feedback(x0, y0, x1, y1, th, c1, c0, _s) { #region } var cx = min(x0, x1); - var cy = y1 - cr; + var cy = (cx == x0? y0 : y1) - cr; draw_set_color(c1); diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index be4399a38..7454d5aad 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -28,10 +28,10 @@ globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER, LATEST_VERSION; LATEST_VERSION = 11600; - VERSION = 11670; - SAVE_VERSION = 11670; - VERSION_STRING = "1.16.7"; - BUILD_NUMBER = 11670; + VERSION = 11680; + SAVE_VERSION = 11680; + VERSION_STRING = "1.16.8"; + BUILD_NUMBER = 11680; globalvar APPEND_MAP; APPEND_MAP = ds_map_create(); diff --git a/scripts/node_FLIP_apply_force/node_FLIP_apply_force.gml b/scripts/node_FLIP_apply_force/node_FLIP_apply_force.gml index 1639954f9..327ee7ffe 100644 --- a/scripts/node_FLIP_apply_force/node_FLIP_apply_force.gml +++ b/scripts/node_FLIP_apply_force/node_FLIP_apply_force.gml @@ -15,7 +15,7 @@ function FLIP_Obstracle() constructor { } function Node_FLIP_Apply_Force(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { - name = "Apply Force"; + name = "Add Collider"; color = COLORS.node_blend_fluid; icon = THEME.fluid_sim; w = 96; @@ -27,7 +27,8 @@ function Node_FLIP_Apply_Force(_x, _y, _group = noone) : Node(_x, _y, _group) co .setVisible(true, true); inputs[| 1] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ] ) - .setDisplay(VALUE_DISPLAY.vector); + .setDisplay(VALUE_DISPLAY.vector) + .setUnitRef(function(index) { return getDimension(); }); inputs[| 2] = nodeValue("Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 4 ) .setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 0.1] }); @@ -51,6 +52,13 @@ function Node_FLIP_Apply_Force(_x, _y, _group = noone) : Node(_x, _y, _group) co index = 0; toReset = true; + static getDimension = function() { + var domain = getInputData(0); + if(!instance_exists(domain)) return [ 1, 1 ]; + + return [ domain.width, domain.height ]; + } + static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region var _posit = getInputData(1); var _rad = getInputData(2); diff --git a/scripts/node_FLIP_apply_velocity/node_FLIP_apply_velocity.gml b/scripts/node_FLIP_apply_velocity/node_FLIP_apply_velocity.gml index e8b7224fc..652fce3d9 100644 --- a/scripts/node_FLIP_apply_velocity/node_FLIP_apply_velocity.gml +++ b/scripts/node_FLIP_apply_velocity/node_FLIP_apply_velocity.gml @@ -11,7 +11,8 @@ function Node_FLIP_Apply_Velocity(_x, _y, _group = noone) : Node(_x, _y, _group) .setVisible(true, true); inputs[| 1] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ] ) - .setDisplay(VALUE_DISPLAY.vector); + .setDisplay(VALUE_DISPLAY.vector) + .setUnitRef(function(index) { return getDimension(); }); inputs[| 2] = nodeValue("Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 4 ) .setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 0.1] }); @@ -31,6 +32,13 @@ function Node_FLIP_Apply_Velocity(_x, _y, _group = noone) : Node(_x, _y, _group) outputs[| 0] = nodeValue("Domain", self, JUNCTION_CONNECT.output, VALUE_TYPE.fdomain, noone ); + static getDimension = function() { + var domain = getInputData(0); + if(!instance_exists(domain)) return [ 1, 1 ]; + + return [ domain.width, domain.height ]; + } + static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region var _posit = getInputData(1); var _rad = getInputData(2); @@ -57,8 +65,8 @@ function Node_FLIP_Apply_Velocity(_x, _y, _group = noone) : Node(_x, _y, _group) draw_line_width2(_px, _py, _vx, _vy, 6, 2); draw_set_alpha(1); - if(inputs[| 1].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny)) active = false; - if(inputs[| 3].drawOverlay(hover, active, _px, _py, _s, _mx, _my, _snx, _sny)) active = false; + if(inputs[| 1].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny)) { hover = false; active = false; } + //if(inputs[| 3].drawOverlay(hover, active, _px, _py, _s, _mx, _my, _snx, _sny)) { hover = false; active = false; } } #endregion diff --git a/scripts/node_FLIP_destroy/node_FLIP_destroy.gml b/scripts/node_FLIP_destroy/node_FLIP_destroy.gml new file mode 100644 index 000000000..32dd62d58 --- /dev/null +++ b/scripts/node_FLIP_destroy/node_FLIP_destroy.gml @@ -0,0 +1,79 @@ +function Node_FLIP_Destroy(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { + name = "Destroy Fluid"; + color = COLORS.node_blend_fluid; + icon = THEME.fluid_sim; + w = 96; + min_h = 96; + + manual_ungroupable = false; + + inputs[| 0] = nodeValue("Domain", self, JUNCTION_CONNECT.input, VALUE_TYPE.fdomain, noone ) + .setVisible(true, true); + + inputs[| 1] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ] ) + .setDisplay(VALUE_DISPLAY.vector) + .setUnitRef(function(index) { return getDimension(); }); + + 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("Rectangle", s_node_shape_type, 0), ]); + + inputs[| 3] = nodeValue("Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 4 ) + .setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 0.1] }); + + inputs[| 4] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 4, 4 ] ) + .setDisplay(VALUE_DISPLAY.vector); + + inputs[| 5] = nodeValue("Ratio", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1 ) + .setDisplay(VALUE_DISPLAY.slider); + + outputs[| 0] = nodeValue("Domain", self, JUNCTION_CONNECT.output, VALUE_TYPE.fdomain, noone ); + + static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region + var _pos = getInputData(1); + var _shp = getInputData(2); + var _rad = getInputData(3); + var _siz = getInputData(4); + + var _px = _x + _pos[0] * _s; + var _py = _y + _pos[1] * _s; + + var _r = _rad * _s; + var _w = _siz[0] * _s; + var _h = _siz[1] * _s; + + draw_set_color(COLORS._main_accent); + if(_shp == 0) draw_circle(_px, _py, _r, true); + else if(_shp == 1) draw_rectangle(_px - _w, _py - _h, _px + _w, _py + _h, true); + + if(inputs[| 1].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny)) active = false; + + } #endregion + + static step = function() { #region + var _shp = getInputData(2); + + inputs[| 3].setVisible(_shp == 0); + inputs[| 4].setVisible(_shp == 1); + } #endregion + + static update = function() { #region + var domain = getInputData(0); + if(!instance_exists(domain)) return; + + outputs[| 0].setValue(domain); + + var _pos = getInputData(1); + var _shp = getInputData(2); + var _rad = getInputData(3); + var _siz = getInputData(4); + var _rat = getInputData(5); + + if(_shp == 0) FLIP_deleteParticle_circle(domain.domain, _pos[0], _pos[1], _rad, _rat); + else if(_shp == 1) FLIP_deleteParticle_rectangle(domain.domain, _pos[0], _pos[1], _siz[0], _siz[1], _rat); + } #endregion + + static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { + var bbox = drawGetBbox(xx, yy, _s); + draw_sprite_fit(s_node_fluidSim_destroy_fluid, 0, bbox.xc, bbox.yc, bbox.w, bbox.h); + } +} \ No newline at end of file diff --git a/scripts/node_FLIP_destroy/node_FLIP_destroy.yy b/scripts/node_FLIP_destroy/node_FLIP_destroy.yy new file mode 100644 index 000000000..c9ab52d72 --- /dev/null +++ b/scripts/node_FLIP_destroy/node_FLIP_destroy.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "node_FLIP_destroy", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "FLIP", + "path": "folders/nodes/data/simulation/FLIP.yy", + }, +} \ No newline at end of file diff --git a/scripts/node_FLIP_domain/node_FLIP_domain.gml b/scripts/node_FLIP_domain/node_FLIP_domain.gml index 8efd8a1d0..6c103210a 100644 --- a/scripts/node_FLIP_domain/node_FLIP_domain.gml +++ b/scripts/node_FLIP_domain/node_FLIP_domain.gml @@ -30,7 +30,7 @@ function Node_FLIP_Domain(_x, _y, _group = noone) : Node(_x, _y, _group) constru inputs[| 8] = nodeValue("Time Step", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.05); inputs[| 9] = nodeValue("Wall type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1) - .setDisplay(VALUE_DISPLAY.enum_scroll, [ "None", "Surround", "Ground only" ]); + .setDisplay(VALUE_DISPLAY.enum_button, [ "None", "Surround", "Ground only" ]); inputs[| 10] = nodeValue("Viscosity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.) .setDisplay(VALUE_DISPLAY.slider, { range: [ -1, 1, 0.01 ] }); @@ -42,9 +42,9 @@ function Node_FLIP_Domain(_x, _y, _group = noone) : Node(_x, _y, _group) constru .setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 2, 0.01 ] }); input_display_list = [ - ["Domain", false], 0, 1, 2, 9, 12, - ["Solver", false], 3, 8, - ["Physics", false], 6, 7, 10, 11, + ["Domain", false], 0, 1, 9, 12, + ["Solver", true], 3, 8, + ["Physics", false], 7, 10, 11, ] outputs[| 0] = nodeValue("Domain", self, JUNCTION_CONNECT.output, VALUE_TYPE.fdomain, noone); @@ -97,6 +97,12 @@ function Node_FLIP_Domain(_x, _y, _group = noone) : Node(_x, _y, _group) constru domain = instance_create(0, 0, FLIP_Domain); toReset = true; + static step = function() { + var _col = getInputData(9); + + inputs[| 12].setVisible(_col); + } + static update = function(frame = CURRENT_FRAME) { var _dim = getInputData(0); var _siz = getInputData(1); _siz = max(_siz, 1); @@ -142,7 +148,7 @@ function Node_FLIP_Domain(_x, _y, _group = noone) : Node(_x, _y, _group) constru domain.flipRatio = _flp; domain.overRelaxation = _ovr; domain.viscosity = _vis; - domain.friction = _fric; + domain.friction = power(1 - _fric, 0.025); domain.wallCollide = _col; domain.wallElasticity = _ela; diff --git a/scripts/node_FLIP_render/node_FLIP_render.gml b/scripts/node_FLIP_render/node_FLIP_render.gml index b63ea0d50..1bb1cdde8 100644 --- a/scripts/node_FLIP_render/node_FLIP_render.gml +++ b/scripts/node_FLIP_render/node_FLIP_render.gml @@ -11,7 +11,8 @@ function Node_FLIP_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constru inputs[| 1] = nodeValue("Merge threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.75) .setDisplay(VALUE_DISPLAY.slider); - inputs[| 2] = nodeValue("Vaporize", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0); + inputs[| 2] = nodeValue("Lifespan", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0 ]) + .setDisplay(VALUE_DISPLAY.range, { linked : true }); inputs[| 3] = nodeValue("Particle expansion", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 10); @@ -30,8 +31,10 @@ function Node_FLIP_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constru inputs[| 9] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) .setDisplay(VALUE_DISPLAY.range); + inputs[| 10] = nodeValue("Segments", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1); + input_display_list = [ 0, 5, - ["Rendering", false], 6, 3, 4, 9, + ["Rendering", false], 6, 10, 3, 4, 9, ["Effect", false], 2, ["Post Processing", false], 8, 7, 1, ]; @@ -50,13 +53,32 @@ function Node_FLIP_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constru triggerRender(); })]); + + static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region + var domain = getInputData(0); + if(!instance_exists(domain)) return; + if(domain.domain == noone) return; + + var _m = min(array_length(domain.particlePos) / 2 - 1, domain.numParticles); + + draw_set_color(COLORS._main_accent); + + for( var i = 0; i < _m; i++ ) { + var _px = domain.particlePos[i * 2 + 0]; + var _py = domain.particlePos[i * 2 + 1]; + + draw_circle(_x + _px * _s, _y + _py * _s, 1, false); + } + } #endregion + static step = function() { var _typ = getInputData(6); var _thr = getInputData(7); - inputs[| 1].setVisible(_typ == 0 && _thr); - inputs[| 3].setVisible(_typ == 0); - inputs[| 5].setVisible(_typ == 0, _typ == 0); + inputs[| 1].setVisible(_typ == 0 && _thr); + inputs[| 3].setVisible(_typ == 0); + inputs[| 5].setVisible(_typ == 0, _typ == 0); + inputs[| 10].setVisible(_typ == 1); } static update = function(frame = CURRENT_FRAME) { @@ -75,8 +97,10 @@ function Node_FLIP_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constru var _thr = getInputData(7); var _add = getInputData(8); var _alp = getInputData(9); + var _seg = getInputData(10); var _outSurf = outputs[| 0].getValue(); + var _maxpart = domain.maxParticles; var _padd = domain.particleSize; var _ww = domain.width - _padd * 2; var _hh = domain.height - _padd * 2; @@ -86,7 +110,7 @@ function Node_FLIP_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constru outputs[| 0].setValue(_outSurf); - var _x, _y, _px, _py, _r, _l, _a; + var _x, _y, _px, _py, _r, _l, _a, _v; var _rad = domain.particleRadius * _exp; var _mx = min(array_length(domain.particlePos) / 2 - 1, domain.numParticles); @@ -120,9 +144,10 @@ function Node_FLIP_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constru _y -= _padd; _r = 1; _a = random_range(_alp[0], _alp[1]); - - if(_vap) { - _r = (_vap - _l) / _vap; + _v = irandom_range(_vap[0], _vap[1]); + + if(_v) { + _r = (_v - _l) / _v; if(_r * _rad < 0.5) continue; } @@ -136,32 +161,42 @@ function Node_FLIP_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constru } } } else if(_typ == 1) { + var _segg = min(_seg, CURRENT_FRAME); + + var _ox, _oy, _nx, _ny; + draw_set_color(c_white); + for( var i = 0; i < _mx; i++ ) { - _x = domain.particlePos[i * 2 + 0]; - _y = domain.particlePos[i * 2 + 1]; - _px = domain.particleHist[i * 2 + 0]; - _py = domain.particleHist[i * 2 + 1]; + _l = domain.particleLife[i]; + _v = irandom_range(_vap[0], _vap[1]); - _l = domain.particleLife[i]; + var fstFr = max(0, CURRENT_FRAME - _segg); + var lstFr = _v? min(CURRENT_FRAME, CURRENT_FRAME - _l + _v) : CURRENT_FRAME; - if(_x == 0 && _y == 0) continue; - if(_px == 0 && _py == 0) continue; + if(lstFr <= fstFr) continue; - if(_vap) { - if(_l >= _vap) continue; - _r = (_vap - _l) / _vap; + _ox = lstFr == CURRENT_FRAME? domain.particlePos[i * 2 + 0] : domain.particleHist[(lstFr + 1) * _maxpart * 2 + i * 2 + 0]; + _oy = lstFr == CURRENT_FRAME? domain.particlePos[i * 2 + 1] : domain.particleHist[(lstFr + 1) * _maxpart * 2 + i * 2 + 1]; + + if(_ox == 0 && _oy == 0) continue; + + _ox -= _padd; + _oy -= _padd; + + for( var j = lstFr; j > fstFr; j-- ) { + _nx = domain.particleHist[j * _maxpart * 2 + i * 2 + 0]; + _ny = domain.particleHist[j * _maxpart * 2 + i * 2 + 1]; - _px = _x + (_px - _x) * _r; - _py = _y + (_py - _y) * _r; + if(_nx == 0 && _ny == 0) continue; + + _nx -= _padd; + _ny -= _padd; + + draw_line(_ox, _oy, _nx, _ny); + + _ox = _nx; + _oy = _ny; } - - _x -= _padd; - _y -= _padd; - _px -= _padd; - _py -= _padd; - - draw_set_color(c_white); - draw_line(_px, _py, _x, _y); } } diff --git a/scripts/node_FLIP_spawner/node_FLIP_spawner.gml b/scripts/node_FLIP_spawner/node_FLIP_spawner.gml index b85630eb7..c95c93dae 100644 --- a/scripts/node_FLIP_spawner/node_FLIP_spawner.gml +++ b/scripts/node_FLIP_spawner/node_FLIP_spawner.gml @@ -10,37 +10,40 @@ function Node_FLIP_Spawner(_x, _y, _group = noone) : Node(_x, _y, _group) constr inputs[| 0] = nodeValue("Domain", self, JUNCTION_CONNECT.input, VALUE_TYPE.fdomain, noone ) .setVisible(true, true); - inputs[| 1] = nodeValue("Spawn shape", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) + inputs[| 1] = nodeValue("Spawn Shape", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Circle", "Surface" ]); - inputs[| 2] = nodeValue("Spawn position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ] ) - .setDisplay(VALUE_DISPLAY.vector); + inputs[| 2] = nodeValue("Spawn Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ] ) + .setDisplay(VALUE_DISPLAY.vector) + .setUnitRef(function(index) { return getDimension(); }); - inputs[| 3] = nodeValue("Spawn type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) + inputs[| 3] = nodeValue("Spawn Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) .setDisplay(VALUE_DISPLAY.enum_button, [ "Stream", "Splash" ]); - inputs[| 4] = nodeValue("Spawn frame", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ); + inputs[| 4] = nodeValue("Spawn Frame", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ); - inputs[| 5] = nodeValue("Spawn amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 8 ); + inputs[| 5] = nodeValue("Spawn Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 8 ); - inputs[| 6] = nodeValue("Spawn velocity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ] ) + inputs[| 6] = nodeValue("Spawn Velocity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ] ) .setDisplay(VALUE_DISPLAY.range); - inputs[| 7] = nodeValue("Spawn surface", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone ); + inputs[| 7] = nodeValue("Spawn Surface", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone ); - inputs[| 8] = nodeValue("Spawn radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 2 ) + inputs[| 8] = nodeValue("Spawn Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 2 ) .setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 0.1] }); inputs[| 9] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, irandom_range(100000, 999999) ); - inputs[| 10] = nodeValue("Spawn direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 45, 135, 0, 0 ] ) + inputs[| 10] = nodeValue("Spawn Direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 45, 135, 0, 0 ] ) .setDisplay(VALUE_DISPLAY.rotation_random); - inputs[| 11] = nodeValue("Inherit velocity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ) + inputs[| 11] = nodeValue("Inherit Velocity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ) .setDisplay(VALUE_DISPLAY.slider); + inputs[| 12] = nodeValue("Spawn Duration", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1 ); + input_display_list = [ 0, 9, - ["Spawner", false], 1, 7, 8, 2, 3, 4, 5, + ["Spawner", false], 1, 7, 8, 2, 3, 4, 12, 5, ["Physics", false], 10, 6, 11, ] @@ -76,11 +79,19 @@ function Node_FLIP_Spawner(_x, _y, _group = noone) : Node(_x, _y, _group) constr } #endregion + static getDimension = function() { + var domain = getInputData(0); + if(!instance_exists(domain)) return [ 1, 1 ]; + + return [ domain.width, domain.height ]; + } + static step = function() { #region var _shp = getInputData(1); var _typ = getInputData(3); - inputs[| 4].setVisible(_typ == 1); + inputs[| 4].setVisible(_typ == 1); + inputs[| 12].setVisible(_typ == 1); inputs[| 7].setVisible(_shp == 1, _shp == 1); inputs[| 8].setVisible(_shp == 0); } #endregion @@ -103,6 +114,7 @@ function Node_FLIP_Spawner(_x, _y, _group = noone) : Node(_x, _y, _group) constr var _vel = getInputData( 6); var _dirr = getInputData(10); var _ivel = getInputData(11); + var _sdur = getInputData(12); if(IS_FIRST_FRAME || toReset) spawn_amo = 0; toReset = false; @@ -110,8 +122,8 @@ function Node_FLIP_Spawner(_x, _y, _group = noone) : Node(_x, _y, _group) constr _amo = min(_amo, domain.maxParticles - domain.numParticles); spawn_amo += _amo; - if(spawn_amo < 1) return; - if(_type == 1 && frame != _fra) return; + if(spawn_amo < 1) return; + if(_type == 1 && (frame < _fra || frame >= _fra + _sdur)) return; if(_shape == 1 && !is_surface(_surf)) return; var _samo = floor(spawn_amo); diff --git a/scripts/node_feedback_inline/node_feedback_inline.gml b/scripts/node_feedback_inline/node_feedback_inline.gml index dd2db35db..66bafbfdd 100644 --- a/scripts/node_feedback_inline/node_feedback_inline.gml +++ b/scripts/node_feedback_inline/node_feedback_inline.gml @@ -60,12 +60,16 @@ function Node_Feedback_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) con } #endregion static drawConnections = function(params = {}) { #region - if(!active) return; - if(!junc_in || !junc_out) return; - if(!junc_in.node.active || !junc_out.node.active) return; + if(!active) return noone; + if(!junc_in || !junc_out) return noone; + if(!junc_in.node.active || !junc_out.node.active) return noone; - if(drawJuncConnection(junc_out, junc_in, params)) - return self; + params.dashed = true; + var sel = drawJuncConnection(junc_out, junc_in, params); + params.dashed = false; + + if(sel) return self; + return noone; } #endregion static drawNode = function(_x, _y, _mx, _my, _s, display_parameter = noone) {} diff --git a/scripts/node_flip/node_flip.gml b/scripts/node_flip/node_flip.gml index 676582561..b2cdabca2 100644 --- a/scripts/node_flip/node_flip.gml +++ b/scripts/node_flip/node_flip.gml @@ -1,13 +1,10 @@ function Node_Flip(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { name = "Flip"; - shader = sh_flip; - uniform_axs = shader_get_uniform(shader, "axis"); - inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); inputs[| 1] = nodeValue("Axis", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) - .setDisplay(VALUE_DISPLAY.enum_button, ["x", "y"]); + .setDisplay(VALUE_DISPLAY.enum_button, [ "x", "y" ]); inputs[| 2] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); active_index = 2; @@ -23,17 +20,12 @@ function Node_Flip(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons static processData = function(_outSurf, _data, _output_index, _array_index) { var _axis = _data[1]; - surface_set_target(_outSurf); - DRAW_CLEAR - BLEND_OVERRIDE; + + surface_set_shader(_outSurf, sh_flip); + shader_set_i("axis", _axis); - shader_set(shader); - shader_set_uniform_i(uniform_axs, _axis); - draw_surface_safe(_data[0], 0, 0); - shader_reset(); - - BLEND_NORMAL; - surface_reset_target(); + draw_surface_safe(_data[0]); + surface_reset_shader(); return _outSurf; } diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index c80e0c3ed..fceb9e727 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -442,8 +442,9 @@ function __initNodes() { ds_list_add(flipSim, "Fluid"); addNodeObject(flipSim, "Spawner", s_node_fluidSim_add_fluid, "Node_FLIP_Spawner", [1, Node_FLIP_Spawner]).hideRecent().setVersion(11620); + addNodeObject(flipSim, "Destroy", s_node_fluidSim_destroy_fluid, "Node_FLIP_Destroy", [1, Node_FLIP_Destroy]).hideRecent().setVersion(11680); addNodeObject(flipSim, "Apply Velocity", s_node_fluidSim_apply_velocity, "Node_FLIP_Apply_Velocity", [1, Node_FLIP_Apply_Velocity]).hideRecent().setVersion(11620); - addNodeObject(flipSim, "Apply Force", s_node_fluidSim_force, "Node_FLIP_Apply_Force", [1, Node_FLIP_Apply_Force]).hideRecent().setVersion(11620); + addNodeObject(flipSim, "Add Collider", s_node_fluidSim_force, "Node_FLIP_Apply_Force", [1, Node_FLIP_Apply_Force]).hideRecent().setVersion(11620); #endregion var strandSim = ds_list_create(); #region diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index 974ebb718..af207f8a5 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -2777,7 +2777,7 @@ function drawJuncConnection(from, to, params) { #region var corner = PREFERENCES.connection_line_corner * _s; var ty = LINE_STYLE.solid; - if(to.type == VALUE_TYPE.node) + if(to.type == VALUE_TYPE.node || struct_try_get(params, "dashed")) ty = LINE_STYLE.dashed; var c0, c1; diff --git a/sprites/s_node_fluidSim_destroy_fluid/f1313810-96c4-4ec6-b05c-b073b68eb467.png b/sprites/s_node_fluidSim_destroy_fluid/f1313810-96c4-4ec6-b05c-b073b68eb467.png new file mode 100644 index 000000000..56715d601 Binary files /dev/null and b/sprites/s_node_fluidSim_destroy_fluid/f1313810-96c4-4ec6-b05c-b073b68eb467.png differ diff --git a/sprites/s_node_fluidSim_destroy_fluid/layers/f1313810-96c4-4ec6-b05c-b073b68eb467/8668c7d8-2c84-465a-8b92-1f35bdb84b04.png b/sprites/s_node_fluidSim_destroy_fluid/layers/f1313810-96c4-4ec6-b05c-b073b68eb467/8668c7d8-2c84-465a-8b92-1f35bdb84b04.png new file mode 100644 index 000000000..56715d601 Binary files /dev/null and b/sprites/s_node_fluidSim_destroy_fluid/layers/f1313810-96c4-4ec6-b05c-b073b68eb467/8668c7d8-2c84-465a-8b92-1f35bdb84b04.png differ diff --git a/sprites/s_node_fluidSim_destroy_fluid/s_node_fluidSim_destroy_fluid.yy b/sprites/s_node_fluidSim_destroy_fluid/s_node_fluidSim_destroy_fluid.yy new file mode 100644 index 000000000..2f715d9e2 --- /dev/null +++ b/sprites/s_node_fluidSim_destroy_fluid/s_node_fluidSim_destroy_fluid.yy @@ -0,0 +1,74 @@ +{ + "resourceType": "GMSprite", + "resourceVersion": "1.0", + "name": "s_node_fluidSim_destroy_fluid", + "bbox_bottom": 61, + "bbox_left": 8, + "bbox_right": 61, + "bbox_top": 11, + "bboxMode": 0, + "collisionKind": 1, + "collisionTolerance": 0, + "DynamicTexturePage": false, + "edgeFiltering": false, + "For3D": false, + "frames": [ + {"resourceType":"GMSpriteFrame","resourceVersion":"1.1","name":"f1313810-96c4-4ec6-b05c-b073b68eb467",}, + ], + "gridX": 0, + "gridY": 0, + "height": 64, + "HTile": false, + "layers": [ + {"resourceType":"GMImageLayer","resourceVersion":"1.0","name":"8668c7d8-2c84-465a-8b92-1f35bdb84b04","blendMode":0,"displayName":"default","isLocked":false,"opacity":100.0,"visible":true,}, + ], + "nineSlice": null, + "origin": 4, + "parent": { + "name": "fluidSim", + "path": "folders/nodes/icons/fluidSim.yy", + }, + "preMultiplyAlpha": false, + "sequence": { + "resourceType": "GMSequence", + "resourceVersion": "1.4", + "name": "s_node_fluidSim_destroy_fluid", + "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":"f1313810-96c4-4ec6-b05c-b073b68eb467","path":"sprites/s_node_fluidSim_destroy_fluid/s_node_fluidSim_destroy_fluid.yy",},},},"Disabled":false,"id":"e522dfff-694e-47f8-a460-e7fa969d9da4","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