Region fill, level out, outlin aa, perlin improvement

This commit is contained in:
Tanasart 2024-01-30 21:04:56 +07:00
parent ca775c80f2
commit 6c2a04d023
49 changed files with 1607 additions and 963 deletions

View file

@ -288,6 +288,7 @@
{"name":"surface_functions","order":5,"path":"scripts/surface_functions/surface_functions.yy",},
{"name":"__node_iterator_inline","order":8,"path":"scripts/__node_iterator_inline/__node_iterator_inline.yy",},
{"name":"s_MKFX","order":6,"path":"sprites/s_MKFX/s_MKFX.yy",},
{"name":"sh_region_fill_inner","order":3,"path":"shaders/sh_region_fill_inner/sh_region_fill_inner.yy",},
{"name":"_f_sdf","order":13,"path":"fonts/_f_sdf/_f_sdf.yy",},
{"name":"dynaSurf_iso","order":1,"path":"scripts/dynaSurf_iso/dynaSurf_iso.yy",},
{"name":"sh_fd_add_velocity_glsl","order":1,"path":"shaders/sh_fd_add_velocity_glsl/sh_fd_add_velocity_glsl.yy",},
@ -488,6 +489,7 @@
{"name":"GMSSimpleMIDI","order":15,"path":"extensions/GMSSimpleMIDI/GMSSimpleMIDI.yy",},
{"name":"s_node_fluidSim_domain","order":6,"path":"sprites/s_node_fluidSim_domain/s_node_fluidSim_domain.yy",},
{"name":"s_node_displace","order":17,"path":"sprites/s_node_displace/s_node_displace.yy",},
{"name":"sh_region_fill_map","order":4,"path":"shaders/sh_region_fill_map/sh_region_fill_map.yy",},
{"name":"sh_polar","order":1,"path":"shaders/sh_polar/sh_polar.yy",},
{"name":"s_node_warp_mesh","order":10,"path":"sprites/s_node_warp_mesh/s_node_warp_mesh.yy",},
{"name":"sh_pixel_cloud","order":4,"path":"shaders/sh_pixel_cloud/sh_pixel_cloud.yy",},
@ -965,6 +967,7 @@
{"name":"node_perlin","order":8,"path":"scripts/node_perlin/node_perlin.yy",},
{"name":"node_blur_non_uniform","order":4,"path":"scripts/node_blur_non_uniform/node_blur_non_uniform.yy",},
{"name":"node_feedback_input","order":1,"path":"scripts/node_feedback_input/node_feedback_input.yy",},
{"name":"node_bend","order":18,"path":"scripts/node_bend/node_bend.yy",},
{"name":"s_node_vfx_trail","order":13,"path":"sprites/s_node_vfx_trail/s_node_vfx_trail.yy",},
{"name":"s_node_gui_in","order":37,"path":"sprites/s_node_gui_in/s_node_gui_in.yy",},
{"name":"s_node_base_conversion","order":10,"path":"sprites/s_node_base_conversion/s_node_base_conversion.yy",},
@ -1003,6 +1006,7 @@
{"name":"FirebaseREST_HTTP_Success_Firestore","order":19,"path":"scripts/FirebaseREST_HTTP_Success_Firestore/FirebaseREST_HTTP_Success_Firestore.yy",},
{"name":"s_node_pb_draw_rectangle","order":13,"path":"sprites/s_node_pb_draw_rectangle/s_node_pb_draw_rectangle.yy",},
{"name":"panel_animation","order":1,"path":"scripts/panel_animation/panel_animation.yy",},
{"name":"sh_bend_arc","order":13,"path":"shaders/sh_bend_arc/sh_bend_arc.yy",},
{"name":"node_array_rearrange","order":19,"path":"scripts/node_array_rearrange/node_array_rearrange.yy",},
{"name":"sh_pb_to_mask","order":7,"path":"shaders/sh_pb_to_mask/sh_pb_to_mask.yy",},
{"name":"d3d_gizmo_plane","order":5,"path":"scripts/d3d_gizmo_plane/d3d_gizmo_plane.yy",},
@ -1203,6 +1207,7 @@
{"name":"s_node_flood_fill","order":24,"path":"sprites/s_node_flood_fill/s_node_flood_fill.yy",},
{"name":"json_compare","order":21,"path":"scripts/json_compare/json_compare.yy",},
{"name":"node_rigid_force_apply","order":4,"path":"scripts/node_rigid_force_apply/node_rigid_force_apply.yy",},
{"name":"checkboxActive","order":38,"path":"scripts/checkboxActive/checkboxActive.yy",},
{"name":"__node_shader","order":21,"path":"scripts/__node_shader/__node_shader.yy",},
{"name":"__node_iterator","order":6,"path":"scripts/__node_iterator/__node_iterator.yy",},
{"name":"s_node_rigid_variable","order":8,"path":"sprites/s_node_rigid_variable/s_node_rigid_variable.yy",},
@ -1552,6 +1557,7 @@
{"name":"node_scale_algo","order":12,"path":"scripts/node_scale_algo/node_scale_algo.yy",},
{"name":"s_node_image_replace","order":49,"path":"sprites/s_node_image_replace/s_node_image_replace.yy",},
{"name":"node_alpha_hash","order":11,"path":"scripts/node_alpha_hash/node_alpha_hash.yy",},
{"name":"sh_region_fill_border","order":5,"path":"shaders/sh_region_fill_border/sh_region_fill_border.yy",},
{"name":"sh_mask_modify","order":2,"path":"shaders/sh_mask_modify/sh_mask_modify.yy",},
{"name":"toggleGroup","order":31,"path":"scripts/toggleGroup/toggleGroup.yy",},
{"name":"mouse_input","order":1,"path":"scripts/mouse_input/mouse_input.yy",},

View file

@ -480,6 +480,7 @@
{"id":{"name":"surface_functions","path":"scripts/surface_functions/surface_functions.yy",},},
{"id":{"name":"__node_iterator_inline","path":"scripts/__node_iterator_inline/__node_iterator_inline.yy",},},
{"id":{"name":"s_MKFX","path":"sprites/s_MKFX/s_MKFX.yy",},},
{"id":{"name":"sh_region_fill_inner","path":"shaders/sh_region_fill_inner/sh_region_fill_inner.yy",},},
{"id":{"name":"_f_sdf","path":"fonts/_f_sdf/_f_sdf.yy",},},
{"id":{"name":"dynaSurf_iso","path":"scripts/dynaSurf_iso/dynaSurf_iso.yy",},},
{"id":{"name":"sh_fd_add_velocity_glsl","path":"shaders/sh_fd_add_velocity_glsl/sh_fd_add_velocity_glsl.yy",},},
@ -710,6 +711,7 @@
{"id":{"name":"GMSSimpleMIDI","path":"extensions/GMSSimpleMIDI/GMSSimpleMIDI.yy",},},
{"id":{"name":"s_node_fluidSim_domain","path":"sprites/s_node_fluidSim_domain/s_node_fluidSim_domain.yy",},},
{"id":{"name":"s_node_displace","path":"sprites/s_node_displace/s_node_displace.yy",},},
{"id":{"name":"sh_region_fill_map","path":"shaders/sh_region_fill_map/sh_region_fill_map.yy",},},
{"id":{"name":"sh_polar","path":"shaders/sh_polar/sh_polar.yy",},},
{"id":{"name":"s_node_warp_mesh","path":"sprites/s_node_warp_mesh/s_node_warp_mesh.yy",},},
{"id":{"name":"sh_pixel_cloud","path":"shaders/sh_pixel_cloud/sh_pixel_cloud.yy",},},
@ -1254,6 +1256,7 @@
{"id":{"name":"node_perlin","path":"scripts/node_perlin/node_perlin.yy",},},
{"id":{"name":"node_blur_non_uniform","path":"scripts/node_blur_non_uniform/node_blur_non_uniform.yy",},},
{"id":{"name":"node_feedback_input","path":"scripts/node_feedback_input/node_feedback_input.yy",},},
{"id":{"name":"node_bend","path":"scripts/node_bend/node_bend.yy",},},
{"id":{"name":"s_node_vfx_trail","path":"sprites/s_node_vfx_trail/s_node_vfx_trail.yy",},},
{"id":{"name":"o_dialog_add_multiple_images","path":"objects/o_dialog_add_multiple_images/o_dialog_add_multiple_images.yy",},},
{"id":{"name":"assets_data","path":"scripts/assets_data/assets_data.yy",},},
@ -1298,6 +1301,7 @@
{"id":{"name":"node_surface_from_color","path":"scripts/node_surface_from_color/node_surface_from_color.yy",},},
{"id":{"name":"s_node_pb_draw_rectangle","path":"sprites/s_node_pb_draw_rectangle/s_node_pb_draw_rectangle.yy",},},
{"id":{"name":"panel_animation","path":"scripts/panel_animation/panel_animation.yy",},},
{"id":{"name":"sh_bend_arc","path":"shaders/sh_bend_arc/sh_bend_arc.yy",},},
{"id":{"name":"node_array_rearrange","path":"scripts/node_array_rearrange/node_array_rearrange.yy",},},
{"id":{"name":"sh_pb_to_mask","path":"shaders/sh_pb_to_mask/sh_pb_to_mask.yy",},},
{"id":{"name":"d3d_gizmo_plane","path":"scripts/d3d_gizmo_plane/d3d_gizmo_plane.yy",},},
@ -1519,6 +1523,7 @@
{"id":{"name":"node_iterate_each_inline","path":"scripts/node_iterate_each_inline/node_iterate_each_inline.yy",},},
{"id":{"name":"json_compare","path":"scripts/json_compare/json_compare.yy",},},
{"id":{"name":"node_rigid_force_apply","path":"scripts/node_rigid_force_apply/node_rigid_force_apply.yy",},},
{"id":{"name":"checkboxActive","path":"scripts/checkboxActive/checkboxActive.yy",},},
{"id":{"name":"__node_shader","path":"scripts/__node_shader/__node_shader.yy",},},
{"id":{"name":"__node_iterator","path":"scripts/__node_iterator/__node_iterator.yy",},},
{"id":{"name":"s_node_rigid_variable","path":"sprites/s_node_rigid_variable/s_node_rigid_variable.yy",},},
@ -1924,6 +1929,7 @@
{"id":{"name":"node_scale_algo","path":"scripts/node_scale_algo/node_scale_algo.yy",},},
{"id":{"name":"s_node_image_replace","path":"sprites/s_node_image_replace/s_node_image_replace.yy",},},
{"id":{"name":"node_alpha_hash","path":"scripts/node_alpha_hash/node_alpha_hash.yy",},},
{"id":{"name":"sh_region_fill_border","path":"shaders/sh_region_fill_border/sh_region_fill_border.yy",},},
{"id":{"name":"node_PCX_condition","path":"scripts/node_PCX_condition/node_PCX_condition.yy",},},
{"id":{"name":"sh_mask_modify","path":"shaders/sh_mask_modify/sh_mask_modify.yy",},},
{"id":{"name":"toggleGroup","path":"scripts/toggleGroup/toggleGroup.yy",},},

