This commit is contained in:
Tanasart 2024-08-30 16:08:30 +07:00
parent 0f57d13ca0
commit 33a7cd02ed
32 changed files with 417 additions and 184 deletions

View file

@ -1057,6 +1057,7 @@
{"name":"node_registry","order":9,"path":"scripts/node_registry/node_registry.yy",},
{"name":"node_repeat_texture","order":23,"path":"scripts/node_repeat_texture/node_repeat_texture.yy",},
{"name":"node_repeat","order":5,"path":"scripts/node_repeat/node_repeat.yy",},
{"name":"node_revert","order":29,"path":"scripts/node_revert/node_revert.yy",},
{"name":"node_rigid_activate","order":1,"path":"scripts/node_rigid_activate/node_rigid_activate.yy",},
{"name":"node_rigid_force_apply","order":2,"path":"scripts/node_rigid_force_apply/node_rigid_force_apply.yy",},
{"name":"node_rigid_global","order":3,"path":"scripts/node_rigid_global/node_rigid_global.yy",},
@ -2386,6 +2387,7 @@
{"name":"s_node_repeat","order":23,"path":"sprites/s_node_repeat/s_node_repeat.yy",},
{"name":"s_node_replace_palette","order":44,"path":"sprites/s_node_replace_palette/s_node_replace_palette.yy",},
{"name":"s_node_resize","order":139,"path":"sprites/s_node_resize/s_node_resize.yy",},
{"name":"s_node_revert","order":12,"path":"sprites/s_node_revert/s_node_revert.yy",},
{"name":"s_node_RGB_combine","order":46,"path":"sprites/s_node_RGB_combine/s_node_RGB_combine.yy",},
{"name":"s_node_RGB","order":45,"path":"sprites/s_node_RGB/s_node_RGB.yy",},
{"name":"s_node_rigid_override","order":9,"path":"sprites/s_node_rigid_override/s_node_rigid_override.yy",},

View file

@ -1645,6 +1645,7 @@
{"id":{"name":"node_render_sprite_sheet","path":"scripts/node_render_sprite_sheet/node_render_sprite_sheet.yy",},},
{"id":{"name":"node_repeat_texture","path":"scripts/node_repeat_texture/node_repeat_texture.yy",},},
{"id":{"name":"node_repeat","path":"scripts/node_repeat/node_repeat.yy",},},
{"id":{"name":"node_revert","path":"scripts/node_revert/node_revert.yy",},},
{"id":{"name":"node_rgb_channel","path":"scripts/node_rgb_channel/node_rgb_channel.yy",},},
{"id":{"name":"node_rigid_activate","path":"scripts/node_rigid_activate/node_rigid_activate.yy",},},
{"id":{"name":"node_rigid_force_apply","path":"scripts/node_rigid_force_apply/node_rigid_force_apply.yy",},},
@ -3124,6 +3125,7 @@
{"id":{"name":"s_node_repeat","path":"sprites/s_node_repeat/s_node_repeat.yy",},},
{"id":{"name":"s_node_replace_palette","path":"sprites/s_node_replace_palette/s_node_replace_palette.yy",},},
{"id":{"name":"s_node_resize","path":"sprites/s_node_resize/s_node_resize.yy",},},
{"id":{"name":"s_node_revert","path":"sprites/s_node_revert/s_node_revert.yy",},},
{"id":{"name":"s_node_RGB_combine","path":"sprites/s_node_RGB_combine/s_node_RGB_combine.yy",},},
{"id":{"name":"s_node_RGB","path":"sprites/s_node_RGB/s_node_RGB.yy",},},
{"id":{"name":"s_node_rigid_override","path":"sprites/s_node_rigid_override/s_node_rigid_override.yy",},},

View file

