This commit is contained in:
Tanasart 2024-02-04 13:33:42 +07:00
parent c3dc4261c3
commit dacd345afb
23 changed files with 296 additions and 87 deletions

View file

@ -883,6 +883,7 @@
{"name":"node_iterator_length","order":4,"path":"scripts/node_iterator_length/node_iterator_length.yy",},
{"name":"node_VFX_effect_attract","order":2,"path":"scripts/node_VFX_effect_attract/node_VFX_effect_attract.yy",},
{"name":"sh_d3d_ssao_blur","order":1,"path":"shaders/sh_d3d_ssao_blur/sh_d3d_ssao_blur.yy",},
{"name":"function_register","order":2,"path":"scripts/function_register/function_register.yy",},
{"name":"panel_addon","order":5,"path":"scripts/panel_addon/panel_addon.yy",},
{"name":"s_node_text_splice","order":6,"path":"sprites/s_node_text_splice/s_node_text_splice.yy",},
{"name":"__node_3d_transform","order":7,"path":"scripts/__node_3d_transform/__node_3d_transform.yy",},

View file

@ -1160,6 +1160,7 @@
{"id":{"name":"node_VFX_effect_attract","path":"scripts/node_VFX_effect_attract/node_VFX_effect_attract.yy",},},
{"id":{"name":"node_fluid_repulse","path":"scripts/node_fluid_repulse/node_fluid_repulse.yy",},},
{"id":{"name":"sh_d3d_ssao_blur","path":"shaders/sh_d3d_ssao_blur/sh_d3d_ssao_blur.yy",},},
{"id":{"name":"function_register","path":"scripts/function_register/function_register.yy",},},
{"id":{"name":"panel_addon","path":"scripts/panel_addon/panel_addon.yy",},},
{"id":{"name":"s_node_text_splice","path":"sprites/s_node_text_splice/s_node_text_splice.yy",},},
{"id":{"name":"__node_3d_transform","path":"scripts/__node_3d_transform/__node_3d_transform.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

@ -1,4 +1,6 @@
function APPEND(_path, context = PANEL_GRAPH.getCurrentContext()) { #region
CALL("APPEND");
if(_path == "") return noone;
var _map = json_load_struct(_path);
@ -21,7 +23,7 @@ function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext()) { #region
if(struct_has(_map, "version")) {
var _v = _map.version;
PROJECT.version = _v;
if(floor(_v) != floor(SAVE_VERSION)) {
if(PREFERENCES.notify_load_version && floor(_v) != floor(SAVE_VERSION)) {
var warn = $"File version mismatch : loading file version {_v} to Pixel Composer {SAVE_VERSION}";
log_warning("FILE", warn)
}

View file

@ -281,6 +281,8 @@ function mergeAction(act) { #region
} #endregion
function UNDO() { #region
CALL("UNDO");
if(ds_stack_empty(UNDO_STACK)) return;
if(instance_exists(_p_dialog_undo_block)) return;
@ -296,6 +298,8 @@ function UNDO() { #region
} #endregion
function REDO() { #region
CALL("REDO");
if(ds_stack_empty(REDO_STACK)) return;
if(instance_exists(_p_dialog_undo_block)) return;

View file

@ -0,0 +1,68 @@
#region macros
gml_pragma("global", "__fnInit()");
#macro ARG new __fnArgument
#macro CALL _args = []; for(i = 0; i < argument_count; i++) _args[i] = argument[i]; callStatusFunction
function __fnArgument(name, def, fn = false) constructor {
self.name = name;
self.def = def;
self.fn = fn;
}
function __fnInit() {
globalvar FUNCTIONS;
FUNCTIONS = {};
__registerFunction("NEW", NEW, []);
__registerFunction("SAVE_AT", SAVE_AT, [ ARG("project", function() { return PROJECT; }, true), ARG("path", ""), ARG("log", "save at ") ]);
__registerFunction("LOAD_AT", LOAD_AT, [ ARG("path", ""), ARG("readonly", false), ARG("override", false) ]);
__registerFunction("CLOSE", closeProject, [ ARG("project", function() { return PROJECT; }, true) ]);
__registerFunction("APPEND", APPEND, [ ARG("path", ""), ARG("context", function() { return PANEL_GRAPH.getCurrentContext(); }, true) ]);
__registerFunction("UNDO", UNDO, []);
__registerFunction("REDO", REDO, []);
}
#endregion
function __registerFunction(name, fn, args = []) { #region
INLINE
FUNCTIONS[$ name] = { fn, args };
} #endregion
function callStatusFunction(name) { #region
INLINE
var command = $"{name} {string_join_ext(",", _args)}";
array_push(CMD, cmdLine(command, COLORS._main_text_sub));
array_push(CMDIN, command);
} #endregion
function callFunction(name, args) { #region
INLINE
var _f = FUNCTIONS[$ name];
switch(array_length(_f.args)) {
case 0 : _f.fn(); break;
case 1 : _f.fn(args[0]); break;
case 2 : _f.fn(args[0], args[1]); break;
case 3 : _f.fn(args[0], args[1], args[2]); break;
case 4 : _f.fn(args[0], args[1], args[2], args[3]); break;
case 5 : _f.fn(args[0], args[1], args[2], args[3], args[4]); break;
case 6 : _f.fn(args[0], args[1], args[2], args[3], args[4], args[5]); break;
case 7 : _f.fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); break;
case 8 : _f.fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]); break;
case 9 : _f.fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]); break;
case 10 : _f.fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]); break;
case 11 : _f.fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10]); break;
case 12 : _f.fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11]); break;
case 13 : _f.fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12]); break;
case 14 : _f.fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13]); break;
case 15 : _f.fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13], args[14]); break;
case 16 : _f.fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13], args[14], args[15]); break;
}
return true;
} #endregion