Binary file not shown.

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

@ -88,7 +88,7 @@ event_inherited();
if(mouse_press(mb_left, interactable && sFOCUS)) {
palette = array_create(array_length(pal.palette));
for( var j = 0; j < array_length(pal.palette); j++ )
palette[j] = pal.palette[j];
palette[j] = cola(pal.palette[j]);
onApply(palette);
index_selecting = 0;

View file

@ -5,12 +5,12 @@ function buttonGradient(_onApply, dialog = noone) : widget() constructor {
current_gradient = noone;
side_button = noone;
function apply(value) {
function apply(value) { #region
if(!interactable) return;
onApply(value);
}
} #endregion
static trigger = function() {
static trigger = function() { #region
var dialog = dialogCall(o_dialog_gradient, WIN_W / 2, WIN_H / 2);
dialog.setDefault(current_gradient.clone());
dialog.onApply = apply;
@ -18,13 +18,11 @@ function buttonGradient(_onApply, dialog = noone) : widget() constructor {
if(parentDialog)
parentDialog.addChildren(dialog);
}
} #endregion
static drawParam = function(params) {
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
}
static drawParam = function(params) { return draw(params.x, params.y, params.w, params.h, params.data, params.m); }
static draw = function(_x, _y, _w, _h, _gradient, _m) {
static draw = function(_x, _y, _w, _h, _gradient, _m) { #region
x = _x;
y = _y;
w = _w;
@ -91,5 +89,5 @@ function buttonGradient(_onApply, dialog = noone) : widget() constructor {
resetFocus();
return h;
}
} #endregion
}

View file

@ -1,14 +1,16 @@
function buttonPalette(_onApply, dialog = noone) : widget() constructor {
onApply = _onApply;
onApply = _onApply;
parentDialog = dialog;
current_palette = [];
function apply(value) {
current_palette = [];
side_button = noone;
function apply(value) { #region
if(!interactable) return;
onApply(value);
}
} #endregion
static trigger = function() {
static trigger = function() { #region
var dialog = dialogCall(o_dialog_palette, WIN_W / 2, WIN_H / 2);
dialog.setDefault(current_palette);
dialog.onApply = apply;
@ -16,18 +18,22 @@ function buttonPalette(_onApply, dialog = noone) : widget() constructor {
if(parentDialog)
parentDialog.addChildren(dialog);
}
} #endregion
static drawParam = function(params) {
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
}
static drawParam = function(params) { return draw(params.x, params.y, params.w, params.h, params.data, params.m); }
static draw = function(_x, _y, _w, _h, _color, _m) {
static draw = function(_x, _y, _w, _h, _color, _m) { #region
x = _x;
y = _y;
w = _w;
h = _h;
if(side_button && instanceof(side_button) == "buttonClass") {
side_button.setFocusHover(active, hover);
side_button.draw(_x + _w - ui(32), _y + _h / 2 - ui(32 / 2), ui(32), ui(32), _m, THEME.button_hide);
_w -= ui(40);
}
var _pw = _w - ui(8);
var _ph = _h - ui(8);
@ -83,7 +89,7 @@ function buttonPalette(_onApply, dialog = noone) : widget() constructor {
resetFocus();
return h;
}
} #endregion
}
function drawPalette(_pal, _x, _y, _w, _h, _a = 1) { #region

View file

@ -0,0 +1,48 @@
function checkBoxActive(_onClick) : widget() constructor {
onClick = _onClick;
spr = THEME.checkbox_active;
static trigger = function() {
if(!is_callable(onClick))
return noone;
onClick();
}
static drawParam = function(params) { return draw(params.x, params.y, params.data, params.m, params.w, params.h); }
static draw = function(_x, _y, _value, _m, _w, _h) {
x = _x;
y = _y;
w = _w;
h = _h;
var bw = ui(96);
var bh = h;
var bx = x + w / 2 - bw / 2;
var by = y;
draw_sprite_stretched_ext(spr, _value, bx - 8, by - 8, bw + 16, bh + 16, c_white, 1);
if(hover && point_in_rectangle(_m[0], _m[1], bx, by, bx + bw, by + bh)) {
BLEND_ADD
draw_sprite_stretched_ext(THEME.slider, 3, bx, by, bw, bh, COLORS._main_icon_dark, 1);
BLEND_NORMAL
if(mouse_press(mb_left, active))
trigger();
} else {
if(mouse_press(mb_left))
deactivate();
}
draw_set_text(f_p1, fa_center, fa_center, _value? COLORS._main_value_positive : COLORS._main_value_negative);
draw_text_add(bx + bw / 2, by + bh / 2, _value? "ACTIVE" : "INACTIVE");
if(WIDGET_CURRENT == self)
draw_sprite_stretched_ext(THEME.widget_selecting, 0, bx - ui(3), by - ui(3), bw + ui(6), bh + ui(6), COLORS._main_accent, 1);
resetFocus();
return h;
}
}

View file

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

View file

@ -134,6 +134,7 @@ function __LOAD_PATH(path, readonly = false, override = false) { #region
if(struct_has(_load_content, "attributes"))
struct_override(PROJECT.attributes, _load_content.attributes);
PROJECT.setPalette();
if(struct_has(_load_content, "notes")) {
PROJECT.notes = array_create(array_length(_load_content.notes));

View file

@ -313,6 +313,7 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
break;
case VALUE_TYPE.boolean :
if(is_instanceof(wid, checkBoxActive)) break;
param.halign = breakLine? fa_left : fa_center;
param.s = breakLine? ui(24) : editBoxH;

View file

@ -0,0 +1,29 @@
function Node_Bend(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Bend";
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
inputs[| 1] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
active_index = 1;
inputs[| 2] = nodeValue("Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Arc" ]);
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
input_display_list = [ 1,
["Surfaces", false], 0,
["Bend", false], 2,
]
attribute_surface_depth();
attribute_interpolation();
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
var _typ = _data[2];
return _outSurf;
} #endregion
}

View file

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

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

@ -8,7 +8,7 @@ function Node_Combine_RGB(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
inputs[| 3] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
inputs[| 4] = nodeValue("Sampling type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_scroll, ["Brightness", "Channel value"]);
.setDisplay(VALUE_DISPLAY.enum_scroll, ["Channel value", "Greyscale"]);
inputs[| 5] = nodeValue("Base value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0, "Set value to the unconnected color channels.")
.setDisplay(VALUE_DISPLAY.slider)
@ -57,7 +57,7 @@ function Node_Combine_RGB(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
shader_set_i("useB", is_surface(_b));
shader_set_i("useA", is_surface(_a));
shader_set_i("mode", _data[4]);
shader_set_i("mode", !_data[4]);
shader_set_f_map("base", _data[5], _data[6], inputs[| 5]);
draw_sprite_stretched(s_fx_pixel, 0, 0, 0, surface_get_width_safe(_outSurf), surface_get_height_safe(_outSurf));

View file

@ -40,26 +40,28 @@ function Node_Gradient_Points(_x, _y, _group = noone) : Node_Processor(_x, _y, _
inputs[| 14] = nodeValue("Falloff 4", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 6 )
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 32, 1 ] });
inputs[| 15] = nodeValue("Normalize weight", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false )
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
input_display_list = [
["Output", true], 0,
["Positions", false], 1, 3, 5, 7,
["Falloff", true], 11, 12, 13, 14,
["Falloff", true], 11, 12, 13, 14, 15,
["Colors", false], 9, 10, 2, 4, 6, 8,
];
attribute_surface_depth();
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
if(inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny)) active = false;
if(inputs[| 3].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny)) active = false;
if(inputs[| 5].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny)) active = false;
if(inputs[| 7].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny)) active = false;
}
} #endregion
static step = function() {
static step = function() { #region
var _usePal = getInputData(9);
inputs[| 10].setVisible(_usePal, _usePal);
@ -68,9 +70,9 @@ function Node_Gradient_Points(_x, _y, _group = noone) : Node_Processor(_x, _y, _
inputs[| 4].setVisible(!_usePal, !_usePal);
inputs[| 6].setVisible(!_usePal, !_usePal);
inputs[| 8].setVisible(!_usePal, !_usePal);
}
} #endregion
static processData = function(_outSurf, _data, _output_index, _array_index) {
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
var _dim = _data[0];
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
@ -78,20 +80,18 @@ function Node_Gradient_Points(_x, _y, _group = noone) : Node_Processor(_x, _y, _
var _usePal = _data[9];
var _pal = _data[10];
var _1cen = _data[1];
var _1col = _data[2];
var _2cen = _data[3];
var _2col = _data[4];
var _3cen = _data[5];
var _3col = _data[6];
var _4cen = _data[7];
var _4col = _data[8];
var _1cen = _data[1], _1col = _data[2];
var _2cen = _data[3], _2col = _data[4];
var _3cen = _data[5], _3col = _data[6];
var _4cen = _data[7], _4col = _data[8];
var _1str = _data[11];
var _2str = _data[12];
var _3str = _data[13];
var _4str = _data[14];
var _blnd = _data[15];
var colArr = [];
if(_usePal) {
@ -100,18 +100,18 @@ function Node_Gradient_Points(_x, _y, _group = noone) : Node_Processor(_x, _y, _
} else
colArr = array_merge(colorArrayFromReal(_1col), colorArrayFromReal(_2col), colorArrayFromReal(_3col), colorArrayFromReal(_4col))
surface_set_target(_outSurf);
DRAW_CLEAR
shader_set(sh_gradient_points);
shader_set_f("dimension", _dim[0], _dim[1]);
shader_set_f("center", array_merge(_1cen, _2cen, _3cen, _4cen));
shader_set_f("color", colArr);
shader_set_f("strength", _1str, _2str, _3str, _4str);
surface_set_shader(_outSurf, sh_gradient_points);
shader_set_f("dimension", _dim);
shader_set_f("center", array_merge(_1cen, _2cen, _3cen, _4cen));
shader_set_f("color", colArr);
shader_set_f("strength", _1str, _2str, _3str, _4str);
shader_set_i("blend", _blnd);
draw_sprite_stretched_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], c_white, 1);
shader_reset();
surface_reset_target();
surface_reset_shader();
return _outSurf;
}
} #endregion
}

View file

@ -3,19 +3,19 @@ function Node_Level(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
inputs[| 1] = nodeValue("White", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1])
inputs[| 1] = nodeValue("White in", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1])
.setDisplay(VALUE_DISPLAY.slider_range);
inputs[| 2] = nodeValue("Red", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1])
inputs[| 2] = nodeValue("Red in", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1])
.setDisplay(VALUE_DISPLAY.slider_range);
inputs[| 3] = nodeValue("Green", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1])
inputs[| 3] = nodeValue("Green in", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1])
.setDisplay(VALUE_DISPLAY.slider_range);
inputs[| 4] = nodeValue("Blue", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1])
inputs[| 4] = nodeValue("Blue in", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1])
.setDisplay(VALUE_DISPLAY.slider_range);
inputs[| 5] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1])
inputs[| 5] = nodeValue("Alpha in", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1])
.setDisplay(VALUE_DISPLAY.slider_range);
inputs[| 6] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
@ -31,6 +31,21 @@ function Node_Level(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
__init_mask_modifier(6); // inputs 10, 11
inputs[| 12] = nodeValue("White out", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1])
.setDisplay(VALUE_DISPLAY.slider_range);
inputs[| 13] = nodeValue("Red out", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1])
.setDisplay(VALUE_DISPLAY.slider_range);
inputs[| 14] = nodeValue("Green out", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1])
.setDisplay(VALUE_DISPLAY.slider_range);
inputs[| 15] = nodeValue("Blue out", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1])
.setDisplay(VALUE_DISPLAY.slider_range);
inputs[| 16] = nodeValue("Alpha out", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 1])
.setDisplay(VALUE_DISPLAY.slider_range);
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
attribute_surface_depth();
@ -71,8 +86,11 @@ function Node_Level(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
input_display_list = [ 8, 9,
level_renderer,
["Surfaces", true], 0, 6, 7, 10, 11,
["Level", false], 1,
["Channel", true], 2, 3, 4, 5
["Brightness", false], 1, 12,
["Red", false], 2, 13,
["Green", false], 3, 14,
["Blue", false], 4, 15,
["Alpha", false], 5, 16,
];
histogramInit();
@ -94,18 +112,30 @@ function Node_Level(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
} #endregion
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
var _w = _data[1];
var _r = _data[2];
var _g = _data[3];
var _b = _data[4];
var _a = _data[5];
var _wi = _data[1];
var _ri = _data[2];
var _gi = _data[3];
var _bi = _data[4];
var _ai = _data[5];
var _wo = _data[12];
var _ro = _data[13];
var _go = _data[14];
var _bo = _data[15];
var _ao = _data[16];
surface_set_shader(_outSurf, sh_level);
shader_set_f("lw", _w);
shader_set_f("lr", _r);
shader_set_f("lg", _g);
shader_set_f("lb", _b);
shader_set_f("la", _a);
shader_set_f("lwi", _wi);
shader_set_f("lri", _ri);
shader_set_f("lgi", _gi);
shader_set_f("lbi", _bi);
shader_set_f("lai", _ai);
shader_set_f("lwo", _wo);
shader_set_f("lro", _ro);
shader_set_f("lgo", _go);
shader_set_f("lbo", _bo);
shader_set_f("lao", _ao);
draw_surface_safe(_data[0]);
surface_reset_shader();

View file

@ -10,10 +10,10 @@ function Node_MK_Rain(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
inputs[| 2] = nodeValue("Density", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 5);
inputs[| 3] = nodeValue("Raindrop width", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 2 ])
.setDisplay(VALUE_DISPLAY.vector_range);
.setDisplay(VALUE_DISPLAY.range);
inputs[| 4] = nodeValue("Raindrop length", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 5, 10 ])
.setDisplay(VALUE_DISPLAY.vector_range);
.setDisplay(VALUE_DISPLAY.range);
inputs[| 5] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white));
@ -21,7 +21,7 @@ function Node_MK_Rain(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
.setDisplay(VALUE_DISPLAY.slider_range);
inputs[| 7] = nodeValue("Velocity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 2 ])
.setDisplay(VALUE_DISPLAY.vector_range);
.setDisplay(VALUE_DISPLAY.range);
inputs[| 8] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, irandom_range(100_000, 999_999));
@ -31,7 +31,7 @@ function Node_MK_Rain(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
new scrollItem("Texture", s_node_mk_rain_type, 2) ]);
inputs[| 10] = nodeValue("Snow size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 3, 4 ])
.setDisplay(VALUE_DISPLAY.vector_range);
.setDisplay(VALUE_DISPLAY.range);
inputs[| 11] = nodeValue("Texture", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);

View file

@ -134,10 +134,14 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
var data = processData(_out, _data, outIndex, 0); // Process data
if(manage_atlas && _atlas && is_surface(data)) { // Convert back to atlas
var _atl = _pAtl.clone();
_atl.setSurface(data);
return _atl;
if(_output.type == VALUE_TYPE.surface) {
if(manage_atlas && _atlas && is_surface(data)) { // Convert back to atlas
var _atl = _pAtl.clone();
_atl.setSurface(data);
return _atl;
}
//data = surface_project_posterize(data);
}
return data;
@ -195,10 +199,14 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
} else {
_out[l] = processData(_out[l], _data, outIndex, l); // Process data
if(manage_atlas && _atlas && is_surface(_out[l])) { // Convert back to atlas
var _atl = _pAtl.clone();
_atl.setSurface(_out[l]);
_out[l] = _atl;
if(_output.type == VALUE_TYPE.surface) {
if(manage_atlas && _atlas && is_surface(_out[l])) { // Convert back to atlas
var _atl = _pAtl.clone();
_atl.setSurface(_out[l]);
_out[l] = _atl;
}
//data = surface_project_posterize(data);
}
}
}

View file

@ -5,23 +5,40 @@ function Node_Region_Fill(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
inputs[| 1] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
inputs[| 2] = nodeValue("Colors", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, DEF_PALETTE )
inputs[| 2] = nodeValue("Fill Colors", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, DEF_PALETTE )
.setDisplay(VALUE_DISPLAY.palette);
inputs[| 3] = nodeValue("Fill Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
inputs[| 3] = nodeValue("Fill", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
inputs[| 4] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, irandom_range(10000, 99999));
inputs[| 5] = nodeValue("Target Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, cola(c_black, 0));
inputs[| 6] = nodeValue("Inner only", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Only fill regions with surrounding pixels.");
inputs[| 7] = nodeValue("Draw original", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
inputs[| 8] = nodeValue("Fill type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Random", "Color map" ]);
inputs[| 9] = nodeValue("Color map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
input_display_list = [
input_display_list = [ 4,
["Surfaces", false], 0, 1,
["Fill", false, 3], 4, 2,
["Fill", false, 3], 5, 8, 2, 9, 6,
["Render", false], 7,
];
temp_surface = [ surface_create(1, 1), surface_create(1, 1) ];
temp_surface = array_create(3);
static step = function() {}
static step = function() {
var _filt = getInputData(8);
inputs[| 2].setVisible(_filt == 0);
inputs[| 9].setVisible(_filt == 1, _filt == 1);
}
static processData = function(_outSurf, _data, _output_index, _array_index) {
var _surf = _data[0];
@ -30,47 +47,97 @@ function Node_Region_Fill(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
var _colr = _data[2];
var _fill = _data[3];
var _seed = _data[4];
var _targ = _data[5];
var _innr = _data[6];
var _rnbg = _data[7];
var _filt = _data[8];
var _cmap = _data[9];
var _sw = surface_get_width_safe(_surf);
var _sh = surface_get_height_safe(_surf)
temp_surface[0] = surface_verify(temp_surface[0], _sw, _sh);
temp_surface[1] = surface_verify(temp_surface[1], _sw, _sh);
surface_clear(temp_surface[0]);
for( var i = 0, n = array_length(temp_surface); i < n; i++ ) {
temp_surface[i] = surface_verify(temp_surface[i], _sw, _sh);
surface_clear(temp_surface[i]);
}
surface_set_shader(temp_surface[1], sh_region_fill_init);
draw_surface_safe(_surf, 0, 0);
shader_set_color("targetColor", _targ);
draw_surface_safe(_surf);
surface_reset_shader();
var base = 0;
var amo = _sw;
if(_innr) {
repeat( amo ) {
surface_set_shader(temp_surface[base], sh_region_fill_inner);
shader_set_f("dimension", _sw, _sh);
draw_surface_safe(temp_surface[!base]);
surface_reset_shader();
base = !base;
}
}
var amo = _sw + _sh;
for( var i = 0; i < amo; i++ ) {
repeat( amo ) {
surface_set_shader(temp_surface[base], sh_region_fill_coordinate);
shader_set_f("dimension", _sw, _sh);
draw_surface_safe(temp_surface[!base], 0, 0);
draw_surface_safe(temp_surface[!base]);
surface_reset_shader();
base = !base;
}
surface_set_shader(temp_surface[base], sh_region_fill_border);
shader_set_f("dimension", _sw, _sh);
shader_set_surface("original", _surf);
draw_surface_safe(temp_surface[!base]);
surface_reset_shader();
if(_fill) {
var _pal = [];
for( var i = 0, n = array_length(_colr); i < n; i++ )
array_append(_pal, colToVec4(_colr[i]));
surface_set_shader(_outSurf, sh_region_fill_color);
shader_set_f("colors", _pal);
shader_set_f("seed", _seed);
shader_set_f("colorAmount", array_length(_colr));
surface_set_shader(_outSurf);
switch(_filt) {
case 0 :
shader_set(sh_region_fill_color);
draw_surface_safe(temp_surface[base], 0, 0);
shader_set_f("colors", _pal);
shader_set_f("seed", _seed);
shader_set_f("colorAmount", array_length(_colr));
draw_surface_safe(temp_surface[base]);
break;
case 1 :
shader_set(sh_region_fill_map);
shader_set_surface("colorMap", _cmap);
draw_surface_safe(temp_surface[base]);
break;
}
if(_rnbg) {
shader_reset();
shader_set(sh_sample);
draw_surface_safe(_surf);
}
surface_reset_shader();
} else {
surface_set_shader(_outSurf);
draw_surface_safe(temp_surface[base], 0, 0);
draw_surface_safe(temp_surface[base]);
if(_rnbg)
draw_surface_safe(_surf);
surface_reset_shader();
}

View file

@ -1137,9 +1137,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
}
break;
case VALUE_TYPE.boolean : #region
editWidget = new checkBox(function() {
return setValueDirect(!animator.getValue());
} );
if(name == "Active") editWidget = new checkBoxActive(function() { return setValueDirect(!animator.getValue()); } );
else editWidget = new checkBox(function() { return setValueDirect(!animator.getValue()); } );
key_inter = CURVE_TYPE.cut;
extract_node = "Node_Boolean";

View file

@ -44,6 +44,8 @@ function Node_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
attributes[? "initalset"] = LOADING || APPENDING;
warp_surface = array_create(2);
static onValueFromUpdate = function(index) { #region
if(index == 0 && attributes[? "initalset"] == false) {
var _surf = getInputData(0);
@ -68,7 +70,7 @@ function Node_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
dimension_index = _useDim? 7 : 0;
} #endregion
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny, params) { #region
PROCESSOR_OVERLAY_CHECK
var _surf = outputs[| 0].getValue();
@ -92,6 +94,30 @@ function Node_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
bl[1] = _y + bl[1] * _s;
br[1] = _y + br[1] * _s;
#region preview
var sw = surface_get_width(_surf) * _s;
var sh = surface_get_height(_surf) * _s;
warp_surface[0] = surface_verify(warp_surface[0], params.w, params.h);
warp_surface[1] = surface_verify(warp_surface[1], sw, sh);
surface_set_target(warp_surface[1]);
draw_clear(c_black);
draw_set_color(c_dkgrey);
for(var i = 0; i <= 1; i += 0.125) {
draw_line_width(0, i * sh, sw, i * sh, 2);
draw_line_width(i * sw, 0, i * sw, sh, 2);
}
surface_reset_target();
warpSurface( warp_surface[0], warp_surface[1], params.w, params.h, tl, tr, bl, br, true );
BLEND_ADD
draw_surface(warp_surface[0], 0, 0);
BLEND_NORMAL
#endregion
draw_set_color(COLORS._main_accent);
draw_line(tl[0], tl[1], tr[0], tr[1]);
draw_line(tl[0], tl[1], bl[0], bl[1]);
@ -117,100 +143,134 @@ function Node_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
}
}
draw_set_color(COLORS.node_overlay_gizmo_inactive);
if(drag_side == 0) {
draw_line_width(tl[0], tl[1], tr[0], tr[1], 3);
var _tlx = value_snap(drag_s[0][0] + dx, _snx);
var _tly = value_snap(drag_s[0][1] + dy, _sny);
var _trx = value_snap(drag_s[1][0] + dx, _snx);
var _try = value_snap(drag_s[1][1] + dy, _sny);
var _up1 = inputs[| 1].setValue([ _tlx, _tly ]);
var _up2 = inputs[| 2].setValue([ _trx, _try ]);
if(_up1 || _up2) UNDO_HOLDING = true;
} else if(drag_side == 1) {
draw_line_width(tl[0], tl[1], bl[0], bl[1], 3);
var _tlx = value_snap(drag_s[0][0] + dx, _snx);
var _tly = value_snap(drag_s[0][1] + dy, _sny);
var _blx = value_snap(drag_s[1][0] + dx, _snx);
var _bly = value_snap(drag_s[1][1] + dy, _sny);
var _up1 = inputs[| 1].setValue([ _tlx, _tly ]);
var _up3 = inputs[| 3].setValue([ _blx, _bly ]);
if(_up1 || _up3) UNDO_HOLDING = true;
} else if(drag_side == 2) {
draw_line_width(br[0], br[1], tr[0], tr[1], 3);
var _brx = value_snap(drag_s[0][0] + dx, _snx);
var _bry = value_snap(drag_s[0][1] + dy, _sny);
var _trx = value_snap(drag_s[1][0] + dx, _snx);
var _try = value_snap(drag_s[1][1] + dy, _sny);
var _up4 = inputs[| 4].setValue([ _brx, _bry ]);
var _up2 = inputs[| 2].setValue([ _trx, _try ]);
if(_up4 || _up2) UNDO_HOLDING = true;
} else if(drag_side == 3) {
draw_line_width(br[0], br[1], bl[0], bl[1], 3);
var _brx = value_snap(drag_s[0][0] + dx, _snx);
var _bry = value_snap(drag_s[0][1] + dy, _sny);
var _blx = value_snap(drag_s[1][0] + dx, _snx);
var _bly = value_snap(drag_s[1][1] + dy, _sny);
var _up4 = inputs[| 4].setValue([ _brx, _bry ]);
var _up3 = inputs[| 3].setValue([ _blx, _bly ]);
if(_up4 || _up3) UNDO_HOLDING = true;
} else if(_hactive) {
draw_set_color(COLORS._main_accent);
if(distance_to_line_infinite(_mx, _my, tl[0], tl[1], tr[0], tr[1]) < 12) {
#region edit
draw_set_color(COLORS.node_overlay_gizmo_inactive);
if(drag_side == 0) {
draw_line_width(tl[0], tl[1], tr[0], tr[1], 3);
if(mouse_press(mb_left)) {
drag_side = 0;
drag_mx = _mx;
drag_my = _my;
drag_s = [ current_data[1], current_data[2] ];
}
} else if(distance_to_line_infinite(_mx, _my, tl[0], tl[1], bl[0], bl[1]) < 12) {
var _tlx = value_snap(drag_s[0][0] + dx, _snx);
var _tly = value_snap(drag_s[0][1] + dy, _sny);
var _trx = value_snap(drag_s[1][0] + dx, _snx);
var _try = value_snap(drag_s[1][1] + dy, _sny);
var _up1 = inputs[| 1].setValue([ _tlx, _tly ]);
var _up2 = inputs[| 2].setValue([ _trx, _try ]);
if(_up1 || _up2) UNDO_HOLDING = true;
} else if(drag_side == 1) {
draw_line_width(tl[0], tl[1], bl[0], bl[1], 3);
if(mouse_press(mb_left)) {
drag_side = 1;
drag_mx = _mx;
drag_my = _my;
drag_s = [ current_data[1], current_data[3] ];
}
} else if(distance_to_line_infinite(_mx, _my, br[0], br[1], tr[0], tr[1]) < 12) {
var _tlx = value_snap(drag_s[0][0] + dx, _snx);
var _tly = value_snap(drag_s[0][1] + dy, _sny);
var _blx = value_snap(drag_s[1][0] + dx, _snx);
var _bly = value_snap(drag_s[1][1] + dy, _sny);
var _up1 = inputs[| 1].setValue([ _tlx, _tly ]);
var _up3 = inputs[| 3].setValue([ _blx, _bly ]);
if(_up1 || _up3) UNDO_HOLDING = true;
} else if(drag_side == 2) {
draw_line_width(br[0], br[1], tr[0], tr[1], 3);
if(mouse_press(mb_left)) {
drag_side = 2;
drag_mx = _mx;
drag_my = _my;
drag_s = [ current_data[4], current_data[2] ];
}
} else if(distance_to_line_infinite(_mx, _my, br[0], br[1], bl[0], bl[1]) < 12) {
var _brx = value_snap(drag_s[0][0] + dx, _snx);
var _bry = value_snap(drag_s[0][1] + dy, _sny);
var _trx = value_snap(drag_s[1][0] + dx, _snx);
var _try = value_snap(drag_s[1][1] + dy, _sny);
var _up4 = inputs[| 4].setValue([ _brx, _bry ]);
var _up2 = inputs[| 2].setValue([ _trx, _try ]);
if(_up4 || _up2) UNDO_HOLDING = true;
} else if(drag_side == 3) {
draw_line_width(br[0], br[1], bl[0], bl[1], 3);
if(mouse_press(mb_left)) {
drag_side = 3;
drag_mx = _mx;
drag_my = _my;
drag_s = [ current_data[4], current_data[3] ];
var _brx = value_snap(drag_s[0][0] + dx, _snx);
var _bry = value_snap(drag_s[0][1] + dy, _sny);
var _blx = value_snap(drag_s[1][0] + dx, _snx);
var _bly = value_snap(drag_s[1][1] + dy, _sny);
var _up4 = inputs[| 4].setValue([ _brx, _bry ]);
var _up3 = inputs[| 3].setValue([ _blx, _bly ]);
if(_up4 || _up3) UNDO_HOLDING = true;
} else if(_hactive) {
draw_set_color(COLORS._main_accent);
if(distance_to_line_infinite(_mx, _my, tl[0], tl[1], tr[0], tr[1]) < 12) {
draw_line_width(tl[0], tl[1], tr[0], tr[1], 3);
if(mouse_press(mb_left)) {
drag_side = 0;
drag_mx = _mx;
drag_my = _my;
drag_s = [ current_data[1], current_data[2] ];
}
} else if(distance_to_line_infinite(_mx, _my, tl[0], tl[1], bl[0], bl[1]) < 12) {
draw_line_width(tl[0], tl[1], bl[0], bl[1], 3);
if(mouse_press(mb_left)) {
drag_side = 1;
drag_mx = _mx;
drag_my = _my;
drag_s = [ current_data[1], current_data[3] ];
}
} else if(distance_to_line_infinite(_mx, _my, br[0], br[1], tr[0], tr[1]) < 12) {
draw_line_width(br[0], br[1], tr[0], tr[1], 3);
if(mouse_press(mb_left)) {
drag_side = 2;
drag_mx = _mx;
drag_my = _my;
drag_s = [ current_data[4], current_data[2] ];
}
} else if(distance_to_line_infinite(_mx, _my, br[0], br[1], bl[0], bl[1]) < 12) {
draw_line_width(br[0], br[1], bl[0], bl[1], 3);
if(mouse_press(mb_left)) {
drag_side = 3;
drag_mx = _mx;
drag_my = _my;
drag_s = [ current_data[4], current_data[3] ];
}
}
}
}
if(inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny)) active = false;
if(inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny)) active = false;
if(inputs[| 3].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny)) active = false;
if(inputs[| 4].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny)) active = false;
if(inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny)) active = false;
if(inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny)) active = false;
if(inputs[| 3].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny)) active = false;
if(inputs[| 4].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny)) active = false;
#endregion
} #endregion
static warpSurface = function(surf, warp, sw, sh, tl, tr, bl, br, filt = false) { #region
var teq = round(tl[1]) == round(tr[1]);
var beq = round(bl[1]) == round(br[1]);
var leq = round(tl[0]) == round(bl[0]);
var req = round(tr[0]) == round(br[0]);
if(teq && beq && leq && req) {
surface_set_shader(surf)
shader_set_interpolation(warp);
if(filt) gpu_set_tex_filter(true);
draw_surface_stretched_safe(warp, tl[0], tl[1], tr[0] - tl[0], bl[1] - tl[1]);
if(filt) gpu_set_tex_filter(false);
surface_reset_shader();
} else {
surface_set_shader(surf, sh_warp_4points);
shader_set_interpolation(warp);
shader_set_f("dimension", surface_get_dimension(warp));
shader_set_f("p0", br[0] / sw, br[1] / sh);
shader_set_f("p1", tr[0] / sw, tr[1] / sh);
shader_set_f("p2", tl[0] / sw, tl[1] / sh);
shader_set_f("p3", bl[0] / sw, bl[1] / sh);
if(filt) gpu_set_tex_filter(true);
draw_surface_stretched(warp, 0, 0, sw, sh);
if(filt) gpu_set_tex_filter(false);
surface_reset_shader();
}
} #endregion
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
@ -225,29 +285,7 @@ function Node_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
var sw = _useDim? _dim[0] : surface_get_width_safe(_data[0]);
var sh = _useDim? _dim[1] : surface_get_height_safe(_data[0]);
var teq = round(tl[1]) == round(tr[1]);
var beq = round(bl[1]) == round(br[1]);
var leq = round(tl[0]) == round(bl[0]);
var req = round(tr[0]) == round(br[0]);
if(teq && beq && leq && req) {
surface_set_shader(_outSurf)
shader_set_interpolation(_data[0]);
draw_surface_stretched_safe(_data[0], tl[0], tl[1], tr[0] - tl[0], bl[1] - tl[1]);
surface_reset_shader();
} else {
surface_set_shader(_outSurf, sh_warp_4points);
shader_set_interpolation(_data[0]);
shader_set_f("dimension", surface_get_dimension(_data[0]));
shader_set_f("p0", br[0] / sw, br[1] / sh);
shader_set_f("p1", tr[0] / sw, tr[1] / sh);
shader_set_f("p2", tl[0] / sw, tl[1] / sh);
shader_set_f("p3", bl[0] / sw, bl[1] / sh);
draw_surface_stretched(_data[0], 0, 0, sw, sh);
surface_reset_shader();
}
warpSurface(_outSurf, _data[0], sw, sh, tl, tr, bl, br);
return _outSurf;
} #endregion

