- New smear node.
|
@ -611,6 +611,7 @@
|
|||
{"name":"node_3d_mesh_cone","order":6,"path":"scripts/node_3d_mesh_cone/node_3d_mesh_cone.yy",},
|
||||
{"name":"font_loader","order":8,"path":"scripts/font_loader/font_loader.yy",},
|
||||
{"name":"sh_water_caustic","order":18,"path":"shaders/sh_water_caustic/sh_water_caustic.yy",},
|
||||
{"name":"node_smear","order":12,"path":"scripts/node_smear/node_smear.yy",},
|
||||
{"name":"node_iterator_filter_input","order":1,"path":"scripts/node_iterator_filter_input/node_iterator_filter_input.yy",},
|
||||
{"name":"s_node_ovreride_channel","order":56,"path":"sprites/s_node_ovreride_channel/s_node_ovreride_channel.yy",},
|
||||
{"name":"point_rotate","order":1,"path":"scripts/point_rotate/point_rotate.yy",},
|
||||
|
@ -1555,7 +1556,9 @@
|
|||
{"name":"node_gradient_replace_color","order":12,"path":"scripts/node_gradient_replace_color/node_gradient_replace_color.yy",},
|
||||
{"name":"s_node_vfx_repel","order":6,"path":"sprites/s_node_vfx_repel/s_node_vfx_repel.yy",},
|
||||
{"name":"sh_pb_mask_inset","order":10,"path":"shaders/sh_pb_mask_inset/sh_pb_mask_inset.yy",},
|
||||
{"name":"s_node_smear","order":8,"path":"sprites/s_node_smear/s_node_smear.yy",},
|
||||
{"name":"fd_rectangle_set_collision_mask_surface","order":2,"path":"scripts/fd_rectangle_set_collision_mask_surface/fd_rectangle_set_collision_mask_surface.yy",},
|
||||
{"name":"sh_smear","order":13,"path":"shaders/sh_smear/sh_smear.yy",},
|
||||
{"name":"node_array_length","order":8,"path":"scripts/node_array_length/node_array_length.yy",},
|
||||
{"name":"node_erode","order":9,"path":"scripts/node_erode/node_erode.yy",},
|
||||
{"name":"sh_colours_replace","order":34,"path":"shaders/sh_colours_replace/sh_colours_replace.yy",},
|
||||
|
|
|
@ -846,6 +846,7 @@
|
|||
{"id":{"name":"node_3d_mesh_cone","path":"scripts/node_3d_mesh_cone/node_3d_mesh_cone.yy",},},
|
||||
{"id":{"name":"font_loader","path":"scripts/font_loader/font_loader.yy",},},
|
||||
{"id":{"name":"sh_water_caustic","path":"shaders/sh_water_caustic/sh_water_caustic.yy",},},
|
||||
{"id":{"name":"node_smear","path":"scripts/node_smear/node_smear.yy",},},
|
||||
{"id":{"name":"node_iterator_filter_input","path":"scripts/node_iterator_filter_input/node_iterator_filter_input.yy",},},
|
||||
{"id":{"name":"s_node_ovreride_channel","path":"sprites/s_node_ovreride_channel/s_node_ovreride_channel.yy",},},
|
||||
{"id":{"name":"point_rotate","path":"scripts/point_rotate/point_rotate.yy",},},
|
||||
|
@ -1916,8 +1917,10 @@
|
|||
{"id":{"name":"s_node_condition","path":"sprites/s_node_condition/s_node_condition.yy",},},
|
||||
{"id":{"name":"s_node_vfx_repel","path":"sprites/s_node_vfx_repel/s_node_vfx_repel.yy",},},
|
||||
{"id":{"name":"sh_pb_mask_inset","path":"shaders/sh_pb_mask_inset/sh_pb_mask_inset.yy",},},
|
||||
{"id":{"name":"s_node_smear","path":"sprites/s_node_smear/s_node_smear.yy",},},
|
||||
{"id":{"name":"fd_rectangle_set_collision_mask_surface","path":"scripts/fd_rectangle_set_collision_mask_surface/fd_rectangle_set_collision_mask_surface.yy",},},
|
||||
{"id":{"name":"node_armature","path":"scripts/node_armature/node_armature.yy",},},
|
||||
{"id":{"name":"sh_smear","path":"shaders/sh_smear/sh_smear.yy",},},
|
||||
{"id":{"name":"node_array_length","path":"scripts/node_array_length/node_array_length.yy",},},
|
||||
{"id":{"name":"node_erode","path":"scripts/node_erode/node_erode.yy",},},
|
||||
{"id":{"name":"sh_colours_replace","path":"shaders/sh_colours_replace/sh_colours_replace.yy",},},
|
||||
|
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
|
@ -65,16 +65,23 @@ event_inherited();
|
|||
}
|
||||
|
||||
function animationPreStep() {
|
||||
INLINE
|
||||
if(!ready) return;
|
||||
|
||||
var runResult = lua_call(thread, "animationPreStep");
|
||||
}
|
||||
|
||||
function animationPostStep() {
|
||||
INLINE
|
||||
if(!ready) return;
|
||||
|
||||
var runResult = lua_call(thread, "animationPostStep");
|
||||
}
|
||||
|
||||
function callFunctions(fn) {
|
||||
INLINE
|
||||
if(!ready) return;
|
||||
|
||||
lua_call(thread, fn);
|
||||
}
|
||||
#endregion
|
|
@ -20,8 +20,9 @@ function addonPanel(_addon, pane) : PanelContent() constructor {
|
|||
|
||||
function drawGUI() {
|
||||
if(drawUIFn == "") return;
|
||||
if(!_addon.ready) return;
|
||||
lua_add_code(_addon.thread, "panelID = '" + string(ID) + "'");
|
||||
if(!_addon.ready) return;
|
||||
|
||||
lua_add_code(_addon.thread, $"panelID = '{ID}'");
|
||||
var runResult = lua_call(_addon.thread, drawUIFn);
|
||||
}
|
||||
|
||||
|
@ -30,9 +31,10 @@ function addonPanel(_addon, pane) : PanelContent() constructor {
|
|||
}
|
||||
|
||||
function drawContent(panel) {
|
||||
if(drawFn == "") return;
|
||||
if(drawFn == "") return;
|
||||
if(!_addon.ready) return;
|
||||
lua_add_code(_addon.thread, "panelID = '" + string(ID) + "'");
|
||||
|
||||
lua_add_code(_addon.thread, $"panelID = '{ID}'");
|
||||
__addon_lua_panel_variable(_addon.thread, self);
|
||||
var runResult = lua_call(_addon.thread, drawFn);
|
||||
}
|
||||
|
@ -40,6 +42,7 @@ function addonPanel(_addon, pane) : PanelContent() constructor {
|
|||
static onClose = function() {
|
||||
if(closeFn == "") return;
|
||||
if(!_addon.ready) return;
|
||||
|
||||
var runResult = lua_call(_addon.thread, closeFn);
|
||||
}
|
||||
}
|
|
@ -134,10 +134,11 @@ function __addon_lua_setup_constants(lua, context) {
|
|||
lua_add_code(lua, "Panel = {};");
|
||||
lua_add_code(lua, "Animator = {};");
|
||||
|
||||
lua_add_code(lua, $"s_ui_panel_active = {THEME.ui_panel_active}");
|
||||
lua_add_code(lua, $"s_ui_panel_bg = {THEME.ui_panel_bg}");
|
||||
lua_add_code(lua, $"s_ui_scrollbar = {THEME.ui_scrollbar}");
|
||||
|
||||
var _sprs = variable_struct_get_names(THEME);
|
||||
for( var i = 0, n = array_length(_sprs); i < n; i++ ) {
|
||||
var txt = $"s_{_sprs[i]} = {real(THEME[$ _sprs[i]])}";
|
||||
lua_add_code(lua, txt);
|
||||
}
|
||||
}
|
||||
|
||||
function __addon_lua_panel_variable(lua, panel) {
|
||||
|
|
|
@ -49,6 +49,7 @@ function Node_FLIP_Apply_Force(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
|||
|
||||
obstracle = new FLIP_Obstracle();
|
||||
index = 0;
|
||||
toReset = true;
|
||||
|
||||
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
|
||||
var _posit = getInputData(1);
|
||||
|
@ -102,17 +103,19 @@ function Node_FLIP_Apply_Force(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
|||
obstracle.y = _posit[1];
|
||||
obstracle.texture = _tex;
|
||||
|
||||
if(IS_FIRST_FRAME) {
|
||||
if(IS_FIRST_FRAME || toReset) {
|
||||
index = FLIP_createObstracle(domain.domain);
|
||||
array_push(domain.obstracles, obstracle);
|
||||
}
|
||||
|
||||
toReset = false;
|
||||
|
||||
if(_shp == 0) FLIP_setObstracle_circle(domain.domain, index, _posit[0], _posit[1], _rad);
|
||||
else if(_shp == 1) FLIP_setObstracle_rectangle(domain.domain, index, _posit[0], _posit[1], _siz[0], _siz[1]);
|
||||
} #endregion
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
draw_sprite_fit(s_node_fluidSim_add_collider, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
|
||||
}
|
||||
draw_sprite_bbox(s_node_fluidSim_add_collider, 0, bbox);
|
||||
} #endregion
|
||||
}
|
|
@ -94,7 +94,8 @@ function Node_FLIP_Domain(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
|||
})]);
|
||||
#endregion
|
||||
|
||||
domain = instance_create(0, 0, FLIP_Domain);
|
||||
domain = instance_create(0, 0, FLIP_Domain);
|
||||
toReset = true;
|
||||
|
||||
static update = function(frame = CURRENT_FRAME) {
|
||||
var _dim = getInputData(0);
|
||||
|
@ -118,7 +119,7 @@ function Node_FLIP_Domain(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
|||
var _itrP = attributes.iteration_pressure;
|
||||
var _itrR = attributes.iteration_particle;
|
||||
|
||||
if(IS_FIRST_FRAME) {
|
||||
if(IS_FIRST_FRAME || toReset) {
|
||||
var width = _dim[0] + _siz * 2;
|
||||
var height = _dim[1] + _siz * 2;
|
||||
var particleSize = _siz;
|
||||
|
@ -128,6 +129,8 @@ function Node_FLIP_Domain(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
|||
domain.init(width, height, particleSize, density, maxParticles);
|
||||
}
|
||||
|
||||
toReset = false;
|
||||
|
||||
domain.velocityDamping = _dmp;
|
||||
domain.dt = _dt;
|
||||
|
||||
|
@ -150,9 +153,8 @@ function Node_FLIP_Domain(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
|||
outputs[| 0].setValue(domain);
|
||||
}
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
|
||||
draw_sprite_fit(s_node_fluidSim_domain, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
|
||||
}
|
||||
draw_sprite_bbox(s_node_fluidSim_domain, 0, bbox);
|
||||
} #endregion
|
||||
}
|
|
@ -48,6 +48,7 @@ function Node_FLIP_Spawner(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
|
||||
spawn_amo = 0;
|
||||
prev_position = [ 0, 0 ];
|
||||
toReset = true;
|
||||
|
||||
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
|
||||
var _shp = getInputData(1);
|
||||
|
@ -103,7 +104,8 @@ function Node_FLIP_Spawner(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
var _dirr = getInputData(10);
|
||||
var _ivel = getInputData(11);
|
||||
|
||||
if(IS_FIRST_FRAME) spawn_amo = 0;
|
||||
if(IS_FIRST_FRAME || toReset) spawn_amo = 0;
|
||||
toReset = false;
|
||||
|
||||
_amo = min(_amo, domain.maxParticles - domain.numParticles);
|
||||
spawn_amo += _amo;
|
||||
|
|
|
@ -32,9 +32,11 @@ function Node_Blur_Directional(_x, _y, _group = noone) : Node_Processor(_x, _y,
|
|||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 11] = nodeValue("Single direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
|
||||
|
||||
input_display_list = [ 5, 6,
|
||||
["Surfaces", true], 0, 3, 4, 7, 8,
|
||||
["Blur", false], 1, 9, 2, 10,
|
||||
["Blur", false], 1, 9, 2, 10, 11,
|
||||
]
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
@ -58,16 +60,17 @@ function Node_Blur_Directional(_x, _y, _group = noone) : Node_Processor(_x, _y,
|
|||
static step = function() { #region
|
||||
__step_mask_modifier();
|
||||
|
||||
inputs[| 1].mappableStep();
|
||||
inputs[| 2].mappableStep();
|
||||
inputs[| 1].mappableStep();
|
||||
inputs[| 2].mappableStep();
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
|
||||
surface_set_shader(_outSurf, sh_blur_directional);
|
||||
shader_set_f("size", max(surface_get_width_safe(_data[0]), surface_get_height_safe( _data[0])));
|
||||
shader_set_f_map("strength", _data[1], _data[ 9], inputs[| 1]);
|
||||
shader_set_f_map("direction", _data[2], _data[10], inputs[| 2]);
|
||||
shader_set_f_map("strength", _data[ 1], _data[ 9], inputs[| 1]);
|
||||
shader_set_f_map("direction", _data[ 2], _data[10], inputs[| 2]);
|
||||
shader_set_i("scale", _data[11]);
|
||||
shader_set_i("sampleMode", struct_try_get(attributes, "oversample"));
|
||||
|
||||
draw_surface_safe(_data[0], 0, 0);
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
function Node_Normal(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Normal";
|
||||
|
||||
uniform_dim = shader_get_uniform(sh_normal, "dimension");
|
||||
uniform_hei = shader_get_uniform(sh_normal, "height");
|
||||
uniform_smt = shader_get_uniform(sh_normal, "smooth");
|
||||
|
||||
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
|
||||
|
||||
inputs[| 1] = nodeValue("Height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1);
|
||||
|
||||
inputs[| 2] = nodeValue("Smooth", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Include diagonal pixel in normal calculation, which leads to smoother output.");
|
||||
inputs[| 2] = nodeValue("Smooth", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0, "Include diagonal pixel in normal calculation, which leads to smoother output.")
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range : [ 0, 4, 0.1] });
|
||||
|
||||
inputs[| 3] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
|
||||
active_index = 3;
|
||||
|
@ -28,11 +25,15 @@ function Node_Normal(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
var _smt = _data[2];
|
||||
|
||||
surface_set_shader(_outSurf, sh_normal);
|
||||
shader_set_uniform_f(uniform_hei, _hei);
|
||||
shader_set_uniform_i(uniform_smt, _smt);
|
||||
shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]) ]);
|
||||
gpu_set_texfilter(true);
|
||||
|
||||
shader_set_f("dimension", surface_get_dimension(_data[0]), surface_get_height_safe(_data[0]));
|
||||
shader_set_f("height", _hei);
|
||||
shader_set_f("smooth", _smt);
|
||||
|
||||
draw_surface_safe(_data[0], 0, 0);
|
||||
draw_surface_safe(_data[0]);
|
||||
|
||||
gpu_set_texfilter(false);
|
||||
surface_reset_shader();
|
||||
|
||||
return _outSurf;
|
||||
|
|
|
@ -550,6 +550,7 @@ function __initNodes() {
|
|||
addNodeObject(filter, "Contrast Blur", s_node_blur_contrast, "Node_Blur_Contrast", [1, Node_Blur_Contrast],, "Blur only pixel of a similiar color.");
|
||||
addNodeObject(filter, "Shape Blur", s_node_shape_blur, "Node_Blur_Shape", [1, Node_Blur_Shape]).setVersion(11650);
|
||||
addNodeObject(filter, "Average", s_node_average, "Node_Average", [1, Node_Average],, "Average color of every pixels in the image.").setVersion(1110);
|
||||
addNodeObject(filter, "Smear", s_node_smear, "Node_Smear", [1, Node_Smear]).setVersion(11670);
|
||||
|
||||
ds_list_add(filter, "Warps");
|
||||
addNodeObject(filter, "Mirror", s_node_mirror, "Node_Mirror", [1, Node_Mirror],, "Reflect the image along a reflection line.").setVersion(1070);
|
||||
|
|
|
@ -30,7 +30,6 @@ function Node_Rigid_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _gro
|
|||
}
|
||||
|
||||
static update = function() {
|
||||
if(IS_FIRST_FRAME)
|
||||
reset();
|
||||
if(IS_FIRST_FRAME) reset();
|
||||
}
|
||||
}
|
37
scripts/node_smear/node_bw.gml
Normal file
|
@ -0,0 +1,37 @@
|
|||
function Node_create_BW(_x, _y) {
|
||||
var node = new Node_BW(_x, _y);
|
||||
ds_list_add(PANEL_GRAPH.nodes_list, node);
|
||||
return node;
|
||||
}
|
||||
|
||||
function Node_BW(_x, _y) : Node_Processor(_x, _y) constructor {
|
||||
name = "BW";
|
||||
|
||||
uniform_exp = shader_get_uniform(sh_bw, "brightness");
|
||||
uniform_con = shader_get_uniform(sh_bw, "contrast");
|
||||
|
||||
inputs[| 0] = new NodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
inputs[| 1] = new NodeValue(1, "Brightness", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0);
|
||||
inputs[| 1].setDisplay(VALUE_DISPLAY.slider, [ -1, 1, 0.01]);
|
||||
|
||||
inputs[| 2] = new NodeValue(2, "Contrast", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1);
|
||||
inputs[| 2].setDisplay(VALUE_DISPLAY.slider, [ -1, 4, 0.01]);
|
||||
|
||||
outputs[| 0] = new NodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1));
|
||||
|
||||
function process_data(_inSurf, _outSurf, _data) {
|
||||
var _exp = _data[1];
|
||||
var _con = _data[2];
|
||||
surface_set_target(_outSurf);
|
||||
draw_clear_alpha(0, 0);
|
||||
|
||||
shader_set(sh_bw);
|
||||
shader_set_uniform_f(uniform_exp, _exp);
|
||||
shader_set_uniform_f(uniform_con, _con);
|
||||
draw_surface(_inSurf, 0, 0);
|
||||
shader_reset();
|
||||
surface_reset_target();
|
||||
|
||||
return _outSurf;
|
||||
}
|
||||
}
|
12
scripts/node_smear/node_bw.yy
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"isDnD": false,
|
||||
"isCompatibility": false,
|
||||
"parent": {
|
||||
"name": "filter",
|
||||
"path": "folders/nodes/data/filter.yy",
|
||||
},
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_bw",
|
||||
"tags": [],
|
||||
"resourceType": "GMScript",
|
||||
}
|
12
scripts/node_smear/node_color_adjustment.yy
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"isDnD": false,
|
||||
"isCompatibility": false,
|
||||
"parent": {
|
||||
"name": "filter",
|
||||
"path": "folders/nodes/data/filter.yy",
|
||||
},
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_color_adjustment",
|
||||
"tags": [],
|
||||
"resourceType": "GMScript",
|
||||
}
|
12
scripts/node_smear/node_color_replacement.yy
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"isDnD": false,
|
||||
"isCompatibility": false,
|
||||
"parent": {
|
||||
"name": "process",
|
||||
"path": "folders/nodes/data/process.yy",
|
||||
},
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_color_replacement",
|
||||
"tags": [],
|
||||
"resourceType": "GMScript",
|
||||
}
|
12
scripts/node_smear/node_greyscale.yy
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"isDnD": false,
|
||||
"isCompatibility": false,
|
||||
"parent": {
|
||||
"name": "filter",
|
||||
"path": "folders/nodes/data/filter.yy",
|
||||
},
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_greyscale",
|
||||
"tags": [],
|
||||
"resourceType": "GMScript",
|
||||
}
|
12
scripts/node_smear/node_outline.yy
Normal 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",
|
||||
}
|
92
scripts/node_smear/node_smear.gml
Normal file
|
@ -0,0 +1,92 @@
|
|||
function Node_Smear(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Smear";
|
||||
|
||||
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
|
||||
|
||||
inputs[| 1] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2)
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 0.5, 0.001] })
|
||||
.setMappable(9);
|
||||
|
||||
inputs[| 2] = nodeValue("Direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
.setDisplay(VALUE_DISPLAY.rotation)
|
||||
.setMappable(10);
|
||||
|
||||
inputs[| 3] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
|
||||
|
||||
inputs[| 4] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
|
||||
.setDisplay(VALUE_DISPLAY.slider);
|
||||
|
||||
inputs[| 5] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
|
||||
active_index = 5;
|
||||
|
||||
inputs[| 6] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111)
|
||||
.setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) });
|
||||
|
||||
__init_mask_modifier(3); // inputs 7, 8
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 9] = nodeValueMap("Strength map", self);
|
||||
|
||||
inputs[| 10] = nodeValueMap("Direction map", self);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 11] = nodeValue("Mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
.setDisplay(VALUE_DISPLAY.enum_button, [ "Greyscale", "Alpha" ]);
|
||||
|
||||
inputs[| 12] = nodeValue("Modulate strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false)
|
||||
|
||||
inputs[| 13] = nodeValue("Spread", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
|
||||
input_display_list = [ 5, 6,
|
||||
["Surfaces", true], 0, 3, 4, 7, 8,
|
||||
["Smear", false], 11, 1, 9, 2, 10, 13, 12,
|
||||
]
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
attribute_surface_depth();
|
||||
attribute_oversample();
|
||||
|
||||
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
|
||||
var _surf = outputs[| 0].getValue();
|
||||
if(is_array(_surf)) {
|
||||
if(array_length(_surf) == 0) return;
|
||||
_surf = _surf[preview_index];
|
||||
}
|
||||
|
||||
var ww = surface_get_width_safe(_surf);
|
||||
var hh = surface_get_height_safe(_surf);
|
||||
|
||||
inputs[| 2].drawOverlay(hover, active, _x + ww / 2 * _s, _y + hh / 2 * _s, _s, _mx, _my, _snx, _sny);
|
||||
} #endregion
|
||||
|
||||
static step = function() { #region
|
||||
__step_mask_modifier();
|
||||
|
||||
inputs[| 1].mappableStep();
|
||||
inputs[| 2].mappableStep();
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
|
||||
surface_set_shader(_outSurf, sh_smear);
|
||||
shader_set_f("size", max(surface_get_width_safe(_data[0]), surface_get_height_safe( _data[0])));
|
||||
shader_set_f_map("strength", _data[ 1], _data[ 9], inputs[| 1]);
|
||||
shader_set_f_map("direction", _data[ 2], _data[10], inputs[| 2]);
|
||||
shader_set_i("sampleMode", struct_try_get(attributes, "oversample"));
|
||||
shader_set_i("alpha", _data[11]);
|
||||
shader_set_i("modulateStr", _data[12]);
|
||||
shader_set_f("spread", _data[13]);
|
||||
|
||||
draw_surface_safe(_data[0], 0, 0);
|
||||
surface_reset_shader();
|
||||
|
||||
__process_mask_modifier(_data);
|
||||
_outSurf = mask_apply(_data[0], _outSurf, _data[3], _data[4]);
|
||||
_outSurf = channel_apply(_data[0], _outSurf, _data[6]);
|
||||
|
||||
return _outSurf;
|
||||
} #endregion
|
||||
}
|
11
scripts/node_smear/node_smear.yy
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"resourceType": "GMScript",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_smear",
|
||||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "blur",
|
||||
"path": "folders/nodes/data/filter/blur.yy",
|
||||
},
|
||||
}
|
|
@ -1304,7 +1304,7 @@ function Panel_Preview() : PanelContent() constructor {
|
|||
//draw_sprite_stretched_ext(THEME.toolbar_shadow, 0, 0, ty - 12 + 4, w, 12, c_white, 0.5);
|
||||
|
||||
var aa = d3_active? 0.8 : 1;
|
||||
draw_sprite_stretched_ext(THEME.toolbar, 1, 0, 0, w, topbar_height, c_white, aa);
|
||||
draw_sprite_stretched_ext(THEME.toolbar, 1, 0, 0, w, topbar_height, c_white, aa);
|
||||
draw_sprite_stretched_ext(THEME.toolbar, 0, 0, ty, w, toolbar_height, c_white, aa);
|
||||
|
||||
if(!_node) return;
|
||||
|
@ -1487,7 +1487,7 @@ function Panel_Preview() : PanelContent() constructor {
|
|||
} #endregion
|
||||
|
||||
function drawContent(panel) { #region >>>>>>>>>>>>>>>>>>>> MAIN DRAW <<<<<<<<<<<<<<<<<<<<
|
||||
mouse_on_preview = pHOVER && point_in_rectangle(mx, my, 0, toolbar_height, w, h - toolbar_height);
|
||||
mouse_on_preview = pHOVER && point_in_rectangle(mx, my, 0, topbar_height, w, h - toolbar_height);
|
||||
|
||||
var _prev_node = getNodePreview();
|
||||
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
//
|
||||
// Simple passthrough fragment shader
|
||||
//
|
||||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform float size;
|
||||
|
||||
uniform vec2 strength;
|
||||
uniform int strengthUseSurf;
|
||||
uniform sampler2D strengthSurf;
|
||||
uniform int scale;
|
||||
|
||||
uniform vec2 direction;
|
||||
uniform int directionUseSurf;
|
||||
uniform sampler2D directionSurf;
|
||||
|
||||
uniform vec2 strength;
|
||||
uniform int strengthUseSurf;
|
||||
uniform sampler2D strengthSurf;
|
||||
|
||||
uniform int sampleMode;
|
||||
|
||||
vec4 sampleTexture(vec2 pos) { #region
|
||||
|
@ -36,17 +34,31 @@ vec4 sampleTexture(vec2 pos) { #region
|
|||
} #endregion
|
||||
|
||||
vec4 dirBlur(vec2 angle) { #region
|
||||
vec4 acc = vec4(0.);
|
||||
float delta = 1. / size;
|
||||
vec4 acc = vec4(0.);
|
||||
float delta = 1. / size;
|
||||
float weight = 0.;
|
||||
|
||||
for(float i = -1.0; i <= 1.0; i += delta) {
|
||||
vec4 col = sampleTexture( v_vTexcoord - angle * i);
|
||||
acc += col;
|
||||
weight += col.a;
|
||||
}
|
||||
acc.rgb /= weight;
|
||||
acc.a /= size * 2.;
|
||||
if(scale == 0) {
|
||||
for(float i = -1.0; i <= 1.0; i += delta) {
|
||||
vec4 col = sampleTexture( v_vTexcoord - angle * i);
|
||||
acc += col;
|
||||
weight += col.a;
|
||||
}
|
||||
|
||||
acc.rgb /= weight;
|
||||
acc.a /= size * 2.;
|
||||
} else {
|
||||
for(float i = 0.; i <= 1.0; i += delta) {
|
||||
vec4 col = sampleTexture( v_vTexcoord - angle * i);
|
||||
acc += col ;
|
||||
weight += col.a;
|
||||
}
|
||||
|
||||
acc.rgb /= weight;
|
||||
acc.a /= size - 1.;
|
||||
|
||||
acc += sampleTexture( v_vTexcoord );
|
||||
}
|
||||
|
||||
return acc;
|
||||
} #endregion
|
||||
|
|
|
@ -1,33 +1,32 @@
|
|||
//
|
||||
// Simple passthrough fragment shader
|
||||
//
|
||||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform vec2 dimension;
|
||||
uniform vec2 dimension;
|
||||
uniform float height;
|
||||
uniform int smooth;
|
||||
uniform float smooth;
|
||||
|
||||
float bright(in vec4 col) { return dot(col.rgb, vec3(0.2126, 0.7152, 0.0722)) * col.a; }
|
||||
|
||||
void main() {
|
||||
vec2 pixelStep = 1. / dimension;
|
||||
vec2 tx = 1. / dimension;
|
||||
|
||||
vec4 c = texture2D(gm_BaseTexture, v_vTexcoord);
|
||||
vec4 c = texture2D(gm_BaseTexture, v_vTexcoord);
|
||||
float siz = 1. + smooth;
|
||||
|
||||
float col = bright(c);
|
||||
float h0 = bright(texture2D(gm_BaseTexture, v_vTexcoord + pixelStep * vec2(-1., 0.)));
|
||||
float h1 = bright(texture2D(gm_BaseTexture, v_vTexcoord + pixelStep * vec2( 1., 0.)));
|
||||
float v0 = bright(texture2D(gm_BaseTexture, v_vTexcoord + pixelStep * vec2( 0., -1.)));
|
||||
float v1 = bright(texture2D(gm_BaseTexture, v_vTexcoord + pixelStep * vec2( 0., 1.)));
|
||||
|
||||
float d0 = bright(texture2D(gm_BaseTexture, v_vTexcoord + pixelStep * vec2( 1., -1.)));
|
||||
float d1 = bright(texture2D(gm_BaseTexture, v_vTexcoord + pixelStep * vec2(-1., -1.)));
|
||||
float d2 = bright(texture2D(gm_BaseTexture, v_vTexcoord + pixelStep * vec2(-1., 1.)));
|
||||
float d3 = bright(texture2D(gm_BaseTexture, v_vTexcoord + pixelStep * vec2( 1., 1.)));
|
||||
float h0 = bright(texture2D(gm_BaseTexture, v_vTexcoord + tx * vec2(-1., 0.) * siz));
|
||||
float h1 = bright(texture2D(gm_BaseTexture, v_vTexcoord + tx * vec2( 1., 0.) * siz));
|
||||
float v0 = bright(texture2D(gm_BaseTexture, v_vTexcoord + tx * vec2( 0., -1.) * siz));
|
||||
float v1 = bright(texture2D(gm_BaseTexture, v_vTexcoord + tx * vec2( 0., 1.) * siz));
|
||||
|
||||
vec2 normal;
|
||||
|
||||
if(smooth == 1) {
|
||||
if(smooth > 0.) {
|
||||
float d0 = bright(texture2D(gm_BaseTexture, v_vTexcoord + tx * vec2( 1., -1.) * siz));
|
||||
float d1 = bright(texture2D(gm_BaseTexture, v_vTexcoord + tx * vec2(-1., -1.) * siz));
|
||||
float d2 = bright(texture2D(gm_BaseTexture, v_vTexcoord + tx * vec2(-1., 1.) * siz));
|
||||
float d3 = bright(texture2D(gm_BaseTexture, v_vTexcoord + tx * vec2( 1., 1.) * siz));
|
||||
|
||||
normal = (vec2(h1 - col, 0.)
|
||||
+ vec2(col - h0, 0.)
|
||||
+ vec2(0., v1 - col)
|
||||
|
@ -36,14 +35,17 @@ void main() {
|
|||
+ vec2(col - d1, col - d1) / sqrt(2.)
|
||||
+ vec2(col - d2, d2 - col) / sqrt(2.)
|
||||
+ vec2(d3 - col, d3 - col) / sqrt(2.)
|
||||
) / (2. + 2. * sqrt(2.)) * height + 0.5;
|
||||
} else if(smooth == 0) {
|
||||
) / (2. + 2. * sqrt(2.));
|
||||
|
||||
} else {
|
||||
normal = (vec2(h1 - col, 0.)
|
||||
+ vec2(col - h0, 0.)
|
||||
+ vec2(0., v1 - col)
|
||||
+ vec2(0., col - v0)
|
||||
) / 2. * height + 0.5;
|
||||
) / 2.;
|
||||
}
|
||||
|
||||
normal = normal * height + 0.5;
|
||||
|
||||
gl_FragColor = vec4(normal, 1., c.a);
|
||||
}
|
||||
|
|
92
shaders/sh_smear/sh_smear.fsh
Normal file
|
@ -0,0 +1,92 @@
|
|||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform float size;
|
||||
uniform float spread;
|
||||
|
||||
uniform vec2 direction;
|
||||
uniform int directionUseSurf;
|
||||
uniform sampler2D directionSurf;
|
||||
|
||||
uniform vec2 strength;
|
||||
uniform int strengthUseSurf;
|
||||
uniform sampler2D strengthSurf;
|
||||
|
||||
uniform int sampleMode;
|
||||
uniform int alpha;
|
||||
uniform int modulateStr;
|
||||
|
||||
vec4 sampleTexture(vec2 pos) { #region
|
||||
if(pos.x >= 0. && pos.y >= 0. && pos.x <= 1. && pos.y <= 1.)
|
||||
return texture2D(gm_BaseTexture, pos);
|
||||
|
||||
if(sampleMode == 0)
|
||||
return vec4(0.);
|
||||
|
||||
else if(sampleMode == 1)
|
||||
return texture2D(gm_BaseTexture, clamp(pos, 0., 1.));
|
||||
|
||||
else if(sampleMode == 2)
|
||||
return texture2D(gm_BaseTexture, fract(pos));
|
||||
|
||||
else if(sampleMode == 3)
|
||||
return vec4(vec3(0.), 1.);
|
||||
|
||||
return vec4(0.);
|
||||
} #endregion
|
||||
|
||||
vec4 smear(vec2 angle) { #region
|
||||
float delta = 1. / size;
|
||||
|
||||
vec4 base = sampleTexture( v_vTexcoord );
|
||||
float maxBright = (base.r + base.g + base.b) / 3. * base.a;
|
||||
vec4 res = base;
|
||||
|
||||
for(float i = 0.; i <= 1.0; i += delta) {
|
||||
vec4 col = sampleTexture( v_vTexcoord - angle * i);
|
||||
if(alpha == 0)
|
||||
col.rgb *= 1. - i;
|
||||
else
|
||||
col.a *= 1. - i;
|
||||
|
||||
float bright = (col.r + col.g + col.b) / 3. * col.a;
|
||||
|
||||
if(bright > maxBright) {
|
||||
maxBright = bright;
|
||||
res = col;
|
||||
}
|
||||
}
|
||||
|
||||
if(modulateStr == 1) {
|
||||
if(alpha == 0) res.rgb *= maxBright;
|
||||
else res.a *= res.a;
|
||||
}
|
||||
|
||||
return res;
|
||||
} #endregion
|
||||
|
||||
void main() {
|
||||
float str = strength.x;
|
||||
if(strengthUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( strengthSurf, v_vTexcoord );
|
||||
str = mix(strength.x, strength.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
float dir = direction.x;
|
||||
if(directionUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( directionSurf, v_vTexcoord );
|
||||
dir = mix(direction.x, direction.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
vec4 col = vec4(0.);
|
||||
|
||||
for(float i = -spread; i <= spread; i++) {
|
||||
float r = radians(dir + 90. + i);
|
||||
vec2 dirr = vec2(sin(r), cos(r)) * str;
|
||||
vec4 smr = smear(dirr);
|
||||
|
||||
col = max(col, smr);
|
||||
}
|
||||
|
||||
gl_FragColor = col;
|
||||
}
|
19
shaders/sh_smear/sh_smear.vsh
Normal file
|
@ -0,0 +1,19 @@
|
|||
//
|
||||
// Simple passthrough vertex shader
|
||||
//
|
||||
attribute vec3 in_Position; // (x,y,z)
|
||||
//attribute vec3 in_Normal; // (x,y,z) unused in this shader.
|
||||
attribute vec4 in_Colour; // (r,g,b,a)
|
||||
attribute vec2 in_TextureCoord; // (u,v)
|
||||
|
||||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0);
|
||||
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;
|
||||
|
||||
v_vColour = in_Colour;
|
||||
v_vTexcoord = in_TextureCoord;
|
||||
}
|
10
shaders/sh_smear/sh_smear.yy
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"resourceType": "GMShader",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "sh_smear",
|
||||
"parent": {
|
||||
"name": "blur",
|
||||
"path": "folders/shader/filter/blur.yy",
|
||||
},
|
||||
"type": 1,
|
||||
}
|
BIN
sprites/s_node_smear/ef5048a7-5f78-4b73-a42f-c2babe84d704.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
74
sprites/s_node_smear/s_node_smear.yy
Normal file
|
@ -0,0 +1,74 @@
|
|||
{
|
||||
"resourceType": "GMSprite",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "s_node_smear",
|
||||
"bbox_bottom": 60,
|
||||
"bbox_left": 3,
|
||||
"bbox_right": 59,
|
||||
"bbox_top": 3,
|
||||
"bboxMode": 0,
|
||||
"collisionKind": 1,
|
||||
"collisionTolerance": 0,
|
||||
"DynamicTexturePage": false,
|
||||
"edgeFiltering": false,
|
||||
"For3D": false,
|
||||
"frames": [
|
||||
{"resourceType":"GMSpriteFrame","resourceVersion":"1.1","name":"ef5048a7-5f78-4b73-a42f-c2babe84d704",},
|
||||
],
|
||||
"gridX": 0,
|
||||
"gridY": 0,
|
||||
"height": 64,
|
||||
"HTile": false,
|
||||
"layers": [
|
||||
{"resourceType":"GMImageLayer","resourceVersion":"1.0","name":"0d8fe800-a660-4041-89bf-029a5af4dab4","blendMode":0,"displayName":"default","isLocked":false,"opacity":100.0,"visible":true,},
|
||||
],
|
||||
"nineSlice": null,
|
||||
"origin": 4,
|
||||
"parent": {
|
||||
"name": "blur",
|
||||
"path": "folders/nodes/icons/filter/blur.yy",
|
||||
},
|
||||
"preMultiplyAlpha": false,
|
||||
"sequence": {
|
||||
"resourceType": "GMSequence",
|
||||
"resourceVersion": "1.4",
|
||||
"name": "s_node_smear",
|
||||
"autoRecord": true,
|
||||
"backdropHeight": 768,
|
||||
"backdropImageOpacity": 0.5,
|
||||
"backdropImagePath": "",
|
||||
"backdropWidth": 1366,
|
||||
"backdropXOffset": 0.0,
|
||||
"backdropYOffset": 0.0,
|
||||
"events": {"resourceType":"KeyframeStore<MessageEventKeyframe>","resourceVersion":"1.0","Keyframes":[],},
|
||||
"eventStubScript": null,
|
||||
"eventToFunction": {},
|
||||
"length": 1.0,
|
||||
"lockOrigin": false,
|
||||
"moments": {"resourceType":"KeyframeStore<MomentsEventKeyframe>","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<SpriteFrameKeyframe>","resourceVersion":"1.0","Keyframes":[
|
||||
{"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"1.0","Channels":{"0":{"resourceType":"SpriteFrameKeyframe","resourceVersion":"1.0","Id":{"name":"ef5048a7-5f78-4b73-a42f-c2babe84d704","path":"sprites/s_node_smear/s_node_smear.yy",},},},"Disabled":false,"id":"c2fa8280-7d60-4be5-b1e6-904cf7f754da","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,
|
||||
}
|