View file

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

View file

@ -15,8 +15,11 @@
#region main
globalvar OS, DEBUG, THEME, COLOR_KEYS;
OS = os_type;
//OS = os_macosx;
globalvar CMD, CMDIN;
OS = os_type;
CMD = [];
CMDIN = [];
DEBUG = false;
THEME = new Theme();
@ -25,10 +28,10 @@
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER, LATEST_VERSION;
LATEST_VERSION = 11600;
VERSION = 11642;
SAVE_VERSION = 11642;
VERSION_STRING = "1.16.4.2";
BUILD_NUMBER = 11640;
VERSION = 11650;
SAVE_VERSION = 11650;
VERSION_STRING = "1.16.5.0";
BUILD_NUMBER = 11650;
globalvar APPEND_MAP;
APPEND_MAP = ds_map_create();
@ -129,13 +132,13 @@
#macro PANEL_PAD THEME_VALUE.panel_padding
function print(str) {
//show_debug_message(string(str));
INLINE
noti_status(string(str));
}
function printIf(cond, log) {
if(!cond) return;
show_debug_message(log);
INLINE
if(cond) print(log);
}
#endregion

View file

@ -18,7 +18,7 @@ function TEST_PATH(path) { #region
PROJECT = new Project();
PANEL_GRAPH.setProject(PROJECT);
__LOAD_PATH(path);
LOAD_AT(path);
} #endregion
function LOAD_PATH(path, readonly = false, safe_mode = false) { #region
@ -40,7 +40,7 @@ function LOAD_PATH(path, readonly = false, safe_mode = false) { #region
array_push(PROJECTS, PROJECT);
}
var res = __LOAD_PATH(path, readonly);
var res = LOAD_AT(path, readonly);
if(!res) return false;
PROJECT.safeMode = safe_mode;
@ -49,7 +49,9 @@ function LOAD_PATH(path, readonly = false, safe_mode = false) { #region
return PROJECT;
} #endregion
function __LOAD_PATH(path, readonly = false, override = false) { #region
function LOAD_AT(path, readonly = false, override = false) { #region
CALL("LOAD_AT");
//print($"========== Loading {path} =========="); var t = get_timer();
if(DEMO) return false;
@ -90,7 +92,7 @@ function __LOAD_PATH(path, readonly = false, override = false) { #region
if(struct_has(_load_content, "version")) {
var _v = _load_content.version;
PROJECT.version = _v;
if(floor(_v) != floor(SAVE_VERSION)) {
if(PREFERENCES.notify_load_version && floor(_v) != floor(SAVE_VERSION)) {
var warn = $"File version mismatch : loading file version {_v} to Pixel Composer {SAVE_VERSION}";
log_warning("LOAD", warn);
}

View file

@ -9,7 +9,7 @@ function Node_Noise_Bubble(_x, _y, _group = noone) : Node_Shader_Generator(_x, _
inputs[| 2] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(4));
addShaderProp(SHADER_UNIFORM.float, "seed");
inputs[| 3] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0.9, 0.95 ] )
inputs[| 3] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0.5, 0.8 ] )
.setDisplay(VALUE_DISPLAY.slider_range);
addShaderProp(SHADER_UNIFORM.float, "scale");
@ -25,9 +25,13 @@ function Node_Noise_Bubble(_x, _y, _group = noone) : Node_Shader_Generator(_x, _
.setDisplay(VALUE_DISPLAY.slider_range);
addShaderProp(SHADER_UNIFORM.float, "alpha");
inputs[| 7] = nodeValue("Blending", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 )
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Max", "Add" ] );
addShaderProp(SHADER_UNIFORM.integer, "render");
input_display_list = [ 2,
["Output", true], 0,
["Noise", false], 1, 3,
["Render", false], 5, 4, 6,
["Render", false], 5, 4, 6, 7,
];
}

View file

@ -472,7 +472,7 @@ function __initNodes() {
ds_list_add(transform, "Warps");
addNodeObject(transform, "Crop", s_node_crop, "Node_Crop", [1, Node_Crop],, "Crop out image to create smaller ones.");
addNodeObject(transform, "Crop Content", s_node_crop_content, "Node_Crop_Content", [1, Node_Crop_Content],, "Crop out empty pixel pixel from the image.");
addNodeObject(transform, "Bend", s_node_bend, "Node_Bend", [1, Node_Bend], ["wrap"], "Warp image by freely moving the corners.");
addNodeObject(transform, "Bend", s_node_bend, "Node_Bend", [1, Node_Bend], ["wrap"]).setVersion(11650);
addNodeObject(transform, "Warp", s_node_warp, "Node_Warp", [1, Node_Warp], ["warp corner"], "Warp image by freely moving the corners.");
addNodeObject(transform, "Skew", s_node_skew, "Node_Skew", [1, Node_Skew], ["shear"], "Skew image horizontally, or vertically.");
addNodeObject(transform, "Mesh Warp", s_node_warp_mesh, "Node_Mesh_Warp", [1, Node_Mesh_Warp], ["mesh wrap"], "Wrap image by converting it to mesh, and using control points.");

View file

@ -2,8 +2,8 @@
globalvar STATUSES, WARNING, ERRORS;
STATUSES = ds_list_create();
WARNING = ds_list_create();
ERRORS = ds_list_create();
WARNING = ds_list_create();
ERRORS = ds_list_create();
#endregion
#region classes
@ -14,29 +14,32 @@
}
function notification(type, str, icon = noone, color = c_ui_blue_dkgrey, life = -1) constructor {
self.type = type;
self.txt = str;
self.icon = icon;
self.color = color;
self.type = type;
self.txt = str;
self.txtclr = COLORS._main_text_sub;
self.icon = icon;
self.color = color;
self.life_max = life;
self.life = life;
self.onClick = noone;
self.tooltip = "";
self.onClick = noone;
self.tooltip = "";
self.icon_end = noone;
self.amount = 1;
self.time = string_lead_zero(current_hour, 2) + ":" + string_lead_zero(current_minute, 2) + "." + string_lead_zero(current_second, 2);
self.time = $"{string_lead_zero(current_hour, 2)}:{string_lead_zero(current_minute, 2)}.{string_lead_zero(current_second, 2)}";
static setOnClick = function(onClick, tooltip = "", icon_end = noone) {
self.onClick = method(self, onClick);
self.tooltip = tooltip;
self.onClick = method(self, onClick);
self.tooltip = tooltip;
self.icon_end = icon_end;
return self;
}
array_push(CMD, self);
}
function noti_status(str, icon = noone, flash = false, ref = noone) {
@ -87,6 +90,8 @@
show_debug_message("WARNING: " + str);
var noti = new notification(NOTI_TYPE.warning, str, icon, c_ui_orange, PREFERENCES.notification_time);
noti.txtclr = c_ui_orange;
ds_list_add(STATUSES, noti);
ds_list_add(WARNING, noti);
@ -107,6 +112,8 @@
if(PANEL_MAIN == 0) print(str);
var noti = new notification(NOTI_TYPE.error, str, icon, c_ui_red);
noti.txtclr = c_ui_red;
ds_list_add(STATUSES, noti);
ds_list_add(ERRORS, noti);

View file

@ -1,73 +1,169 @@
#region
#macro cmdLine new __cmdLine
#macro cmdLineIn new __cmdLineIn
function __cmdLine(txt, color) constructor {
self.txt = txt;
self.color = color;
}
function __cmdLineIn(txt, color = COLORS._main_text) : __cmdLine(txt, color) constructor {}
#endregion
function Panel_Console() : PanelContent() constructor {
title = __txtx("panel_debug_console", "Debug Console");
w = ui(640);
h = ui(320);
command = "";
history = [];
cmd_history = [];
title = __txtx("panel_debug_console", "Console");
w = ui(640);
h = ui(320);
auto_pin = true;
command = "";
cmd_index = 0;
keyboard_string = "";
scroll_y = 0;
prevFocus = false;
static submit_command = function() {
static submit_command = function() { #region
if(command == "") return;
array_push(history, { txt: command, color: COLORS._main_text_sub });
array_push(cmd_history, command);
array_push(CMD, cmdLineIn(command));
array_push(CMDIN, command);
var cmd = string_splice(command, " ");
var cmd = string_splice(command, " ", false, false);
switch(cmd[0]) {
case "flag":
if(array_length(cmd) < 2) break;
var flg = array_safe_get(cmd, 1, "");
if(array_length(cmd) < 2) {
array_push(CMD, cmdLine($"Error: \"{cmd[0]}\" not enough argument.", COLORS._main_value_negative) );
break;
}
var flg = cmd[1];
global.FLAG[$ flg] = !global.FLAG[$ flg];
array_push(history, { txt: $"Toggled debug flag: {flg} = {global.FLAG[$ flg]? "True" : "False"}", color: COLORS._main_value_positive });
array_push(CMD, cmdLine($"Toggled debug flag: {flg} = {global.FLAG[$ flg]? "True" : "False"}", COLORS._main_value_positive) );
break;
default:
if(struct_has(FUNCTIONS, cmd[0])) {
var _f = FUNCTIONS[$ cmd[0]];
var _vars = string_splice(array_safe_get(cmd, 1, ""), ",");
var _args = [];
for( var i = 0, n = array_length(_f.args); i < n; i++ ) {
var _arg = _f.args[i];
var _def = _arg.fn? _arg.def() : _arg.def;
if(i < array_length(_vars) && _vars[i] != "") {
if(is_real(_def)) _args[i] = toNumber(_vars[i]);
else _args[i] = _vars[i];
} else
_args[i] = _def;
}
callFunction(cmd[0], _args);
} else
array_push(CMD, cmdLine($"Error: \"{cmd[0]}\" command not found.", COLORS._main_value_negative) );
break;
}
keyboard_string = "";
command = "";
}
keyboard_string = "";
} #endregion
function drawContent(panel) {
HOTKEY_BLOCK = true;
command = keyboard_string;
function drawHistory(_y) { #region
var _x = ui(32 + 8);
var _w = w - ui(16 + 32);
draw_clear_alpha(CDEF.main_dkblack, 1);
draw_set_text(f_code, fa_left, fa_bottom, COLORS._main_text_sub);
draw_set_color(c_black);
draw_set_alpha(0.75);
for( var i = array_length(CMD) - 1 - scroll_y; i >= 0; i-- ) {
var his = CMD[i];
if(is_instanceof(his, __cmdLine)) {
var txt = his.txt;
draw_set_color(his.color);
if(is_instanceof(his, __cmdLineIn)) {
draw_sprite_ext(THEME.icon_cmd_enter, 0, _x + ui(8), _y - line_get_height() / 2, 1, 1, 0, his.color, 1);
draw_text_line(_x + ui(20), _y, txt, -1, _w);
} else
draw_text_line(_x, _y, txt, -1, _w);
_y -= string_height_ext(txt, -1, _w);
} else if(is_instanceof(his, notification)) {
var txt = his.txt;
draw_set_color(his.txtclr);
draw_text_line(_x, _y, txt, -1, _w);
_y -= string_height_ext(txt, -1, _w);
} else {
draw_set_color(COLORS._main_text_sub);
draw_text_line(_x, _y, his, -1, _w);
_y -= string_height_ext(his, -1, _w);
}
draw_set_color(CDEF.main_dkgrey);
draw_set_halign(fa_right);
draw_text(_x - ui(12), _y + line_get_height(), i);
draw_set_halign(fa_left);
_y -= ui(2);
if(_y <= 0) break;
}
if(pHOVER) {
if(mouse_wheel_up()) scroll_y = clamp(scroll_y + 1, 0, array_length(CMD) - 1);
if(mouse_wheel_down()) scroll_y = clamp(scroll_y - 1, 0, array_length(CMD) - 1);
}
} #endregion
function drawContent(panel) { #region
if(pFOCUS) {
if(prevFocus == false)
keyboard_string = command;
HOTKEY_BLOCK = true;
command = keyboard_string;
}
prevFocus = pFOCUS;
draw_clear(merge_color(c_black, CDEF.main_dkblack, 0.75));
draw_set_color(merge_color(c_black, CDEF.main_dkblack, 0.60));
draw_rectangle(0, 0, ui(32), h, false);
draw_set_color(merge_color(c_black, CDEF.main_dkblack, 0.25));
draw_rectangle(0, h - ui(28), w, h, false);
draw_set_alpha(1);
draw_set_text(f_code, fa_left, fa_bottom, COLORS._main_text);
draw_text(ui(8), h - ui(4), command);
draw_set_color(COLORS._main_text_sub);
draw_text(ui(8) + string_width(command), h - ui(4), "_");
var hy = h - ui(32);
for( var i = 0, n = array_length(history); i < n; i++ ) {
var his = history[array_length(history) - i - 1];
var txt = his.txt;
drawHistory(hy);
draw_set_color(his.color);
draw_text_line(ui(8), hy, txt, -1, w - ui(16));
hy -= string_height_ext(txt, -1, w - ui(16));
if(hy <= 0) break;
}
if(keyboard_check_pressed(vk_enter))
submit_command();
draw_set_text(f_code, fa_right, fa_bottom, CDEF.main_dkgrey);
draw_text(ui(32 - 4), h - ui(4), ">");
if(keyboard_check_pressed(vk_up)) {
cmd_index = max(0, cmd_index - 1);
keyboard_string = array_safe_get(cmd_history, cmd_index, "");
command = keyboard_string;
} else if(keyboard_check_pressed(vk_anykey))
cmd_index = array_length(cmd_history);
}
draw_set_text(f_code, fa_left, fa_bottom, COLORS._main_text);
draw_text(ui(32 + 8), h - ui(4), command);
draw_set_color(COLORS._main_text_sub);
draw_text(ui(32 + 8) + string_width(command), h - ui(4), "_");
if(pFOCUS) {
if(keyboard_check_pressed(vk_enter)) {
submit_command();
} else if(keyboard_check_pressed(vk_up)) {
cmd_index = max(0, cmd_index - 1);
var his = array_safe_get(CMDIN, cmd_index, "");
command = is_instanceof(his, __cmdLine)? his.txt : his;
keyboard_string = command;
} else if(keyboard_check_pressed(vk_escape)) {
command = "";
keyboard_string = "";
} else if(keyboard_check_pressed(vk_anykey)) {
cmd_index = array_length(CMDIN);
}
}
} #endregion
}

View file

@ -224,7 +224,7 @@ function Panel_Menu() : PanelContent() constructor {
if(TESTING) { #region
array_push(menus, [ __txt("Dev"), [
menuItem(__txtx("panel_debug_console", "Debug console"), function() {
menuItem(__txtx("panel_debug_console", "Console"), function() {
panelAdd("Panel_Console", true)
}),
menuItem(__txtx("panel_debug_overlay", "Debug overlay"), function() {

View file

@ -17,7 +17,9 @@
PREFERENCES.show_splash = true;
PREFERENCES.splash_expand_recent = false;
PREFERENCES.notification_time = 180;
PREFERENCES.notify_load_version = true;
PREFERENCES.display_scaling = 1;
PREFERENCES.window_width = 1600;

View file

@ -97,6 +97,8 @@
gc_collect();
} #endregion
static toString = function() { return $"ProjectObject [{path}]"; }
}
function __initProject() {

View file

@ -1,4 +1,6 @@
function closeProject(project) {
CALL("CLOSE");
project.active = false;
array_remove(PROJECTS, project);
if(array_length(PROJECTS) == 0) {
@ -10,7 +12,7 @@ function closeProject(project) {
for( var i = array_length(panels) - 1; i >= 0; i-- ) {
var panel = panels[i];
//print($" Check {panel.project.path}");
if(panel.project != project)
continue;

View file

@ -2,6 +2,8 @@ globalvar SAVING;
SAVING = false;
function NEW() { #region
CALL("NEW");
PROJECT = new Project();
array_push(PROJECTS, PROJECT);
@ -11,7 +13,7 @@ function NEW() { #region
} #endregion
function save_serialize(project = PROJECT, _outMap = false) { #region
var _map = {};
var _map = {};
_map.version = SAVE_VERSION;
var _node_list = [];
@ -84,6 +86,7 @@ function SAVE_ALL() { #region
function SAVE(project = PROJECT) { #region
if(DEMO) return false;
print("SAVE");
if(project.path == "" || project.readonly)
return SAVE_AS(project);
return SAVE_AT(project, project.path);
@ -108,6 +111,8 @@ function SAVE_AS(project = PROJECT) { #region
} #endregion
function SAVE_AT(project = PROJECT, path = "", log = "save at ") { #region
CALL("SAVE_AT");
if(DEMO) return false;
SAVING = true;

View file

@ -9,6 +9,7 @@ uniform float seed;
uniform vec2 scale;
uniform vec2 alpha;
uniform int mode;
uniform int render;
uniform float thickness;
@ -34,15 +35,13 @@ void main() {
float _a = mix(alpha.x, alpha.y, random(vec2(float(i), 2.)));
float dst = 1. - distance(pos, vec2(_x, _y));
float st;
if(mode == 0) {
float st = smoothstep(1. - max(_t, thickness), 1., 1. - abs(dst - (1. - _s))) * _a;
w = max(w, st);
} else if(mode == 1) {
float st = smoothstep(1. - max(_t, thickness), 1., 1. - max(0., dst - (1. - _s))) * _a;
w = max(w, st);
}
if(mode == 0) st = smoothstep(1. - max(_t, thickness), 1., 1. - abs(dst - (1. - _s))) * _a;
else if(mode == 1) st = smoothstep(1. - _s - thickness, 1. - _s + thickness, max(0., dst)) * _a;
if(render == 0) w = max(w, st);
else if(render == 1) w += st;
}
gl_FragColor = vec4(vec3(w), 1.);