@ -86,8 +86,9 @@ function __part(_node) : __particleObject() constructor {
scx_history = [];
scy_history = [];
follow = false;
rot_s = 0;
follow = false;
rot_base = 0;
rot_s = 0;
path = noone;
pathIndex = 0;
@ -131,16 +132,16 @@ function __part(_node) : __particleObject() constructor {
frame = 0;
static reset = function() { #region
static reset = function() {
INLINE
surf = noone;
prevx = undefined;
prevy = undefined;
} #endregion
}
static create = function(_surf, _x, _y, _life) { #region
static create = function(_surf, _x, _y, _life) {
INLINE
active = true;
@ -165,9 +166,9 @@ function __part(_node) : __particleObject() constructor {
scy_history = array_create(life);
blend_history = array_create(life);
alp_history = array_create(life);
} #endregion
}
static setPhysic = function(_sx, _sy, _ac, _g, _gDir, _turn, _turnSpd) { #region
static setPhysic = function(_sx, _sy, _ac, _g, _gDir, _turn, _turnSpd) {
INLINE
speedx = _sx;
@ -183,9 +184,9 @@ function __part(_node) : __particleObject() constructor {
spVec[0] = point_distance(0, 0, speedx, speedy);
spVec[1] = point_direction(0, 0, speedx, speedy);
} #endregion
}
static setWiggle = function(wiggle_maps) { #region
static setWiggle = function(wiggle_maps) {
INLINE
wig_psx = wiggle_maps.wig_psx;
@ -194,30 +195,31 @@ function __part(_node) : __particleObject() constructor {
wig_scx = wiggle_maps.wig_scx;
wig_scy = wiggle_maps.wig_scy;
wig_dir = wiggle_maps.wig_dir;
} #endregion
}
static setGround = function(_ground, _ground_offset, _ground_bounce, _ground_frict) { #region
static setGround = function(_ground, _ground_offset, _ground_bounce, _ground_frict) {
INLINE
ground = _ground;
ground_y = y + _ground_offset;
ground_bounce = _ground_bounce;
ground_friction = clamp(1 - _ground_frict, 0, 1);
} #endregion
}
static setTransform = function(_scx, _scy, _sct, _rot, _rots, _follow) { #region
static setTransform = function(_scx, _scy, _sct, _rot, _rots, _follow) {
INLINE
sc_sx = _scx;
sc_sy = _scy;
sct = _sct;
rot = _rot;
rot_s = _rots;
follow = _follow;
} #endregion
rot_base = _rot;
rot = _rot;
rot_s = _rots;
follow = _follow;
}
static setDraw = function(_col, _blend, _alp, _fade) { #region
static setDraw = function(_col, _blend, _alp, _fade) {
INLINE
col = _col;
@ -225,24 +227,24 @@ function __part(_node) : __particleObject() constructor {
alp = _alp;
alp_draw = _alp;
alp_fade = _fade;
} #endregion
}
static setPath = function(_path, _pathDiv) { #region
static setPath = function(_path, _pathDiv) {
INLINE
path = _path;
pathDiv = _pathDiv;
} #endregion
}
static kill = function(callDestroy = true) { #region
static kill = function(callDestroy = true) {
INLINE
active = false;
if(callDestroy && node.onPartDestroy != noone)
node.onPartDestroy(self);
} #endregion
}
static step = function(frame = 0) { #region
static step = function(frame = 0) {
INLINE
trailLife++;
@ -281,8 +283,10 @@ function __part(_node) : __particleObject() constructor {
speedx = lengthdir_x(diss, dirr) + gravX;
speedy = lengthdir_y(diss, dirr) + gravY;
if(follow) rot = spVec[1];
else rot += rot_s;
rot_base += rot_s;
if(follow) rot = spVec[1] + rot_base;
else rot = rot_base;
if(node.onPartStep != noone && step_int > 0 && safe_mod(life, step_int) == 0)
node.onPartStep(self);
@ -291,7 +295,8 @@ function __part(_node) : __particleObject() constructor {
if(prevx != undefined) {
spVec[0] = point_distance(prevx, prevy, x, y);
spVec[1] = point_direction(prevx, prevy, x, y);
if(spVec[0] > 1)
spVec[1] = point_direction(prevx, prevy, x, y);
}
x_history[life_incr] = drawx;
@ -312,9 +317,9 @@ function __part(_node) : __particleObject() constructor {
drawrot += wig_rot.get(seed + life);
drawsx += wig_scy.get(seed + life);
drawsy += wig_scy.get(seed + life);
} #endregion
}
static draw = function(exact, surf_w, surf_h) { #region
static draw = function(exact, surf_w, surf_h) {
INLINE
if(render_type == PARTICLE_RENDER_TYPE.line) {
@ -462,19 +467,18 @@ function __part(_node) : __particleObject() constructor {
break;
}
} #endregion
}
static getPivot = function() { #region
static getPivot = function() {
INLINE
return [x, y];
} #endregion
}
static clone = function() { #region
static clone = function() {
var _p = new __part(node);
struct_override(_p, self);
return _p;
} #endregion
}
}
#region helper

View file

@ -115,6 +115,8 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
newInput(49, nodeValue_Bool("Stretch Animation", self, false ));
newInput(50, nodeValue_Palette("Color by Index", self, [ cola(c_white) ] ));
for (var i = 2, n = array_length(inputs); i < n; i++)
inputs[i].rejectArray();
@ -130,7 +132,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
["Rotation", true], 15, 8, 9,
["Scale", true], 10, 17, 11,
["Wiggles", true], 20, 41, 42, 43,
["Color", true], 12, 28, 13, 14,
["Color", true], 12, 28, 50, 13, 14,
["Render", true], 21,
];
@ -141,10 +143,11 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
parts = array_create(attributes.part_amount);
parts_runner = 0;
seed = 0;
spawn_index = 0;
scatter_index = 0;
def_surface = -1;
seed = 0;
spawn_index_raw = 0;
spawn_index = 0;
scatter_index = 0;
def_surface = -1;
surface_cache = {};
@ -194,6 +197,8 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
var _color = getInputData(12);
var _blend = getInputData(28);
var _color_idx = getInputData(50);
var _color_idx_len = array_length(_color_idx);
var _alpha = getInputData(13);
var _arr_type = getInputData(22);
@ -212,7 +217,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
if(array_empty(_inSurf)) return;
random_set_seed(seed); seed++;
random_set_seed(seed); seed += 1000;
var _amo = irandom_range(_spawn_amount[0], _spawn_amount[1]);
if(_distrib == 2) _posDist = get_points_from_dist(_dist_map, _amo, seed);
@ -247,10 +252,12 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
xx = _spawn_area[0] + _spr.x + _spr.w / 2;
yy = _spawn_area[1] + _spr.y + _spr.h / 2;
part.atlas = _spr;
} else if(_distrib < 2) {
var sp = area_get_random_point(_spawn_area, _distrib, _scatter, spawn_index, _amo);
xx = sp[0];
yy = sp[1];
} else if(_distrib == 2) {
var sp = array_safe_get_fast(_posDist, i);
if(!is_array(sp)) continue;
@ -258,6 +265,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
xx = _spawn_area[0] + _spawn_area[2] * (sp[0] * 2 - 1.);
yy = _spawn_area[1] + _spawn_area[3] * (sp[1] * 2 - 1.);
}
} else {
xx = _pos[0];
yy = _pos[1];
@ -268,7 +276,8 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
var _rot = angle_random_eval(_rotation);
var _rot_spd = random_range(_rotation_speed[0], _rotation_speed[1]);
var _dirr = _directCenter? point_direction(_spawn_area[0], _spawn_area[1], xx, yy) : angle_random_eval(_direction);
var _dirRand = angle_random_eval(_direction);
var _dirr = _directCenter? point_direction(_spawn_area[0], _spawn_area[1], xx, yy) + _dirRand : _dirRand;
var _velo = random_range(_velocity[0], _velocity[1]);
var _vx = lengthdir_x(_velo, _dirr);
@ -282,6 +291,9 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
var _alp = random_range(_alpha[0], _alpha[1]);
var _bld = _blend.eval(random(1));
var _clr_ind = array_safe_get(_color_idx, safe_mod(spawn_index, _color_idx_len), cola(c_white));
_bld = colorMultiply(_bld, _clr_ind);
part.seed = irandom_range(100000, 999999);
part.create(_spr, xx, yy, _lif);
part.anim_speed = random_range(_anim_speed[0], _anim_speed[1]);
@ -305,6 +317,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
onSpawn(_time, part);
parts_runner = safe_mod(parts_runner + 1, attributes.part_amount);
spawn_index_raw++;
}
}
@ -344,8 +357,9 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
surface_cache = {};
getSurfaceCache();
spawn_index = 0;
scatter_index = 0;
spawn_index_raw = 0;
spawn_index = 0;
scatter_index = 0;
for(var i = 0; i < array_length(parts); i++) {
if(!parts[i].active) continue;
@ -433,13 +447,10 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
var _inSurf = getInputData(0);
var _dist = getInputData(4);
var _scatt = getInputData(24);
var _dirAng = getInputData(29);
var _turn = getInputData(34);
var _spwTyp = getInputData(16);
var _usePth = getInputData(45);
inputs[ 6].setVisible(!_dirAng);
inputs[24].setVisible(_dist < 2);
inputs[30].setVisible(_dist == 2, _dist == 2);

View file

@ -22,21 +22,27 @@ function area_get_random_point(area, distrib = AREA_DISTRIBUTION.area, scatter =
var _area_t = array_safe_get_fast(area, 4);
var xx = 0, yy = 0;
index = safe_mod(index, total);
switch(distrib) {
case AREA_DISTRIBUTION.area :
if(scatter == AREA_SCATTER.uniform) {
if(_area_t == AREA_SHAPE.rectangle) {
var _col = ceil(sqrt(total));
var _row = ceil(total / _col);
var _iwid = _area_w * 2 / _col;
var _ihig = _area_h * 2 / _row;
var _irow = floor(index / _col);
var _icol = safe_mod(index, _col);
xx = _area_x - _area_w + (_icol + 0.5) * _iwid;
yy = _area_y - _area_h + (_irow + 0.5) * _ihig;
//print($"{yy} = {_area_y} - {_area_h} + ({_irow} + 0.5) * {_ihig}")
} else {
if(index == 0) {
xx = _area_x;
@ -61,10 +67,12 @@ function area_get_random_point(area, distrib = AREA_DISTRIBUTION.area, scatter =
xx = _area_x + lengthdir_x(_sr, _sa);
yy = _area_y + lengthdir_y(_sr, _sa) / _a;
}
} else if(scatter == AREA_SCATTER.random) {
if(_area_t == AREA_SHAPE.rectangle) {
xx = _area_x + random_range(-_area_w, _area_w);
yy = _area_y + random_range(-_area_h, _area_h);
} else if(_area_t == AREA_SHAPE.elipse) {
var rr = random(360);
xx = _area_x + lengthdir_x(1, rr) * random(_area_w);
@ -109,6 +117,7 @@ function area_get_random_point(area, distrib = AREA_DISTRIBUTION.area, scatter =
xx = _area_x + lengthdir_x(_area_w, rr);
yy = _area_y + lengthdir_y(_area_h, rr);
}
} else if(scatter == AREA_SCATTER.random) {
if(_area_t == AREA_SHAPE.rectangle) {
var perimeter = _area_w * 2 + _area_h * 2;
@ -126,6 +135,7 @@ function area_get_random_point(area, distrib = AREA_DISTRIBUTION.area, scatter =
xx = _area_x + _area_w;
yy = _area_y + random_range(-_area_h, _area_h);
}
} else if(_area_t == AREA_SHAPE.elipse) {
var rr = random(360);
xx = _area_x + lengthdir_x(_area_w, rr);

View file

@ -19,11 +19,15 @@ function Node_MK_Delay_Machine(_x, _y, _group = noone) : Node(_x, _y, _group) co
newInput(6, nodeValue_Int("Seed", self, seed_random(6)))
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[6].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(7, nodeValue_Bool("Loop", self, false));
newInput(8, nodeValue_Enum_Scroll("Blend Mode", self, 0, [ "Normal", "Alpha", "Additive" ]));
outputs[0] = nodeValue_Output("Surface", self, VALUE_TYPE.surface, noone);
input_display_list = [ 0,
["Delay", false], 1, 2,
["Render", false], 3, 5, 6, 4,
["Render", false], 3, 5, 6, 4, 7, 8,
];
insp2UpdateTooltip = "Clear cache";
@ -45,6 +49,8 @@ function Node_MK_Delay_Machine(_x, _y, _group = noone) : Node(_x, _y, _group) co
var _alpC = getInputData(4);
var _psel = getInputData(5);
var _seed = getInputData(6);
var _loop = getInputData(7);
var _blnd = getInputData(8);
cacheCurrentFrame(_surf);
@ -62,8 +68,16 @@ function Node_MK_Delay_Machine(_x, _y, _group = noone) : Node(_x, _y, _group) co
surface_set_target(_outSurf);
DRAW_CLEAR
switch(_blnd) {
case 0 : BLEND_NORMAL; break;
case 1 : BLEND_ALPHA; break;
case 2 : BLEND_ADD; break;
}
for( var i = _amo - 1; i >= 0; i-- ) {
var _ff = CURRENT_FRAME - i * _frm;
if(_loop) _ff = (_ff + TOTAL_FRAMES) % TOTAL_FRAMES;
var _s = array_safe_get_fast(cached_output, _ff);
if(!is_surface(_s)) continue;
@ -77,6 +91,8 @@ function Node_MK_Delay_Machine(_x, _y, _group = noone) : Node(_x, _y, _group) co
draw_surface_ext(_s, 0, 0, 1, 1, 0, cc, aa);
}
BLEND_NORMAL
surface_reset_target();
outputs[0].setValue(_outSurf);

View file

@ -1,6 +1,5 @@
function Node_3D_Transform_Image(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group) constructor {
name = "Transform 3D";
batch_output = false;
preview_channel = 1;
object = new __3dPlane();
@ -23,16 +22,24 @@ function Node_3D_Transform_Image(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y,
newInput(in_mesh + 3, nodeValue_Vec2("Texture Tiling", self, [ 1, 1 ]));
newInput(in_mesh + 4, nodeValue_Vec2("View Range", self, [ 0.001, 10 ]));
newInput(in_mesh + 5, nodeValue_Vec2("Depth Range", self, [ 0, 1 ]));
input_display_list = [
["Material", false], in_mesh + 0, in_mesh + 3,
__d3d_input_list_transform,
["Camera", false], in_mesh + 1, in_mesh + 2,
["Camera", false], in_mesh + 1, in_mesh + 2, in_mesh + 4,
["Render", false], in_mesh + 5,
]
outputs[0].setVisible(false);
outputs[1] = nodeValue_Output("Rendered", self, VALUE_TYPE.surface, noone);
output_display_list = [ 1 ]
outputs[2] = nodeValue_Output("Depth", self, VALUE_TYPE.surface, noone);
output_display_list = [ 1, 2 ]
attribute_interpolation();
@ -58,61 +65,64 @@ function Node_3D_Transform_Image(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y,
draw_rectangle(_px, _py, _px + _pws, _py + _phs, true);
}
static processData = function(_output, _data, _output_index, _array_index = 0) {
static processData = function(_outData, _data, _output_index, _array_index = 0) {
var _surf = _data[in_mesh + 0];
var _proj = _data[in_mesh + 1];
var _fov = _data[in_mesh + 2];
var _tile = _data[in_mesh + 3];
var _view = _data[in_mesh + 4];
var _dept = _data[in_mesh + 5];
camObj.transform.position.set(new __vec3(0, 0, 2));
camObj.transform.rotation = new BBMOD_Quaternion().FromEuler(0, -90, 180);
camObj.transform.scale.set(.5, .5, .5);
if(!is_surface(_surf)) return 0;
if(!is_surface(_surf)) return noone;
if(_output_index == 0) {
object.materials = [ new __d3dMaterial(_surf) ];
setTransform(object, _data);
if(_array_index == preview_index) {
materialPreview.surface = _surf;
setTransform(objectPreview, _data);
}
return object;
object.materials = [ new __d3dMaterial(_surf) ];
setTransform(object, _data);
if(_array_index == preview_index) {
materialPreview.surface = _surf;
setTransform(objectPreview, _data);
}
if(_output_index == 1) {
var _dim = surface_get_dimension(_surf);
var projMat = _proj? matrix_build_projection_perspective_fov(_fov, _dim[0] / _dim[1], 0.001, 10) : matrix_build_projection_ortho(1, 1, 0.001, 10);
var viewMat = matrix_build_lookat(0, 0, 1,
0, 0, 0,
1, 0, 0);
var _dim = surface_get_dimension(_surf);
var projMat = _proj? matrix_build_projection_perspective_fov(_fov, _dim[0] / _dim[1], _view[0], _view[1]) : matrix_build_projection_ortho(1, 1, _view[0], _view[1]);
var viewMat = matrix_build_lookat(0, 0, 1,
0, 0, 0,
1, 0, 0);
var _outSurf = surface_verify(_outData[1], _dim[0], _dim[1]);
var _dptSurf = surface_verify(_outData[2], _dim[0], _dim[1]);
surface_set_target_ext(0, _outSurf);
surface_set_target_ext(1, _dptSurf);
shader_set(sh_d3d_3d_transform);
DRAW_CLEAR
BLEND_OVERRIDE
shader_set_2("tiling", _tile);
shader_set_f("viewPlane", _dept);
_output = surface_verify(_output, _dim[0], _dim[1]);
surface_set_shader(_output, sh_d3d_3d_transform);
shader_set_2("tiling", _tile);
camera_set_view_mat(camera, viewMat);
camera_set_proj_mat(camera, projMat);
camera_apply(camera);
gpu_set_texfilter(attributes.interpolate);
object.transform.submitMatrix();
matrix_set(matrix_world, matrix_stack_top());
vertex_submit(object.VB[0], pr_trianglelist, surface_get_texture(_surf));
object.transform.clearMatrix();
matrix_set(matrix_world, matrix_build_identity());
camera_apply(0);
gpu_set_texfilter(false);
surface_reset_shader();
return _output;
}
return 0;
camera_set_view_mat(camera, viewMat);
camera_set_proj_mat(camera, projMat);
camera_apply(camera);
gpu_set_texfilter(attributes.interpolate);
object.transform.submitMatrix();
matrix_set(matrix_world, matrix_stack_top());
vertex_submit(object.VB[0], pr_trianglelist, surface_get_texture(_surf));
object.transform.clearMatrix();
matrix_set(matrix_world, matrix_build_identity());
camera_apply(0);
BLEND_NORMAL
gpu_set_texfilter(false);
surface_reset_target();
return [ object, _outSurf, _dptSurf ];
}
static getPreviewObject = function() { return objectPreview; }

View file

@ -43,30 +43,32 @@ function Node_Bloom(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone);
outputs[1] = nodeValue_Output("Bloom Mask", self, VALUE_TYPE.surface, noone);
temp_surface = [ 0 ];
attribute_surface_depth();
surface_blur_init();
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
var _typ = getSingleValue(13);
var _hov = false;
if(_typ == 1) { var hv = inputs[14].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny); _hov |= hv; }
return _hov;
} #endregion
}
static step = function() { #region
static step = function() {
__step_mask_modifier();
var _typ = getSingleValue(13);
inputs[11].setVisible(_typ == 0);
inputs[12].setVisible(_typ == 0);
inputs[14].setVisible(_typ == 1);
} #endregion
}
static processData = function(_outSurf, _data, _output_index, _array_index) {
static processData = function(_outData, _data, _output_index, _array_index) {
var _surf = _data[0];
var _size = _data[1];
var _tole = _data[2];
@ -82,6 +84,8 @@ function Node_Bloom(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
var _sh = surface_get_height_safe(_surf);
temp_surface[0] = surface_verify(temp_surface[0], _sw, _sh);
var _outSurf = surface_verify(_outData[0], _sw, _sh);
var _maskSurf = surface_verify(_outData[1], _sw, _sh);
surface_set_shader(temp_surface[0], sh_bloom_pass);
draw_clear_alpha(c_black, 1);
@ -106,10 +110,14 @@ function Node_Bloom(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
draw_surface_safe(_surf);
surface_reset_shader();
surface_set_shader(_maskSurf, noone);
draw_surface_safe(pass1blur);
surface_reset_shader();
__process_mask_modifier(_data);
_outSurf = mask_apply(_surf, _outSurf, _data[5], _data[6]);
_outSurf = channel_apply(_surf, _outSurf, _data[8]);
return _outSurf;
return [ _outSurf, _maskSurf ];
}
}

View file

@ -22,20 +22,20 @@ function Node_Cache(_x, _y, _group = noone) : __Node_Cache(_x, _y, _group) const
enableNodeGroup();
}
static step = function() { #region
if(cache_loading) {
cached_output[cache_loading_progress] = __surface_array_deserialize(cache_content[cache_loading_progress]);
cache_result[cache_loading_progress] = true;
cache_loading_progress++;
if(cache_loading_progress == TOTAL_FRAMES) {
cache_loading = false;
update();
}
static step = function() {
if(!cache_loading) return;
cached_output[cache_loading_progress] = __surface_array_deserialize(cache_content[cache_loading_progress]);
cache_result[cache_loading_progress] = true;
cache_loading_progress++;
if(cache_loading_progress == TOTAL_FRAMES) {
cache_loading = false;
update();
}
} #endregion
}
static update = function() { #region
static update = function() {
if(recoverCache() || cache_loading) return;
if(!inputs[0].value_from) return;
@ -46,25 +46,23 @@ function Node_Cache(_x, _y, _group = noone) : __Node_Cache(_x, _y, _group) const
var _surf = getInputData(0);
cacheCurrentFrame(_surf);
disableNodeGroup();
} #endregion
}
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
if(cache_loading)
draw_sprite_ui(THEME.loading, 0, xx + w * _s / 2, yy + h * _s / 2, _s, _s, current_time / 2, COLORS._main_icon, 1);
} #endregion
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
if(cache_loading) draw_sprite_ui(THEME.loading, 0, xx + w * _s / 2, yy + h * _s / 2, _s, _s, current_time / 2, COLORS._main_icon, 1);
}
static doSerialize = function(_map) { #region
static doSerialize = function(_map) {
_map.cache = surface_array_serialize(cached_output);
} #endregion
}
static postDeserialize = function() { #region
static postDeserialize = function() {
refreshCacheGroup();
if(!struct_has(load_map, "cache")) return;
cache_content = json_try_parse(load_map.cache);
cache_loading_progress = 0;
cache_loading = true;
} #endregion
}
}

View file

@ -29,7 +29,7 @@ function Node_Cache_Array(_x, _y, _group = noone) : __Node_Cache(_x, _y, _group)
enableNodeGroup();
}
static step = function() { #region
static step = function() {
if(!cache_loading) return;
var _content = cache_content[cache_loading_progress];
@ -42,9 +42,9 @@ function Node_Cache_Array(_x, _y, _group = noone) : __Node_Cache(_x, _y, _group)
cache_loading = false;
update();
}
} #endregion
}
static update = function() { #region
static update = function() {
if(cache_loading) return;
if(!inputs[0].value_from) return;
@ -77,22 +77,22 @@ function Node_Cache_Array(_x, _y, _group = noone) : __Node_Cache(_x, _y, _group)
outputs[0].setValue(ss);
disableNodeGroup();
} #endregion
}
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
if(cache_loading) draw_sprite_ui(THEME.loading, 0, xx + w * _s / 2, yy + h * _s / 2, _s, _s, current_time / 2, COLORS._main_icon, 1);
} #endregion
}
static doSerialize = function(_map) { #region
static doSerialize = function(_map) {
_map.cache = surface_array_serialize(cached_output);
} #endregion
}
static postDeserialize = function() { #region
static postDeserialize = function() {
refreshCacheGroup();
if(!struct_has(load_map, "cache")) return;
cache_content = json_try_parse(load_map.cache);
cache_loading_progress = 0;
cache_loading = true;
} #endregion
}
}

View file

@ -38,21 +38,19 @@ function __Node_Cache(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
static enableNodeGroup = function() { #region
if(LOADING || APPENDING) return;
print("Enacle");
for( var i = 0, n = array_length(cache_group_members); i < n; i++ )
cache_group_members[i].renderActive = true;
clearCache(true);
} #endregion
static disableNodeGroup = function() { #region
static disableNodeGroup = function() {
if(LOADING || APPENDING) return;
print("Disable");
if(IS_PLAYING && IS_LAST_FRAME)
for( var i = 0, n = array_length(cache_group_members); i < n; i++ )
cache_group_members[i].renderActive = false;
} #endregion
}
static refreshCacheGroup = function() { #region
cache_group_members = [];

View file

@ -7,10 +7,12 @@ function Node_Delay(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
newInput(1, nodeValue_Int("Frames", self, 1));
newInput(2, nodeValue_Bool("Loop", self, false));
outputs[0] = nodeValue_Output("Surface", self, VALUE_TYPE.surface, noone);
input_display_list = [ 0,
["Delay", false], 1,
["Delay", false], 1, 2,
];
surf_indexes = [];
@ -24,9 +26,12 @@ function Node_Delay(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
static processData = function(_output, _data, _output_index, _array_index = 0) {
var _surf = _data[0];
var _frme = _data[1];
var _loop = _data[2];
var _time = CURRENT_FRAME;
var _frtm = clamp(_time - _frme, 0, TOTAL_FRAMES - 1);
var _frtm = _time - _frme;
if(_loop) _frtm = (_frtm + TOTAL_FRAMES) % TOTAL_FRAMES;
else _frtm = clamp(_frtm, 0, TOTAL_FRAMES - 1);
var _sw = surface_get_width_safe(_surf);
var _sh = surface_get_height_safe(_surf);
@ -35,12 +40,15 @@ function Node_Delay(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
surface_set_target(surf_indexes[_array_index][_time]);
DRAW_CLEAR
BLEND_OVERRIDE
draw_surface_safe(_surf);
BLEND_NORMAL
surface_reset_target();
_output = surface_verify(_output, _sw, _sh);
surface_set_target(_output);
DRAW_CLEAR
BLEND_OVERRIDE
if(0 <= _frtm && _frtm < TOTAL_FRAMES) {
draw_surface_safe(surf_indexes[_array_index][_frtm]);
@ -48,6 +56,8 @@ function Node_Delay(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
surface_free(surf_indexes[_array_index][_frtm]);
surf_indexes[_array_index][_frtm] = 0;
}
BLEND_NORMAL
surface_reset_target();
return _output;

View file

@ -158,7 +158,7 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
var _wig = _data[4];
var _sed = _data[5];
var _ang = _data[6];
var _pat = _data[7]; print(_pat);
var _pat = _data[7];
var _ratio = _data[8];
var _shift = _data[9];

View file

@ -245,10 +245,14 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
if(_os == 1) {
data = processData(_out[0], inputs_data, 0, 0);
if(data == noone) return;
outputs[0].setValue(data);
} else {
data = processData(_out, inputs_data, 0, 0);
if(data == noone) return;
for(var i = 0; i < _os; i++) outputs[i].setValue(data[i]);
}

View file

@ -1008,6 +1008,7 @@ function __initNodes() {
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, "Delay", s_node_delay, "Node_Delay", [1, Node_Delay],, "Delay the animation by fix amount of frames.").setVersion(11640);
addNodeObject(animation, "Stagger", s_node_stagger, "Node_Stagger", [1, Node_Stagger],, "Delay the animation based on array index.").setVersion(11640);
addNodeObject(animation, "Revert", s_node_revert, "Node_Revert", [1, Node_Revert],, "Cache the entire animation and replay backward.").setVersion(1_17_11_0);
ds_list_add(animation, "Value");
addNodeObject(animation, "WaveTable", s_node_wave, "Node_Fn_WaveTable", [1, Node_Fn_WaveTable],, "Create value changing overtime in wave pattern.").setVersion(11720);

View file

@ -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",
}

View file

@ -0,0 +1,33 @@
function Node_Revert(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Revert";
use_cache = CACHE_USE.manual;
newInput(0, nodeValue_Surface("Surface in", self));
outputs[0] = nodeValue_Output("Output", self, VALUE_TYPE.surface, noone);
input_display_list = [
["Surfaces", true], 0,
];
insp2UpdateTooltip = "Clear cache";
insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ];
static onInspector2Update = function() {
clearCache(true);
}
static update = function() {
if(!inputs[0].value_from) return;
if(!inputs[0].value_from.node.renderActive) return;
var _surf = getInputData(0);
cacheCurrentFrame(_surf);
var _frm = TOTAL_FRAMES - CURRENT_FRAME - 1;
if(!cacheExist(_frm)) return;
outputs[0].setValue(getCacheFrame(_frm));
}
}

View file

@ -0,0 +1,13 @@
{
"$GMScript":"v1",
"%Name":"node_revert",
"isCompatibility":false,
"isDnD":false,
"name":"node_revert",
"parent":{
"name":"misc",
"path":"folders/nodes/data/misc.yy",
},
"resourceType":"GMScript",
"resourceVersion":"2.0",
}

View file

@ -17,11 +17,14 @@ function Node_Vignette(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
newInput(5, nodeValue_Float("Roundness", self, 0))
.setDisplay(VALUE_DISPLAY.slider);
newInput(6, nodeValue_Bool("Lighten", self, false))
outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone);
input_display_list = [ 1,
["Surfaces", false], 0,
["Vignette", false], 5, 2, 3,
["Surfaces", false], 0,
["Vignette", false], 5, 2, 3,
["Render", false], 6,
]
attribute_surface_depth();
@ -32,6 +35,7 @@ function Node_Vignette(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
shader_set_f("strength", _data[3]);
shader_set_f("amplitude", _data[4]);
shader_set_f("smoothness", _data[5]);
shader_set_i("light", _data[6]);
draw_surface_safe(_data[0]);
surface_reset_shader();

View file

@ -13,6 +13,8 @@ void main() {
vec4 _col1 = texture2D( fore, v_vTexcoord );
vec4 res = _col0 + _col1 * opacity;
////////// Alpha
float bright = dot(_col1.rgb, vec3(0.2126, 0.7152, 0.0722));
float aa = _col0.a + bright * opacity;
res.a = aa;

View file

@ -12,7 +12,7 @@ uniform float points_x[MAX_POINTS];
uniform float points_y[MAX_POINTS];
uniform float intensity;
uniform float i_curve[64];
uniform float i_curve[1024];
uniform int i_amount;
vec4 sample(vec2 pos) { #region
@ -88,7 +88,7 @@ float eval_curve_segment_x(in float _y0, in float ax0, in float ay0, in float bx
return eval_curve_segment_t(_y0, ax0, ay0, bx1, by1, _y1, _xt);
}
float curveEval(in float[64] curve, in int amo, in float _x) {
float curveEval(in float[1024] curve, in int amo, in float _x) {
int _shf = amo - int(floor(float(amo) / 6.) * 6.);
int _segs = (amo - _shf) / 6 - 1;

View file

@ -4,19 +4,19 @@
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform float w_curve[64];
uniform float w_curve[1024];
uniform int w_amount;
uniform float r_curve[64];
uniform float r_curve[1024];
uniform int r_amount;
uniform float g_curve[64];
uniform float g_curve[1024];
uniform int g_amount;
uniform float b_curve[64];
uniform float b_curve[1024];
uniform int b_amount;
uniform float a_curve[64];
uniform float a_curve[1024];
uniform int a_amount;
float eval_curve_segment_t(in float _y0, in float ax0, in float ay0, in float bx1, in float by1, in float _y1, in float prog) {
@ -73,7 +73,7 @@ float eval_curve_segment_x(in float _y0, in float ax0, in float ay0, in float bx
return eval_curve_segment_t(_y0, ax0, ay0, bx1, by1, _y1, _xt);
}
float curveEval(in float[64] curve, in int amo, in float _x) {
float curveEval(in float[1024] curve, in int amo, in float _x) {
int _shf = amo - int(floor(float(amo) / 6.) * 6.);
int _segs = (amo - _shf) / 6 - 1;

View file

@ -1,13 +1,13 @@
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform float h_curve[64];
uniform float h_curve[1024];
uniform int h_amount;
uniform float s_curve[64];
uniform float s_curve[1024];
uniform int s_amount;
uniform float v_curve[64];
uniform float v_curve[1024];
uniform int v_amount;
float eval_curve_segment_t(in float _y0, in float ax0, in float ay0, in float bx1, in float by1, in float _y1, in float prog) {
@ -64,7 +64,7 @@ float eval_curve_segment_x(in float _y0, in float ax0, in float ay0, in float bx
return eval_curve_segment_t(_y0, ax0, ay0, bx1, by1, _y1, _xt);
}
float curveEval(in float[64] curve, in int amo, in float _x) {
float curveEval(in float[1024] curve, in int amo, in float _x) {
int _shf = amo - int(floor(float(amo) / 6.) * 6.);
int _segs = (amo - _shf) / 6 - 1;

View file

@ -1,9 +1,16 @@
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
varying vec2 v_vTexcoord;
varying float v_LightDepth;
uniform vec2 tiling;
uniform vec2 viewPlane;
uniform vec2 tiling;
void main() {
vec2 px = fract(v_vTexcoord * tiling);
gl_FragColor = texture2D( gm_BaseTexture, px );
vec2 uv_coord = fract(v_vTexcoord * tiling);
vec4 mat_baseColor = texture2D( gm_BaseTexture, uv_coord );
float depth = (v_LightDepth - viewPlane.x) / (viewPlane.y - viewPlane.x);
depth = 1. - depth;
gl_FragData[0] = mat_baseColor;
gl_FragData[1] = vec4(vec3(depth), 1.);
}

View file

@ -1,19 +1,15 @@
//
// 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)
attribute vec3 in_Position;
attribute vec3 in_Normal;
attribute vec4 in_Colour;
attribute vec2 in_TextureCoord;
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
varying vec2 v_vTexcoord;
varying float v_LightDepth;
void main()
{
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;
v_LightDepth = gl_Position.z / gl_Position.w;
v_vTexcoord = in_TextureCoord;
}

View file

@ -7,7 +7,7 @@ uniform float dist;
uniform int useMap;
uniform sampler2D strengthMap;
uniform float alpha_curve[64];
uniform float alpha_curve[1024];
uniform int curve_amount;
uniform float randomAmount;

View file

@ -10,22 +10,20 @@ uniform float max_distance;
void main() {
vec4 col = texture2D( gm_BaseTexture, v_vTexcoord );
float aa = alpha == 1? texture2D( original, v_vTexcoord ).a : 1.;
if(col.xy == vec2(0.)) {
gl_FragColor = vec4(vec3(0.), 1.);
gl_FragColor = vec4(vec3(0.), aa);
return;
}
float dist = (max_distance - distance(col.xy, v_vTexcoord)) / max_distance;
if(invert == 1) dist = 1. - dist;
if((side == 0 && col.z == 0.) || (side == 1 && col.z == 1.)) {
gl_FragColor = vec4(vec3(col.z), 1.);
gl_FragColor = vec4(vec3(col.z), aa);
return;
}
float aa = 1.;
if(alpha == 1) aa = texture2D( original, v_vTexcoord ).a;
if(invert == 1) dist = 1. - dist;
gl_FragColor = vec4(vec3(dist), aa);
}

View file

@ -12,7 +12,7 @@ uniform int tile;
uniform int drawBG;
uniform int drawDF;
uniform vec2 dfLevel;
uniform float w_curve[64];
uniform float w_curve[1024];
uniform int w_amount;
uniform float rotation;
@ -106,7 +106,7 @@ float eval_curve_segment_x(in float _y0, in float ax0, in float ay0, in float bx
return eval_curve_segment_t(_y0, ax0, ay0, bx1, by1, _y1, _xt);
}
float curveEval(in float[64] curve, in int amo, in float _x) {
float curveEval(in float[1024] curve, in int amo, in float _x) {
int _shf = amo - int(floor(float(amo) / 6.) * 6.);
int _segs = (amo - _shf) / 6 - 1;

View file

@ -5,6 +5,7 @@ uniform float exposure;
uniform float strength;
uniform float amplitude;
uniform float smoothness;
uniform int light;
void main() {
vec2 uv = v_vTexcoord;
@ -24,5 +25,8 @@ void main() {
vig = clamp(vig, 0., 1.);
vec4 samp = texture2D( gm_BaseTexture, v_vTexcoord );
gl_FragColor = vec4(samp.rgb * (1. - ((1. - vig) * strength)), samp.a);
float str = (1. - ((1. - vig) * strength));
if(light == 1) str = str < 0.001? 10000. : 1. / str;
gl_FragColor = vec4(samp.rgb * str, samp.a);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -0,0 +1,90 @@
{
"$GMSprite":"",
"%Name":"s_node_revert",
"bboxMode":0,
"bbox_bottom":51,
"bbox_left":3,
"bbox_right":56,
"bbox_top":12,
"collisionKind":1,
"collisionTolerance":0,
"DynamicTexturePage":false,
"edgeFiltering":false,
"For3D":false,
"frames":[
{"$GMSpriteFrame":"","%Name":"1fb6b3f0-c200-4273-80f6-e96fa553995b","name":"1fb6b3f0-c200-4273-80f6-e96fa553995b","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
],
"gridX":0,
"gridY":0,
"height":64,
"HTile":false,
"layers":[
{"$GMImageLayer":"","%Name":"d731e6b4-02b8-4d03-a630-971be1f4542b","blendMode":0,"displayName":"default","isLocked":false,"name":"d731e6b4-02b8-4d03-a630-971be1f4542b","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
],
"name":"s_node_revert",
"nineSlice":null,
"origin":4,
"parent":{
"name":"animation",
"path":"folders/nodes/icons/animation.yy",
},
"preMultiplyAlpha":false,
"resourceType":"GMSprite",
"resourceVersion":"2.0",
"sequence":{
"$GMSequence":"",
"%Name":"s_node_revert",
"autoRecord":true,
"backdropHeight":768,
"backdropImageOpacity":0.5,
"backdropImagePath":"",
"backdropWidth":1366,
"backdropXOffset":0.0,
"backdropYOffset":0.0,
"events":{
"$KeyframeStore<MessageEventKeyframe>":"",
"Keyframes":[],
"resourceType":"KeyframeStore<MessageEventKeyframe>",
"resourceVersion":"2.0",
},
"eventStubScript":null,
"eventToFunction":{},
"length":1.0,
"lockOrigin":false,
"moments":{
"$KeyframeStore<MomentsEventKeyframe>":"",
"Keyframes":[],
"resourceType":"KeyframeStore<MomentsEventKeyframe>",
"resourceVersion":"2.0",
},
"name":"s_node_revert",
"playback":1,
"playbackSpeed":30.0,
"playbackSpeedType":0,
"resourceType":"GMSequence",
"resourceVersion":"2.0",
"showBackdrop":true,
"showBackdropImage":false,
"timeUnits":1,
"tracks":[
{"$GMSpriteFramesTrack":"","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"$KeyframeStore<SpriteFrameKeyframe>":"","Keyframes":[
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"1fb6b3f0-c200-4273-80f6-e96fa553995b","path":"sprites/s_node_revert/s_node_revert.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"0c9b46cc-4742-44b2-9251-22348d392e67","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
],"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
],
"visibleRange":null,
"volume":1.0,
"xorigin":32,
"yorigin":32,
},
"swatchColours":null,
"swfPrecision":0.5,
"textureGroupId":{
"name":"Default",
"path":"texturegroups/Default",
},
"type":0,
"VTile":false,
"width":64,
}