mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-01-26 21:08:18 +01:00
posterize algo
This commit is contained in:
parent
734c96890c
commit
03e6d45eb3
36 changed files with 848 additions and 207 deletions
|
@ -135,8 +135,8 @@
|
|||
{"name":"channels","order":41,"path":"folders/shader/filter/channels.yy",},
|
||||
{"name":"color","order":42,"path":"folders/shader/filter/color.yy",},
|
||||
{"name":"corner","order":43,"path":"folders/shader/filter/corner.yy",},
|
||||
{"name":"edge_shade","order":44,"path":"folders/shader/filter/edge_shade.yy",},
|
||||
{"name":"dither","order":53,"path":"folders/shader/filter/dither.yy",},
|
||||
{"name":"edge_shade","order":44,"path":"folders/shader/filter/edge_shade.yy",},
|
||||
{"name":"morph","order":45,"path":"folders/shader/filter/morph.yy",},
|
||||
{"name":"shadow_caster","order":46,"path":"folders/shader/filter/shadow_caster.yy",},
|
||||
{"name":"shape_seperator","order":47,"path":"folders/shader/filter/shape_seperator.yy",},
|
||||
|
@ -842,6 +842,7 @@
|
|||
{"name":"node_noise_tri","order":6,"path":"scripts/node_noise_tri/node_noise_tri.yy",},
|
||||
{"name":"node_normal_light","order":2,"path":"scripts/node_normal_light/node_normal_light.yy",},
|
||||
{"name":"node_normal","order":1,"path":"scripts/node_normal/node_normal.yy",},
|
||||
{"name":"node_normalize","order":17,"path":"scripts/node_normalize/node_normalize.yy",},
|
||||
{"name":"node_note","order":17,"path":"scripts/node_note/node_note.yy",},
|
||||
{"name":"node_offset","order":17,"path":"scripts/node_offset/node_offset.yy",},
|
||||
{"name":"node_onion_skin","order":12,"path":"scripts/node_onion_skin/node_onion_skin.yy",},
|
||||
|
@ -1350,6 +1351,8 @@
|
|||
{"name":"sh_freeform_fill_pass2","order":1,"path":"shaders/sh_freeform_fill_pass2/sh_freeform_fill_pass2.yy",},
|
||||
{"name":"sh_FXAA","order":29,"path":"shaders/sh_FXAA/sh_FXAA.yy",},
|
||||
{"name":"sh_gamma_map","order":38,"path":"shaders/sh_gamma_map/sh_gamma_map.yy",},
|
||||
{"name":"sh_get_max_downsampled","order":8,"path":"shaders/sh_get_max_downsampled/sh_get_max_downsampled.yy",},
|
||||
{"name":"sh_get_min_downsampled","order":9,"path":"shaders/sh_get_min_downsampled/sh_get_min_downsampled.yy",},
|
||||
{"name":"sh_glow","order":18,"path":"shaders/sh_glow/sh_glow.yy",},
|
||||
{"name":"sh_gradient_display_alpha","order":12,"path":"shaders/sh_gradient_display_alpha/sh_gradient_display_alpha.yy",},
|
||||
{"name":"sh_gradient_display","order":7,"path":"shaders/sh_gradient_display/sh_gradient_display.yy",},
|
||||
|
@ -1403,6 +1406,7 @@
|
|||
{"name":"sh_noise_wavelet","order":11,"path":"shaders/sh_noise_wavelet/sh_noise_wavelet.yy",},
|
||||
{"name":"sh_noise","order":1,"path":"shaders/sh_noise/sh_noise.yy",},
|
||||
{"name":"sh_normal_light","order":1,"path":"shaders/sh_normal_light/sh_normal_light.yy",},
|
||||
{"name":"sh_normalize","order":23,"path":"shaders/sh_normalize/sh_normalize.yy",},
|
||||
{"name":"sh_offset","order":12,"path":"shaders/sh_offset/sh_offset.yy",},
|
||||
{"name":"sh_outline_only","order":19,"path":"shaders/sh_outline_only/sh_outline_only.yy",},
|
||||
{"name":"sh_outline","order":9,"path":"shaders/sh_outline/sh_outline.yy",},
|
||||
|
@ -1771,6 +1775,7 @@
|
|||
{"name":"s_node_noise","order":8,"path":"sprites/s_node_noise/s_node_noise.yy",},
|
||||
{"name":"s_node_normal_light","order":37,"path":"sprites/s_node_normal_light/s_node_normal_light.yy",},
|
||||
{"name":"s_node_normal","order":36,"path":"sprites/s_node_normal/s_node_normal.yy",},
|
||||
{"name":"s_node_normalize","order":62,"path":"sprites/s_node_normalize/s_node_normalize.yy",},
|
||||
{"name":"s_node_note","order":35,"path":"sprites/s_node_note/s_node_note.yy",},
|
||||
{"name":"s_node_number","order":7,"path":"sprites/s_node_number/s_node_number.yy",},
|
||||
{"name":"s_node_offset","order":19,"path":"sprites/s_node_offset/s_node_offset.yy",},
|
||||
|
|
|
@ -264,8 +264,8 @@
|
|||
{"$GMFolder":"","%Name":"channels","folderPath":"folders/shader/filter/channels.yy","name":"channels","resourceType":"GMFolder","resourceVersion":"2.0",},
|
||||
{"$GMFolder":"","%Name":"color","folderPath":"folders/shader/filter/color.yy","name":"color","resourceType":"GMFolder","resourceVersion":"2.0",},
|
||||
{"$GMFolder":"","%Name":"corner","folderPath":"folders/shader/filter/corner.yy","name":"corner","resourceType":"GMFolder","resourceVersion":"2.0",},
|
||||
{"$GMFolder":"","%Name":"edge_shade","folderPath":"folders/shader/filter/edge_shade.yy","name":"edge_shade","resourceType":"GMFolder","resourceVersion":"2.0",},
|
||||
{"$GMFolder":"","%Name":"dither","folderPath":"folders/shader/filter/dither.yy","name":"dither","resourceType":"GMFolder","resourceVersion":"2.0",},
|
||||
{"$GMFolder":"","%Name":"edge_shade","folderPath":"folders/shader/filter/edge_shade.yy","name":"edge_shade","resourceType":"GMFolder","resourceVersion":"2.0",},
|
||||
{"$GMFolder":"","%Name":"morph","folderPath":"folders/shader/filter/morph.yy","name":"morph","resourceType":"GMFolder","resourceVersion":"2.0",},
|
||||
{"$GMFolder":"","%Name":"shadow_caster","folderPath":"folders/shader/filter/shadow_caster.yy","name":"shadow_caster","resourceType":"GMFolder","resourceVersion":"2.0",},
|
||||
{"$GMFolder":"","%Name":"shape_seperator","folderPath":"folders/shader/filter/shape_seperator.yy","name":"shape_seperator","resourceType":"GMFolder","resourceVersion":"2.0",},
|
||||
|
@ -1275,6 +1275,7 @@
|
|||
{"id":{"name":"node_noise","path":"scripts/node_noise/node_noise.yy",},},
|
||||
{"id":{"name":"node_normal_light","path":"scripts/node_normal_light/node_normal_light.yy",},},
|
||||
{"id":{"name":"node_normal","path":"scripts/node_normal/node_normal.yy",},},
|
||||
{"id":{"name":"node_normalize","path":"scripts/node_normalize/node_normalize.yy",},},
|
||||
{"id":{"name":"node_note","path":"scripts/node_note/node_note.yy",},},
|
||||
{"id":{"name":"node_number","path":"scripts/node_number/node_number.yy",},},
|
||||
{"id":{"name":"node_offset","path":"scripts/node_offset/node_offset.yy",},},
|
||||
|
@ -1865,6 +1866,8 @@
|
|||
{"id":{"name":"sh_freeform_fill_pass2","path":"shaders/sh_freeform_fill_pass2/sh_freeform_fill_pass2.yy",},},
|
||||
{"id":{"name":"sh_FXAA","path":"shaders/sh_FXAA/sh_FXAA.yy",},},
|
||||
{"id":{"name":"sh_gamma_map","path":"shaders/sh_gamma_map/sh_gamma_map.yy",},},
|
||||
{"id":{"name":"sh_get_max_downsampled","path":"shaders/sh_get_max_downsampled/sh_get_max_downsampled.yy",},},
|
||||
{"id":{"name":"sh_get_min_downsampled","path":"shaders/sh_get_min_downsampled/sh_get_min_downsampled.yy",},},
|
||||
{"id":{"name":"sh_glow","path":"shaders/sh_glow/sh_glow.yy",},},
|
||||
{"id":{"name":"sh_gradient_display_alpha","path":"shaders/sh_gradient_display_alpha/sh_gradient_display_alpha.yy",},},
|
||||
{"id":{"name":"sh_gradient_display","path":"shaders/sh_gradient_display/sh_gradient_display.yy",},},
|
||||
|
@ -1928,6 +1931,7 @@
|
|||
{"id":{"name":"sh_noise","path":"shaders/sh_noise/sh_noise.yy",},},
|
||||
{"id":{"name":"sh_normal_light","path":"shaders/sh_normal_light/sh_normal_light.yy",},},
|
||||
{"id":{"name":"sh_normal","path":"shaders/sh_normal/sh_normal.yy",},},
|
||||
{"id":{"name":"sh_normalize","path":"shaders/sh_normalize/sh_normalize.yy",},},
|
||||
{"id":{"name":"sh_offset","path":"shaders/sh_offset/sh_offset.yy",},},
|
||||
{"id":{"name":"sh_outline_only","path":"shaders/sh_outline_only/sh_outline_only.yy",},},
|
||||
{"id":{"name":"sh_outline","path":"shaders/sh_outline/sh_outline.yy",},},
|
||||
|
@ -2337,6 +2341,7 @@
|
|||
{"id":{"name":"s_node_noise","path":"sprites/s_node_noise/s_node_noise.yy",},},
|
||||
{"id":{"name":"s_node_normal_light","path":"sprites/s_node_normal_light/s_node_normal_light.yy",},},
|
||||
{"id":{"name":"s_node_normal","path":"sprites/s_node_normal/s_node_normal.yy",},},
|
||||
{"id":{"name":"s_node_normalize","path":"sprites/s_node_normalize/s_node_normalize.yy",},},
|
||||
{"id":{"name":"s_node_note","path":"sprites/s_node_note/s_node_note.yy",},},
|
||||
{"id":{"name":"s_node_number","path":"sprites/s_node_number/s_node_number.yy",},},
|
||||
{"id":{"name":"s_node_offset","path":"sprites/s_node_offset/s_node_offset.yy",},},
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/// @description init
|
||||
#region log
|
||||
var path = "log_temp.txt";
|
||||
var f = file_text_open_append(path);
|
||||
file_text_write_string(f, $"[MESSAGE] {_log_template()}session begin\n");
|
||||
file_text_close(f);
|
||||
var file = file_text_open_append(path);
|
||||
file_text_write_string(file, $"[MESSAGE] {_log_template()}session begin\n");
|
||||
file_text_close(file);
|
||||
|
||||
gpu_set_tex_mip_enable(mip_off);
|
||||
gc_enable(true);
|
||||
|
@ -82,6 +82,7 @@
|
|||
globalvar HOTKEY_MOD, HOTKEY_BLOCK;
|
||||
HOTKEY_MOD = 0;
|
||||
HOTKEY_BLOCK = false;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Loader
|
||||
|
|
|
@ -118,15 +118,17 @@ function buttonColor(_onApply, dialog = noone) : widget() constructor {
|
|||
if(mouse_press(mb_left)) deactivate();
|
||||
}
|
||||
|
||||
var _bx = _x + ui(4);
|
||||
var _by = _y + ui(4);
|
||||
var _bw = _cw - ui(8);
|
||||
var _bh = _h - ui(8);
|
||||
var _bx = _x + ui(2);
|
||||
var _by = _y + ui(2);
|
||||
var _bw = _cw - ui(4);
|
||||
var _bh = _h - ui(4);
|
||||
|
||||
if(is_array(current_color))
|
||||
drawPalette(current_color, _bx, _by, _bw, _bh);
|
||||
|
||||
else if(is_real(current_color))
|
||||
draw_sprite_stretched_ext(THEME.palette_mask, 1, _bx, _by, _bw, _bh, current_color, 1);
|
||||
|
||||
else if(is_int64(current_color)) {
|
||||
var _a = _color_get_alpha(current_color);
|
||||
|
||||
|
|
|
@ -36,8 +36,8 @@ function buttonGradient(_onApply, dialog = noone) : widget() constructor {
|
|||
_w -= _bs + ui(8);
|
||||
}
|
||||
|
||||
var _gw = _w - ui(8);
|
||||
var _gh = _h - ui(8);
|
||||
var _gw = _w - ui(4);
|
||||
var _gh = _h - ui(4);
|
||||
|
||||
current_gradient = _gradient;
|
||||
|
||||
|
@ -74,8 +74,8 @@ function buttonGradient(_onApply, dialog = noone) : widget() constructor {
|
|||
|
||||
for( var i = 0, n = array_length(_gradient); i < n; i++ ) {
|
||||
var _grad = _gradient[i];
|
||||
var _gx = _x + ui(4);
|
||||
var _gy = _y + ui(4) + i * _gh;
|
||||
var _gx = _x + ui(2);
|
||||
var _gy = _y + ui(2) + i * _gh;
|
||||
|
||||
if(is_instanceof(_grad, gradientObject))
|
||||
_grad.draw(_gx, _gy, _gw, _gh);
|
||||
|
|
|
@ -37,8 +37,8 @@ function buttonPalette(_onApply, dialog = noone) : widget() constructor {
|
|||
_w -= _bs + ui(8);
|
||||
}
|
||||
|
||||
var _pw = _w - ui(8);
|
||||
var _ph = _h - ui(8);
|
||||
var _pw = _w - ui(4);
|
||||
var _ph = _h - ui(4);
|
||||
|
||||
current_palette = _color;
|
||||
|
||||
|
@ -73,8 +73,8 @@ function buttonPalette(_onApply, dialog = noone) : widget() constructor {
|
|||
|
||||
for( var i = 0, n = array_length(_color); i < n; i++ ) {
|
||||
var _pal = _color[i];
|
||||
var _px = _x + ui(4);
|
||||
var _py = _y + ui(4) + i * _ph;
|
||||
var _px = _x + ui(2);
|
||||
var _py = _y + ui(2) + i * _ph;
|
||||
|
||||
if(is_array(_pal)) drawPalette(_pal, _px, _py, _pw, _ph);
|
||||
}
|
||||
|
|
|
@ -5,25 +5,19 @@ function Node_Atlas_Set(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
inputs[| 0] = nodeValue("Atlas", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone)
|
||||
.setVisible(true, true);
|
||||
|
||||
inputs[| 1] = nodeValue("Surface", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, [])
|
||||
.setArrayDepth(1);
|
||||
inputs[| 1] = nodeValue("Surface", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
|
||||
|
||||
inputs[| 2] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ])
|
||||
.setDisplay(VALUE_DISPLAY.vector)
|
||||
.setArrayDepth(1);
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
|
||||
inputs[| 3] = nodeValue("Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [])
|
||||
.setArrayDepth(1);
|
||||
inputs[| 3] = nodeValue("Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0);
|
||||
|
||||
inputs[| 4] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ])
|
||||
.setDisplay(VALUE_DISPLAY.vector)
|
||||
.setArrayDepth(1);
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
|
||||
inputs[| 5] = nodeValue("Blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [])
|
||||
.setArrayDepth(1);
|
||||
inputs[| 5] = nodeValue("Blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white);
|
||||
|
||||
inputs[| 6] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [])
|
||||
.setArrayDepth(1);
|
||||
inputs[| 6] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1);
|
||||
|
||||
inputs[| 7] = nodeValue("Recalculate Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
|
||||
|
||||
|
@ -41,66 +35,88 @@ function Node_Atlas_Set(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
if(!is_array(atl)) atl = [ atl ];
|
||||
if(array_empty(atl)) return;
|
||||
|
||||
var surf = getInputData(1);
|
||||
var posi = getInputData(2);
|
||||
var rota = getInputData(3);
|
||||
var scal = getInputData(4);
|
||||
var blns = getInputData(5);
|
||||
var alph = getInputData(6);
|
||||
var _rot = getInputData(7);
|
||||
|
||||
var use = array_create(7);
|
||||
for( var i = 1; i < 7; i++ ) use[i] = inputs[| i].value_from != noone;
|
||||
var use = array_create(6);
|
||||
var len = array_create(6);
|
||||
var val = array_create(6);
|
||||
|
||||
var n = array_length(atl);
|
||||
var natl = array_create(n);
|
||||
for( var i = 0; i < 7; i++ ) {
|
||||
val[i] = getInputData(i);
|
||||
len[i] = is_array(val[i])? array_length(val[i]) : 0;
|
||||
use[i] = inputs[| i].value_from != noone;
|
||||
}
|
||||
|
||||
var n = array_length(atl);
|
||||
var natl = [];
|
||||
var _ind = 0;
|
||||
var _at, _newAtl, _surf, _val;
|
||||
|
||||
for( var i = 0; i < n; i++ ) {
|
||||
var _at = atl[i];
|
||||
_at = atl[i];
|
||||
if(!is_instanceof(_at, SurfaceAtlas)) continue;
|
||||
|
||||
natl[i] = _at.clone();
|
||||
_newAtl = _at.clone();
|
||||
_surf = _at.surface.get();
|
||||
|
||||
var _surf = _at.surface.get();
|
||||
|
||||
if(use[1]) natl[i].setSurface(array_safe_get_fast(surf, i));
|
||||
|
||||
if(use[2]) {
|
||||
var pos = array_safe_get_fast(posi, i);
|
||||
natl[i].x = array_safe_get_fast(pos, 0);
|
||||
natl[i].y = array_safe_get_fast(pos, 1);
|
||||
if(use[1] && (len[1] == 0 || i < len[1])) {
|
||||
_val = len[1] == 0? val[1] : val[1][i];
|
||||
|
||||
_newAtl.setSurface(_val);
|
||||
}
|
||||
|
||||
if(use[3]) {
|
||||
var _or = natl[i].rotation;
|
||||
var _nr = array_safe_get_fast(rota, i);
|
||||
if(use[2] && (len[2] == 0 || i < len[2])) {
|
||||
_val = len[2] == 0? val[2] : val[2][i];
|
||||
|
||||
natl[i].rotation = _nr;
|
||||
_newAtl.x = array_safe_get_fast(_val, 0);
|
||||
_newAtl.y = array_safe_get_fast(_val, 1);
|
||||
}
|
||||
|
||||
if(use[3] && (len[3] == 0 || i < len[3])) {
|
||||
_val = len[3] == 0? val[3] : val[3][i];
|
||||
|
||||
var _or = _newAtl.rotation;
|
||||
var _nr = _val;
|
||||
|
||||
_newAtl.rotation = _nr;
|
||||
|
||||
if(_rot) {
|
||||
var _sw = surface_get_width_safe(_surf) * natl[i].sx;
|
||||
var _sh = surface_get_height_safe(_surf) * natl[i].sy;
|
||||
var _sw = surface_get_width_safe(_surf) * _newAtl.sx;
|
||||
var _sh = surface_get_height_safe(_surf) * _newAtl.sy;
|
||||
|
||||
var p0 = point_rotate(0, 0, _sw / 2, _sh / 2, -_or);
|
||||
var p1 = point_rotate(0, 0, _sw / 2, _sh / 2, _nr);
|
||||
|
||||
natl[i].x = natl[i].x - p0[1] + p1[0];
|
||||
natl[i].y = natl[i].y - p0[0] + p1[1];
|
||||
_newAtl.x = _newAtl.x - p0[1] + p1[0];
|
||||
_newAtl.y = _newAtl.y - p0[0] + p1[1];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(use[4]) {
|
||||
var sca = array_safe_get_fast(scal, i);
|
||||
natl[i].sx = array_safe_get_fast(sca, 0, 1);
|
||||
natl[i].sy = array_safe_get_fast(sca, 1, 1);
|
||||
if(use[4] && (len[4] == 0 || i < len[4])) {
|
||||
_val = len[4] == 0? val[4] : val[4][i];
|
||||
|
||||
_newAtl.sx = array_safe_get_fast(_val, 0, 1);
|
||||
_newAtl.sy = array_safe_get_fast(_val, 1, 1);
|
||||
}
|
||||
|
||||
if(use[5]) natl[i].blend = array_safe_get_fast(blns, i);
|
||||
if(use[5] && (len[5] == 0 || i < len[5])) {
|
||||
_val = len[5] == 0? val[5] : val[5][i];
|
||||
|
||||
_newAtl.blend = _val;
|
||||
}
|
||||
|
||||
if(use[6]) natl[i].alpha = array_safe_get_fast(alph, i);
|
||||
if(use[6] && (len[6] == 0 || i < len[6])) {
|
||||
_val = len[6] == 0? val[6] : val[6][i];
|
||||
|
||||
_newAtl.alpha = _val;
|
||||
}
|
||||
|
||||
natl[_ind] = _newAtl;
|
||||
_ind++;
|
||||
}
|
||||
|
||||
array_resize(natl, _ind);
|
||||
outputs[| 0].setValue(natl);
|
||||
}
|
||||
}
|
|
@ -51,12 +51,18 @@ function Node_Dither(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
inputs[| 13] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, seed_random(6))
|
||||
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 13].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
|
||||
|
||||
inputs[| 14] = nodeValue("Use palette", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
|
||||
|
||||
inputs[| 15] = nodeValue("Steps", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4)
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [2, 16, 0.1] });
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
input_display_list = [ 9, 10, 13,
|
||||
["Surfaces", true], 0, 7, 8, 11, 12,
|
||||
["Pattern", false], 2, 3,
|
||||
["Dither", false], 6, 1, 4, 5
|
||||
["Dither", false], 6, 4, 5,
|
||||
["Palette", false, 14], 1, 15,
|
||||
]
|
||||
|
||||
attribute_surface_depth();
|
||||
|
@ -64,13 +70,16 @@ function Node_Dither(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
static step = function() { #region
|
||||
__step_mask_modifier();
|
||||
|
||||
var _type = getInputData(2);
|
||||
var _mode = getInputData(6);
|
||||
var _type = getInputData(2);
|
||||
var _mode = getInputData(6);
|
||||
var _use_pal = getInputData(14);
|
||||
|
||||
inputs[| 3].setVisible(_type == 4, _type == 4);
|
||||
inputs[| 1].setVisible(_mode == 0);
|
||||
inputs[| 1].setVisible(_mode == 0 && _use_pal);
|
||||
inputs[| 4].setVisible(_mode == 0);
|
||||
inputs[| 5].setVisible(_mode == 0);
|
||||
|
||||
inputs[| 15].setVisible(!_use_pal);
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
|
@ -81,6 +90,8 @@ function Node_Dither(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
var _conMap = _data[5];
|
||||
var _mode = _data[6];
|
||||
var _seed = _data[13];
|
||||
var _usepal = _data[14];
|
||||
var _step = _data[15];
|
||||
|
||||
surface_set_shader(_outSurf, _mode? sh_alpha_hash : sh_dither);
|
||||
shader_set_f("dimension", surface_get_dimension(_data[0]));
|
||||
|
@ -123,7 +134,9 @@ function Node_Dither(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
shader_set_i("useConMap", is_surface(_conMap));
|
||||
shader_set_surface("conMap", _conMap);
|
||||
|
||||
shader_set_i("usePalette", _usepal);
|
||||
shader_set_f("palette", paletteToArray(_pal));
|
||||
shader_set_f("colors", _step);
|
||||
shader_set_i("keys", array_length(_pal));
|
||||
}
|
||||
|
||||
|
|
12
scripts/node_normalize/node_color_adjustment.yy
Normal file
12
scripts/node_normalize/node_color_adjustment.yy
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"isDnD": false,
|
||||
"isCompatibility": false,
|
||||
"parent": {
|
||||
"name": "filter",
|
||||
"path": "folders/nodes/data/filter.yy",
|
||||
},
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_color_adjustment",
|
||||
"tags": [],
|
||||
"resourceType": "GMScript",
|
||||
}
|
12
scripts/node_normalize/node_color_replacement.yy
Normal file
12
scripts/node_normalize/node_color_replacement.yy
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"isDnD": false,
|
||||
"isCompatibility": false,
|
||||
"parent": {
|
||||
"name": "process",
|
||||
"path": "folders/nodes/data/process.yy",
|
||||
},
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_color_replacement",
|
||||
"tags": [],
|
||||
"resourceType": "GMScript",
|
||||
}
|
12
scripts/node_normalize/node_greyscale.yy
Normal file
12
scripts/node_normalize/node_greyscale.yy
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"isDnD": false,
|
||||
"isCompatibility": false,
|
||||
"parent": {
|
||||
"name": "filter",
|
||||
"path": "folders/nodes/data/filter.yy",
|
||||
},
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_greyscale",
|
||||
"tags": [],
|
||||
"resourceType": "GMScript",
|
||||
}
|
100
scripts/node_normalize/node_normalize.gml
Normal file
100
scripts/node_normalize/node_normalize.gml
Normal file
|
@ -0,0 +1,100 @@
|
|||
function Node_Normalize(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Normalize";
|
||||
|
||||
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
|
||||
|
||||
input_display_list = [ 0 ];
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
attribute_surface_depth();
|
||||
|
||||
temp_surface = [ surface_create(1, 1), surface_create(1, 1), surface_create(1, 1), surface_create(1, 1) ];
|
||||
|
||||
static step = function() { #region
|
||||
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
var _surf = _data[0];
|
||||
|
||||
var _sw = surface_get_width(_surf);
|
||||
var _sh = surface_get_height(_surf);
|
||||
var _itr = ceil(logn(4, _sw * _sh / 1024));
|
||||
|
||||
var _sww = ceil(_sw / 2);
|
||||
var _shh = ceil(_sh / 2);
|
||||
|
||||
for (var i = 0, n = array_length(temp_surface); i < n; i++)
|
||||
temp_surface[i] = surface_verify(temp_surface[i], _sw, _sh);
|
||||
|
||||
surface_set_shader(temp_surface[0]);
|
||||
draw_surface(_surf, 0, 0);
|
||||
surface_reset_shader();
|
||||
|
||||
surface_set_shader(temp_surface[1]);
|
||||
draw_surface(_surf, 0, 0);
|
||||
surface_reset_shader();
|
||||
|
||||
surface_clear(temp_surface[2]);
|
||||
surface_clear(temp_surface[3]);
|
||||
|
||||
var _ind = 1;
|
||||
repeat(_itr) {
|
||||
surface_resize(temp_surface[(_ind) * 2 + 0], _sww, _shh);
|
||||
surface_resize(temp_surface[(_ind) * 2 + 1], _sww, _shh);
|
||||
|
||||
shader_set(sh_get_max_downsampled);
|
||||
surface_set_target_ext(0, temp_surface[(_ind) * 2 + 0]);
|
||||
surface_set_target_ext(1, temp_surface[(_ind) * 2 + 1]);
|
||||
shader_set_f("dimension", _sww, _shh);
|
||||
shader_set_surface("surfaceMax", temp_surface[(!_ind) * 2 + 0]);
|
||||
shader_set_surface("surfaceMin", temp_surface[(!_ind) * 2 + 1]);
|
||||
|
||||
draw_sprite_stretched(s_fx_pixel, 0, 0, 0, _sww, _shh);
|
||||
surface_reset_target();
|
||||
shader_reset();
|
||||
|
||||
_sww = ceil(_sww / 2);
|
||||
_shh = ceil(_shh / 2);
|
||||
|
||||
_ind = !_ind;
|
||||
}
|
||||
|
||||
var _sMax = temp_surface[(!_ind) * 2 + 0];
|
||||
var _sMin = temp_surface[(!_ind) * 2 + 1];
|
||||
var _ssw = surface_get_width(_sMax);
|
||||
var _ssh = surface_get_height(_sMax);
|
||||
var _max = [ 0, 0, 0 ];
|
||||
var _min = [ 1, 1, 1 ];
|
||||
var _bMax = buffer_from_surface(_sMax, false);
|
||||
var _bMin = buffer_from_surface(_sMin, false);
|
||||
|
||||
buffer_seek(_bMax, buffer_seek_start, 0);
|
||||
buffer_seek(_bMin, buffer_seek_start, 0);
|
||||
repeat(_ssw * _ssh) {
|
||||
var _cc = buffer_read(_bMax, buffer_u32);
|
||||
_max[0] = max(_max[0], _color_get_red(_cc));
|
||||
_max[1] = max(_max[1], _color_get_green(_cc));
|
||||
_max[2] = max(_max[2], _color_get_blue(_cc));
|
||||
|
||||
var _cc = buffer_read(_bMin, buffer_u32);
|
||||
_min[0] = min(_min[0], _color_get_red(_cc));
|
||||
_min[1] = min(_min[1], _color_get_green(_cc));
|
||||
_min[2] = min(_min[2], _color_get_blue(_cc));
|
||||
|
||||
}
|
||||
buffer_delete(_bMax);
|
||||
buffer_delete(_bMin);
|
||||
#endregion
|
||||
|
||||
surface_set_shader(_outSurf, sh_normalize);
|
||||
shader_set_f("cMax", _max);
|
||||
shader_set_f("cMin", _min);
|
||||
|
||||
draw_surface_safe(_surf);
|
||||
surface_reset_shader();
|
||||
|
||||
return _outSurf;
|
||||
} #endregion
|
||||
}
|
13
scripts/node_normalize/node_normalize.yy
Normal file
13
scripts/node_normalize/node_normalize.yy
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"$GMScript":"",
|
||||
"%Name":"node_normalize",
|
||||
"isCompatibility":false,
|
||||
"isDnD":false,
|
||||
"name":"node_normalize",
|
||||
"parent":{
|
||||
"name":"colors",
|
||||
"path":"folders/nodes/data/filter/colors.yy",
|
||||
},
|
||||
"resourceType":"GMScript",
|
||||
"resourceVersion":"2.0",
|
||||
}
|
12
scripts/node_normalize/node_outline.yy
Normal file
12
scripts/node_normalize/node_outline.yy
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"isDnD": false,
|
||||
"isCompatibility": false,
|
||||
"parent": {
|
||||
"name": "process",
|
||||
"path": "folders/nodes/data/process.yy",
|
||||
},
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_outline",
|
||||
"tags": [],
|
||||
"resourceType": "GMScript",
|
||||
}
|
|
@ -8,11 +8,11 @@ function Node_Posterize(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
|
||||
inputs[| 2] = nodeValue("Use palette", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
|
||||
|
||||
inputs[| 3] = nodeValue("Colors", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4)
|
||||
inputs[| 3] = nodeValue("Steps", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4)
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [2, 16, 0.1] });
|
||||
|
||||
inputs[| 4] = nodeValue("Gamma", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.6)
|
||||
.setDisplay(VALUE_DISPLAY.slider)
|
||||
inputs[| 4] = nodeValue("Gamma", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 2, 0.01] })
|
||||
.setMappable(7);
|
||||
|
||||
inputs[| 5] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
|
||||
|
@ -38,6 +38,8 @@ function Node_Posterize(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
|
||||
attribute_surface_depth();
|
||||
|
||||
temp_surface = [ surface_create(1, 1), surface_create(1, 1), surface_create(1, 1), surface_create(1, 1) ];
|
||||
|
||||
static step = function() {
|
||||
var _use_pal = getInputData(2);
|
||||
|
||||
|
@ -49,6 +51,7 @@ function Node_Posterize(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
}
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
var _surf = _data[0];
|
||||
var _pal = _data[1];
|
||||
var _use_pal = _data[2];
|
||||
var _alp = _data[6];
|
||||
|
@ -61,16 +64,89 @@ function Node_Posterize(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
shader_set_i("alpha", _alp);
|
||||
shader_set_i("space", _spce);
|
||||
|
||||
draw_surface_safe(_data[0]);
|
||||
draw_surface_safe(_surf);
|
||||
surface_reset_shader();
|
||||
|
||||
} else {
|
||||
#region get range
|
||||
var _sw = surface_get_width(_surf);
|
||||
var _sh = surface_get_height(_surf);
|
||||
var _itr = ceil(logn(4, _sw * _sh / 1024));
|
||||
|
||||
var _sww = ceil(_sw / 2);
|
||||
var _shh = ceil(_sh / 2);
|
||||
|
||||
for (var i = 0, n = array_length(temp_surface); i < n; i++)
|
||||
temp_surface[i] = surface_verify(temp_surface[i], _sw, _sh);
|
||||
|
||||
surface_set_shader(temp_surface[0]);
|
||||
draw_surface(_surf, 0, 0);
|
||||
surface_reset_shader();
|
||||
|
||||
surface_set_shader(temp_surface[1]);
|
||||
draw_surface(_surf, 0, 0);
|
||||
surface_reset_shader();
|
||||
|
||||
surface_clear(temp_surface[2]);
|
||||
surface_clear(temp_surface[3]);
|
||||
|
||||
var _ind = 1;
|
||||
repeat(_itr) {
|
||||
surface_resize(temp_surface[(_ind) * 2 + 0], _sww, _shh);
|
||||
surface_resize(temp_surface[(_ind) * 2 + 1], _sww, _shh);
|
||||
|
||||
shader_set(sh_get_max_downsampled);
|
||||
surface_set_target_ext(0, temp_surface[(_ind) * 2 + 0]);
|
||||
surface_set_target_ext(1, temp_surface[(_ind) * 2 + 1]);
|
||||
shader_set_f("dimension", _sww, _shh);
|
||||
shader_set_surface("surfaceMax", temp_surface[(!_ind) * 2 + 0]);
|
||||
shader_set_surface("surfaceMin", temp_surface[(!_ind) * 2 + 1]);
|
||||
|
||||
draw_sprite_stretched(s_fx_pixel, 0, 0, 0, _sww, _shh);
|
||||
surface_reset_target();
|
||||
shader_reset();
|
||||
|
||||
_sww = ceil(_sww / 2);
|
||||
_shh = ceil(_shh / 2);
|
||||
|
||||
_ind = !_ind;
|
||||
}
|
||||
|
||||
var _sMax = temp_surface[(!_ind) * 2 + 0];
|
||||
var _sMin = temp_surface[(!_ind) * 2 + 1];
|
||||
var _ssw = surface_get_width(_sMax);
|
||||
var _ssh = surface_get_height(_sMax);
|
||||
var _max = [ 0, 0, 0 ];
|
||||
var _min = [ 1, 1, 1 ];
|
||||
var _bMax = buffer_from_surface(_sMax, false);
|
||||
var _bMin = buffer_from_surface(_sMin, false);
|
||||
|
||||
buffer_seek(_bMax, buffer_seek_start, 0);
|
||||
buffer_seek(_bMin, buffer_seek_start, 0);
|
||||
repeat(_ssw * _ssh) {
|
||||
var _cc = buffer_read(_bMax, buffer_u32);
|
||||
_max[0] = max(_max[0], _color_get_red(_cc));
|
||||
_max[1] = max(_max[1], _color_get_green(_cc));
|
||||
_max[2] = max(_max[2], _color_get_blue(_cc));
|
||||
|
||||
var _cc = buffer_read(_bMin, buffer_u32);
|
||||
_min[0] = min(_min[0], _color_get_red(_cc));
|
||||
_min[1] = min(_min[1], _color_get_green(_cc));
|
||||
_min[2] = min(_min[2], _color_get_blue(_cc));
|
||||
|
||||
}
|
||||
buffer_delete(_bMax);
|
||||
buffer_delete(_bMin);
|
||||
#endregion
|
||||
|
||||
surface_set_shader(_outSurf, sh_posterize);
|
||||
shader_set_i("colors", _data[3]);
|
||||
shader_set_f("cMax", _max);
|
||||
shader_set_f("cMin", _min);
|
||||
shader_set_f("colors", _data[3]);
|
||||
shader_set_f_map("gamma", _data[4], _data[7], inputs[| 4]);
|
||||
shader_set_i("alpha", _alp);
|
||||
|
||||
draw_surface_safe(_data[0]);
|
||||
draw_surface_safe(_surf);
|
||||
surface_reset_shader();
|
||||
}
|
||||
|
||||
|
|
|
@ -620,6 +620,7 @@ function __initNodes() {
|
|||
addNodeObject(filter, "Curve", s_node_curve_edit, "Node_Curve", [1, Node_Curve],, "Adjust brightness of an image using curves.").setVersion(1120);
|
||||
addNodeObject(filter, "Threshold", s_node_threshold, "Node_Threshold", [1, Node_Threshold],, "Set a threshold where pixel darker will becomes black, and brighter to white. Also works with alpha.").setVersion(1080);
|
||||
addNodeObject(filter, "Alpha Cutoff", s_node_alpha_cut, "Node_Alpha_Cutoff", [1, Node_Alpha_Cutoff], ["remove alpha"], "Remove pixel with low alpha value.");
|
||||
addNodeObject(filter, "Normalize", s_node_normalize, "Node_Normalize", [1, Node_Normalize]).setVersion(11710);
|
||||
addNodeObject(filter, "Gamma Map", s_node_gamma_map, "Node_Gamma_Map", [1, Node_Gamma_Map]).setVersion(11660);
|
||||
addNodeObject(filter, "ACE", s_node_ace, "Node_Tonemap_ACE", [1, Node_Tonemap_ACE],, "Apply ACE tonemapping.").setVersion(11710);
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ function Node_Rigid_Render_Output(_x, _y, _group = noone) : Node_Group_Output(_x
|
|||
name = "Render";
|
||||
color = COLORS.node_blend_simulation;
|
||||
icon = THEME.rigidSim;
|
||||
//use_cache = CACHE_USE.auto;
|
||||
|
||||
manual_ungroupable = false;
|
||||
|
||||
|
@ -25,11 +24,6 @@ function Node_Rigid_Render_Output(_x, _y, _group = noone) : Node_Group_Output(_x
|
|||
attributes.show_objects = !attributes.show_objects;
|
||||
})]);
|
||||
|
||||
insp2UpdateTooltip = "Clear cache";
|
||||
insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ];
|
||||
|
||||
static onInspector2Update = function() { clearCache(); }
|
||||
|
||||
static createNewInput = function() { #region
|
||||
var index = ds_list_size(inputs);
|
||||
inputs[| index] = nodeValue("Object", self, JUNCTION_CONNECT.input, VALUE_TYPE.rigid, noone )
|
||||
|
@ -136,18 +130,18 @@ function Node_Rigid_Render_Output(_x, _y, _group = noone) : Node_Group_Output(_x
|
|||
physics_draw_debug();
|
||||
|
||||
surface_reset_target();
|
||||
cacheCurrentFrame(_outSurf);
|
||||
// cacheCurrentFrame(_outSurf);
|
||||
} #endregion
|
||||
|
||||
static recoverCache = function(frame = CURRENT_FRAME) { #region
|
||||
if(!is_instanceof(outParent, NodeValue)) return false;
|
||||
if(!cacheExist(frame)) return false;
|
||||
// static recoverCache = function(frame = CURRENT_FRAME) { #region
|
||||
// if(!is_instanceof(outParent, NodeValue)) return false;
|
||||
// if(!cacheExist(frame)) return false;
|
||||
|
||||
var _s = cached_output[CURRENT_FRAME];
|
||||
outParent.setValue(_s);
|
||||
// var _s = cached_output[CURRENT_FRAME];
|
||||
// outParent.setValue(_s);
|
||||
|
||||
return true;
|
||||
} #endregion
|
||||
// return true;
|
||||
// } #endregion
|
||||
|
||||
static getGraphPreviewSurface = function() { #region
|
||||
if(!is_instanceof(outParent, NodeValue)) return noone;
|
||||
|
|
|
@ -947,7 +947,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
var _dim = struct_try_get(display_data, "useGlobal", true);
|
||||
extract_node = [ "Node_Vector2", "Node_Path" ];
|
||||
|
||||
if(_dim && def_val == DEF_SURF) {
|
||||
if(_dim && array_equals(def_val, DEF_SURF)) {
|
||||
value_tag = "dimension";
|
||||
node.attributes.use_project_dimension = true;
|
||||
editWidget.side_button = button(function() {
|
||||
|
|
|
@ -183,9 +183,7 @@ function Panel_File_Explorer() : PanelContent() constructor {
|
|||
|
||||
grid_size = ui(64);
|
||||
|
||||
tb_root = new textBox(TEXTBOX_INPUT.text, function(val) {
|
||||
setRoot(val);
|
||||
});
|
||||
tb_root = new textBox(TEXTBOX_INPUT.text, function(val) { setRoot(val); });
|
||||
|
||||
file_selectings = [];
|
||||
file_hovering = noone;
|
||||
|
@ -330,6 +328,12 @@ function Panel_File_Explorer() : PanelContent() constructor {
|
|||
|
||||
file_dragging = false;
|
||||
path_dragging = -1;
|
||||
|
||||
} else if(key_mod_press(CTRL)) {
|
||||
|
||||
pieMenuCall("", mouse_mx, mouse_my, [
|
||||
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -668,7 +668,8 @@ function Panel_Inspector() : PanelContent() constructor {
|
|||
jun_disp.rx = ui(16) + x;
|
||||
jun_disp.ry = top_bar_h + y;
|
||||
|
||||
hh += jun_disp.draw(ui(6), yy, con_w - ui(12), _m, _hover, pFOCUS) + ui(8);
|
||||
var _wdh = jun_disp.draw(ui(6), yy, con_w - ui(12), _m, _hover, pFOCUS) + ui(8);
|
||||
if(!is_undefined(_wdh)) hh += _wdh;
|
||||
continue;
|
||||
}
|
||||
jun = _inspecting.inputs[| _inspecting.input_display_list[i]];
|
||||
|
|
|
@ -13,7 +13,7 @@ function tooltipHotkey(text, context = "", name = "") constructor {
|
|||
draw_set_font(f_p1);
|
||||
var _w2 = string_width(keyStr);
|
||||
|
||||
var tw = min(WIN_W - ui(32), _w1 + ui(16) + _w2);
|
||||
var tw = min(WIN_W - ui(32), _w1 + ui(24) + _w2);
|
||||
var th = string_height_ext(text, -1, tw);
|
||||
|
||||
var mx = min(mouse_mx + ui(16), WIN_W - (tw + ui(16)));
|
||||
|
@ -27,6 +27,12 @@ function tooltipHotkey(text, context = "", name = "") constructor {
|
|||
draw_text_line(mx + ui(8), my + ui(8), text, -1, tw);
|
||||
|
||||
draw_set_text(f_p1, fa_right, fa_center, COLORS._main_text_sub);
|
||||
draw_text_line(mx + tw + ui(8), my + th / 2 + ui(10), keyStr, -1, tw);
|
||||
var _tw = string_width( keyStr);
|
||||
var _th = string_height(keyStr);
|
||||
var _hx = mx + tw + ui(6);
|
||||
var _hy = my + th / 2 + ui(10);
|
||||
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_fg, 1, _hx - _tw - ui(4), _hy - _th / 2 - ui(3), _tw + ui(8), _th + ui(3), COLORS._main_text_sub, 0.5);
|
||||
draw_text(_hx, _hy, keyStr);
|
||||
}
|
||||
}
|
|
@ -36,89 +36,91 @@ uniform vec2 blendAmount;
|
|||
uniform int blendAmountUseSurf;
|
||||
uniform int blendMode;
|
||||
|
||||
vec3 rgb2hsv(vec3 c) { #region
|
||||
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||||
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
|
||||
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
|
||||
|
||||
float d = q.x - min(q.w, q.y);
|
||||
float e = 0.0000000001;
|
||||
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
||||
} #endregion
|
||||
|
||||
vec3 hsv2rgb(vec3 c) { #region
|
||||
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
||||
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
||||
} #endregion
|
||||
|
||||
float hue2rgb( in float m1, in float m2, in float hue) { #region
|
||||
if (hue < 0.0)
|
||||
hue += 1.0;
|
||||
else if (hue > 1.0)
|
||||
hue -= 1.0;
|
||||
|
||||
if ((6.0 * hue) < 1.0)
|
||||
return m1 + (m2 - m1) * hue * 6.0;
|
||||
else if ((2.0 * hue) < 1.0)
|
||||
return m2;
|
||||
else if ((3.0 * hue) < 2.0)
|
||||
return m1 + (m2 - m1) * ((2.0 / 3.0) - hue) * 6.0;
|
||||
else
|
||||
return m1;
|
||||
} #endregion
|
||||
|
||||
vec3 hsl2rgb( in vec3 hsl ) { #region
|
||||
float r, g, b;
|
||||
if(hsl.y == 0.) {
|
||||
r = hsl.z;
|
||||
g = hsl.z;
|
||||
b = hsl.z;
|
||||
} else {
|
||||
float m1, m2;
|
||||
if(hsl.z <= 0.5)
|
||||
m2 = hsl.z * (1. + hsl.y);
|
||||
else
|
||||
m2 = hsl.z + hsl.y - hsl.z * hsl.y;
|
||||
m1 = 2. * hsl.z - m2;
|
||||
|
||||
r = hue2rgb(m1, m2, hsl.x + 1. / 3.);
|
||||
g = hue2rgb(m1, m2, hsl.x);
|
||||
b = hue2rgb(m1, m2, hsl.x - 1. / 3.);
|
||||
}
|
||||
#region =========================================== COLORS SPACES ===========================================
|
||||
vec3 rgb2hsv(vec3 c) { #region
|
||||
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||||
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
|
||||
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
|
||||
|
||||
return vec3( r, g, b );
|
||||
} #endregion
|
||||
|
||||
vec3 rgb2hsl( in vec3 c ) { #region
|
||||
float h = 0.0;
|
||||
float s = 0.0;
|
||||
float l = 0.0;
|
||||
float r = c.r;
|
||||
float g = c.g;
|
||||
float b = c.b;
|
||||
float cMin = min( r, min( g, b ) );
|
||||
float cMax = max( r, max( g, b ) );
|
||||
|
||||
l = ( cMax + cMin ) / 2.0;
|
||||
if ( cMax > cMin ) {
|
||||
float cDelta = cMax - cMin;
|
||||
|
||||
s = l < .5 ? cDelta / ( cMax + cMin ) : cDelta / ( 2.0 - ( cMax + cMin ) );
|
||||
|
||||
if ( r == cMax )
|
||||
h = ( g - b ) / cDelta;
|
||||
else if ( g == cMax )
|
||||
h = 2.0 + ( b - r ) / cDelta;
|
||||
float d = q.x - min(q.w, q.y);
|
||||
float e = 0.0000000001;
|
||||
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
||||
} #endregion
|
||||
|
||||
vec3 hsv2rgb(vec3 c) { #region
|
||||
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
||||
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
||||
} #endregion
|
||||
|
||||
float hue2rgb( in float m1, in float m2, in float hue) { #region
|
||||
if (hue < 0.0)
|
||||
hue += 1.0;
|
||||
else if (hue > 1.0)
|
||||
hue -= 1.0;
|
||||
|
||||
if ((6.0 * hue) < 1.0)
|
||||
return m1 + (m2 - m1) * hue * 6.0;
|
||||
else if ((2.0 * hue) < 1.0)
|
||||
return m2;
|
||||
else if ((3.0 * hue) < 2.0)
|
||||
return m1 + (m2 - m1) * ((2.0 / 3.0) - hue) * 6.0;
|
||||
else
|
||||
h = 4.0 + ( r - g ) / cDelta;
|
||||
return m1;
|
||||
} #endregion
|
||||
|
||||
vec3 hsl2rgb( in vec3 hsl ) { #region
|
||||
float r, g, b;
|
||||
if(hsl.y == 0.) {
|
||||
r = hsl.z;
|
||||
g = hsl.z;
|
||||
b = hsl.z;
|
||||
} else {
|
||||
float m1, m2;
|
||||
if(hsl.z <= 0.5)
|
||||
m2 = hsl.z * (1. + hsl.y);
|
||||
else
|
||||
m2 = hsl.z + hsl.y - hsl.z * hsl.y;
|
||||
m1 = 2. * hsl.z - m2;
|
||||
|
||||
r = hue2rgb(m1, m2, hsl.x + 1. / 3.);
|
||||
g = hue2rgb(m1, m2, hsl.x);
|
||||
b = hue2rgb(m1, m2, hsl.x - 1. / 3.);
|
||||
}
|
||||
|
||||
if ( h < 0.0)
|
||||
h += 6.0;
|
||||
h = h / 6.0;
|
||||
}
|
||||
return vec3( h, s, l );
|
||||
} #endregion
|
||||
return vec3( r, g, b );
|
||||
} #endregion
|
||||
|
||||
vec3 rgb2hsl( in vec3 c ) { #region
|
||||
float h = 0.0;
|
||||
float s = 0.0;
|
||||
float l = 0.0;
|
||||
float r = c.r;
|
||||
float g = c.g;
|
||||
float b = c.b;
|
||||
float cMin = min( r, min( g, b ) );
|
||||
float cMax = max( r, max( g, b ) );
|
||||
|
||||
l = ( cMax + cMin ) / 2.0;
|
||||
if ( cMax > cMin ) {
|
||||
float cDelta = cMax - cMin;
|
||||
|
||||
s = l < .5 ? cDelta / ( cMax + cMin ) : cDelta / ( 2.0 - ( cMax + cMin ) );
|
||||
|
||||
if ( r == cMax )
|
||||
h = ( g - b ) / cDelta;
|
||||
else if ( g == cMax )
|
||||
h = 2.0 + ( b - r ) / cDelta;
|
||||
else
|
||||
h = 4.0 + ( r - g ) / cDelta;
|
||||
|
||||
if ( h < 0.0)
|
||||
h += 6.0;
|
||||
h = h / 6.0;
|
||||
}
|
||||
return vec3( h, s, l );
|
||||
} #endregion
|
||||
#endregion =========================================== COLORS SPACES ===========================================
|
||||
|
||||
void main() {
|
||||
vec4 col = texture2D( gm_BaseTexture, v_vTexcoord );
|
||||
|
|
|
@ -19,6 +19,9 @@ uniform vec4 palette[32];
|
|||
uniform int keys;
|
||||
uniform float seed;
|
||||
|
||||
uniform int usePalette;
|
||||
uniform float colors;
|
||||
|
||||
float random (in vec2 st, float seed) { return fract(sin(dot(st.xy, vec2(1892.9898, 78.23453))) * (seed + 437.54123)); }
|
||||
|
||||
#region ============================== COLOR SPACES ==============================
|
||||
|
@ -56,38 +59,52 @@ float random (in vec2 st, float seed) { return fract(sin(dot(st.xy, vec2(1892.98
|
|||
#endregion
|
||||
|
||||
void main() { #region
|
||||
vec4 _col = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
|
||||
vec4 _col = texture2D( gm_BaseTexture, v_vTexcoord );
|
||||
|
||||
bool exactColor = false;
|
||||
int closet1_index = 0;
|
||||
int closet2_index = 0;
|
||||
float closet1_value = 99.;
|
||||
float closet2_value = 99.;
|
||||
bool exactColor = false;
|
||||
vec4 col1, col2;
|
||||
|
||||
for(int i = 0; i < keys; i++) {
|
||||
vec4 p_col = palette[i];
|
||||
float dif = colorDifferent(p_col, _col);
|
||||
if(usePalette == 0) {
|
||||
col1 = floor(_col * colors) / colors;
|
||||
col2 = ceil( _col * colors) / colors;
|
||||
|
||||
if(dif <= 0.001) {
|
||||
exactColor = true;
|
||||
_col = p_col;
|
||||
} else if(dif < closet1_value) {
|
||||
closet2_value = closet1_value;
|
||||
closet2_index = closet1_index;
|
||||
col1.a = _col.a;
|
||||
col2.a = _col.a;
|
||||
|
||||
exactColor = distance(_col, col1) < 0.05;
|
||||
|
||||
} else if(usePalette == 1) {
|
||||
int closet1_index = 0;
|
||||
int closet2_index = 0;
|
||||
float closet1_value = 99.;
|
||||
float closet2_value = 99.;
|
||||
|
||||
for(int i = 0; i < keys; i++) {
|
||||
vec4 p_col = palette[i];
|
||||
float dif = colorDifferent(p_col, _col);
|
||||
|
||||
closet1_value = dif;
|
||||
closet1_index = i;
|
||||
} else if(dif < closet2_value) {
|
||||
closet2_value = dif;
|
||||
closet2_index = i;
|
||||
if(dif <= 0.001) {
|
||||
exactColor = true;
|
||||
_col = p_col;
|
||||
} else if(dif < closet1_value) {
|
||||
closet2_value = closet1_value;
|
||||
closet2_index = closet1_index;
|
||||
|
||||
closet1_value = dif;
|
||||
closet1_index = i;
|
||||
} else if(dif < closet2_value) {
|
||||
closet2_value = dif;
|
||||
closet2_index = i;
|
||||
}
|
||||
}
|
||||
|
||||
col1 = palette[closet1_index];
|
||||
col2 = palette[closet2_index];
|
||||
}
|
||||
|
||||
if(exactColor) {
|
||||
gl_FragColor = _col;
|
||||
} else {
|
||||
vec4 col1 = palette[closet1_index];
|
||||
vec4 col2 = palette[closet2_index];
|
||||
float d1 = colorDifferent(_col, col1);
|
||||
float d2 = colorDifferent(_col, col2);
|
||||
float rat = d1 / (d1 + d2);
|
||||
|
|
27
shaders/sh_get_max_downsampled/sh_get_max_downsampled.fsh
Normal file
27
shaders/sh_get_max_downsampled/sh_get_max_downsampled.fsh
Normal file
|
@ -0,0 +1,27 @@
|
|||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform vec2 dimension;
|
||||
uniform sampler2D surfaceMax;
|
||||
uniform sampler2D surfaceMin;
|
||||
|
||||
vec4 sample(sampler2D tex, vec2 pos) { return texture2D( tex, clamp(pos, 0., 1.) ); }
|
||||
|
||||
void main() {
|
||||
vec2 tx = 1. / dimension;
|
||||
|
||||
vec4 cMax = vec4(0.);
|
||||
cMax = max(cMax, sample( surfaceMax, v_vTexcoord + vec2(0., 0.) * tx ));
|
||||
cMax = max(cMax, sample( surfaceMax, v_vTexcoord + vec2(1., 0.) * tx ));
|
||||
cMax = max(cMax, sample( surfaceMax, v_vTexcoord + vec2(0., 1.) * tx ));
|
||||
cMax = max(cMax, sample( surfaceMax, v_vTexcoord + vec2(1., 1.) * tx ));
|
||||
|
||||
vec4 cMin = vec4(1.);
|
||||
cMin = min(cMin, sample( surfaceMax, v_vTexcoord + vec2(0., 0.) * tx ));
|
||||
cMin = min(cMin, sample( surfaceMax, v_vTexcoord + vec2(1., 0.) * tx ));
|
||||
cMin = min(cMin, sample( surfaceMax, v_vTexcoord + vec2(0., 1.) * tx ));
|
||||
cMin = min(cMin, sample( surfaceMax, v_vTexcoord + vec2(1., 1.) * tx ));
|
||||
|
||||
gl_FragData[0] = cMax;
|
||||
gl_FragData[1] = cMin;
|
||||
}
|
19
shaders/sh_get_max_downsampled/sh_get_max_downsampled.vsh
Normal file
19
shaders/sh_get_max_downsampled/sh_get_max_downsampled.vsh
Normal file
|
@ -0,0 +1,19 @@
|
|||
//
|
||||
// Simple passthrough vertex shader
|
||||
//
|
||||
attribute vec3 in_Position; // (x,y,z)
|
||||
//attribute vec3 in_Normal; // (x,y,z) unused in this shader.
|
||||
attribute vec4 in_Colour; // (r,g,b,a)
|
||||
attribute vec2 in_TextureCoord; // (u,v)
|
||||
|
||||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0);
|
||||
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;
|
||||
|
||||
v_vColour = in_Colour;
|
||||
v_vTexcoord = in_TextureCoord;
|
||||
}
|
12
shaders/sh_get_max_downsampled/sh_get_max_downsampled.yy
Normal file
12
shaders/sh_get_max_downsampled/sh_get_max_downsampled.yy
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"$GMShader":"",
|
||||
"%Name":"sh_get_max_downsampled",
|
||||
"name":"sh_get_max_downsampled",
|
||||
"parent":{
|
||||
"name":"misc",
|
||||
"path":"folders/shader/misc.yy",
|
||||
},
|
||||
"resourceType":"GMShader",
|
||||
"resourceVersion":"2.0",
|
||||
"type":1,
|
||||
}
|
17
shaders/sh_get_min_downsampled/sh_get_min_downsampled.fsh
Normal file
17
shaders/sh_get_min_downsampled/sh_get_min_downsampled.fsh
Normal file
|
@ -0,0 +1,17 @@
|
|||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform vec2 dimension;
|
||||
uniform sampler2D surface;
|
||||
|
||||
void main() {
|
||||
vec2 tx = 1. / dimension;
|
||||
|
||||
vec4 c = vec4(0.);
|
||||
c = min(c, texture2D( surface, v_vTexcoord + vec2(0., 0.) * tx ));
|
||||
c = min(c, texture2D( surface, v_vTexcoord + vec2(1., 0.) * tx ));
|
||||
c = min(c, texture2D( surface, v_vTexcoord + vec2(0., 1.) * tx ));
|
||||
c = min(c, texture2D( surface, v_vTexcoord + vec2(1., 1.) * tx ));
|
||||
|
||||
gl_FragColor = c;
|
||||
}
|
19
shaders/sh_get_min_downsampled/sh_get_min_downsampled.vsh
Normal file
19
shaders/sh_get_min_downsampled/sh_get_min_downsampled.vsh
Normal file
|
@ -0,0 +1,19 @@
|
|||
//
|
||||
// Simple passthrough vertex shader
|
||||
//
|
||||
attribute vec3 in_Position; // (x,y,z)
|
||||
//attribute vec3 in_Normal; // (x,y,z) unused in this shader.
|
||||
attribute vec4 in_Colour; // (r,g,b,a)
|
||||
attribute vec2 in_TextureCoord; // (u,v)
|
||||
|
||||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0);
|
||||
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;
|
||||
|
||||
v_vColour = in_Colour;
|
||||
v_vTexcoord = in_TextureCoord;
|
||||
}
|
12
shaders/sh_get_min_downsampled/sh_get_min_downsampled.yy
Normal file
12
shaders/sh_get_min_downsampled/sh_get_min_downsampled.yy
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"$GMShader":"",
|
||||
"%Name":"sh_get_min_downsampled",
|
||||
"name":"sh_get_min_downsampled",
|
||||
"parent":{
|
||||
"name":"misc",
|
||||
"path":"folders/shader/misc.yy",
|
||||
},
|
||||
"resourceType":"GMShader",
|
||||
"resourceVersion":"2.0",
|
||||
"type":1,
|
||||
}
|
13
shaders/sh_normalize/sh_normalize.fsh
Normal file
13
shaders/sh_normalize/sh_normalize.fsh
Normal file
|
@ -0,0 +1,13 @@
|
|||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform vec3 cMin, cMax;
|
||||
|
||||
void main() {
|
||||
vec4 c = texture2D( gm_BaseTexture, v_vTexcoord );
|
||||
|
||||
vec3 cRan = cMax - cMin;
|
||||
vec3 col = (c.rgb - cMin) / cRan;
|
||||
|
||||
gl_FragColor = vec4(col, c.a);
|
||||
}
|
19
shaders/sh_normalize/sh_normalize.vsh
Normal file
19
shaders/sh_normalize/sh_normalize.vsh
Normal file
|
@ -0,0 +1,19 @@
|
|||
//
|
||||
// Simple passthrough vertex shader
|
||||
//
|
||||
attribute vec3 in_Position; // (x,y,z)
|
||||
//attribute vec3 in_Normal; // (x,y,z) unused in this shader.
|
||||
attribute vec4 in_Colour; // (r,g,b,a)
|
||||
attribute vec2 in_TextureCoord; // (u,v)
|
||||
|
||||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0);
|
||||
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;
|
||||
|
||||
v_vColour = in_Colour;
|
||||
v_vTexcoord = in_TextureCoord;
|
||||
}
|
12
shaders/sh_normalize/sh_normalize.yy
Normal file
12
shaders/sh_normalize/sh_normalize.yy
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"$GMShader":"",
|
||||
"%Name":"sh_normalize",
|
||||
"name":"sh_normalize",
|
||||
"parent":{
|
||||
"name":"color",
|
||||
"path":"folders/shader/filter/color.yy",
|
||||
},
|
||||
"resourceType":"GMShader",
|
||||
"resourceVersion":"2.0",
|
||||
"type":1,
|
||||
}
|
|
@ -1,16 +1,104 @@
|
|||
//
|
||||
// Simple passthrough fragment shader
|
||||
//
|
||||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform int colors;
|
||||
uniform int alpha;
|
||||
uniform float colors;
|
||||
uniform int alpha;
|
||||
uniform vec3 cMin, cMax;
|
||||
|
||||
uniform vec2 gamma;
|
||||
uniform int gammaUseSurf;
|
||||
uniform sampler2D gammaSurf;
|
||||
|
||||
#region =========================================== COLORS SPACES ===========================================
|
||||
vec3 rgb2hsv(vec3 c) { #region
|
||||
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||||
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
|
||||
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
|
||||
|
||||
float d = q.x - min(q.w, q.y);
|
||||
float e = 0.0000000001;
|
||||
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
||||
} #endregion
|
||||
|
||||
vec3 hsv2rgb(vec3 c) { #region
|
||||
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
||||
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
||||
} #endregion
|
||||
|
||||
float hue2rgb( in float m1, in float m2, in float hue) { #region
|
||||
if (hue < 0.0)
|
||||
hue += 1.0;
|
||||
else if (hue > 1.0)
|
||||
hue -= 1.0;
|
||||
|
||||
if ((6.0 * hue) < 1.0)
|
||||
return m1 + (m2 - m1) * hue * 6.0;
|
||||
else if ((2.0 * hue) < 1.0)
|
||||
return m2;
|
||||
else if ((3.0 * hue) < 2.0)
|
||||
return m1 + (m2 - m1) * ((2.0 / 3.0) - hue) * 6.0;
|
||||
else
|
||||
return m1;
|
||||
} #endregion
|
||||
|
||||
vec3 hsl2rgb( in vec3 hsl ) { #region
|
||||
float r, g, b;
|
||||
if(hsl.y == 0.) {
|
||||
r = hsl.z;
|
||||
g = hsl.z;
|
||||
b = hsl.z;
|
||||
} else {
|
||||
float m1, m2;
|
||||
if(hsl.z <= 0.5)
|
||||
m2 = hsl.z * (1. + hsl.y);
|
||||
else
|
||||
m2 = hsl.z + hsl.y - hsl.z * hsl.y;
|
||||
m1 = 2. * hsl.z - m2;
|
||||
|
||||
r = hue2rgb(m1, m2, hsl.x + 1. / 3.);
|
||||
g = hue2rgb(m1, m2, hsl.x);
|
||||
b = hue2rgb(m1, m2, hsl.x - 1. / 3.);
|
||||
}
|
||||
|
||||
return vec3( r, g, b );
|
||||
} #endregion
|
||||
|
||||
vec3 rgb2hsl( in vec3 c ) { #region
|
||||
float h = 0.0;
|
||||
float s = 0.0;
|
||||
float l = 0.0;
|
||||
float r = c.r;
|
||||
float g = c.g;
|
||||
float b = c.b;
|
||||
float cMin = min( r, min( g, b ) );
|
||||
float cMax = max( r, max( g, b ) );
|
||||
|
||||
l = ( cMax + cMin ) / 2.0;
|
||||
if ( cMax > cMin ) {
|
||||
float cDelta = cMax - cMin;
|
||||
|
||||
s = l < .5 ? cDelta / ( cMax + cMin ) : cDelta / ( 2.0 - ( cMax + cMin ) );
|
||||
|
||||
if ( r == cMax )
|
||||
h = ( g - b ) / cDelta;
|
||||
else if ( g == cMax )
|
||||
h = 2.0 + ( b - r ) / cDelta;
|
||||
else
|
||||
h = 4.0 + ( r - g ) / cDelta;
|
||||
|
||||
if ( h < 0.0)
|
||||
h += 6.0;
|
||||
h = h / 6.0;
|
||||
}
|
||||
return vec3( h, s, l );
|
||||
} #endregion
|
||||
#endregion =========================================== COLORS SPACES ===========================================
|
||||
|
||||
float round(float a) { return fract(a) >= 0.5? ceil(a) : floor(a); }
|
||||
vec2 round(vec2 a) { return vec2(round(a.x), round(a.y)); }
|
||||
vec3 round(vec3 a) { return vec3(round(a.x), round(a.y), round(a.z)); }
|
||||
|
||||
void main() {
|
||||
float gam = gamma.x;
|
||||
if(gammaUseSurf == 1) {
|
||||
|
@ -18,11 +106,20 @@ void main() {
|
|||
gam = mix(gamma.x, gamma.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
vec4 _col = texture2D( gm_BaseTexture, v_vTexcoord );
|
||||
vec4 c = _col;
|
||||
c = floor(pow(c, vec4(gam)) * float(colors));
|
||||
c = pow(c / float(colors), vec4(1.0 / gam));
|
||||
gam = max(gam, .0001);
|
||||
|
||||
if(alpha == 1) gl_FragColor = c;
|
||||
else gl_FragColor = vec4(c.rgb, _col.a);
|
||||
vec3 cRan = cMax - cMin;
|
||||
vec4 _col = texture2D( gm_BaseTexture, v_vTexcoord );
|
||||
_col.rgb = clamp((_col.rgb - cMin) / cRan, 0., 1.);
|
||||
|
||||
vec3 c = _col.rgb;
|
||||
|
||||
c = pow(c, vec3(gam));
|
||||
c = floor(c * colors) / (colors - 1.);
|
||||
c = pow(c, vec3(1.0 / gam));
|
||||
_col = vec4(cMin + c * cRan, 1.);
|
||||
|
||||
_col.a = alpha == 1? 1. : _col.a;
|
||||
|
||||
gl_FragColor = _col;
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 765 B |
Binary file not shown.
After Width: | Height: | Size: 765 B |
90
sprites/s_node_normalize/s_node_normalize.yy
Normal file
90
sprites/s_node_normalize/s_node_normalize.yy
Normal file
|
@ -0,0 +1,90 @@
|
|||
{
|
||||
"$GMSprite":"",
|
||||
"%Name":"s_node_normalize",
|
||||
"bboxMode":0,
|
||||
"bbox_bottom":63,
|
||||
"bbox_left":0,
|
||||
"bbox_right":63,
|
||||
"bbox_top":0,
|
||||
"collisionKind":1,
|
||||
"collisionTolerance":0,
|
||||
"DynamicTexturePage":false,
|
||||
"edgeFiltering":false,
|
||||
"For3D":false,
|
||||
"frames":[
|
||||
{"$GMSpriteFrame":"","%Name":"473ee652-8202-4be9-8285-8305bdb7811a","name":"473ee652-8202-4be9-8285-8305bdb7811a","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
|
||||
],
|
||||
"gridX":0,
|
||||
"gridY":0,
|
||||
"height":64,
|
||||
"HTile":false,
|
||||
"layers":[
|
||||
{"$GMImageLayer":"","%Name":"80227e67-9114-44ab-ae2c-4f114b54be58","blendMode":0,"displayName":"default","isLocked":false,"name":"80227e67-9114-44ab-ae2c-4f114b54be58","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
|
||||
],
|
||||
"name":"s_node_normalize",
|
||||
"nineSlice":null,
|
||||
"origin":4,
|
||||
"parent":{
|
||||
"name":"filter",
|
||||
"path":"folders/nodes/icons/filter.yy",
|
||||
},
|
||||
"preMultiplyAlpha":false,
|
||||
"resourceType":"GMSprite",
|
||||
"resourceVersion":"2.0",
|
||||
"sequence":{
|
||||
"$GMSequence":"",
|
||||
"%Name":"s_node_normalize",
|
||||
"autoRecord":true,
|
||||
"backdropHeight":768,
|
||||
"backdropImageOpacity":0.5,
|
||||
"backdropImagePath":"",
|
||||
"backdropWidth":1366,
|
||||
"backdropXOffset":0.0,
|
||||
"backdropYOffset":0.0,
|
||||
"events":{
|
||||
"$KeyframeStore<MessageEventKeyframe>":"",
|
||||
"Keyframes":[],
|
||||
"resourceType":"KeyframeStore<MessageEventKeyframe>",
|
||||
"resourceVersion":"2.0",
|
||||
},
|
||||
"eventStubScript":null,
|
||||
"eventToFunction":{},
|
||||
"length":1.0,
|
||||
"lockOrigin":false,
|
||||
"moments":{
|
||||
"$KeyframeStore<MomentsEventKeyframe>":"",
|
||||
"Keyframes":[],
|
||||
"resourceType":"KeyframeStore<MomentsEventKeyframe>",
|
||||
"resourceVersion":"2.0",
|
||||
},
|
||||
"name":"s_node_normalize",
|
||||
"playback":1,
|
||||
"playbackSpeed":30.0,
|
||||
"playbackSpeedType":0,
|
||||
"resourceType":"GMSequence",
|
||||
"resourceVersion":"2.0",
|
||||
"showBackdrop":true,
|
||||
"showBackdropImage":false,
|
||||
"timeUnits":1,
|
||||
"tracks":[
|
||||
{"$GMSpriteFramesTrack":"","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"$KeyframeStore<SpriteFrameKeyframe>":"","Keyframes":[
|
||||
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
|
||||
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"473ee652-8202-4be9-8285-8305bdb7811a","path":"sprites/s_node_normalize/s_node_normalize.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
|
||||
},"Disabled":false,"id":"cd3b70b3-86d6-45f9-9960-e22d6aaa16c2","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
|
||||
],"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
|
||||
],
|
||||
"visibleRange":null,
|
||||
"volume":1.0,
|
||||
"xorigin":32,
|
||||
"yorigin":32,
|
||||
},
|
||||
"swatchColours":null,
|
||||
"swfPrecision":0.5,
|
||||
"textureGroupId":{
|
||||
"name":"Default",
|
||||
"path":"texturegroups/Default",
|
||||
},
|
||||
"type":0,
|
||||
"VTile":false,
|
||||
"width":64,
|
||||
}
|
Loading…
Reference in a new issue