This commit is contained in:
Tanasart 2024-01-15 19:53:46 +07:00
parent 0672363251
commit e7b70c9abc
20 changed files with 251 additions and 54 deletions

View file

@ -519,6 +519,7 @@
{"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",},
{"name":"sh_d3d_default","order":11,"path":"shaders/sh_d3d_default/sh_d3d_default.yy",},
{"name":"node_stagger","order":4,"path":"scripts/node_stagger/node_stagger.yy",},
{"name":"s_node_gabor","order":32,"path":"sprites/s_node_gabor/s_node_gabor.yy",},
{"name":"s_node_dithering","order":21,"path":"sprites/s_node_dithering/s_node_dithering.yy",},
{"name":"node_3d_mesh_extrude","order":8,"path":"scripts/node_3d_mesh_extrude/node_3d_mesh_extrude.yy",},

View file

@ -743,6 +743,7 @@
{"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",},},
{"id":{"name":"sh_d3d_default","path":"shaders/sh_d3d_default/sh_d3d_default.yy",},},
{"id":{"name":"node_stagger","path":"scripts/node_stagger/node_stagger.yy",},},
{"id":{"name":"s_node_gabor","path":"sprites/s_node_gabor/s_node_gabor.yy",},},
{"id":{"name":"s_node_dithering","path":"sprites/s_node_dithering/s_node_dithering.yy",},},
{"id":{"name":"node_3d_mesh_extrude","path":"scripts/node_3d_mesh_extrude/node_3d_mesh_extrude.yy",},},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View file

@ -331,12 +331,12 @@ function __part(_node) constructor {
if(_useS) draw_surface_ext(surface, _xx, _yy, scx, scy, drawrot, cc, alp_draw);
else {
var ss = round(min(scx, scy));
if(round(ss) == 0) return;
var _s = shader_current();
shader_reset();
var ss = round(min(scx, scy));
draw_set_color(cc);
draw_set_alpha(alp_draw);

View file

@ -21,6 +21,6 @@ function Node_Color(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
return;
}
draw_sprite_stretched_ext(THEME.palette_mask, 1, bbox.x0, bbox.y0, bbox.w, bbox.h, col, 1);
drawColor(col, bbox.x0, bbox.y0, bbox.w, bbox.h);
}
}

View file

@ -23,7 +23,7 @@ function Node_Graph_Preview(_x, _y, _group = noone) : Node(_x, _y, _group) const
input_display_list = [ 0,
["Display", false], 1, 2, 4, 3,
]
];
surf = noone;
stick = true;

View file