View file

@ -709,7 +709,7 @@ function Panel_Animation() : PanelContent() constructor {
#endregion
} #endregion
function drawDopesheetGraphLine(animator, key_y, msx, msy, _gy_val_min = 999999, _gy_val_max = -999999) { #region
function __drawDopesheetGraphLine(animator, key_y, msx, msy, _gy_val_min = 999999, _gy_val_max = -999999) { #region
var bar_total_w = TOTAL_FRAMES * timeline_scale;
var bar_show_w = timeline_shift + bar_total_w;
var hovering = noone;
@ -919,7 +919,7 @@ function Panel_Animation() : PanelContent() constructor {
} #endregion
} #endregion
function drawDopesheetGraph(prop, key_y, msx, msy) { #region
function _drawDopesheetGraph(prop, key_y, msx, msy) { #region
var bar_total_w = TOTAL_FRAMES * timeline_scale;
var bar_show_w = timeline_shift + bar_total_w;
var _gy_top = key_y + ui(16);
@ -981,17 +981,21 @@ function Panel_Animation() : PanelContent() constructor {
}
for( var i = 0, n = array_length(prop.animators); i < n; i++ )
drawDopesheetGraphLine(prop.animators[i], key_y, msx, msy, _min, _max);
__drawDopesheetGraphLine(prop.animators[i], key_y, msx, msy, _min, _max);
} else
drawDopesheetGraphLine(prop.animator, key_y, msx, msy);
__drawDopesheetGraphLine(prop.animator, key_y, msx, msy);
#endregion
} #endregion
function drawDopesheetAnimatorKeysBG(animator, msx, msy) { #region
function _drawDopesheetAnimatorKeysBG(animator, msx, msy) { #region
var prop_dope_y = animator.y;
var key_hover = noone;
var key_list = animator.values;
//if(animator.prop.name == "Active") { #region active prop
//} #endregion
if((animator.prop.on_end == KEYFRAME_END.loop || animator.prop.on_end == KEYFRAME_END.ping) && ds_list_size(key_list) > 1) {
var keyframe_s = animator.prop.loop_range == -1? key_list[| 0].time : key_list[| ds_list_size(key_list) - 1 - animator.prop.loop_range].time;
var keyframe_e = key_list[| ds_list_size(key_list) - 1].time;
@ -1004,7 +1008,7 @@ function Panel_Animation() : PanelContent() constructor {
draw_line_width(ks_x, prop_dope_y - 1, ke_x, prop_dope_y - 1, 4);
draw_set_alpha(1);
}
for( var k = 0; k < ds_list_size(key_list); k++ ) { //draw easing
var key = key_list[| k];
var t = key.dopesheet_x;
@ -1045,7 +1049,7 @@ function Panel_Animation() : PanelContent() constructor {
return key_hover;
} #endregion
function drawDopesheetAnimatorKeys(_cont, animator, msx, msy) { #region
function _drawDopesheetAnimatorKeys(_cont, animator, msx, msy) { #region
var _node = _cont.node;
var prop_y = animator.y;
var node_y = _cont.y + dope_sheet_node_padding;
@ -1122,7 +1126,7 @@ function Panel_Animation() : PanelContent() constructor {
return key_hover;
} #endregion
function drawDopesheetLabelAnimator(_item, _node, animator, msx, msy) { #region
function __drawDopesheetLabelAnimator(_item, _node, animator, msx, msy) { #region
var prop = animator.prop;
var aa = _node.group == PANEL_GRAPH.getCurrentContext()? 1 : 0.9;
var tx = tool_width;
@ -1237,7 +1241,7 @@ function Panel_Animation() : PanelContent() constructor {
draw_set_alpha(1);
} #endregion
function drawDopesheetLabelItem(_item, _x, _y, msx = -1, msy = -1, alpha = 1) { #region
function __drawDopesheetLabelItem(_item, _x, _y, msx = -1, msy = -1, alpha = 1) { #region
var _itx = _x;
var _ity = _y;
var _itw = tool_width;
@ -1261,7 +1265,7 @@ function Panel_Animation() : PanelContent() constructor {
}
} #endregion
function drawDopesheetLabel() { #region
function _drawDopesheetLabel() { #region
surface_set_target(dope_sheet_name_surface);
draw_clear_alpha(COLORS.panel_bg_clear, 0);
var msx = mx - ui(8);
@ -1330,11 +1334,11 @@ function Panel_Animation() : PanelContent() constructor {
continue;
}
drawDopesheetLabelItem(_cont, 0, _cont.y + dope_sheet_node_padding, msx, msy);
__drawDopesheetLabelItem(_cont, 0, _cont.y + dope_sheet_node_padding, msx, msy);
if(_cont.type == "node" && _cont.item.show)
for( var j = 0; j < array_length(_cont.animators); j++ )
drawDopesheetLabelAnimator(_cont, _cont.node, _cont.animators[j], msx, msy);
__drawDopesheetLabelAnimator(_cont, _cont.node, _cont.animators[j], msx, msy);
} //end node loop
if(_itx != -1) {
@ -1658,14 +1662,14 @@ function Panel_Animation() : PanelContent() constructor {
var _prop = prop.prop;
for( var k = 0; k < array_length(prop.animators); k++ ) {
var key = drawDopesheetAnimatorKeysBG(prop.animators[k], msx, msy);
var key = _drawDopesheetAnimatorKeysBG(prop.animators[k], msx, msy);
_dy = prop.animators[k].y;
if(key != noone)
key_hover = key;
}
if(isGraphable(_prop) && _prop.show_graph)
drawDopesheetGraph(_prop, _dy, msx, msy);
_drawDopesheetGraph(_prop, _dy, msx, msy);
}
}
#endregion
@ -1688,7 +1692,7 @@ function Panel_Animation() : PanelContent() constructor {
for( var j = 0, m = array_length(_cont.animators); j < m; j++ ) {
var _anim = _cont.animators[j];
var key = drawDopesheetAnimatorKeys(_cont, _anim, msx, msy);
var key = _drawDopesheetAnimatorKeys(_cont, _anim, msx, msy);
if(key != noone) key_hover = key;
}
}
@ -1921,7 +1925,7 @@ function Panel_Animation() : PanelContent() constructor {
gpu_set_blendmode(bm_normal);
surface_reset_target();
drawDopesheetLabel();
_drawDopesheetLabel();
if(mouse_press(mb_right, pFOCUS)) { #region context menu
if(point_in_rectangle(mx, my, bar_x, ui(8), bar_x + dope_sheet_w, ui(8) + dope_sheet_h)) {
@ -1945,7 +1949,7 @@ function Panel_Animation() : PanelContent() constructor {
draw_sprite_stretched(THEME.ui_panel_bg_cover, 1, bar_x, ui(8), bar_w, dope_sheet_h);
if(item_dragging != noone) drawDopesheetLabelItem(item_dragging, mx - item_dragging_dx, my - item_dragging_dy,,, 0.5);
if(item_dragging != noone) __drawDopesheetLabelItem(item_dragging, mx - item_dragging_dx, my - item_dragging_dy,,, 0.5);
} #endregion
function drawAnimationControl() { #region

View file

@ -46,10 +46,11 @@ function Panel_Preview() : PanelContent() constructor {
#endregion
#region ---- preview ----
preview_node = [ noone, noone ];
preview_surface = [ 0, 0 ];
tile_surface = surface_create(1, 1);
preview_node = [ noone, noone ];
preview_surfaces = [ 0, 0 ];
preview_surface = [ 0, 0 ];
tile_surface = surface_create(1, 1);
preview_x = 0;
preview_x_to = 0;
preview_x_max = 0;
@ -301,11 +302,11 @@ function Panel_Preview() : PanelContent() constructor {
function resetNodePreview() { preview_node = [ noone, noone ]; }
function getNodePreview() { return preview_node[splitView? splitSelection : 0]; }
function getNodePreviewSurface() { return preview_surface[splitView? splitSelection : 0]; }
function getNodePreviewSurface() { return preview_surfaces[splitView? splitSelection : 0]; }
function getNodePreviewSequence() { return preview_sequence[splitView? splitSelection : 0]; }
function getPreviewData() { #region
preview_surface = [ noone, noone ];
preview_surfaces = [ noone, noone ];
preview_sequence = [ noone, noone ];
for( var i = 0; i < 2; i++ ) {
@ -323,13 +324,13 @@ function Panel_Preview() : PanelContent() constructor {
preview_sequence[i] = value;
canvas_a = array_length(value);
} else {
preview_surface[i] = value;
preview_surfaces[i] = value;
canvas_a = 0;
}
if(preview_sequence[i] != noone) {
if(array_length(preview_sequence[i]) == 0) return;
preview_surface[i] = preview_sequence[i][safe_mod(node.preview_index, array_length(preview_sequence[i]))];
preview_surfaces[i] = preview_sequence[i][safe_mod(node.preview_index, array_length(preview_sequence[i]))];
}
}
@ -555,7 +556,7 @@ function Panel_Preview() : PanelContent() constructor {
} #endregion
function drawOnionSkin(node, psx, psy, ss) { #region
var _surf = preview_surface[0];
var _surf = preview_surfaces[0];
var _rang = PROJECT.onion_skin.range;
var _alph = PROJECT.onion_skin.alpha;
@ -599,12 +600,12 @@ function Panel_Preview() : PanelContent() constructor {
var ssx = 0, ssy = 0;
var ssw = 0, ssh = 0;
if(is_surface(preview_surface[0])) {
if(is_surface(preview_surfaces[0])) {
psx = canvas_x + preview_node[0].preview_x * ss;
psy = canvas_y + preview_node[0].preview_y * ss;
psw = surface_get_width_safe(preview_surface[0]);
psh = surface_get_height_safe(preview_surface[0]);
psw = surface_get_width_safe(preview_surfaces[0]);
psh = surface_get_height_safe(preview_surfaces[0]);
pswd = psw * ss;
pshd = psh * ss;
@ -612,99 +613,131 @@ function Panel_Preview() : PanelContent() constructor {
psy1 = psy + pshd;
}
if(is_surface(preview_surface[1])) {
if(is_surface(preview_surfaces[1])) {
var ssx = canvas_x + preview_node[1].preview_x * ss;
var ssy = canvas_y + preview_node[1].preview_y * ss;
var ssw = surface_get_width_safe(preview_surface[1]);
var ssh = surface_get_height_safe(preview_surface[1]);
var ssw = surface_get_width_safe(preview_surfaces[1]);
var ssh = surface_get_height_safe(preview_surfaces[1]);
}
var _node = getNodePreview();
if(_node) title = _node.renamed? _node.display_name : _node.name;
if(splitView == 0 && tileMode == 0) {
var node = preview_node[0];
if(is_surface(preview_surface[0])) {
node.previewing = 1;
var aa = node.preview_alpha;
#region >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Draw Surfaces <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
var _ps0 = is_surface(preview_surfaces[0]);
var _ps1 = is_surface(preview_surfaces[1]);
if(PROJECT.onion_skin.enabled) drawOnionSkin(node, psx, psy, ss);
else draw_surface_ext_safe(preview_surface[0], psx, psy, ss, ss, 0, c_white, aa);
if(_ps0) {
var _sw = surface_get_width(preview_surfaces[0]);
var _sh = surface_get_height(preview_surfaces[0]);
preview_surface[0] = surface_verify(preview_surface[0], _sw, _sh);
surface_set_shader(preview_surface[0], PROJECT.attributes.palette_fix? sh_posterize_palette : sh_sample);
shader_set_f("palette", PROJECT.palettes);
shader_set_i("keys", array_length(PROJECT.attributes.palette));
shader_set_i("alpha", 1);
draw_surface(preview_surfaces[0], 0, 0);
surface_reset_shader();
}
}
switch(splitView) { #region draw surfaces
case 0 :
if(is_surface(preview_surface[0])) {
preview_node[0].previewing = 1;
if(_ps1) {
var _sw = surface_get_width(preview_surfaces[1]);
var _sh = surface_get_height(preview_surfaces[1]);
preview_surface[1] = surface_verify(preview_surface[1], _sw, _sh);
surface_set_shader(preview_surface[1], PROJECT.attributes.palette_fix? sh_posterize_palette : sh_sample);
shader_set_f("palette", PROJECT.palettes);
shader_set_i("keys", array_length(PROJECT.attributes.palette));
shader_set_i("alpha", 1);
switch(tileMode) {
case 1 :
tile_surface = surface_verify(tile_surface, w, surface_get_height_safe(preview_surface[0]) * ss);
surface_set_target(tile_surface);
DRAW_CLEAR
draw_surface_tiled_ext_safe(preview_surface[0], psx, 0, ss, ss, 0, c_white, 1);
surface_reset_target();
draw_surface_safe(tile_surface, 0, psy);
break;
case 2 :
tile_surface = surface_verify(tile_surface, surface_get_width_safe(preview_surface[0]) * ss, h);
surface_set_target(tile_surface);
DRAW_CLEAR
draw_surface_tiled_ext_safe(preview_surface[0], 0, psy, ss, ss, 0, c_white, 1);
surface_reset_target();
draw_surface_safe(tile_surface, psx, 0);
break;
case 3 : draw_surface_tiled_ext_safe(preview_surface[0], psx, psy, ss, ss, 0, c_white, 1); break;
draw_surface(preview_surfaces[1], 0, 0);
surface_reset_shader();
}
switch(splitView) {
case 0 :
if(_ps0) {
preview_node[0].previewing = 1;
switch(tileMode) {
case 0 :
if(PROJECT.onion_skin.enabled) drawOnionSkin(node, psx, psy, ss);
else draw_surface_ext(preview_surface[0], psx, psy, ss, ss, 0, c_white, preview_node[0].preview_alpha);
break;
case 1 :
tile_surface = surface_verify(tile_surface, w, surface_get_height_safe(preview_surface[0]) * ss);
surface_set_target(tile_surface);
DRAW_CLEAR
draw_surface_tiled_ext_safe(preview_surface[0], psx, 0, ss, ss, 0, c_white, 1);
surface_reset_target();
draw_surface_safe(tile_surface, 0, psy);
break;
case 2 :
tile_surface = surface_verify(tile_surface, surface_get_width_safe(preview_surface[0]) * ss, h);
surface_set_target(tile_surface);
DRAW_CLEAR
draw_surface_tiled_ext_safe(preview_surface[0], 0, psy, ss, ss, 0, c_white, 1);
surface_reset_target();
draw_surface_safe(tile_surface, psx, 0);
break;
case 3 :
draw_surface_tiled_ext_safe(preview_surface[0], psx, psy, ss, ss, 0, c_white, 1); break;
}
}
}
break;
case 1 :
var sp = splitPosition * w;
break;
case 1 :
var sp = splitPosition * w;
if(is_surface(preview_surface[0])) {
preview_node[0].previewing = 2;
var maxX = min(sp, psx1);
var sW = min(psw, (maxX - psx) / ss);
if(_ps0) {
preview_node[0].previewing = 2;
var maxX = min(sp, psx1);
var sW = min(psw, (maxX - psx) / ss);
if(sW > 0)
draw_surface_part_ext_safe(preview_surface[0], 0, 0, sW, psh, psx, psy, ss, ss, 0, c_white, 1);
}
if(sW > 0)
draw_surface_part_ext_safe(preview_surface[0], 0, 0, sW, psh, psx, psy, ss, ss, 0, c_white, 1);
}
if(is_surface(preview_surface[1])) {
preview_node[1].previewing = 3;
var minX = max(ssx, sp);
var sX = (minX - ssx) / ss;
var spx = max(sp, ssx);
if(_ps1) {
preview_node[1].previewing = 3;
var minX = max(ssx, sp);
var sX = (minX - ssx) / ss;
var spx = max(sp, ssx);
if(sX >= 0 && sX < ssw)
draw_surface_part_ext_safe(preview_surface[1], sX, 0, ssw - sX, ssh, spx, ssy, ss, ss, 0, c_white, 1);
}
break;
case 2 :
var sp = splitPosition * h;
if(sX >= 0 && sX < ssw)
draw_surface_part_ext_safe(preview_surface[1], sX, 0, ssw - sX, ssh, spx, ssy, ss, ss, 0, c_white, 1);
}
break;
case 2 :
var sp = splitPosition * h;
if(is_surface(preview_surface[0])) {
preview_node[0].previewing = 4;
var maxY = min(sp, psy1);
var sH = min(psh, (maxY - psy) / ss);
if(_ps0) {
preview_node[0].previewing = 4;
var maxY = min(sp, psy1);
var sH = min(psh, (maxY - psy) / ss);
if(sH > 0)
draw_surface_part_ext_safe(preview_surface[0], 0, 0, psw, sH, psx, psy, ss, ss, 0, c_white, 1);
}
if(sH > 0)
draw_surface_part_ext_safe(preview_surface[0], 0, 0, psw, sH, psx, psy, ss, ss, 0, c_white, 1);
}
if(is_surface(preview_surface[1])) {
preview_node[1].previewing = 5;
var minY = max(ssy, sp);
var sY = (minY - ssy) / ss;
var spy = max(sp, ssy);
if(_ps1) {
preview_node[1].previewing = 5;
var minY = max(ssy, sp);
var sY = (minY - ssy) / ss;
var spy = max(sp, ssy);
if(sY >= 0 && sY < ssh)
draw_surface_part_ext_safe(preview_surface[1], 0, sY, ssw, ssh - sY, ssx, spy, ss, ss, 0, c_white, 1);
}
break;
} #endregion
if(sY >= 0 && sY < ssh)
draw_surface_part_ext_safe(preview_surface[1], 0, sY, ssw, ssh - sY, ssx, spy, ss, ss, 0, c_white, 1);
}
break;
}
#endregion
if(!instance_exists(o_dialog_menubox)) { #region color sample
sample_color = noone;
@ -723,7 +756,7 @@ function Panel_Preview() : PanelContent() constructor {
}
} #endregion
if(is_surface(preview_surface[0])) { #region outline
if(is_surface(preview_surfaces[0])) { #region outline
if(PROJECT.previewGrid.show) {
var _gw = PROJECT.previewGrid.size[0] * canvas_s;
var _gh = PROJECT.previewGrid.size[1] * canvas_s;

View file

@ -55,15 +55,29 @@
on_top: true,
}; #endregion
attributes = { #region
surface_dimension: [ 32, 32 ],
palette: [ cola(c_black), cola(c_white) ]
} #endregion
attributeEditor = [ #region
[ "Default Surface", "surface_dimension", new vectorBox(2, function(ind, val) { attributes.surface_dimension[ind] = val; RENDER_ALL return true; }) ],
[ "Palette", "palette", new buttonPalette(function(pal) { attributes.palette = pal; RENDER_ALL return true; }) ],
]; #endregion
#region =================== ATTRIBUTES ===================
attributes = {
surface_dimension : [ 32, 32 ],
palette : [ cola(c_black), cola(c_white) ],
palette_fix : false,
}
var _bpal = new buttonPalette(function(pal) { setPalette(pal); RENDER_ALL return true; });
//_bpal.side_button = button(function() { attributes.palette_fix = !attributes.palette_fix; RENDER_ALL return true; })
// .setIcon( THEME.project_fix_palette, [ function() { return attributes.palette_fix; } ], COLORS._main_icon )
// .setTooltip("Fix palette");
attributeEditor = [
[ "Default Surface", "surface_dimension", new vectorBox(2, function(ind, val) { attributes.surface_dimension[ind] = val; RENDER_ALL return true; }) ],
[ "Palette", "palette", _bpal ],
];
static setPalette = function(pal = noone) {
if(pal != noone) attributes.palette = pal;
palettes = paletteToArray(attributes.palette);
} setPalette();
#endregion
timelines = new timelineItemGroup();

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,15 @@
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
#define PI 3.14159265358979323846;
uniform vec2 position;
uniform float amount;
void main() {
//vec2 cen = v_vTexcoord - position;
//float angle = (atan(cen.y, cen.x) / PI + 1.) / 2.;
//float dist = length(cen);
gl_FragColor = texture2D( gm_BaseTexture, v_vTexcoord );
}

View 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;
}

View file

@ -0,0 +1,10 @@
{
"resourceType": "GMShader",
"resourceVersion": "1.0",
"name": "sh_bend_arc",
"parent": {
"name": "warp",
"path": "folders/shader/filter/warp.yy",
},
"type": 1,
}

View file

@ -18,7 +18,7 @@ uniform vec2 dimension;
uniform vec4 palette[32];
uniform int keys;
vec3 rgb2xyz( vec3 c ) {
vec3 rgb2xyz( vec3 c ) { #region
vec3 tmp;
tmp.x = ( c.r > 0.04045 ) ? pow( ( c.r + 0.055 ) / 1.055, 2.4 ) : c.r / 12.92;
tmp.y = ( c.g > 0.04045 ) ? pow( ( c.g + 0.055 ) / 1.055, 2.4 ) : c.g / 12.92,
@ -27,35 +27,35 @@ vec3 rgb2xyz( vec3 c ) {
mat3( 0.4124, 0.3576, 0.1805,
0.2126, 0.7152, 0.0722,
0.0193, 0.1192, 0.9505 );
}
} #endregion
vec3 xyz2lab( vec3 c ) {
vec3 xyz2lab( vec3 c ) { #region
vec3 n = c / vec3( 95.047, 100, 108.883 );
vec3 v;
v.x = ( n.x > 0.008856 ) ? pow( n.x, 1.0 / 3.0 ) : ( 7.787 * n.x ) + ( 16.0 / 116.0 );
v.y = ( n.y > 0.008856 ) ? pow( n.y, 1.0 / 3.0 ) : ( 7.787 * n.y ) + ( 16.0 / 116.0 );
v.z = ( n.z > 0.008856 ) ? pow( n.z, 1.0 / 3.0 ) : ( 7.787 * n.z ) + ( 16.0 / 116.0 );
return vec3(( 116.0 * v.y ) - 16.0, 500.0 * ( v.x - v.y ), 200.0 * ( v.y - v.z ));
}
} #endregion
vec3 rgb2lab(vec3 c) {
vec3 rgb2lab(vec3 c) { #region
vec3 lab = xyz2lab( rgb2xyz( c ) );
return vec3( lab.x / 100.0, 0.5 + 0.5 * ( lab.y / 127.0 ), 0.5 + 0.5 * ( lab.z / 127.0 ));
}
} #endregion
float colorDifferent(in vec4 c1, in vec4 c2) {
float colorDifferent(in vec4 c1, in vec4 c2) { #region
vec3 lab1 = rgb2lab(c1.rgb);
vec3 lab2 = rgb2lab(c2.rgb);
return length(lab1 - lab2);
}
} #endregion
void main() {
void main() { #region
vec4 _col = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
bool exactColor = false;
int closet1_index = 0;
int closet2_index = 0;
bool exactColor = false;
int closet1_index = 0;
int closet2_index = 0;
float closet1_value = 99.;
float closet2_value = 99.;
@ -124,4 +124,4 @@ void main() {
}
gl_FragColor.a *= _col.a;
}
} #endregion

View file

@ -1,25 +1,24 @@
//
// Simple passthrough fragment shader
//
#define TAU 6.283185307179586
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
#define TAU 6.283185307179586
uniform vec2 dimension;
uniform vec2 center[4];
uniform vec3 color[4];
uniform vec4 strength;
uniform int blend;
void main() {
vec4 distances = vec4(0.);
float maxDist = 0.;
int i;
for( i = 0; i < 4; i++ ) {
float d = distance(v_vTexcoord, center[i] / dimension);
float d = distance(v_vTexcoord, center[i] / dimension);
distances[i] = d;
maxDist = max(maxDist, d);
maxDist = max(maxDist, d);
}
maxDist *= 2.;
@ -27,8 +26,15 @@ void main() {
for( i = 0; i < 4; i++ )
distances[i] = pow((maxDist - distances[i]) / maxDist, strength[i]);
vec4 weights = distances / (distances[0] + distances[1] + distances[2] + distances[3]);
vec3 clr = (color[0] * weights[0]) + (color[1] * weights[1]) + (color[2] * weights[2]) + (color[3] * weights[3]);
vec4 weights;
if(blend == 0) weights = distances / (distances[0] + distances[1] + distances[2] + distances[3]);
else if(blend == 1) weights = normalize(distances);
vec3 clr = color[0] * weights[0] +
color[1] * weights[1] +
color[2] * weights[2] +
color[3] * weights[3];
gl_FragColor = vec4(clr, 1.);
}

View file

@ -1,21 +1,27 @@
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform vec2 lw;
uniform vec2 lr;
uniform vec2 lg;
uniform vec2 lb;
uniform vec2 la;
uniform vec2 lwi;
uniform vec2 lri;
uniform vec2 lgi;
uniform vec2 lbi;
uniform vec2 lai;
uniform vec2 lwo;
uniform vec2 lro;
uniform vec2 lgo;
uniform vec2 lbo;
uniform vec2 lao;
void main() {
vec4 col = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
col.r = (col.r - lr.x) / (lr.y - lr.x);
col.g = (col.g - lg.x) / (lg.y - lg.x);
col.b = (col.b - lb.x) / (lb.y - lb.x);
col.a = (col.a - la.x) / (la.y - la.x);
col.r = (col.r - lri.x) / (lri.y - lri.x) * (lro.y - lro.x) + lro.x;
col.g = (col.g - lgi.x) / (lgi.y - lgi.x) * (lgo.y - lgo.x) + lgo.x;
col.b = (col.b - lbi.x) / (lbi.y - lbi.x) * (lbo.y - lbo.x) + lbo.x;
col.a = (col.a - lai.x) / (lai.y - lai.x) * (lao.y - lao.x) + lao.x;
col.rgb = (col.rgb - lw.x) / (lw.y - lw.x);
col.rgb = (col.rgb - lwi.x) / (lwi.y - lwi.x) * (lwo.y - lwo.x) + lwo.x;
gl_FragColor = col;
}

View file

@ -79,7 +79,7 @@ void main() { #region
#region filter out filled ot empty pixel
bool isBorder = false;
if(side == 0) isBorder = point.a == 1.;
if(side == 0) isBorder = point.a > 0.;
else if(side == 1) isBorder = point.a < 1.;
if(!isBorder) {
@ -154,7 +154,7 @@ void main() { #region
if(is_blend == 0) {
if(side == 0) {
col = borderColor;
if(is_aa == 1)
if(is_aa == 1)
col.a = point.a;
} else {
float alpha = point.a + outline_alpha * (1. - point.a);

View file

@ -1,6 +1,3 @@
//
// Simple passthrough fragment shader
//
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
@ -12,23 +9,21 @@ uniform int iteration;
///////////////////// PERLIN START /////////////////////
float random (in vec2 st) { return fract(sin(dot(st.xy, vec2(12.9898, 78.233))) * 43758.5453123); }
float random (in vec2 st) { return fract(sin(dot(st.xy, vec2(12.9898, 78.233))) * 43758.5453123); }
vec2 random2 (in vec2 st) {
float a = random(st);
return vec2(cos(a), sin(a));
}
float noise (in vec2 st) {
vec2 i = floor(st);
vec2 f = fract(st);
// Four corners in 2D of a tile
float a = random(i);
float b = random(i + vec2(1.0, 0.0));
float c = random(i + vec2(0.0, 1.0));
float d = random(i + vec2(1.0, 1.0));
// Cubic Hermine Curve. Same as SmoothStep()
vec2 u = f * f * (3.0 - 2.0 * f);
// Mix 4 coorners percentages
return mix(mix(a, b, u.x), mix(c, d, u.x), u.y);
float lerp1 = mix(dot(f + vec2(0.0, 0.0), random2(i + vec2(0.0, 0.0))), dot(f + vec2(1.0, 0.0), random2(i + vec2(1.0, 0.0))), u.x);
float lerp2 = mix(dot(f + vec2(0.0, 1.0), random2(i + vec2(0.0, 1.0))), dot(f + vec2(1.0, 1.0), random2(i + vec2(1.0, 1.0))), u.x);
return mix(lerp1, lerp2, u.y);
}
float perlin ( vec2 pos, int iteration ) {

View file

@ -25,16 +25,8 @@ vec3 hsv2rgb(vec3 c) { #region
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
} #endregion
float random (in vec2 st, float _seed) { return fract(sin(dot(st.xy + vec2(21.456, 46.856), vec2(12.989, 78.233))) * (43758.545 + _seed)); }
float randomFloat (in vec2 st, float _seed) { #region
float sedSt = floor(_seed);
float sedFr = fract(_seed);
return mix(random(st, sedSt), random(st, sedSt + 1.), sedFr);
} #endregion
vec2 random2 (in vec2 st, float _seed) { return vec2(random(st, _seed), random(st, _seed + 1.864)); }
float random (in vec2 st) { return smoothstep(0., 1., abs(fract(sin(dot(st.xy + vec2(21.456, 46.856), vec2(12.989, 78.233))) * (43758.545 + seed)) * 2. - 1.)); }
vec2 random2 (in vec2 st) { float a = random(st) * 6.28319; return vec2(cos(a), sin(a)); }
float noise (in vec2 st, in vec2 scale) { #region
vec2 cellMin = floor(st);
@ -48,12 +40,33 @@ float noise (in vec2 st, in vec2 scale) { #region
vec2 f = fract(st);
vec2 u = f * f * (3.0 - 2.0 * f);
float a = randomFloat(vec2(cellMin.x, cellMin.y), seed);
float b = randomFloat(vec2(cellMax.x, cellMin.y), seed);
float c = randomFloat(vec2(cellMin.x, cellMax.y), seed);
float d = randomFloat(vec2(cellMax.x, cellMax.y), seed);
vec2 _a = vec2(cellMin.x, cellMin.y);
vec2 _b = vec2(cellMax.x, cellMin.y);
vec2 _c = vec2(cellMin.x, cellMax.y);
vec2 _d = vec2(cellMax.x, cellMax.y);
return abs(mix(mix(a, b, u.x), mix(c, d, u.x), u.y));
vec2 ai = f - vec2(0., 0.);
vec2 bi = f - vec2(1., 0.);
vec2 ci = f - vec2(0., 1.);
vec2 di = f - vec2(1., 1.);
//float a = random(_a);
//float b = random(_b);
//float c = random(_c);
//float d = random(_d);
vec2 a2 = random2(_a);
vec2 b2 = random2(_b);
vec2 c2 = random2(_c);
vec2 d2 = random2(_d);
//float l1 = mix(a, b, u.x);
//float l2 = mix(c, d, u.x);
float l1 = mix(dot(ai, a2), dot(bi, b2), u.x);
float l2 = mix(dot(ci, c2), dot(di, d2), u.x);
return mix(l1, l2, u.y) + 0.5;
} #endregion
float perlin(in vec2 st) { #region
@ -65,8 +78,6 @@ float perlin(in vec2 st) { #region
for(int i = 0; i < iteration; i++) {
n += noise(pos, sc) * amp;
//pos += random2(vec2(float(i), float(i)), seed + 1.57) * sc; //make the result goes random somehow
sc *= 2.;
amp *= .5;
pos *= 2.;

View file

@ -0,0 +1,64 @@
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
#define ITERATION 8.
uniform vec2 dimension;
uniform sampler2D original;
vec4 sample ( vec2 position ) {
if(position.x < 0. || position.y < 0. || position.x > 1. || position.y > 1.) return vec4(0.);
return texture2D( gm_BaseTexture, position );
}
void main() {
vec2 tx = 1. / dimension;
vec4 c = texture2D( gm_BaseTexture, v_vTexcoord );
vec4 o = texture2D( original, v_vTexcoord );
gl_FragColor = c;
if(c.a == 1.) return;
if(o.a == 0.) return;
float minD = ITERATION;
for( float i = 1.; i < ITERATION; i++ ) {
if(i >= minD) break;
vec4 s = sample( v_vTexcoord + vec2(tx.x * i, 0.) );
if(s.a == 0.) continue;
gl_FragColor = s;
minD = i;
}
for( float i = 1.; i < ITERATION; i++ ) {
if(i >= minD) break;
vec4 s = sample( v_vTexcoord - vec2(tx.x * i, 0.) );
if(s.a == 0.) continue;
gl_FragColor = s;
minD = i;
}
for( float i = 1.; i < ITERATION; i++ ) {
if(i >= minD) break;
vec4 s = sample( v_vTexcoord + vec2(0., tx.y * i) );
if(s.a == 0.) continue;
gl_FragColor = s;
minD = i;
}
for( float i = 1.; i < ITERATION; i++ ) {
if(i >= minD) break;
vec4 s = sample( v_vTexcoord - vec2(0., tx.y * i) );
if(s.a == 0.) continue;
gl_FragColor = s;
minD = i;
}
}

View 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;
}

View file

@ -0,0 +1,10 @@
{
"resourceType": "GMShader",
"resourceVersion": "1.0",
"name": "sh_region_fill_border",
"parent": {
"name": "region",
"path": "folders/shader/generator/region.yy",
},
"type": 1,
}

View file

@ -19,11 +19,7 @@ vec4 less ( vec4 a, vec4 b ) {
}
vec4 sample ( vec2 position ) {
if(position.x < 0.) return vec4(1.);
if(position.y < 0.) return vec4(1.);
if(position.x > 1.) return vec4(1.);
if(position.y > 1.) return vec4(1.);
if(position.x < 0. || position.y < 0. || position.x > 1. || position.y > 1.) return vec4(1.);
return texture2D( gm_BaseTexture, position );
}
@ -33,6 +29,10 @@ void main() {
gl_FragColor = c;
if(c.a == 0.) return;
if(c.b == 1.) {
gl_FragColor = vec4(0.);
return;
}
for( float i = 1.; i < ITERATION; i++ ) {
vec4 s = sample( v_vTexcoord + vec2(tx.x * i, 0) );

View file

@ -1,13 +1,13 @@
//
// Simple passthrough fragment shader
//
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform vec4 targetColor;
void main() {
vec4 c = texture2D( gm_BaseTexture, v_vTexcoord );
vec3 _c = c.rgb * c.a;
float _f = _c.r + _c.g + _c.b;
vec4 c = texture2D( gm_BaseTexture, v_vTexcoord );
gl_FragColor = _f == 0.? vec4(0.) : vec4(v_vTexcoord, 0., 1.);
if(targetColor.a == 0.)
gl_FragColor = c.a == 0.? vec4(v_vTexcoord, 0., 1.) : vec4(0.);
else
gl_FragColor = targetColor == c? vec4(v_vTexcoord, 0., 1.) : vec4(0.);
}

View file

@ -0,0 +1,58 @@
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
#define ITERATION 8.
uniform vec2 dimension;
vec4 sample ( vec2 position ) {
if(position.x < 0. || position.y < 0. || position.x > 1. || position.y > 1.) return vec4(1., 1., 1., 1.);
return texture2D( gm_BaseTexture, position );
}
void main() {
vec2 tx = 1. / dimension;
gl_FragColor = texture2D( gm_BaseTexture, v_vTexcoord );
if(gl_FragColor.b == 1.) return;
for( float i = 1.; i < ITERATION; i++ ) {
vec4 s = sample( v_vTexcoord + vec2(tx.x * i, 0) );
if(s.a == 0.) break;
if(s.b == 0.) continue;
gl_FragColor.b = 1.;
return;
}
for( float i = 1.; i < ITERATION; i++ ) {
vec4 s = sample( v_vTexcoord - vec2(tx.x * i, 0) );
if(s.a == 0.) break;
if(s.b == 0.) continue;
gl_FragColor.b = 1.;
return;
}
for( float i = 1.; i < ITERATION; i++ ) {
vec4 s = sample( v_vTexcoord + vec2(0, tx.y * i) );
if(s.a == 0.) break;
if(s.b == 0.) continue;
gl_FragColor.b = 1.;
return;
}
for( float i = 1.; i < ITERATION; i++ ) {
vec4 s = sample( v_vTexcoord - vec2(0, tx.y * i) );
if(s.a == 0.) break;
if(s.b == 0.) continue;
gl_FragColor.b = 1.;
return;
}
}

View 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;
}

View file

@ -0,0 +1,10 @@
{
"resourceType": "GMShader",
"resourceVersion": "1.0",
"name": "sh_region_fill_inner",
"parent": {
"name": "region",
"path": "folders/shader/generator/region.yy",
},
"type": 1,
}

View file

@ -0,0 +1,13 @@
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform sampler2D colorMap;
void main() {
vec4 c = texture2D( gm_BaseTexture, v_vTexcoord );
gl_FragColor = c;
if(c.rgb == vec3(0.)) return;
gl_FragColor = texture2D( colorMap, c.xy );
}

View 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;
}

View file

@ -0,0 +1,10 @@
{
"resourceType": "GMShader",
"resourceVersion": "1.0",
"name": "sh_region_fill_map",
"parent": {
"name": "region",
"path": "folders/shader/generator/region.yy",
},
"type": 1,
}