@ -65,14 +65,19 @@ function Node_MIDI_In(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
var _wx = TEXTBOX_HEIGHT + ui(16);
var _wy = by + bh + ui(8);
var _ww = _w - _wx;
var _wh = TEXTBOX_HEIGHT;
var _ww = _w - _wx - _wh - ui(8);
for( var i = input_fix_len, n = ds_list_size(inputs); i < n; i++ ) {
var jun = inputs[| i];
for( var i = input_fix_len, n = ds_list_size(inputs); i < n; i += data_length ) {
var jun = inputs[| i + 0];
var nor = inputs[| i + 1];
var _name = jun.getName();
var wid = jun.editWidget;
var _show = jun.showValue();
var shw = jun.showValue();
var nwid = nor.editWidget;
var nshw = nor.showValue();
var bs = TEXTBOX_HEIGHT;
var bx = _x;
@ -82,11 +87,16 @@ function Node_MIDI_In(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
var cc = index_watching == i? COLORS._main_value_negative : COLORS._main_icon;
draw_sprite_ext(THEME.circle_16, 0, bx + bs / 2, by + bs / 2, 1, 1, 0, cc, 1);
var param = new widgetParam(_wx, _wy, _ww, _wh, _show, jun.display_data, _m);
wid.setFocusHover(_focus, _hover);
wid .setFocusHover(_focus, _hover);
nwid.setFocusHover(_focus, _hover);
var param = new widgetParam(_wx, _wy, _ww, _wh, shw, jun.display_data, _m);
var hh = wid.drawParam(param) + ui(8);
param = new widgetParam(_wx + _ww + ui(8), _wy, _wh, _wh, nshw, nor.display_data, _m);
param.s = _wh;
nwid.drawParam(param);
if(index_watching == i) {
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_value_negative);
draw_text(_wx + ui(6), _wy + _wh / 2 + ui(2), "Waiting for MIDI input...");
@ -103,16 +113,17 @@ function Node_MIDI_In(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
["Watchers", false], watcher_controllers,
];
setIsDynamicInput(1);
setIsDynamicInput(2);
static createNewInput = function() { #region
index_watching = ds_list_size(inputs);
var _inp = nodeValue("Index", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, -1 );
ds_list_add(inputs, _inp);
ds_list_add(outputs, nodeValue("Value", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, -1 ));
_inp.editWidget.slidable = false;
ds_list_add(inputs, _inp);
ds_list_add(inputs, nodeValue("Normalize", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false ));
ds_list_add(outputs, nodeValue("Value", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, -1 ));
} #endregion
index_watching = noone;
@ -167,10 +178,17 @@ function Node_MIDI_In(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
outputs[| 1].setValue(notesPressing);
outputs[| 2].setValue(values);
for( var i = input_fix_len, n = ds_list_size(inputs); i < n; i++ ) {
var _ikey = inputs[| i].getValue();
outputs[| i + 2].setName($"{_ikey} Value");
outputs[| i + 2].setValue(struct_try_get(values, _ikey, 0));
var _ind = 1;
for( var i = input_fix_len, n = ds_list_size(inputs); i < n; i += data_length ) {
var _ikey = inputs[| i + 0].getValue();
var _inor = inputs[| i + 1].getValue();
var _val = struct_try_get(values, _ikey, 0);
if(_inor) _val /= 127;
outputs[| 2 + _ind].setName($"{_ikey} Value");
outputs[| 2 + _ind].setValue(_val);
_ind++;
}
} #endregion

View file

@ -14,12 +14,12 @@ function Node_MK_Fall(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
inputs[| 4] = nodeValue("Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 10);
inputs[| 5] = nodeValue("Gravity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1);
inputs[| 5] = nodeValue("Gravity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0);
inputs[| 6] = nodeValue("X Swing", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 4, 4 ])
inputs[| 6] = nodeValue("X Swing", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ])
.setDisplay(VALUE_DISPLAY.range, { linked : true });
inputs[| 7] = nodeValue("Y Swing", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ])
inputs[| 7] = nodeValue("Y Swing", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0.25, 0.25 ])
.setDisplay(VALUE_DISPLAY.range, { linked : true });
inputs[| 8] = nodeValue("Swing frequency", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ])
@ -54,7 +54,7 @@ function Node_MK_Fall(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
inputs[| 19] = nodeValue("Twist Rate", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1)
.setDisplay(VALUE_DISPLAY.slider);
inputs[| 20] = nodeValue("Twist Speed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 10 ])
inputs[| 20] = nodeValue("Twist Speed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 5, 10 ])
.setDisplay(VALUE_DISPLAY.range);
inputs[| 21] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ])
@ -63,6 +63,9 @@ function Node_MK_Fall(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
inputs[| 22] = nodeValue("Render Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Leaf", "Circle" ]);
inputs[| 23] = nodeValue("Twist Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.7)
.setDisplay(VALUE_DISPLAY.slider);
outputs[| 0] = nodeValue("Output", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
input_display_list = [ new Inspector_Sprite(s_MKFX), 2,
@ -72,7 +75,7 @@ function Node_MK_Fall(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
["Swing", false], 8, 6, 7, 11, 17,
["Render", false], 22, 9, 21, 13, 14,
["Ground", true, 15], 16,
["Twist", true, 18], 19, 20,
["Twist", true, 18], 19, 20, 23,
];
_gravity = 0;
@ -89,7 +92,30 @@ function Node_MK_Fall(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
_ground = noone;
_scale = [ 0, 0 ];
traj = [];
traj_index = 0;
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
draw_set_color(COLORS._main_accent);
for( var i = 0, n = array_length(traj); i < n; i++ ) {
var _tj = traj[i];
var ox, oy, nx, ny;
for( var j = 0, m = array_length(_tj); j < m; j++ ) {
nx = _x + _tj[j][0] * _s;
ny = _y + _tj[j][1] * _s;
if(j) {
draw_set_color(_tj[j - 1][2] != 0? c_red : COLORS._main_accent);
draw_line(ox, oy, nx, ny);
}
ox = nx;
oy = ny;
}
}
inputs[| 3].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
if(getInputData(15)) {
@ -125,24 +151,42 @@ function Node_MK_Fall(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
var _ny = random_range(_yswinn[0], _yswinn[1]);
var _sw = random_range(_fswing[0], _fswing[1]);
var _sp = random_range(_speed [0], _speed [1]);
var _td = _twistd;
var _tr = _twistr;
var _curving = 0;
var _curved = false;
var _cvds = 0;
var _cvdr = 0;
var _cvrr = 0;
var _cv_x = 0;
var _cv_y = 0;
var _gr = _ground == noone? 999999 : random_range(_ground[0], _ground[1]);
var _vx = 0;
var _vy = 1;
var _vy = _sp;
var _vvx = _vx;
var _vvy = _vy;
var _p0 = [ 0, 0 ];
var _p1 = [ _px, _py ];
var _frc = 1;
var life = 0;
_sx *= _sw * _sg;
_sy *= _sw;
var _swp = _sw * _sp;
var _sp2 = _sp * _sp;
var poss = array_create(t + 2);
var _vds = point_distance(0, 0, _vx, _vy);
var _vdr = point_direction(0, 0, _vx, _vy);
for(var i = -2; i < t; i++) {
var _i = life / TOTAL_FRAMES * pi * 4;
if(_curving != 0) {
_cvdr += _curving;
@ -150,19 +194,30 @@ function Node_MK_Fall(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
_vx = lengthdir_x(_cvrr, _cvdr);
_vy = lengthdir_y(_cvrr, _cvdr);
_cvrr *= 0.975;
_curving = clamp(_curving * 1.05, -10, 10);
_cvrr *= _td;
_curving = clamp(_curving * 1.05, -45, 45);
if(abs(_cvdr - _cvds) > 300) _curving = 0;
if(abs(_cvdr - _cvds) > 360) {
_curving = 0;
_vx = _cv_x;
_vy = _cv_y;
}
} else {
_vx = sin(_sw * _sp * _i) * _sg * _sx * (1 + life / TOTAL_FRAMES * _nx);
_vy += sin(_sw / _sp * _i * 2) * _sy * (1 + life / TOTAL_FRAMES * _ny);
var _i = life / 30 * pi * 4;
if(_twist && random(1) < _twistr) {
_vx -= cos(_swp * _i) * _sx * (1 + life / 30 * _nx) * _sp2;
_vy += sin(_swp * _i * 2) * _sy * (1 + life / 30 * _ny) * _sp2;
if(life > 2 && _twist && random(1) < (_tr * clamp(life / 30, 0, 1))) {
_curving = random_range(_twists[0], _twists[1]) * sign(_vx);
_cvds = point_direction(0, 0, _vx, _vy);
_cvdr = _cvds;
_cvrr = point_distance(0, 0, _vx, _vy) * 2;
_curved = true;
_cv_x = _vx;
_cv_y = _vy;
if(abs(_curving) <= 1) _curving = 0;
}
@ -170,15 +225,26 @@ function Node_MK_Fall(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
life++;
}
poss[i + 2] = [ _px, _py, _curving ];
var __vvds = point_distance(0, 0, _vx, _vy);
var __vvdr = point_direction(0, 0, _vx, _vy);
_vds = lerp( _vds, __vvds, 0.5);
_vdr = lerp_float_angle(_vdr, __vvdr, 0.5);
var _vvx = lengthdir_x(_vds, _vdr);
var _vvy = lengthdir_y(_vds, _vdr);
if(_frc >= 0.2) {
_p0[0] = _p1[0];
_p1[0] = _px;
_px += (_vx + _wind[0]) * _sp * _frc;
_px += (_vvx + _wind[0] * _sp) * _frc;
}
_p0[1] = _p1[1];
_p1[1] = _py;
_py += (_vy + _wind[1]) * _sp * _frc;
_py += (_vvy + _wind[1] * _sp) * _frc;
if(_py > _gr)
_frc *= 0.5;
@ -186,6 +252,8 @@ function Node_MK_Fall(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
_vy += _gravity * _sp;
}
if(traj_index < 16) traj[traj_index] = poss;
return [ _p0, _p1, [ _px, _py ] ];
} #endregion
@ -218,6 +286,7 @@ function Node_MK_Fall(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
_twists = getInputData(20);
_scale = getInputData(21);
var _rtyp = getInputData(22);
_twistd = getInputData(23); _twistd = power(_twistd, 0.2);
_twistr = _twistr * _twistr * _twistr;
@ -236,6 +305,9 @@ function Node_MK_Fall(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
draw_surface_safe(_surf);
BLEND_ALPHA_MULP
traj_index = 0;
traj = array_create(min(16, _amou));
shader_set(sh_draw_divide);
for( var i = 0; i < _amou; i++ ) {
_sed += 100;
@ -285,6 +357,8 @@ function Node_MK_Fall(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
}
draw_set_alpha(1);
traj_index++;
}
shader_reset();

View file

@ -852,6 +852,7 @@ function __initNodes() {
addNodeObject(animation, "Wiggler", s_node_wiggler, "Node_Wiggler", [1, Node_Wiggler],, "Create smooth random value.");
addNodeObject(animation, "Evaluate Curve", s_node_curve_eval, "Node_Anim_Curve", [1, Node_Anim_Curve],, "Evaluate value from an animation curve.");
addNodeObject(animation, "Rate Remap", s_node_rate_remap, "Node_Rate_Remap", [1, Node_Rate_Remap],, "Remap animation to a new framerate.").setVersion(1147);
addNodeObject(animation, "Stagger", s_node_rate_remap, "Node_Stagger", [1, Node_Stagger]).setVersion(11640);
ds_list_add(animation, "Audio");
addNodeObject(animation, "WAV File In", s_node_wav_file_read, "Node_WAV_File_Read", [0, Node_create_WAV_File_Read],, "Load wav audio file.").setVersion(1144);

View file

@ -43,15 +43,21 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
inputs[| 8] = nodeValue("Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0 ], "Starting/ending frames, set end to 0 to default to last frame.")
.setDisplay(VALUE_DISPLAY.vector)
inputs[| 9] = nodeValue("Spacing", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0 ])
.setDisplay(VALUE_DISPLAY.vector);
inputs[| 10] = nodeValue("Overlappable", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false)
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, [])
.setArrayDepth(1);
input_display_list = [
["Surfaces", false], 0, 1, 2,
["Sprite", false], 3, 8,
["Packing", false], 4, 5, 6, 7,
["Surfaces", false], 0, 1, 2,
["Sprite", false], 3, 8,
["Packing", false], 4, 5, 6, 9, 7,
["Rendering", false], 10,
]
attribute_surface_depth();
@ -83,6 +89,8 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
inputs[| 2].setVisible(grup == SPRITE_ANIM_GROUP.animation);
inputs[| 4].setVisible(pack == SPRITE_STACK.grid);
inputs[| 5].setVisible(pack != SPRITE_STACK.grid);
inputs[| 6].setVisible(pack != SPRITE_STACK.grid);
inputs[| 9].setVisible(pack == SPRITE_STACK.grid);
update_on_frame = grup == 0;
} #endregion
@ -115,6 +123,8 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
var spac = getInputData(6);
var padd = getInputData(7);
var rang = getInputData(8);
var spc2 = getInputData(9);
var ovlp = getInputData(10);
var cDep = attrDepth();
@ -175,13 +185,13 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
if(index >= _ed) break;
row_w += surface_get_width_safe(inpt[index]);
if(j) row_w += spac;
if(j) row_w += spc2[0];
row_h = max(row_h, surface_get_height_safe(inpt[index]));
}
ww = max(ww, row_w);
hh += row_h
if(i) hh += spac;
if(i) hh += spc2[1];
}
break;
}
@ -195,7 +205,9 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
surface_set_target(_surf);
DRAW_CLEAR
BLEND_OVERRIDE;
if(ovlp) BLEND_ALPHA_MULP
else BLEND_OVERRIDE
switch(pack) {
case SPRITE_STACK.horizontal :
var px = padd[2];
@ -262,10 +274,10 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
array_push(_atl, new SurfaceAtlas(inpt[index], px, py));
draw_surface_safe(inpt[index], px, py);
px += _w + spac;
px += _w + spc2[0];
row_h = max(row_h, _h);
}
py += row_h + spac;
py += row_h + spc2[1];
}
break;
}
@ -286,6 +298,8 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
var spac = getInputData(6);
var padd = getInputData(7);
var rang = getInputData(8);
var spc2 = getInputData(9);
var ovlp = getInputData(10);
var _atl = outputs[| 1].getValue();
var cDep = attrDepth();
@ -337,8 +351,8 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
var col = getInputData(4);
var row = ceil(amo / col);
ww = sw * col + spac * (col - 1);
hh = sh * row + spac * (row - 1);
ww = sw * col + spc2[0] * (col - 1);
hh = sh * row + spc2[1] * (row - 1);
break;
}
@ -369,6 +383,8 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
var spac = getInputData(6);
var padd = getInputData(7);
var rang = getInputData(8);
var spc2 = getInputData(9);
var ovlp = getInputData(10);
var _atl = outputs[| 1].getValue();
var cDep = attrDepth();
@ -447,7 +463,8 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
var _sy = 0;
surface_set_target(oo);
BLEND_OVERRIDE
if(ovlp) BLEND_ALPHA_MULP
else BLEND_OVERRIDE
switch(pack) {
case SPRITE_STACK.horizontal :
@ -477,8 +494,8 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
var _row = floor(_frame / col);
var _col = safe_mod(_frame, col);
_sx = px + _col * _w + max(0, _col) * spac;
_sy = py + _row * _h + max(0, _row) * spac;
_sx = px + _col * _w + max(0, _col) * spc2[0];
_sy = py + _row * _h + max(0, _row) * spc2[1];
break;
}

View file

@ -299,6 +299,7 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
path_line_index = floor(i / _pre_amount);
}
array_resize(_sct, _sct_len);
if(sortY) array_sort(_sct, function(a1, a2) { return a1.y - a2.y; });
for( var i = 0; i < _sct_len; i++ ) {
@ -332,7 +333,6 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
BLEND_NORMAL;
surface_reset_target();
array_resize(_sct, _sct_len);
scatter_data = _sct;
return _outSurf;

View file

@ -8,7 +8,7 @@ function Node_Spherize(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
.setUnitRef(function(index) { return getDimension(index); });
inputs[| 2] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
.setDisplay(VALUE_DISPLAY.slider, { range: [-3, 3, 0.01] })
.setDisplay(VALUE_DISPLAY.slider)
.setMappable(11);
inputs[| 3] = nodeValue("Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2)

View file

@ -0,0 +1,60 @@
function Node_Stagger(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Stagger";
inputs[| 0] = nodeValue("Surface", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
inputs[| 1] = nodeValue("Base Delay", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0);
inputs[| 2] = nodeValue("Delay Step", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1);
inputs[| 3] = nodeValue("Delay Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1);
outputs[| 0] = nodeValue("Surface", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
input_display_list = [ 0,
["Delay", false], 2, 3,
];
surf_indexes = [];
static processData_prebatch = function() {
surf_indexes = array_verify(surf_indexes, process_amount);
for( var i = 0; i < process_amount; i++ )
surf_indexes[i] = array_verify(surf_indexes[i], TOTAL_FRAMES);
}
static processData = function(_output, _data, _output_index, _array_index = 0) {
var _surf = _data[0];
var _base = _data[1];
var _step = _data[2];
var _amnt = _data[3];
var _time = CURRENT_FRAME;
if(_time == -1) return _output;
var _frtm = _time - floor(_array_index / _step) * _amnt;
var _sw = surface_get_width_safe(_surf);
var _sh = surface_get_height_safe(_surf);
surf_indexes[_array_index][_time] = surface_verify(surf_indexes[_array_index][_time], _sw, _sh);
surface_set_target(surf_indexes[_array_index][_time]);
DRAW_CLEAR
draw_surface_safe(_surf);
surface_reset_target();
_output = surface_verify(_output, _sw, _sh);
surface_set_target(_output);
DRAW_CLEAR
if(_frtm >= 0) {
draw_surface_safe(surf_indexes[_array_index][_frtm]);
surface_free(surf_indexes[_array_index][_frtm]);
surf_indexes[_array_index][_frtm] = 0;
}
surface_reset_target();
return _output;
}
}

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "node_stagger",
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "animation",
"path": "folders/nodes/data/animation.yy",
},
}

View file

@ -14,20 +14,24 @@ function Node_Vignette(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
inputs[| 4] = nodeValue("Exponent", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.25)
.setDisplay(VALUE_DISPLAY.slider);
inputs[| 5] = nodeValue("Roundness", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
.setDisplay(VALUE_DISPLAY.slider);
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
input_display_list = [ 1,
["Surfaces", false], 0,
["Vignette", false], 2, 3, 4,
["Vignette", false], 5, 2, 3,
]
attribute_surface_depth();
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
surface_set_shader(_outSurf, sh_vignette);
shader_set_f("smoothness", _data[2]);
shader_set_f("exposure", _data[2]);
shader_set_f("strength", _data[3]);
shader_set_f("amplitude", _data[4]);
shader_set_f("smoothness", _data[5]);
draw_surface_safe(_data[0], 0, 0);
surface_reset_shader();

View file

@ -97,7 +97,7 @@ void main() {
vec2 uv = (v_vTexcoord - cen);
float d = 1. - dot(uv, uv) / rad;
float dist = sqrt(abs(d));
vec4 c = sampleTexture(cen + uv / dist);
vec4 c = sampleTexture(mix(uv, cen + uv / dist, str));
if(d > trim) gl_FragColor = c;
}

View file

@ -1,16 +1,26 @@
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform float smoothness;
uniform float exposure;
uniform float strength;
uniform float amplitude;
uniform float smoothness;
void main() {
vec2 uv = v_vTexcoord;
uv *= 1.0 - uv.yx;
float vig = uv.x * uv.y * smoothness;
vec2 _uv = v_vTexcoord - 0.5;
float dist = dot(_uv, _uv);
float ang = atan(_uv.y, _uv.x);
vec2 _sp = 0.5 + vec2(cos(ang), sin(ang)) * dist;
float smt = smoothness / 2.;
uv = mix(uv, _sp, smt);
uv *= 1.0 - uv.yx;
float vig = uv.x * uv.y * exposure;
vig = pow(vig, amplitude);
vig = pow(vig, 0.25 + smt);
vig = clamp(vig, 0., 1.);
vec4 samp = texture2D( gm_BaseTexture, v_vTexcoord );