Mappable 2
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
|
@ -22,13 +22,20 @@ function Node_Shader(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
var _dat = shader_data[i];
|
||||
if(_dat == 0) continue;
|
||||
|
||||
var _val = _data[i];
|
||||
var _inp = inputs[| i];
|
||||
|
||||
switch(_dat.type) {
|
||||
case SHADER_UNIFORM.integer : shader_set_i(_dat.key, _val); break;
|
||||
case SHADER_UNIFORM.float : shader_set_f(_dat.key, _val); break;
|
||||
case SHADER_UNIFORM.color : shader_set_color(_dat.key, _val); break;
|
||||
case SHADER_UNIFORM.integer : shader_set_i(_dat.key, _data[i]); break;
|
||||
|
||||
case SHADER_UNIFORM.float :
|
||||
if(struct_has(_inp.attributes, "mapped") && _inp.attributes.mapped)
|
||||
shader_set_f_map(_dat.key, _data[i], _data[_inp.attributes.map_index], _inp);
|
||||
else
|
||||
shader_set_f(_dat.key, _data[i]);
|
||||
break;
|
||||
case SHADER_UNIFORM.color : shader_set_color(_dat.key, _data[i]); break;
|
||||
}
|
||||
|
||||
}
|
||||
} #endregion
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ function Node_2D_light(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
inputs[| 1] = nodeValue("Light shape", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Point", "Line", "Line asymmetric", "Spot" ]);
|
||||
|
||||
inputs[| 2] = nodeValue("Center", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 16, 16])
|
||||
inputs[| 2] = nodeValue("Center", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 16, 16 ])
|
||||
.setDisplay(VALUE_DISPLAY.vector)
|
||||
.setUnitRef(function(index) { return getDimension(index); });
|
||||
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
function Node_Bevel(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Bevel";
|
||||
|
||||
shader = sh_bevel;
|
||||
uniform_dim = shader_get_uniform(shader, "dimension");
|
||||
uniform_shf = shader_get_uniform(shader, "shift");
|
||||
uniform_sca = shader_get_uniform(shader, "scale");
|
||||
uniform_hei = shader_get_uniform(shader, "height");
|
||||
uniform_slp = shader_get_uniform(shader, "slope");
|
||||
uniform_sam = shader_get_uniform(shader, "sampleMode");
|
||||
|
||||
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
inputs[| 1] = nodeValue("Height", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4);
|
||||
|
||||
inputs[| 1] = nodeValue("Height", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4)
|
||||
.setMappable(11);
|
||||
|
||||
inputs[| 2] = nodeValue("Shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ])
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
|
@ -34,18 +28,24 @@ function Node_Bevel(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
|
|||
|
||||
__init_mask_modifier(5); // inputs 9, 10
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 11] = nodeValueMap("Height map", self);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
input_display_list = [ 7,
|
||||
["Surfaces", true], 0, 5, 6, 9, 10,
|
||||
["Bevel", false], 4, 1,
|
||||
["Bevel", false], 4, 1, 11,
|
||||
["Transform", false], 2, 3,
|
||||
];
|
||||
|
||||
attribute_surface_depth();
|
||||
attribute_oversample();
|
||||
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
|
||||
PROCESSOR_OVERLAY_CHECK
|
||||
|
||||
var _surf = current_data[0];
|
||||
|
@ -55,10 +55,12 @@ function Node_Bevel(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
|
|||
var _ph = surface_get_height_safe(_surf) * _s / 2;
|
||||
|
||||
inputs[| 2].drawOverlay(active, _x + _pw, _y + _ph, _s, _mx, _my, _snx, _sny);
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static step = function() { #region
|
||||
__step_mask_modifier();
|
||||
|
||||
inputs[| 1].mappableStep();
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
|
@ -68,15 +70,15 @@ function Node_Bevel(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
|
|||
var _slp = _data[4];
|
||||
var _sam = struct_try_get(attributes, "oversample");
|
||||
|
||||
surface_set_shader(_outSurf, shader);
|
||||
shader_set_uniform_f(uniform_hei, _hei);
|
||||
shader_set_uniform_f_array_safe(uniform_shf, _shf);
|
||||
shader_set_uniform_f_array_safe(uniform_sca, _sca);
|
||||
shader_set_uniform_i(uniform_slp, _slp);
|
||||
shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]) ]);
|
||||
shader_set_uniform_i(uniform_sam, _sam);
|
||||
surface_set_shader(_outSurf, sh_bevel);
|
||||
shader_set_f("dimension", surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]));
|
||||
shader_set_f_map("height", _hei, _data[11], inputs[| 1]);
|
||||
shader_set_f("shift", _shf);
|
||||
shader_set_f("scale", _sca);
|
||||
shader_set_i("slope", _slp);
|
||||
shader_set_i("sampleMode", _sam);
|
||||
|
||||
draw_surface_safe(_data[0], 0, 0);
|
||||
draw_surface_safe(_data[0]);
|
||||
surface_reset_shader();
|
||||
|
||||
__process_mask_modifier(_data);
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
function Node_Blur_Bokeh(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Lens Blur";
|
||||
|
||||
shader = sh_blur_bokeh;
|
||||
uniform_dim = shader_get_uniform(shader, "dimension");
|
||||
uniform_str = shader_get_uniform(shader, "strength");
|
||||
|
||||
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
|
||||
inputs[| 1] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2)
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 16, 0.01] });
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 16, 0.01] })
|
||||
.setMappable(8);
|
||||
|
||||
inputs[| 2] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
|
||||
|
@ -23,9 +20,15 @@ function Node_Blur_Bokeh(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
|
|||
|
||||
__init_mask_modifier(2); // inputs 6, 7
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 8] = nodeValueMap("Strength map", self);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
input_display_list = [ 4, 5,
|
||||
["Surfaces", true], 0, 2, 3, 6, 7,
|
||||
["Blur", false], 1,
|
||||
["Blur", false], 1, 8,
|
||||
]
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
@ -34,28 +37,21 @@ function Node_Blur_Bokeh(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
|
|||
|
||||
static step = function() { #region
|
||||
__step_mask_modifier();
|
||||
|
||||
inputs[| 1].mappableStep();
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
var _str = _data[1];
|
||||
var _mask = _data[2];
|
||||
var _mix = _data[3];
|
||||
|
||||
surface_set_target(_outSurf);
|
||||
DRAW_CLEAR
|
||||
BLEND_OVERRIDE;
|
||||
surface_set_shader(_outSurf, sh_blur_bokeh);
|
||||
shader_set_f("dimension", surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]));
|
||||
shader_set_f_map("strength", _data[1], _data[8], inputs[| 1]);
|
||||
|
||||
shader_set(shader);
|
||||
shader_set_uniform_f(uniform_dim, surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]));
|
||||
shader_set_uniform_f(uniform_str, _str);
|
||||
draw_surface_safe(_data[0], 0, 0);
|
||||
shader_reset();
|
||||
|
||||
BLEND_NORMAL;
|
||||
surface_reset_target();
|
||||
surface_reset_shader();
|
||||
|
||||
__process_mask_modifier(_data);
|
||||
_outSurf = mask_apply(_data[0], _outSurf, _mask, _mix);
|
||||
_outSurf = mask_apply(_data[0], _outSurf, _data[2], _data[3]);
|
||||
_outSurf = channel_apply(_data[0], _outSurf, _data[5]);
|
||||
|
||||
return _outSurf;
|
||||
|
|
|
@ -4,10 +4,12 @@ function Node_Blur_Directional(_x, _y, _group = noone) : Node_Processor(_x, _y,
|
|||
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
|
||||
inputs[| 1] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2)
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 0.1, 0.001] });
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 0.5, 0.001] })
|
||||
.setMappable(9);
|
||||
|
||||
inputs[| 2] = nodeValue("Direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
.setDisplay(VALUE_DISPLAY.rotation);
|
||||
.setDisplay(VALUE_DISPLAY.rotation)
|
||||
.setMappable(10);
|
||||
|
||||
inputs[| 3] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
|
||||
|
@ -22,9 +24,17 @@ function Node_Blur_Directional(_x, _y, _group = noone) : Node_Processor(_x, _y,
|
|||
|
||||
__init_mask_modifier(3); // inputs 7, 8
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 9] = nodeValueMap("Strength map", self);
|
||||
|
||||
inputs[| 10] = nodeValueMap("Direction map", self);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
input_display_list = [ 5, 6,
|
||||
["Surfaces", true], 0, 3, 4, 7, 8,
|
||||
["Blur", false], 1, 2,
|
||||
["Blur", false], 1, 9, 2, 10,
|
||||
]
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
@ -47,24 +57,24 @@ function Node_Blur_Directional(_x, _y, _group = noone) : Node_Processor(_x, _y,
|
|||
|
||||
static step = function() { #region
|
||||
__step_mask_modifier();
|
||||
|
||||
inputs[| 1].mappableStep();
|
||||
inputs[| 2].mappableStep();
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
var _str = _data[1];
|
||||
var _dir = _data[2];
|
||||
var _mask = _data[3];
|
||||
var _mix = _data[4];
|
||||
|
||||
surface_set_shader(_outSurf, sh_blur_directional);
|
||||
shader_set_f("size", max(surface_get_width_safe(_data[0]), surface_get_height_safe( _data[1])));
|
||||
shader_set_f("strength", _str);
|
||||
shader_set_f("direction", _dir + 90);
|
||||
shader_set_i("sampleMode", struct_try_get(attributes, "oversample"));
|
||||
shader_set_f("size", max(surface_get_width_safe(_data[0]), surface_get_height_safe( _data[0])));
|
||||
shader_set_f_map("strength", _data[1], _data[ 9], inputs[| 1]);
|
||||
shader_set_f_map("direction", _data[2], _data[10], inputs[| 2]);
|
||||
shader_set_i("sampleMode", struct_try_get(attributes, "oversample"));
|
||||
|
||||
draw_surface_safe(_data[0], 0, 0);
|
||||
surface_reset_shader();
|
||||
|
||||
__process_mask_modifier(_data);
|
||||
_outSurf = mask_apply(_data[0], _outSurf, _mask, _mix);
|
||||
_outSurf = mask_apply(_data[0], _outSurf, _data[3], _data[4]);
|
||||
_outSurf = channel_apply(_data[0], _outSurf, _data[6]);
|
||||
|
||||
return _outSurf;
|
||||
|
|
|
@ -4,7 +4,8 @@ function Node_Blur_Radial(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
|||
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
|
||||
inputs[| 1] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 45)
|
||||
.setDisplay(VALUE_DISPLAY.rotation);
|
||||
.setDisplay(VALUE_DISPLAY.rotation)
|
||||
.setMappable(10);
|
||||
|
||||
inputs[| 2] = nodeValue("Center", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ])
|
||||
.setDisplay(VALUE_DISPLAY.vector)
|
||||
|
@ -26,11 +27,17 @@ function Node_Blur_Radial(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
|||
|
||||
__init_mask_modifier(4); // inputs 8, 9,
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 10] = nodeValueMap("Strength map", self);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
input_display_list = [ 6, 7,
|
||||
["Surfaces", true], 0, 4, 5, 8, 9,
|
||||
["Blur", false], 1, 2,
|
||||
["Blur", false], 1, 10, 2,
|
||||
];
|
||||
|
||||
attribute_surface_depth();
|
||||
|
@ -48,13 +55,12 @@ function Node_Blur_Radial(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
|||
|
||||
static step = function() { #region
|
||||
__step_mask_modifier();
|
||||
|
||||
inputs[| 1].mappableStep();
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
var _str = _data[1];
|
||||
var _cen = _data[2];
|
||||
var _mask = _data[4];
|
||||
var _mix = _data[5];
|
||||
var _cen = _data[2];
|
||||
|
||||
_cen = array_clone(_cen);
|
||||
_cen[0] /= surface_get_width_safe(_outSurf);
|
||||
|
@ -63,14 +69,14 @@ function Node_Blur_Radial(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
|||
surface_set_shader(_outSurf, sh_blur_radial);
|
||||
shader_set_interpolation(_data[0]);
|
||||
shader_set_f("dimension", surface_get_width_safe(_outSurf), surface_get_height_safe(_outSurf));
|
||||
shader_set_f("strength", abs(_str));
|
||||
shader_set_f("center", _cen);
|
||||
shader_set_f_map("strength", _data[1], _data[10], inputs[| 1]);
|
||||
shader_set_f("center", _cen);
|
||||
|
||||
draw_surface_safe(_data[0], 0, 0);
|
||||
draw_surface_safe(_data[0]);
|
||||
surface_reset_shader();
|
||||
|
||||
__process_mask_modifier(_data);
|
||||
_outSurf = mask_apply(_data[0], _outSurf, _mask, _mix);
|
||||
_outSurf = mask_apply(_data[0], _outSurf, _data[4], _data[5]);
|
||||
_outSurf = channel_apply(_data[0], _outSurf, _data[7]);
|
||||
|
||||
return _outSurf;
|
||||
|
|
|
@ -3,7 +3,8 @@ function Node_Blur_Zoom(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
|
||||
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
|
||||
inputs[| 1] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2);
|
||||
inputs[| 1] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2)
|
||||
.setMappable(12);
|
||||
|
||||
inputs[| 2] = nodeValue("Center", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ])
|
||||
.setDisplay(VALUE_DISPLAY.vector)
|
||||
|
@ -30,11 +31,17 @@ function Node_Blur_Zoom(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
|
||||
__init_mask_modifier(6); // inputs 10, 11
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 12] = nodeValueMap("Strength map", self);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
input_display_list = [ 8, 9,
|
||||
["Surfaces", true], 0, 6, 7, 10, 11,
|
||||
["Blur", false], 1, 2, 4, 5
|
||||
["Blur", false], 1, 12, 2, 4, 5
|
||||
];
|
||||
|
||||
attribute_surface_depth();
|
||||
|
@ -51,35 +58,31 @@ function Node_Blur_Zoom(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
|
||||
static step = function() { #region
|
||||
__step_mask_modifier();
|
||||
|
||||
inputs[| 1].mappableStep();
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
var _str = _data[1];
|
||||
var _cen = _data[2];
|
||||
var _sam = struct_try_get(attributes, "oversample");
|
||||
var _blr = _data[4];
|
||||
var _msk = _data[5];
|
||||
var _mask = _data[6];
|
||||
var _mix = _data[7];
|
||||
|
||||
_cen = array_clone(_cen);
|
||||
var _cen = array_clone(_data[2]);
|
||||
_cen[0] /= surface_get_width_safe(_outSurf);
|
||||
_cen[1] /= surface_get_height_safe(_outSurf);
|
||||
|
||||
surface_set_shader(_outSurf, sh_blur_zoom);
|
||||
shader_set_f("strength", _str);
|
||||
shader_set_f("center", _cen);
|
||||
shader_set_i("blurMode", _blr);
|
||||
shader_set_i("sampleMode", _sam);
|
||||
shader_set_f("center", _cen);
|
||||
shader_set_f_map("strength", _data[1], _data[12], inputs[| 1]);
|
||||
shader_set_i("blurMode", _data[4]);
|
||||
shader_set_i("sampleMode", _sam);
|
||||
|
||||
shader_set_i("useMask", is_surface(_msk));
|
||||
shader_set_surface("mask", _msk);
|
||||
shader_set_i("useMask", is_surface(_data[5]));
|
||||
shader_set_surface("mask", _data[5]);
|
||||
|
||||
draw_surface_safe(_data[0], 0, 0);
|
||||
surface_reset_shader();
|
||||
|
||||
__process_mask_modifier(_data);
|
||||
_outSurf = mask_apply(_data[0], _outSurf, _mask, _mix);
|
||||
_outSurf = mask_apply(_data[0], _outSurf, _data[6], _data[7]);
|
||||
_outSurf = channel_apply(_data[0], _outSurf, _data[9]);
|
||||
|
||||
return _outSurf;
|
||||
|
|
|
@ -24,11 +24,13 @@ function Node_BW(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constr
|
|||
|
||||
__init_mask_modifier(3); // inputs 7, 8
|
||||
|
||||
inputs[| 9] = nodeValue("Brightness map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone)
|
||||
.setVisible(false, false);
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 10] = nodeValue("Contrast map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone)
|
||||
.setVisible(false, false);
|
||||
inputs[| 9] = nodeValueMap("Brightness map", self);
|
||||
|
||||
inputs[| 10] = nodeValueMap("Contrast map", self);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
input_display_list = [ 5, 6,
|
||||
["Surfaces", true], 0, 3, 4, 7, 8,
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
function Node_Chromatic_Aberration(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Chromatic Aberration";
|
||||
|
||||
shader = sh_chromatic_aberration;
|
||||
uniform_dim = shader_get_uniform(shader, "dimension");
|
||||
uniform_cen = shader_get_uniform(shader, "center");
|
||||
uniform_str = shader_get_uniform(shader, "strength");
|
||||
|
||||
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
|
||||
inputs[| 1] = nodeValue("Center", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0.5, 0.5 ])
|
||||
|
@ -13,16 +8,23 @@ function Node_Chromatic_Aberration(_x, _y, _group = noone) : Node_Processor(_x,
|
|||
.setUnitRef(function(index) { return getDimension(index); }, VALUE_UNIT.reference);
|
||||
|
||||
inputs[| 2] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [-16, 16, 0.01] });
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [-16, 16, 0.01] })
|
||||
.setMappable(4);
|
||||
|
||||
inputs[| 3] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
|
||||
active_index = 3;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 4] = nodeValueMap("Strength map", self);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
input_display_list = [ 3,
|
||||
["Surface", false], 0,
|
||||
["Effect", false], 1, 2,
|
||||
["Effect", false], 1, 2, 4,
|
||||
]
|
||||
|
||||
attribute_surface_depth();
|
||||
|
@ -36,16 +38,18 @@ function Node_Chromatic_Aberration(_x, _y, _group = noone) : Node_Processor(_x,
|
|||
inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
}
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
var center = _data[1];
|
||||
var stren = _data[2];
|
||||
static step = function() { #region
|
||||
inputs[| 2].mappableStep();
|
||||
} #endregion
|
||||
|
||||
surface_set_shader(_outSurf, shader);
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
|
||||
surface_set_shader(_outSurf, sh_chromatic_aberration);
|
||||
shader_set_interpolation(_data[0]);
|
||||
shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]) ]);
|
||||
shader_set_uniform_f_array_safe(uniform_cen, center);
|
||||
shader_set_uniform_f(uniform_str, stren);
|
||||
draw_surface_safe(_data[0], 0, 0);
|
||||
shader_set_f("dimension", surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]));
|
||||
shader_set_f("center", _data[1]);
|
||||
shader_set_f_map("strength", _data[2], _data[4], inputs[| 2]);
|
||||
draw_surface_safe(_data[0]);
|
||||
surface_reset_shader();
|
||||
|
||||
return _outSurf;
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
function Node_Color_Remove(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Remove Color";
|
||||
|
||||
shader = sh_color_remove;
|
||||
uniform_from = shader_get_uniform(shader, "colorFrom");
|
||||
uniform_from_count = shader_get_uniform(shader, "colorFrom_amo");
|
||||
uniform_invert = shader_get_uniform(shader, "invert");
|
||||
|
||||
uniform_ter = shader_get_uniform(shader, "treshold");
|
||||
|
||||
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
|
||||
inputs[| 1] = nodeValue("Colors", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, DEF_PALETTE )
|
||||
.setDisplay(VALUE_DISPLAY.palette);
|
||||
|
||||
inputs[| 2] = nodeValue("Threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1)
|
||||
.setDisplay(VALUE_DISPLAY.slider);
|
||||
.setDisplay(VALUE_DISPLAY.slider)
|
||||
.setMappable(10);
|
||||
|
||||
inputs[| 3] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
|
||||
|
@ -31,9 +25,15 @@ function Node_Color_Remove(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
|
|||
|
||||
__init_mask_modifier(3); // inputs 8, 9,
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 10] = nodeValueMap("Threshold map", self);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
input_display_list = [ 5, 7,
|
||||
["Surfaces", true], 0, 3, 4, 8, 9,
|
||||
["Remove", false], 1, 2, 6,
|
||||
["Remove", false], 1, 2, 10, 6,
|
||||
]
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
@ -42,32 +42,25 @@ function Node_Color_Remove(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
|
|||
|
||||
static step = function() { #region
|
||||
__step_mask_modifier();
|
||||
|
||||
inputs[| 2].mappableStep();
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
var frm = _data[1];
|
||||
var thr = _data[2];
|
||||
var inv = _data[6];
|
||||
|
||||
var _colors = [];
|
||||
for(var i = 0; i < array_length(frm); i++)
|
||||
array_append(_colors, colToVec4(frm[i]));
|
||||
|
||||
surface_set_target(_outSurf);
|
||||
DRAW_CLEAR
|
||||
BLEND_OVERRIDE;
|
||||
|
||||
shader_set(shader);
|
||||
shader_set_uniform_f_array_safe(uniform_from, _colors);
|
||||
shader_set_uniform_i(uniform_from_count, array_length(frm));
|
||||
shader_set_uniform_f(uniform_ter, thr);
|
||||
shader_set_uniform_i(uniform_invert, inv);
|
||||
surface_set_shader(_outSurf, sh_color_remove);
|
||||
shader_set_f("colorFrom", _colors);
|
||||
shader_set_i("colorFrom_amo", array_length(frm));
|
||||
shader_set_f_map("treshold", _data[2], _data[10], inputs[| 2]);
|
||||
shader_set_i("invert", _data[6]);
|
||||
|
||||
draw_surface_safe(_data[0], 0, 0);
|
||||
shader_reset();
|
||||
|
||||
BLEND_NORMAL;
|
||||
surface_reset_target();
|
||||
surface_reset_shader();
|
||||
|
||||
__process_mask_modifier(_data);
|
||||
_outSurf = mask_apply(_data[0], _outSurf, _data[3], _data[4]);
|
||||
|
|
|
@ -122,7 +122,7 @@ function Node_Colors_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
|
|||
input_display_list = [ 6,
|
||||
["Surfaces", true], 0, 4, 5, 7, 8,
|
||||
["Replace", false], render_palette, 2,
|
||||
["Comparison", false], 3,
|
||||
//["Comparison", false], 3,
|
||||
];
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
|
|
@ -1,20 +1,13 @@
|
|||
function Node_Colorize(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Colorize";
|
||||
|
||||
shader = sh_colorize;
|
||||
uniform_grad_blend = shader_get_uniform(shader, "gradient_blend");
|
||||
uniform_color = shader_get_uniform(shader, "gradient_color");
|
||||
uniform_time = shader_get_uniform(shader, "gradient_time");
|
||||
uniform_shift = shader_get_uniform(shader, "gradient_shift");
|
||||
uniform_key = shader_get_uniform(shader, "gradient_keys");
|
||||
uniform_alpha = shader_get_uniform(shader, "multiply_alpha");
|
||||
|
||||
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
|
||||
inputs[| 1] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject([ c_black, c_white ]) );
|
||||
|
||||
inputs[| 2] = nodeValue("Gradient shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [ -1, 1, .01 ] });
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [ -1, 1, .01 ] })
|
||||
.setMappable(10);
|
||||
|
||||
inputs[| 3] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
|
||||
|
@ -31,9 +24,15 @@ function Node_Colorize(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
|
||||
__init_mask_modifier(3); // inputs 8, 9,
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 10] = nodeValueMap("Gradient shift map", self);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
input_display_list = [ 5, 7,
|
||||
["Surfaces", true], 0, 3, 4, 8, 9,
|
||||
["Colorize", false], 1, 2, 6,
|
||||
["Colorize", false], 1, 2, 10, 6,
|
||||
]
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
@ -42,34 +41,21 @@ function Node_Colorize(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
|
||||
static step = function() { #region
|
||||
__step_mask_modifier();
|
||||
|
||||
inputs[| 2].mappableStep();
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
var _gra = _data[1];
|
||||
var _gra_shift = _data[2];
|
||||
var _alpha = _data[6];
|
||||
|
||||
var _grad = _gra.toArray();
|
||||
var _grad_color = _grad[0];
|
||||
var _grad_time = _grad[1];
|
||||
surface_set_shader(_outSurf, sh_colorize);
|
||||
_gra.shader_submit();
|
||||
|
||||
surface_set_target(_outSurf);
|
||||
DRAW_CLEAR
|
||||
BLEND_OVERRIDE;
|
||||
shader_set_f_map("gradient_shift", _data[2], _data[10], inputs[| 2]);
|
||||
shader_set_i("multiply_alpha", _data[6]);
|
||||
|
||||
shader_set(shader);
|
||||
shader_set_uniform_i(uniform_grad_blend, _gra.type);
|
||||
shader_set_uniform_f_array_safe(uniform_color, _grad_color);
|
||||
shader_set_uniform_f_array_safe(uniform_time, _grad_time);
|
||||
shader_set_uniform_f(uniform_shift, _gra_shift);
|
||||
shader_set_uniform_i(uniform_key, array_length(_gra.keys));
|
||||
shader_set_uniform_i(uniform_alpha, _alpha);
|
||||
|
||||
draw_surface_safe(_data[0], 0, 0);
|
||||
shader_reset();
|
||||
|
||||
BLEND_NORMAL;
|
||||
surface_reset_target();
|
||||
draw_surface_safe(_data[0]);
|
||||
surface_reset_shader();
|
||||
|
||||
__process_mask_modifier(_data);
|
||||
_outSurf = mask_apply(_data[0], _outSurf, _data[3], _data[4]);
|
||||
|
|
|
@ -11,24 +11,33 @@ function Node_Combine_RGB(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
|||
.setDisplay(VALUE_DISPLAY.enum_scroll, ["Brightness", "Channel value"]);
|
||||
|
||||
inputs[| 5] = nodeValue("Base value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0, "Set value to the unconnected color channels.")
|
||||
.setDisplay(VALUE_DISPLAY.slider);
|
||||
.setDisplay(VALUE_DISPLAY.slider)
|
||||
.setMappable(6);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 6] = nodeValueMap("Base value", self);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
input_display_list = [
|
||||
["Sampling", false], 4, 5,
|
||||
["Sampling", false], 4, 5, 6,
|
||||
["Surfaces", true], 0, 1, 2, 3,
|
||||
]
|
||||
|
||||
attribute_surface_depth();
|
||||
|
||||
static step = function() { #region
|
||||
inputs[| 5].mappableStep();
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
var _r = _data[0];
|
||||
var _g = _data[1];
|
||||
var _b = _data[2];
|
||||
var _a = _data[3];
|
||||
var _mode = _data[4];
|
||||
var _base = _data[5];
|
||||
|
||||
var _baseS = _r;
|
||||
if(!is_surface(_baseS)) _baseS = _g;
|
||||
|
@ -48,8 +57,8 @@ 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_f("base", _base);
|
||||
shader_set_i("mode", _mode);
|
||||
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));
|
||||
surface_reset_shader();
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
function Node_Dilate(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Dilate";
|
||||
|
||||
shader = sh_dilate;
|
||||
uniform_dim = shader_get_uniform(shader, "dimension");
|
||||
uniform_cen = shader_get_uniform(shader, "center");
|
||||
uniform_str = shader_get_uniform(shader, "strength");
|
||||
uniform_rad = shader_get_uniform(shader, "radius");
|
||||
uniform_sam = shader_get_uniform(shader, "sampleMode");
|
||||
|
||||
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
|
||||
inputs[| 1] = nodeValue("Center", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ])
|
||||
|
@ -15,9 +8,11 @@ function Node_Dilate(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
.setUnitRef(function(index) { return getDimension(index); });
|
||||
|
||||
inputs[| 2] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [-3, 3, 0.01] });
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [-3, 3, 0.01] })
|
||||
.setMappable(11);
|
||||
|
||||
inputs[| 3] = nodeValue("Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 16);
|
||||
inputs[| 3] = nodeValue("Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 16)
|
||||
.setMappable(12);
|
||||
|
||||
inputs[| 4] = nodeValue("Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.")
|
||||
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Empty", "Clamp", "Repeat" ]);
|
||||
|
@ -35,11 +30,21 @@ function Node_Dilate(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
|
||||
__init_mask_modifier(5); // inputs 9, 10
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 11] = nodeValue("Strength map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone)
|
||||
.setVisible(false, false);
|
||||
|
||||
inputs[| 12] = nodeValue("Radius map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone)
|
||||
.setVisible(false, false);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
input_display_list = [ 7, 8,
|
||||
["Surfaces", true], 0, 5, 6, 9, 10,
|
||||
["Dilate", false], 1, 2, 3,
|
||||
["Dilate", false], 1, 2, 11, 3, 12,
|
||||
];
|
||||
|
||||
attribute_surface_depth();
|
||||
|
@ -58,21 +63,22 @@ function Node_Dilate(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
|
||||
static step = function() { #region
|
||||
__step_mask_modifier();
|
||||
|
||||
inputs[| 2].mappableStep();
|
||||
inputs[| 3].mappableStep();
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
var center = _data[1];
|
||||
var stren = _data[2];
|
||||
var rad = _data[3];
|
||||
var sam = struct_try_get(attributes, "oversample");
|
||||
var sam = struct_try_get(attributes, "oversample");
|
||||
|
||||
surface_set_shader(_outSurf, shader);
|
||||
surface_set_shader(_outSurf, sh_dilate);
|
||||
shader_set_interpolation(_data[0]);
|
||||
shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]) ]);
|
||||
shader_set_uniform_f_array_safe(uniform_cen, center);
|
||||
shader_set_uniform_f(uniform_str, stren);
|
||||
shader_set_uniform_f(uniform_rad, rad);
|
||||
shader_set_uniform_i(uniform_sam, sam);
|
||||
shader_set_f("dimension", [ surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]) ]);
|
||||
shader_set_f("center", _data[1]);
|
||||
shader_set_f_map("strength", _data[2], _data[11], inputs[| 2]);
|
||||
shader_set_f_map("radius", _data[3], _data[12], inputs[| 3]);
|
||||
|
||||
shader_set_i("sampleMode", sam);
|
||||
draw_surface_safe(_data[0], 0, 0);
|
||||
surface_reset_shader();
|
||||
|
||||
|
|
|
@ -43,9 +43,13 @@ If set, then strength value control how many times the effect applies on itself.
|
|||
|
||||
__init_mask_modifier(8); // inputs 13, 14
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 15] = nodeValue("Strength map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone)
|
||||
.setVisible(false, false);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
input_display_list = [ 10, 12,
|
||||
["Surfaces", true], 0, 8, 9, 13, 14,
|
||||
["Displace", false], 1, 3, 15, 4,
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
function Node_Erode(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Erode";
|
||||
|
||||
shader = sh_erode;
|
||||
uniform_dim = shader_get_uniform(shader, "dimension");
|
||||
uniform_size = shader_get_uniform(shader, "size");
|
||||
uniform_bor = shader_get_uniform(shader, "border");
|
||||
uniform_alp = shader_get_uniform(shader, "alpha");
|
||||
|
||||
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
|
||||
inputs[| 1] = nodeValue("Width", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1);
|
||||
inputs[| 1] = nodeValue("Width", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1)
|
||||
.setMappable(10);
|
||||
|
||||
inputs[| 2] = nodeValue("Preserve border",self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
|
||||
|
||||
|
@ -28,9 +23,16 @@ function Node_Erode(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
|
|||
|
||||
__init_mask_modifier(4); // inputs 8, 9,
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 10] = nodeValue("Width map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone)
|
||||
.setVisible(false, false);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
input_display_list = [ 6, 7,
|
||||
["Surfaces", true], 0, 4, 5, 8, 9,
|
||||
["Erode", false], 1, 2, 3,
|
||||
["Erode", false], 1, 10, 2, 3,
|
||||
]
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
@ -39,25 +41,19 @@ function Node_Erode(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
|
|||
|
||||
static step = function() { #region
|
||||
__step_mask_modifier();
|
||||
|
||||
inputs[| 1].mappableStep();
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
var wd = _data[1];
|
||||
|
||||
surface_set_target(_outSurf);
|
||||
DRAW_CLEAR
|
||||
BLEND_OVERRIDE;
|
||||
|
||||
shader_set(shader);
|
||||
shader_set_uniform_f_array_safe(uniform_dim, [surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0])]);
|
||||
shader_set_uniform_f(uniform_size, wd);
|
||||
shader_set_uniform_i(uniform_bor, _data[2]? 1 : 0);
|
||||
shader_set_uniform_i(uniform_alp, _data[3]? 1 : 0);
|
||||
surface_set_shader(_outSurf, sh_erode);
|
||||
shader_set_f("dimension", surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]));
|
||||
shader_set_f_map("size" , _data[1], _data[10], inputs[| 1]);
|
||||
shader_set_i("border" , _data[2]);
|
||||
shader_set_i("alpha" , _data[3]);
|
||||
draw_surface_safe(_data[0], 0, 0);
|
||||
shader_reset();
|
||||
|
||||
BLEND_NORMAL;
|
||||
surface_reset_target();
|
||||
surface_reset_shader();
|
||||
|
||||
__process_mask_modifier(_data);
|
||||
_outSurf = mask_apply(_data[0], _outSurf, _data[4], _data[5]);
|
||||
|
|
|
@ -1,20 +1,6 @@
|
|||
function Node_Gradient(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Draw Gradient";
|
||||
|
||||
shader = sh_gradient;
|
||||
uniform_grad_blend = shader_get_uniform(shader, "gradient_blend");
|
||||
uniform_grad = shader_get_uniform(shader, "gradient_color");
|
||||
uniform_grad_time = shader_get_uniform(shader, "gradient_time");
|
||||
uniform_grad_key = shader_get_uniform(shader, "gradient_keys");
|
||||
uniform_grad_loop = shader_get_uniform(shader, "gradient_loop");
|
||||
|
||||
uniform_type = shader_get_uniform(shader, "type");
|
||||
uniform_center = shader_get_uniform(shader, "center");
|
||||
|
||||
uniform_angle = shader_get_uniform(shader, "angle");
|
||||
uniform_radius = shader_get_uniform(shader, "radius");
|
||||
uniform_radius_shf = shader_get_uniform(shader, "shift");
|
||||
|
||||
inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF )
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
|
||||
|
@ -24,12 +10,15 @@ function Node_Gradient(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Linear", "Circular", "Radial" ]);
|
||||
|
||||
inputs[| 3] = nodeValue("Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
.setDisplay(VALUE_DISPLAY.rotation);
|
||||
.setDisplay(VALUE_DISPLAY.rotation)
|
||||
.setMappable(10);
|
||||
|
||||
inputs[| 4] = nodeValue("Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, .5);
|
||||
inputs[| 4] = nodeValue("Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, .5)
|
||||
.setMappable(11);
|
||||
|
||||
inputs[| 5] = nodeValue("Shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [-2, 2, 0.01] });
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [-2, 2, 0.01] })
|
||||
.setMappable(12);
|
||||
|
||||
inputs[| 6] = nodeValue("Center", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0.5, 0.5 ])
|
||||
.setDisplay(VALUE_DISPLAY.vector)
|
||||
|
@ -40,14 +29,27 @@ function Node_Gradient(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
inputs[| 8] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
|
||||
|
||||
inputs[| 9] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 2, 0.01] });
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 2, 0.01] })
|
||||
.setMappable(13);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 10] = nodeValueMap("Angle map", self);
|
||||
|
||||
inputs[| 11] = nodeValueMap("Radius map", self);
|
||||
|
||||
inputs[| 12] = nodeValueMap("Shift map", self);
|
||||
|
||||
inputs[| 13] = nodeValueMap("Scale map", self);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
input_display_list = [
|
||||
["Output", true], 0, 8,
|
||||
["Gradient", false], 1, 5, 9, 7,
|
||||
["Shape", false], 2, 3, 4, 6
|
||||
["Gradient", false], 1, 5, 12, 9, 13, 7,
|
||||
["Shape", false], 2, 3, 10, 4, 11, 6,
|
||||
];
|
||||
|
||||
attribute_surface_depth();
|
||||
|
@ -56,29 +58,22 @@ function Node_Gradient(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
inputs[| 6].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
}
|
||||
|
||||
static step = function() { #region
|
||||
inputs[| 3].mappableStep();
|
||||
inputs[| 4].mappableStep();
|
||||
inputs[| 5].mappableStep();
|
||||
inputs[| 9].mappableStep();
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
var _dim = _data[0];
|
||||
|
||||
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
|
||||
|
||||
var _gra = _data[1];
|
||||
//print("Draw gradient " + string(_gra))
|
||||
|
||||
var _typ = _data[2];
|
||||
var _ang = _data[3];
|
||||
var _rad = _data[4];
|
||||
var _shf = _data[5];
|
||||
var _cnt = _data[6];
|
||||
var _lop = _data[7];
|
||||
var _msk = _data[8];
|
||||
var _sca = _data[9];
|
||||
|
||||
var _grad = _gra.toArray();
|
||||
var _grad_color = _grad[0];
|
||||
var _grad_time = _grad[1];
|
||||
|
||||
for( var i = 0, n = array_length(_grad_time); i < n; i++ )
|
||||
_grad_time[i] = 0.5 + (_grad_time[i] - 0.5) * _sca;
|
||||
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
|
||||
|
||||
if(_typ == 0 || _typ == 2) {
|
||||
inputs[| 3].setVisible(true);
|
||||
|
@ -88,30 +83,21 @@ function Node_Gradient(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
inputs[| 4].setVisible(true);
|
||||
}
|
||||
|
||||
surface_set_target(_outSurf);
|
||||
DRAW_CLEAR
|
||||
shader_set(shader);
|
||||
shader_set_uniform_i(uniform_grad_blend, _gra.type);
|
||||
shader_set_uniform_f_array_safe(uniform_grad, _grad_color);
|
||||
shader_set_uniform_f_array_safe(uniform_grad_time, _grad_time);
|
||||
shader_set_uniform_i(uniform_grad_key, array_length(_gra.keys));
|
||||
shader_set_uniform_i(uniform_grad_loop, _lop);
|
||||
surface_set_shader(_outSurf, sh_gradient);
|
||||
_gra.shader_submit();
|
||||
|
||||
shader_set_uniform_f_array_safe(uniform_center, [_cnt[0] / _dim[0], _cnt[1] / _dim[1]]);
|
||||
shader_set_uniform_i(uniform_type, _typ);
|
||||
shader_set_i("gradient_loop", _lop);
|
||||
shader_set_f("center", _cnt[0] / _dim[0], _cnt[1] / _dim[1]);
|
||||
shader_set_i("type", _typ);
|
||||
|
||||
shader_set_uniform_f(uniform_angle, degtorad(_ang));
|
||||
shader_set_uniform_f(uniform_radius, _rad * sqrt(2));
|
||||
shader_set_uniform_f(uniform_radius_shf, _shf);
|
||||
shader_set_f_map("angle", _data[3], _data[10], inputs[| 3]);
|
||||
shader_set_f_map("radius", _data[4], _data[11], inputs[| 4]);
|
||||
shader_set_f_map("shift", _data[5], _data[12], inputs[| 5]);
|
||||
shader_set_f_map("scale", _data[9], _data[13], inputs[| 9]);
|
||||
|
||||
BLEND_OVERRIDE;
|
||||
if(is_surface(_msk))
|
||||
draw_surface_stretched_ext(_msk, 0, 0, _dim[0], _dim[1], c_white, 1);
|
||||
else
|
||||
draw_sprite_stretched_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], c_white, 1);
|
||||
BLEND_NORMAL;
|
||||
shader_reset();
|
||||
surface_reset_target();
|
||||
if(is_surface(_msk)) draw_surface_stretched_ext(_msk, 0, 0, _dim[0], _dim[1], c_white, 1);
|
||||
else draw_sprite_stretched_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], c_white, 1);
|
||||
surface_reset_shader();
|
||||
|
||||
return _outSurf;
|
||||
}
|
||||
|
|
|
@ -9,13 +9,16 @@ function Node_Grid(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
.setUnitRef(function(index) { return getDimension(index); });
|
||||
|
||||
inputs[| 2] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 2, 2 ])
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
.setDisplay(VALUE_DISPLAY.vector)
|
||||
.setMappable(13);
|
||||
|
||||
inputs[| 3] = nodeValue("Gap", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1)
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 0.5, 0.01] });
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 0.5, 0.01] })
|
||||
.setMappable(14);
|
||||
|
||||
inputs[| 4] = nodeValue("Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
||||
.setDisplay(VALUE_DISPLAY.rotation);
|
||||
.setDisplay(VALUE_DISPLAY.rotation)
|
||||
.setMappable(15);
|
||||
|
||||
inputs[| 5] = nodeValue("Tile color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) );
|
||||
|
||||
|
@ -24,7 +27,8 @@ function Node_Grid(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
inputs[| 7] = nodeValue("Texture", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
|
||||
inputs[| 8] = nodeValue("Shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [-0.5, 0.5, 0.01] });
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [-0.5, 0.5, 0.01] })
|
||||
.setMappable(16);
|
||||
|
||||
inputs[| 9] = nodeValue("Shift axis", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
.setDisplay(VALUE_DISPLAY.enum_button, ["X", "Y"]);
|
||||
|
@ -36,9 +40,21 @@ function Node_Grid(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
|
||||
inputs[| 12] = nodeValue("Anti aliasing", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 13] = nodeValueMap("Scale map", self);
|
||||
|
||||
inputs[| 14] = nodeValueMap("Gap map", self);
|
||||
|
||||
inputs[| 15] = nodeValueMap("Angle map", self);
|
||||
|
||||
inputs[| 16] = nodeValueMap("Shift map", self);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
input_display_list = [
|
||||
["Output", false], 0,
|
||||
["Pattern", false], 1, 4, 2, 3, 9, 8,
|
||||
["Pattern", false], 1, 4, 15, 2, 13, 3, 14, 9, 8, 16,
|
||||
["Render", false], 10, 11, 5, 6, 7, 12,
|
||||
];
|
||||
|
||||
|
@ -50,43 +66,40 @@ function Node_Grid(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
}
|
||||
|
||||
static step = function() { #region
|
||||
inputs[| 2].mappableStep();
|
||||
inputs[| 3].mappableStep();
|
||||
inputs[| 4].mappableStep();
|
||||
inputs[| 8].mappableStep();
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
var _dim = _data[0];
|
||||
var _pos = _data[1];
|
||||
var _sca = _data[2];
|
||||
var _wid = _data[3];
|
||||
var _ang = _data[4];
|
||||
var _sam = _data[7];
|
||||
var _shf = _data[8];
|
||||
var _shx = _data[9];
|
||||
var _dim = _data[ 0];
|
||||
var _pos = _data[ 1];
|
||||
var _sam = _data[ 7];
|
||||
var _mode = _data[10];
|
||||
var _sed = _data[11];
|
||||
var _aa = _data[12];
|
||||
|
||||
var _col_gap = _data[6];
|
||||
var _gra = _data[5];
|
||||
|
||||
var _grad = _gra.toArray();
|
||||
var _grad_color = _grad[0];
|
||||
var _grad_time = _grad[1];
|
||||
|
||||
inputs[| 5].setVisible(_mode == 0);
|
||||
inputs[| 6].setVisible(_mode != 1);
|
||||
inputs[| 7].setVisible(_mode == 2 || _mode == 3);
|
||||
|
||||
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
|
||||
|
||||
surface_set_shader(_outSurf, sh_grid);
|
||||
shader_set_f("position", _pos[0] / _dim[0], _pos[1] / _dim[1]);
|
||||
shader_set_f("dimension", _dim[0], _dim[1]);
|
||||
shader_set_f("scale", _sca);
|
||||
shader_set_f("width", _wid);
|
||||
shader_set_f("angle", degtorad(_ang));
|
||||
shader_set_f("shift", _shx? _shf / _sca[1] : _shf / _sca[0]);
|
||||
shader_set_f("seed", _sed);
|
||||
shader_set_i("shiftAxis", _shx);
|
||||
|
||||
shader_set_f_map("scale", _data[ 2], _data[13], inputs[| 2]);
|
||||
shader_set_f_map("width", _data[ 3], _data[14], inputs[| 3]);
|
||||
shader_set_f_map("angle", _data[ 4], _data[15], inputs[| 4]);
|
||||
shader_set_f_map("shift", _data[ 8], _data[16], inputs[| 8]);
|
||||
|
||||
shader_set_i("mode", _mode);
|
||||
shader_set_i("aa", _aa);
|
||||
shader_set_f("seed", _data[11]);
|
||||
shader_set_i("shiftAxis", _data[ 9]);
|
||||
shader_set_i("aa", _data[12]);
|
||||
shader_set_color("gapCol", _col_gap);
|
||||
|
||||
_gra.shader_submit();
|
||||
|
|
|
@ -9,13 +9,16 @@ function Node_Grid_Hex(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
.setUnitRef(function(index) { return getDimension(index); });
|
||||
|
||||
inputs[| 2] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 2, 2 ])
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
.setDisplay(VALUE_DISPLAY.vector)
|
||||
.setMappable(11);
|
||||
|
||||
inputs[| 3] = nodeValue("Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
.setDisplay(VALUE_DISPLAY.rotation);
|
||||
.setDisplay(VALUE_DISPLAY.rotation)
|
||||
.setMappable(12);
|
||||
|
||||
inputs[| 4] = nodeValue("Gap", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1)
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 0.5, 0.01] });
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 0.5, 0.01] })
|
||||
.setMappable(13);
|
||||
|
||||
inputs[| 5] = nodeValue("Tile color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) );
|
||||
|
||||
|
@ -30,9 +33,19 @@ function Node_Grid_Hex(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
|
||||
inputs[| 10] = nodeValue("Anti aliasing", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 11] = nodeValueMap("Scale map", self);
|
||||
|
||||
inputs[| 12] = nodeValueMap("Angle map", self);
|
||||
|
||||
inputs[| 13] = nodeValueMap("Gap map", self);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
input_display_list = [
|
||||
["Output", false], 0,
|
||||
["Pattern", false], 1, 3, 2, 4,
|
||||
["Pattern", false], 1, 3, 12, 2, 11, 4, 13,
|
||||
["Render", false], 7, 8, 5, 6, 9, 10,
|
||||
];
|
||||
|
||||
|
@ -44,24 +57,21 @@ function Node_Grid_Hex(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
}
|
||||
|
||||
static step = function() { #region
|
||||
inputs[| 2].mappableStep();
|
||||
inputs[| 3].mappableStep();
|
||||
inputs[| 4].mappableStep();
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
var _dim = _data[0];
|
||||
var _pos = _data[1];
|
||||
var _sca = _data[2];
|
||||
var _rot = _data[3];
|
||||
var _thk = _data[4];
|
||||
var _mode = _data[7];
|
||||
var _sed = _data[8];
|
||||
var _sam = _data[9];
|
||||
var _aa = _data[10];
|
||||
var _mode = _data[7];
|
||||
|
||||
var _col_gap = _data[6];
|
||||
var _gra = _data[5];
|
||||
|
||||
var _grad = _gra.toArray();
|
||||
var _grad_color = _grad[0];
|
||||
var _grad_time = _grad[1];
|
||||
|
||||
inputs[| 5].setVisible(_mode == 0);
|
||||
inputs[| 6].setVisible(_mode != 1);
|
||||
inputs[| 9].setVisible(_mode == 2 || _mode == 3);
|
||||
|
@ -71,12 +81,14 @@ function Node_Grid_Hex(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
surface_set_shader(_outSurf, sh_grid_hex);
|
||||
shader_set_f("dimension", _dim[0], _dim[1]);
|
||||
shader_set_f("position", _pos[0] / _dim[0], _pos[1] / _dim[1]);
|
||||
shader_set_f("scale", _sca[0], _sca[1]);
|
||||
shader_set_f("angle", degtorad(_rot));
|
||||
shader_set_f("thick", _thk);
|
||||
shader_set_f("seed", _sed);
|
||||
shader_set_i("mode", _mode);
|
||||
shader_set_i("aa", _aa);
|
||||
|
||||
shader_set_f_map("scale", _data[ 2], _data[11], inputs[| 2]);
|
||||
shader_set_f_map("angle", _data[ 3], _data[12], inputs[| 3]);
|
||||
shader_set_f_map("thick", _data[ 4], _data[13], inputs[| 4]);
|
||||
|
||||
shader_set_f("seed", _data[ 8]);
|
||||
shader_set_i("mode", _mode);
|
||||
shader_set_i("aa", _data[10]);
|
||||
shader_set_color("gapCol",_col_gap);
|
||||
|
||||
_gra.shader_submit();
|
||||
|
|
|
@ -9,13 +9,16 @@ function Node_Grid_Tri(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
.setUnitRef(function(index) { return getDimension(index); });
|
||||
|
||||
inputs[| 2] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 2, 2 ])
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
.setDisplay(VALUE_DISPLAY.vector)
|
||||
.setMappable(11);
|
||||
|
||||
inputs[| 3] = nodeValue("Gap", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1)
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 0.5, 0.01] });
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 0.5, 0.01] })
|
||||
.setMappable(12);
|
||||
|
||||
inputs[| 4] = nodeValue("Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
||||
.setDisplay(VALUE_DISPLAY.rotation);
|
||||
.setDisplay(VALUE_DISPLAY.rotation)
|
||||
.setMappable(13);
|
||||
|
||||
inputs[| 5] = nodeValue("Tile color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) );
|
||||
|
||||
|
@ -30,9 +33,19 @@ function Node_Grid_Tri(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
|
||||
inputs[| 10] = nodeValue("Anti aliasing", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 11] = nodeValueMap("Scale map", self);
|
||||
|
||||
inputs[| 12] = nodeValueMap("Gap map", self);
|
||||
|
||||
inputs[| 13] = nodeValueMap("Angle map", self);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
input_display_list = [
|
||||
["Output", false], 0,
|
||||
["Pattern", false], 1, 4, 2, 3,
|
||||
["Pattern", false], 1, 4, 13, 2, 11, 3, 12,
|
||||
["Render", false], 8, 9, 5, 6, 7, 10,
|
||||
];
|
||||
|
||||
|
@ -44,12 +57,15 @@ function Node_Grid_Tri(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
}
|
||||
|
||||
static step = function() { #region
|
||||
inputs[| 2].mappableStep();
|
||||
inputs[| 3].mappableStep();
|
||||
inputs[| 4].mappableStep();
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
var _dim = _data[0];
|
||||
var _pos = _data[1];
|
||||
var _sca = _data[2];
|
||||
var _wid = _data[3];
|
||||
var _ang = _data[4];
|
||||
var _sam = _data[7];
|
||||
var _mode = _data[8];
|
||||
var _sed = _data[9];
|
||||
|
@ -71,9 +87,11 @@ function Node_Grid_Tri(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
surface_set_shader(_outSurf, sh_grid_tri);
|
||||
shader_set_f("position", _pos[0] / _dim[0], _pos[1] / _dim[1]);
|
||||
shader_set_f("dimension", _dim[0], _dim[1]);
|
||||
shader_set_f("scale", _sca);
|
||||
shader_set_f("width", _wid);
|
||||
shader_set_f("angle", degtorad(_ang));
|
||||
|
||||
shader_set_f_map("scale", _data[2], _data[11], inputs[| 2]);
|
||||
shader_set_f_map("width", _data[3], _data[12], inputs[| 3]);
|
||||
shader_set_f_map("angle", _data[4], _data[13], inputs[| 4]);
|
||||
|
||||
shader_set_f("seed", _sed);
|
||||
shader_set_i("mode", _mode);
|
||||
shader_set_i("aa", _aa);
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
function Node_Level_Selector(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Level Selector";
|
||||
|
||||
shader = sh_level_selector;
|
||||
uniform_middle = shader_get_uniform(shader, "middle");
|
||||
uniform_range = shader_get_uniform(shader, "range");
|
||||
|
||||
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
|
||||
inputs[| 1] = nodeValue("Mid point", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
||||
.setDisplay(VALUE_DISPLAY.slider);
|
||||
inputs[| 1] = nodeValue("Midpoint", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
||||
.setDisplay(VALUE_DISPLAY.slider)
|
||||
.setMappable(9);
|
||||
|
||||
inputs[| 2] = nodeValue("Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1)
|
||||
.setDisplay(VALUE_DISPLAY.slider);
|
||||
.setDisplay(VALUE_DISPLAY.slider)
|
||||
.setMappable(10);
|
||||
|
||||
inputs[| 3] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
|
||||
|
@ -26,6 +24,14 @@ function Node_Level_Selector(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
|
|||
|
||||
__init_mask_modifier(3); // inputs 7, 8,
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 9] = nodeValueMap("Midpoint map", self);
|
||||
|
||||
inputs[| 10] = nodeValueMap("Range map", self);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
attribute_surface_depth();
|
||||
|
@ -40,6 +46,10 @@ function Node_Level_Selector(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
|
|||
|
||||
var _middle = getInputData(1);
|
||||
var _span = getInputData(2);
|
||||
|
||||
if(is_array(_middle)) _middle = array_safe_get(_middle, 0);
|
||||
if(is_array(_span)) _span = array_safe_get(_span, 0);
|
||||
|
||||
var _min = _middle - _span;
|
||||
var _max = _middle + _span;
|
||||
|
||||
|
@ -68,7 +78,7 @@ function Node_Level_Selector(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
|
|||
input_display_list = [ 5, 6,
|
||||
level_renderer,
|
||||
["Surfaces", true], 0, 3, 4, 7, 8,
|
||||
["Level", false], 1, 2,
|
||||
["Level", false], 1, 9, 2, 10,
|
||||
];
|
||||
histogramInit();
|
||||
|
||||
|
@ -87,25 +97,19 @@ function Node_Level_Selector(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
|
|||
|
||||
static step = function() { #region
|
||||
__step_mask_modifier();
|
||||
|
||||
inputs[| 1].mappableStep();
|
||||
inputs[| 2].mappableStep();
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
var _middle = _data[1];
|
||||
var _range = _data[2];
|
||||
|
||||
surface_set_target(_outSurf);
|
||||
DRAW_CLEAR
|
||||
BLEND_OVERRIDE;
|
||||
|
||||
shader_set(shader);
|
||||
shader_set_uniform_f(uniform_middle, _middle);
|
||||
shader_set_uniform_f(uniform_range , _range );
|
||||
surface_set_shader(_outSurf, sh_level_selector);
|
||||
shader_set_f_map("middle", _data[1], _data[ 9], inputs[| 1]);
|
||||
shader_set_f_map("range" , _data[2], _data[10], inputs[| 2]);
|
||||
|
||||
draw_surface_safe(_data[0], 0, 0);
|
||||
shader_reset();
|
||||
|
||||
BLEND_NORMAL;
|
||||
surface_reset_target();
|
||||
surface_reset_shader();
|
||||
|
||||
__process_mask_modifier(_data);
|
||||
_outSurf = mask_apply(_data[0], _outSurf, _data[3], _data[4]);
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
function Node_Local_Analyze(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Local Analyze";
|
||||
|
||||
shader = sh_local_analyze;
|
||||
uniform_dim = shader_get_uniform(shader, "dimension");
|
||||
uniform_alg = shader_get_uniform(shader, "algorithm");
|
||||
uniform_siz = shader_get_uniform(shader, "size");
|
||||
uniform_sha = shader_get_uniform(shader, "shape");
|
||||
uniform_sam = shader_get_uniform(shader, "sampleMode");
|
||||
|
||||
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
|
||||
inputs[| 1] = nodeValue("Algorithm", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
|
@ -52,23 +45,16 @@ function Node_Local_Analyze(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
var _alg = _data[1];
|
||||
var _siz = _data[2];
|
||||
var _sam = struct_try_get(attributes, "oversample");
|
||||
var _shp = _data[4];
|
||||
var _sam = struct_try_get(attributes, "oversample");
|
||||
|
||||
surface_set_target(_outSurf);
|
||||
DRAW_CLEAR
|
||||
BLEND_OVERRIDE;
|
||||
|
||||
shader_set(shader);
|
||||
shader_set_uniform_f(uniform_dim, surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]));
|
||||
shader_set_uniform_i(uniform_alg, _alg);
|
||||
shader_set_uniform_i(uniform_sam, _sam);
|
||||
shader_set_uniform_i(uniform_sha, _shp);
|
||||
shader_set_uniform_f(uniform_siz, _siz);
|
||||
surface_set_shader(_outSurf, sh_local_analyze);
|
||||
shader_set_f("dimension" , surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]));
|
||||
shader_set_i("algorithm" , _alg);
|
||||
shader_set_f("size" , _siz);
|
||||
shader_set_i("shape" , _shp);
|
||||
shader_set_i("sampleMode", _sam);
|
||||
draw_surface_safe(_data[0], 0, 0);
|
||||
shader_reset();
|
||||
|
||||
BLEND_NORMAL;
|
||||
surface_reset_target();
|
||||
|
||||
__process_mask_modifier(_data);
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
function Node_Noise_Aniso(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Anisotropic Noise";
|
||||
|
||||
shader = sh_ani_noise;
|
||||
uniform_noi = shader_get_uniform(shader, "noiseAmount");
|
||||
uniform_sed = shader_get_uniform(shader, "seed");
|
||||
uniform_pos = shader_get_uniform(shader, "position");
|
||||
uniform_ang = shader_get_uniform(shader, "angle");
|
||||
|
||||
inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF )
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
|
||||
inputs[| 1] = nodeValue("Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 2, 16 ])
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
inputs[| 1] = nodeValue("X Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 2)
|
||||
.setMappable(6);
|
||||
|
||||
inputs[| 2] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, irandom(9999999));
|
||||
|
||||
|
@ -20,11 +14,25 @@ function Node_Noise_Aniso(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
|||
.setUnitRef(function(index) { return getDimension(index); });
|
||||
|
||||
inputs[| 4] = nodeValue("Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
||||
.setDisplay(VALUE_DISPLAY.rotation);
|
||||
.setDisplay(VALUE_DISPLAY.rotation)
|
||||
.setMappable(8);
|
||||
|
||||
inputs[| 5] = nodeValue("Y Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 16)
|
||||
.setMappable(7);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 6] = nodeValueMap("X Amount map", self);
|
||||
|
||||
inputs[| 7] = nodeValueMap("Y Amount map", self);
|
||||
|
||||
inputs[| 8] = nodeValueMap("Rotation map", self);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
input_display_list = [
|
||||
["Output", false], 0,
|
||||
["Noise", false], 2, 1, 3, 4
|
||||
["Noise", false], 2, 1, 6, 5, 7, 3, 4, 8
|
||||
];
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
@ -35,25 +43,28 @@ function Node_Noise_Aniso(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
|||
inputs[| 3].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
}
|
||||
|
||||
static step = function() { #region
|
||||
inputs[| 1].mappableStep();
|
||||
inputs[| 4].mappableStep();
|
||||
inputs[| 5].mappableStep();
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
var _dim = _data[0];
|
||||
var _amo = _data[1];
|
||||
var _sed = _data[2];
|
||||
var _pos = _data[3];
|
||||
var _ang = _data[4];
|
||||
|
||||
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
|
||||
|
||||
surface_set_target(_outSurf);
|
||||
shader_set(shader);
|
||||
shader_set_uniform_f_array_safe(uniform_noi, _amo);
|
||||
shader_set_uniform_f(uniform_pos, _pos[0] / _dim[0], _pos[1] / _dim[1]);
|
||||
shader_set_uniform_f(uniform_sed, _sed);
|
||||
shader_set_uniform_f(uniform_ang, degtorad(_ang));
|
||||
surface_set_shader(_outSurf, sh_ani_noise);
|
||||
shader_set_f("position", _pos[0] / _dim[0], _pos[1] / _dim[1]);
|
||||
shader_set_f("seed", _data[2]);
|
||||
|
||||
draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], 0, c_white, 1);
|
||||
shader_reset();
|
||||
surface_reset_target();
|
||||
shader_set_f_map("noiseX", _data[1], _data[6], inputs[| 1]);
|
||||
shader_set_f_map("noiseY", _data[5], _data[7], inputs[| 5]);
|
||||
shader_set_f_map("angle", _data[4], _data[8], inputs[| 4]);
|
||||
|
||||
draw_sprite_stretched(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1]);
|
||||
surface_reset_shader();
|
||||
|
||||
return _outSurf;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@ function Node_Cellular(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
.setDisplay(VALUE_DISPLAY.vector)
|
||||
.setUnitRef(function(index) { return getDimension(index); });
|
||||
|
||||
inputs[| 2] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 4);
|
||||
inputs[| 2] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 4)
|
||||
.setMappable(11);
|
||||
|
||||
inputs[| 3] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0);
|
||||
|
||||
|
@ -32,9 +33,15 @@ function Node_Cellular(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
|
||||
inputs[| 10] = nodeValue("Colored", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 11] = nodeValueMap("Scale map", self);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
input_display_list = [
|
||||
["Output", false], 0,
|
||||
["Noise", false], 4, 6, 3, 1, 2,
|
||||
["Noise", false], 4, 6, 3, 1, 2, 11,
|
||||
["Radial", false], 8, 9,
|
||||
["Rendering", false], 5, 7, 10,
|
||||
];
|
||||
|
@ -47,10 +54,13 @@ function Node_Cellular(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
}
|
||||
|
||||
static step = function() { #region
|
||||
inputs[| 2].mappableStep();
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
var _dim = _data[0];
|
||||
var _pos = _data[1];
|
||||
var _sca = _data[2];
|
||||
var _tim = _data[3];
|
||||
var _type = _data[4];
|
||||
var _con = _data[5];
|
||||
|
@ -79,7 +89,7 @@ function Node_Cellular(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
shader_set_f("dimension", _dim);
|
||||
shader_set_f("time", _tim);
|
||||
shader_set_f("position", _pos);
|
||||
shader_set_f("scale", _sca);
|
||||
shader_set_f_map("scale", _data[2], _data[11], inputs[| 2]);
|
||||
shader_set_f("contrast", _con);
|
||||
shader_set_f("middle", _mid);
|
||||
shader_set_f("radiusScale", _rad);
|
||||
|
|
|
@ -8,18 +8,21 @@ function Node_Gabor_Noise(_x, _y, _group = noone) : Node_Shader_Generator(_x, _y
|
|||
addShaderProp(SHADER_UNIFORM.float, "position");
|
||||
|
||||
inputs[| 2] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 4, 4 ])
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
.setDisplay(VALUE_DISPLAY.vector)
|
||||
.setMappable(8);
|
||||
addShaderProp(SHADER_UNIFORM.float, "scale");
|
||||
|
||||
inputs[| 3] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, irandom(99999));
|
||||
addShaderProp(SHADER_UNIFORM.float, "seed");
|
||||
|
||||
inputs[| 4] = nodeValue("Density", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 2)
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 4, 0.01 ] });
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 4, 0.01 ] })
|
||||
.setMappable(9);
|
||||
addShaderProp(SHADER_UNIFORM.float, "alignment");
|
||||
|
||||
inputs[| 5] = nodeValue("Sharpness", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 4)
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 5, 0.01 ] });
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 5, 0.01 ] })
|
||||
.setMappable(10);
|
||||
addShaderProp(SHADER_UNIFORM.float, "sharpness");
|
||||
|
||||
inputs[| 6] = nodeValue("Augment", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 11, 31 ])
|
||||
|
@ -27,9 +30,22 @@ function Node_Gabor_Noise(_x, _y, _group = noone) : Node_Shader_Generator(_x, _y
|
|||
addShaderProp(SHADER_UNIFORM.float, "augment");
|
||||
|
||||
inputs[| 7] = nodeValue("Phase", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
||||
.setDisplay(VALUE_DISPLAY.rotation);
|
||||
.setDisplay(VALUE_DISPLAY.rotation)
|
||||
.setMappable(11);
|
||||
addShaderProp(SHADER_UNIFORM.float, "rotation");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 8] = nodeValueMap("Scale map", self); addShaderProp();
|
||||
|
||||
inputs[| 9] = nodeValueMap("Density map", self); addShaderProp();
|
||||
|
||||
inputs[| 10] = nodeValueMap("Sharpness map", self); addShaderProp();
|
||||
|
||||
inputs[| 11] = nodeValueMap("Phase map", self); addShaderProp();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
input_display_list = [
|
||||
["Output", true], 0, 3,
|
||||
["Noise", false], 1, 2, 4, 7, 5,
|
||||
|
|
|
@ -4,14 +4,16 @@ function Node_Noise_Simplex(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF )
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
|
||||
inputs[| 1] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [0, 0, 0] )
|
||||
inputs[| 1] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ] )
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
|
||||
inputs[| 2] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [2, 2] )
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
inputs[| 2] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 2, 2 ] )
|
||||
.setDisplay(VALUE_DISPLAY.vector)
|
||||
.setMappable(8);
|
||||
|
||||
inputs[| 3] = nodeValue("Iteration", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1 )
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 1] });
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 1] })
|
||||
.setMappable(9);
|
||||
|
||||
inputs[| 4] = nodeValue("Color mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
.setDisplay(VALUE_DISPLAY.enum_button, [ "Greyscale", "RGB", "HSV" ]);
|
||||
|
@ -25,9 +27,17 @@ function Node_Noise_Simplex(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
inputs[| 7] = nodeValue("Color B range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
|
||||
.setDisplay(VALUE_DISPLAY.slider_range);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 8] = nodeValueMap("Scale map", self);
|
||||
|
||||
inputs[| 9] = nodeValueMap("Iteration map", self);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
input_display_list = [
|
||||
["Output", false], 0,
|
||||
["Noise", false], 1, 2, 3,
|
||||
["Noise", false], 1, 2, 8, 3, 9,
|
||||
["Render", false], 4, 5, 6, 7,
|
||||
];
|
||||
|
||||
|
@ -35,7 +45,7 @@ function Node_Noise_Simplex(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
|
||||
attribute_surface_depth();
|
||||
|
||||
static step = function() {
|
||||
static step = function() { #region
|
||||
var _col = getInputData(4);
|
||||
|
||||
inputs[| 5].setVisible(_col != 0);
|
||||
|
@ -45,13 +55,14 @@ function Node_Noise_Simplex(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
inputs[| 5].name = _col == 1? "Color R range" : "Color H range";
|
||||
inputs[| 6].name = _col == 1? "Color G range" : "Color S range";
|
||||
inputs[| 7].name = _col == 1? "Color B range" : "Color V range";
|
||||
}
|
||||
|
||||
inputs[| 2].mappableStep();
|
||||
inputs[| 3].mappableStep();
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
var _dim = _data[0];
|
||||
var _pos = _data[1];
|
||||
var _sca = _data[2];
|
||||
var _itr = _data[3];
|
||||
|
||||
var _col = _data[4];
|
||||
var _clr = _data[5];
|
||||
|
@ -61,11 +72,11 @@ function Node_Noise_Simplex(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
|
||||
|
||||
surface_set_shader(_outSurf, sh_simplex);
|
||||
shader_set_f("position", _pos);
|
||||
shader_set_f("scale", _sca);
|
||||
shader_set_i("iteration", _itr);
|
||||
shader_set_f("position", _pos);
|
||||
shader_set_f_map("scale", _data[2], _data[8], inputs[| 2]);
|
||||
shader_set_f_map("iteration", _data[3], _data[9], inputs[| 3]);
|
||||
|
||||
shader_set_i("colored", _col);
|
||||
shader_set_i("colored", _col);
|
||||
shader_set_f("colorRanR", _clr);
|
||||
shader_set_f("colorRanG", _clg);
|
||||
shader_set_f("colorRanB", _clb);
|
||||
|
|
|
@ -2,13 +2,17 @@ function Node_Outline(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
|||
name = "Outline";
|
||||
|
||||
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
inputs[| 1] = nodeValue("Width", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0);
|
||||
|
||||
inputs[| 1] = nodeValue("Width", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
.setMappable(15);
|
||||
|
||||
inputs[| 2] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white);
|
||||
|
||||
inputs[| 3] = nodeValue("Blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, 0, "Blend outline color with the original color.");
|
||||
|
||||
inputs[| 4] = nodeValue("Blend alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
|
||||
.setDisplay(VALUE_DISPLAY.slider);
|
||||
.setDisplay(VALUE_DISPLAY.slider)
|
||||
.setMappable(16);
|
||||
|
||||
inputs[| 5] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1)
|
||||
.setDisplay(VALUE_DISPLAY.enum_button, ["Inside", "Outside"]);
|
||||
|
@ -18,7 +22,8 @@ function Node_Outline(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
|||
inputs[| 7] = nodeValue("Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.")
|
||||
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Empty", "Clamp", "Repeat" ]);
|
||||
|
||||
inputs[| 8] = nodeValue("Start", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "Shift outline inside, outside the shape.");
|
||||
inputs[| 8] = nodeValue("Start", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "Shift outline inside, outside the shape.")
|
||||
.setMappable(17);
|
||||
|
||||
inputs[| 9] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
|
||||
|
@ -32,14 +37,24 @@ function Node_Outline(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
|||
|
||||
__init_mask_modifier(9); // inputs 13, 14
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 15] = nodeValueMap("Width map", self);
|
||||
|
||||
inputs[| 16] = nodeValueMap("Blend alpha map", self);
|
||||
|
||||
inputs[| 17] = nodeValueMap("Start map", self);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
outputs[| 1] = nodeValue("Outline", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
input_display_list = [ 11,
|
||||
["Surfaces", true], 0, 9, 10, 13, 14,
|
||||
["Outline", false], 1, 5, 8, 12,
|
||||
["Render", false], 2, 3, 4, 6,
|
||||
["Outline", false], 1, 15, 5, 8, 17, 12,
|
||||
["Render", false], 2, 3, 4, 16, 6,
|
||||
];
|
||||
|
||||
attribute_surface_depth();
|
||||
|
@ -53,37 +68,38 @@ function Node_Outline(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
|||
inputs[| 12].setVisible(_side == 0);
|
||||
|
||||
__step_mask_modifier();
|
||||
|
||||
inputs[| 1].mappableStep();
|
||||
inputs[| 4].mappableStep();
|
||||
inputs[| 8].mappableStep();
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
var ww = surface_get_width_safe(_data[0]);
|
||||
var hh = surface_get_height_safe(_data[0]);
|
||||
var wd = _data[1];
|
||||
var cl = _data[2];
|
||||
|
||||
var blend = _data[3];
|
||||
var alpha = _data[4];
|
||||
var side = _data[5];
|
||||
var aa = _data[6];
|
||||
var sam = struct_try_get(attributes, "oversample");
|
||||
var bst = _data[8];
|
||||
var _crop = _data[12];
|
||||
|
||||
surface_set_shader(_outSurf, sh_outline);
|
||||
shader_set_f("dimension", ww, hh);
|
||||
shader_set_f("borderStart", bst);
|
||||
shader_set_f("borderSize", wd);
|
||||
shader_set_f("dimension", ww, hh);
|
||||
shader_set_f_map("borderSize", _data[1], _data[15], inputs[| 1]);
|
||||
shader_set_f_map("borderStart", _data[8], _data[17], inputs[| 8]);
|
||||
shader_set_color("borderColor", cl);
|
||||
|
||||
shader_set_i("side", side);
|
||||
shader_set_i("is_aa", aa);
|
||||
shader_set_i("outline_only", _output_index);
|
||||
shader_set_i("is_blend", blend);
|
||||
shader_set_f("blend_alpha", alpha);
|
||||
shader_set_i("sampleMode", sam);
|
||||
shader_set_i("crop_border", _crop);
|
||||
shader_set_i("side", side);
|
||||
shader_set_i("is_aa", aa);
|
||||
shader_set_i("outline_only", _output_index);
|
||||
shader_set_i("is_blend", blend);
|
||||
shader_set_f_map("blend_alpha", _data[4], _data[16], inputs[| 4]);
|
||||
shader_set_i("sampleMode", sam);
|
||||
shader_set_i("crop_border", _crop);
|
||||
|
||||
draw_surface_safe(_data[0], 0, 0);
|
||||
draw_surface_safe(_data[0]);
|
||||
surface_reset_shader();
|
||||
|
||||
__process_mask_modifier(_data);
|
||||
|
|
|
@ -9,7 +9,8 @@ function Node_Perlin(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
.setUnitRef(function(index) { return getDimension(index); });
|
||||
|
||||
inputs[| 2] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 5, 5 ])
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
.setDisplay(VALUE_DISPLAY.vector)
|
||||
.setMappable(10);
|
||||
|
||||
inputs[| 3] = nodeValue("Iteration", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 2);
|
||||
|
||||
|
@ -29,9 +30,15 @@ function Node_Perlin(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
inputs[| 9] = nodeValue("Color B range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
|
||||
.setDisplay(VALUE_DISPLAY.slider_range);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 10] = nodeValueMap("Scale map", self);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
input_display_list = [
|
||||
["Output", true], 0, 5,
|
||||
["Noise", false], 1, 2, 3, 4,
|
||||
["Noise", false], 1, 2, 10, 3, 4,
|
||||
["Render", false], 6, 7, 8, 9,
|
||||
];
|
||||
|
||||
|
@ -49,12 +56,13 @@ function Node_Perlin(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
inputs[| 7].name = _col == 1? "Color R range" : "Color H range";
|
||||
inputs[| 8].name = _col == 1? "Color G range" : "Color S range";
|
||||
inputs[| 9].name = _col == 1? "Color B range" : "Color V range";
|
||||
|
||||
inputs[| 2].mappableStep();
|
||||
}
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
var _dim = _data[0];
|
||||
var _pos = _data[1];
|
||||
var _sca = _data[2];
|
||||
var _ite = _data[3];
|
||||
var _til = _data[4];
|
||||
var _sed = _data[5];
|
||||
|
@ -69,7 +77,7 @@ function Node_Perlin(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
surface_set_shader(_outSurf, sh_perlin_tiled);
|
||||
shader_set_f("u_resolution", _dim);
|
||||
shader_set_f("position", _pos);
|
||||
shader_set_f("scale", _sca);
|
||||
shader_set_f_map("scale", _data[2], _data[10], inputs[| 2]);
|
||||
shader_set_f("seed", _sed);
|
||||
shader_set_i("tile", _til);
|
||||
shader_set_i("iteration", _ite);
|
||||
|
|
|
@ -8,7 +8,7 @@ function Node_Perlin_Smear(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
|
|||
.setDisplay(VALUE_DISPLAY.vector)
|
||||
.setUnitRef(function(index) { return getDimension(index); });
|
||||
|
||||
inputs[| 2] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 4, 6])
|
||||
inputs[| 2] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 4, 6 ])
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
|
||||
inputs[| 3] = nodeValue("Iteration", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 3);
|
||||
|
|
|
@ -1,23 +1,6 @@
|
|||
function Node_Pixel_Cloud(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Pixel Cloud";
|
||||
|
||||
shader = sh_pixel_cloud;
|
||||
uniform_sed = shader_get_uniform(shader, "seed");
|
||||
uniform_str = shader_get_uniform(shader, "strength");
|
||||
uniform_dis = shader_get_uniform(shader, "dist");
|
||||
|
||||
uniform_map_use = shader_get_uniform(shader, "useMap");
|
||||
uniform_map = shader_get_sampler_index(shader, "strengthMap");
|
||||
|
||||
uniform_grad_blend = shader_get_uniform(shader, "gradient_blend");
|
||||
uniform_grad = shader_get_uniform(shader, "gradient_color");
|
||||
uniform_grad_time = shader_get_uniform(shader, "gradient_time");
|
||||
uniform_grad_key = shader_get_uniform(shader, "gradient_keys");
|
||||
|
||||
uniform_alpha = shader_get_uniform(shader, "alpha_curve");
|
||||
uniform_alamo = shader_get_uniform(shader, "curve_amount");
|
||||
uniform_rnd = shader_get_uniform(shader, "randomAmount");
|
||||
|
||||
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
|
||||
inputs[| 1] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, irandom(100000));
|
||||
|
@ -49,48 +32,28 @@ function Node_Pixel_Cloud(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
|||
|
||||
attribute_surface_depth();
|
||||
|
||||
static step = function() {
|
||||
|
||||
}
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
var _sed = _data[1];
|
||||
var _str = _data[2];
|
||||
var _map = _data[3];
|
||||
var _gra = _data[4];
|
||||
var _dis = _data[5];
|
||||
var _alp = _data[6];
|
||||
var _rnd = _data[7];
|
||||
|
||||
var _grad = _gra.toArray();
|
||||
var _grad_color = _grad[0];
|
||||
var _grad_time = _grad[1];
|
||||
surface_set_shader(_outSurf, sh_pixel_cloud);
|
||||
shader_set_f("seed" , _data[1]);
|
||||
shader_set_f("strength", _data[2]);
|
||||
shader_set_f("dist" , _data[5]);
|
||||
|
||||
surface_set_target(_outSurf);
|
||||
DRAW_CLEAR
|
||||
BLEND_OVERRIDE;
|
||||
shader_set_i("useMap", is_surface(_data[3]));
|
||||
shader_set_surface("strengthMap", _data[3]);
|
||||
|
||||
shader_set(shader);
|
||||
shader_set_uniform_f(uniform_sed, _sed);
|
||||
shader_set_uniform_f(uniform_str, _str);
|
||||
shader_set_uniform_f(uniform_dis, _dis);
|
||||
if(is_surface(_map)) {
|
||||
shader_set_uniform_i(uniform_map_use, 1);
|
||||
texture_set_stage(uniform_map, surface_get_texture(_map));
|
||||
} else {
|
||||
shader_set_uniform_i(uniform_map_use, 0);
|
||||
}
|
||||
_data[4].shader_submit();
|
||||
|
||||
shader_set_uniform_i(uniform_grad_blend, _gra.type);
|
||||
shader_set_uniform_f_array_safe(uniform_grad, _grad_color);
|
||||
shader_set_uniform_f_array_safe(uniform_grad_time, _grad_time);
|
||||
shader_set_uniform_i(uniform_grad_key, array_length(_gra.keys));
|
||||
|
||||
shader_set_uniform_f_array_safe(uniform_alpha, _alp);
|
||||
shader_set_uniform_i(uniform_alamo, array_length(_alp));
|
||||
shader_set_uniform_f(uniform_rnd, _rnd);
|
||||
shader_set_f("alpha_curve" , _data[6]);
|
||||
shader_set_i("curve_amount", array_length(_data[6]));
|
||||
shader_set_f("randomAmount", _data[7]);
|
||||
|
||||
draw_surface_safe(_data[0], 0, 0);
|
||||
shader_reset();
|
||||
|
||||
BLEND_NORMAL;
|
||||
surface_reset_target();
|
||||
surface_reset_shader();
|
||||
|
||||
return _outSurf;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,8 @@ function Node_Polar(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
|
|||
inputs[| 5] = nodeValue("Invert", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false)
|
||||
|
||||
inputs[| 6] = nodeValue("Blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
|
||||
.setDisplay(VALUE_DISPLAY.slider);
|
||||
.setDisplay(VALUE_DISPLAY.slider)
|
||||
.setMappable(11);
|
||||
|
||||
__init_mask_modifier(1); // inputs 7, 8,
|
||||
|
||||
|
@ -26,11 +27,17 @@ function Node_Polar(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
|
|||
|
||||
inputs[| 10] = nodeValue("Swap", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 11] = nodeValueMap("Blend map", self);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
input_display_list = [ 3, 4,
|
||||
["Surfaces", false], 0, 1, 2, 7, 8,
|
||||
["Effect", false], 5, 6, 9, 10,
|
||||
["Effect", false], 5, 6, 11, 9, 10,
|
||||
]
|
||||
|
||||
attribute_surface_depth();
|
||||
|
@ -38,15 +45,18 @@ function Node_Polar(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
|
|||
|
||||
static step = function() { #region
|
||||
__step_mask_modifier();
|
||||
|
||||
inputs[| 6].mappableStep();
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
|
||||
surface_set_shader(_outSurf, sh_polar);
|
||||
shader_set_interpolation(_data[0]);
|
||||
shader_set_i("invert", _data[5]);
|
||||
shader_set_i("distMode", _data[9]);
|
||||
shader_set_f("blend", _data[6]);
|
||||
shader_set_i("swap", _data[10]);
|
||||
shader_set_interpolation( _data[0]);
|
||||
shader_set_i("invert", _data[5]);
|
||||
shader_set_i("distMode", _data[9]);
|
||||
shader_set_f_map("blend", _data[6], _data[11], inputs[| 6]);
|
||||
shader_set_i("swap", _data[10]);
|
||||
|
||||
draw_surface_safe(_data[0], 0, 0);
|
||||
surface_reset_shader();
|
||||
|
|
|
@ -12,16 +12,23 @@ function Node_Posterize(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
.setDisplay(VALUE_DISPLAY.slider, { range: [2, 16, 1] });
|
||||
|
||||
inputs[| 4] = nodeValue("Gamma", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.6)
|
||||
.setDisplay(VALUE_DISPLAY.slider);
|
||||
.setDisplay(VALUE_DISPLAY.slider)
|
||||
.setMappable(7);
|
||||
|
||||
inputs[| 5] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
|
||||
active_index = 5;
|
||||
|
||||
inputs[| 6] = nodeValue("Posterize alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 7] = nodeValueMap("Gamma map", self);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
input_display_list = [ 5,
|
||||
["Effect settings", false], 0, 2, 1, 6,
|
||||
["Auto color", false], 3, 4
|
||||
["Auto color", false], 3, 4, 7,
|
||||
];
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
@ -34,6 +41,7 @@ function Node_Posterize(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
inputs[| 1].setVisible(_use_pal);
|
||||
inputs[| 3].setVisible(!_use_pal);
|
||||
inputs[| 4].setVisible(!_use_pal);
|
||||
inputs[| 4].mappableStep();
|
||||
}
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
|
@ -58,13 +66,10 @@ function Node_Posterize(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
draw_surface_safe(_data[0], 0, 0);
|
||||
surface_reset_shader();
|
||||
} else {
|
||||
var _colors = _data[3];
|
||||
var _gamma = _data[4];
|
||||
|
||||
surface_set_shader(_outSurf, sh_posterize);
|
||||
shader_set_i("colors", _colors);
|
||||
shader_set_f("gamma", _gamma);
|
||||
shader_set_i("alpha", _alp);
|
||||
shader_set_i("colors", _data[3]);
|
||||
shader_set_f_map("gamma", _data[4], _data[7], inputs[| 4]);
|
||||
shader_set_i("alpha", _alp);
|
||||
|
||||
draw_surface_safe(_data[0], 0, 0);
|
||||
surface_reset_shader();
|
||||
|
|
|
@ -12,13 +12,9 @@ function Node_Rate_Remap(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
|
|||
outputs[| 0] = nodeValue("Surface", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
input_display_list = [ 2,
|
||||
0, 1
|
||||
["Remap", false], 0, 1
|
||||
];
|
||||
|
||||
static step = function() {
|
||||
|
||||
}
|
||||
|
||||
static processData = function(_output, _data, _output_index, _array_index = 0) {
|
||||
var _surf = _data[0];
|
||||
var _rate = _data[1];
|
||||
|
|
|
@ -5,7 +5,7 @@ function Node_Skew(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
inputs[| 1] = nodeValue("Axis", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
.setDisplay(VALUE_DISPLAY.enum_button, ["x", "y"]);
|
||||
|
||||
inputs[| 2] = nodeValue("Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
||||
inputs[| 2] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [-1, 1, 0.01] })
|
||||
.setMappable(12);
|
||||
|
||||
|
@ -32,8 +32,11 @@ function Node_Skew(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
|
||||
__init_mask_modifier(6); // inputs 10, 11
|
||||
|
||||
inputs[| 12] = nodeValue("Strength map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone)
|
||||
.setVisible(false, false);
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 12] = nodeValueMap("Strength map", self);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
input_display_list = [ 8, 9,
|
||||
["Surfaces", true], 0, 6, 7, 10, 11,
|
||||
|
@ -65,18 +68,14 @@ function Node_Skew(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
var _axis = _data[1];
|
||||
var _amou = _data[2];
|
||||
var _wrap = _data[3];
|
||||
var _cent = _data[4];
|
||||
var _samp = struct_try_get(attributes, "oversample");
|
||||
|
||||
surface_set_shader(_outSurf, sh_skew);
|
||||
shader_set_interpolation(_data[0]);
|
||||
shader_set_dim("dimension", _data[0]);
|
||||
shader_set_f("center", _cent);
|
||||
shader_set_i("axis", _axis);
|
||||
shader_set_f_map("amount", _amou, _data[12], inputs[| 2]);
|
||||
shader_set_f("center", _data[4]);
|
||||
shader_set_i("axis", _data[1]);
|
||||
shader_set_f_map("amount", _data[2], _data[12], inputs[| 2]);
|
||||
shader_set_i("sampleMode", _samp);
|
||||
draw_surface_safe(_data[0], 0, 0);
|
||||
surface_reset_shader();
|
||||
|
|
|
@ -5,19 +5,22 @@ function Node_Stripe(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
|
||||
inputs[| 1] = nodeValue("Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 0.1] });
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 0.1] })
|
||||
.setMappable(11);
|
||||
|
||||
inputs[| 2] = nodeValue("Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
.setDisplay(VALUE_DISPLAY.rotation);
|
||||
.setDisplay(VALUE_DISPLAY.rotation)
|
||||
.setMappable(12);
|
||||
|
||||
inputs[| 3] = nodeValue("Blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, 0, "Smoothly blend between each stripe.");
|
||||
|
||||
inputs[| 4] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0] )
|
||||
inputs[| 4] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0 ] )
|
||||
.setDisplay(VALUE_DISPLAY.vector)
|
||||
.setUnitRef(function(index) { return getDimension(index); });
|
||||
|
||||
inputs[| 5] = nodeValue("Random", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
||||
.setDisplay(VALUE_DISPLAY.slider);
|
||||
.setDisplay(VALUE_DISPLAY.slider)
|
||||
.setMappable(13);
|
||||
|
||||
inputs[| 6] = nodeValue("Random color", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
|
||||
|
||||
|
@ -28,13 +31,26 @@ function Node_Stripe(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
inputs[| 9] = nodeValue("Color 2", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black);
|
||||
|
||||
inputs[| 10] = nodeValue("Strip ratio", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5)
|
||||
.setDisplay(VALUE_DISPLAY.slider);
|
||||
.setDisplay(VALUE_DISPLAY.slider)
|
||||
.setMappable(14);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 11] = nodeValueMap("Amount map", self);
|
||||
|
||||
inputs[| 12] = nodeValueMap("Angle map", self);
|
||||
|
||||
inputs[| 13] = nodeValueMap("Random map", self);
|
||||
|
||||
inputs[| 14] = nodeValueMap("Ratio map", self);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
input_display_list = [
|
||||
["Output", true], 0,
|
||||
["Pattern", false], 1, 10, 2, 4, 5,
|
||||
["Pattern", false], 1, 11, 10, 14, 2, 12, 4, 5, 13,
|
||||
["Render", false], 6, 7, 8, 9, 3
|
||||
];
|
||||
|
||||
|
@ -49,17 +65,19 @@ function Node_Stripe(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
inputs[| 2].drawOverlay(active, px, py, _s, _mx, _my, _snx, _sny);
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
var _dim = _data[0];
|
||||
var _amo = _data[1];
|
||||
var _ang = _data[2];
|
||||
var _bnd = _data[3];
|
||||
var _pos = _data[4];
|
||||
var _rnd = _data[5];
|
||||
static step = function() { #region
|
||||
inputs[| 1].mappableStep();
|
||||
inputs[| 2].mappableStep();
|
||||
inputs[| 5].mappableStep();
|
||||
inputs[| 10].mappableStep();
|
||||
} #endregion
|
||||
|
||||
var _clr0 = _data[ 8];
|
||||
var _clr1 = _data[ 9];
|
||||
var _rat = _data[10];
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
var _dim = _data[0];
|
||||
var _bnd = _data[3];
|
||||
var _pos = _data[4];
|
||||
var _clr0 = _data[8];
|
||||
var _clr1 = _data[9];
|
||||
|
||||
var _grad_use = _data[6];
|
||||
inputs[| 7].setVisible(_grad_use);
|
||||
|
@ -68,29 +86,23 @@ function Node_Stripe(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
|
||||
var _gra = _data[7];
|
||||
|
||||
var _g = _gra.toArray();
|
||||
var _grad_color = _g[0];
|
||||
var _grad_time = _g[1];
|
||||
|
||||
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
|
||||
|
||||
surface_set_shader(_outSurf, sh_stripe);
|
||||
shader_set_f("dimension", _dim[0], _dim[1]);
|
||||
shader_set_f("position", _pos[0] / _dim[0], _pos[1] / _dim[1]);
|
||||
shader_set_f("angle", degtorad(_ang));
|
||||
shader_set_f("amount", _amo);
|
||||
shader_set_f("blend", _bnd);
|
||||
shader_set_f("randomAmount", _rnd);
|
||||
shader_set_f("ratio", _rat);
|
||||
|
||||
shader_set_f_map("amount", _data[ 1], _data[11], inputs[| 1]);
|
||||
shader_set_f_map("angle", _data[ 2], _data[12], inputs[| 2]);
|
||||
shader_set_f_map("randomAmount", _data[ 5], _data[13], inputs[| 5]);
|
||||
shader_set_f_map("ratio", _data[10], _data[14], inputs[| 10]);
|
||||
|
||||
shader_set_f("color0", colToVec4(_clr0));
|
||||
shader_set_f("color1", colToVec4(_clr1));
|
||||
|
||||
shader_set_i("gradient_use", _grad_use);
|
||||
shader_set_i("gradient_blend", _gra.type);
|
||||
shader_set_f("gradient_color", _grad_color);
|
||||
shader_set_f("gradient_time", _grad_time);
|
||||
shader_set_i("gradient_keys", array_length(_gra.keys));
|
||||
_gra.shader_submit();
|
||||
|
||||
draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], 0, c_white, 1);
|
||||
surface_reset_shader();
|
||||
|
|
|
@ -6,7 +6,8 @@ function Node_Threshold(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
inputs[| 1] = nodeValue("Brightness", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
|
||||
|
||||
inputs[| 2] = nodeValue("Brightness Threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5)
|
||||
.setDisplay(VALUE_DISPLAY.slider);
|
||||
.setDisplay(VALUE_DISPLAY.slider)
|
||||
.setMappable(13);
|
||||
|
||||
inputs[| 3] = nodeValue("Brightness Smoothness", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
||||
.setDisplay(VALUE_DISPLAY.slider);
|
||||
|
@ -22,7 +23,8 @@ function Node_Threshold(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
inputs[| 7] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
|
||||
|
||||
inputs[| 8] = nodeValue("Alpha Threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5)
|
||||
.setDisplay(VALUE_DISPLAY.slider);
|
||||
.setDisplay(VALUE_DISPLAY.slider)
|
||||
.setMappable(14);
|
||||
|
||||
inputs[| 9] = nodeValue("Alpha Smoothness", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
||||
.setDisplay(VALUE_DISPLAY.slider);
|
||||
|
@ -32,11 +34,19 @@ function Node_Threshold(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
|
||||
__init_mask_modifier(4); // inputs 11, 12
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 13] = nodeValueMap("Brightness map", self);
|
||||
|
||||
inputs[| 14] = nodeValueMap("Alpha map", self);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
input_display_list = [ 6, 10,
|
||||
["Surfaces", true], 0, 4, 5, 11, 12,
|
||||
["Threshold", false], 1, 2, 3, 7, 8, 9,
|
||||
["Threshold", false], 1, 2, 13, 3, 7, 8, 14, 9,
|
||||
];
|
||||
|
||||
attribute_surface_depth();
|
||||
|
@ -51,25 +61,21 @@ function Node_Threshold(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
inputs[| 9].setVisible(_alpha);
|
||||
|
||||
__step_mask_modifier();
|
||||
|
||||
inputs[| 2].mappableStep();
|
||||
inputs[| 8].mappableStep();
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
var _bright = _data[1];
|
||||
var _brightThreshold = _data[2];
|
||||
var _brightSmooth = _data[3];
|
||||
|
||||
var _alpha = _data[7];
|
||||
var _alphaThreshold = _data[8];
|
||||
var _alphaSmooth = _data[9];
|
||||
|
||||
surface_set_shader(_outSurf, sh_threshold);
|
||||
shader_set_i("bright", _bright );
|
||||
shader_set_f("brightThreshold", _brightThreshold);
|
||||
shader_set_f("brightSmooth", _brightSmooth );
|
||||
shader_set_i("bright", _data[1]);
|
||||
shader_set_f_map("brightThreshold", _data[2], _data[13], inputs[| 2]);
|
||||
shader_set_f("brightSmooth", _data[3]);
|
||||
|
||||
shader_set_i("alpha", _alpha );
|
||||
shader_set_f("alphaThreshold", _alphaThreshold );
|
||||
shader_set_f("alphaSmooth", _alphaSmooth );
|
||||
shader_set_i("alpha", _data[7]);
|
||||
shader_set_f_map("alphaThreshold", _data[8], _data[14], inputs[| 8]);
|
||||
shader_set_f("alphaSmooth", _data[9]);
|
||||
|
||||
draw_surface_safe(_data[0]);
|
||||
surface_reset_shader();
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
function Node_Twirl(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Twirl";
|
||||
|
||||
shader = sh_twirl;
|
||||
uniform_dim = shader_get_uniform(shader, "dimension");
|
||||
uniform_cen = shader_get_uniform(shader, "center");
|
||||
uniform_str = shader_get_uniform(shader, "strength");
|
||||
uniform_rad = shader_get_uniform(shader, "radius");
|
||||
uniform_sam = shader_get_uniform(shader, "sampleMode");
|
||||
|
||||
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
|
||||
inputs[| 1] = nodeValue("Center", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ])
|
||||
|
@ -15,9 +8,11 @@ function Node_Twirl(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
|
|||
.setUnitRef(function(index) { return getDimension(index); });
|
||||
|
||||
inputs[| 2] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 3)
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [-10, 10, 0.01] });
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [-10, 10, 0.01] })
|
||||
.setMappable(11);
|
||||
|
||||
inputs[| 3] = nodeValue("Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 16);
|
||||
inputs[| 3] = nodeValue("Radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 16)
|
||||
.setMappable(12);
|
||||
|
||||
inputs[| 4] = nodeValue("Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.")
|
||||
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Empty", "Clamp", "Repeat" ]);
|
||||
|
@ -35,11 +30,21 @@ function Node_Twirl(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
|
|||
|
||||
__init_mask_modifier(5); // inputs 9, 10
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 11] = nodeValue("Strength map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone)
|
||||
.setVisible(false, false);
|
||||
|
||||
inputs[| 12] = nodeValue("Radius map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone)
|
||||
.setVisible(false, false);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
input_display_list = [ 7, 8,
|
||||
["Surfaces", true], 0, 5, 6, 9, 10,
|
||||
["Twirl", false], 1, 2, 3,
|
||||
["Twirl", false], 1, 2, 11, 3, 12,
|
||||
];
|
||||
|
||||
attribute_surface_depth();
|
||||
|
@ -57,22 +62,23 @@ function Node_Twirl(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
|
|||
|
||||
static step = function() { #region
|
||||
__step_mask_modifier();
|
||||
|
||||
inputs[| 2].mappableStep();
|
||||
inputs[| 3].mappableStep();
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
var center = _data[1];
|
||||
var stren = _data[2];
|
||||
var rad = _data[3];
|
||||
var sam = struct_try_get(attributes, "oversample");
|
||||
|
||||
surface_set_shader(_outSurf, shader);
|
||||
surface_set_shader(_outSurf, sh_twirl);
|
||||
shader_set_interpolation(_data[0]);
|
||||
shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]) ]);
|
||||
shader_set_uniform_f_array_safe(uniform_cen, center);
|
||||
shader_set_uniform_f(uniform_str, stren);
|
||||
shader_set_uniform_f(uniform_rad, rad);
|
||||
shader_set_uniform_i(uniform_sam, sam);
|
||||
draw_surface_safe(_data[0], 0, 0);
|
||||
shader_set_f("dimension" , surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]));
|
||||
shader_set_f("center" , _data[1]);
|
||||
shader_set_f_map("strength", _data[2], _data[11], inputs[| 2]);
|
||||
shader_set_f_map("radius" , _data[3], _data[12], inputs[| 3]);
|
||||
shader_set_i("sampleMode", sam);
|
||||
|
||||
draw_surface_safe(_data[0]);
|
||||
surface_reset_shader();
|
||||
|
||||
__process_mask_modifier(_data);
|
||||
|
|
|
@ -504,6 +504,7 @@ function nodeValueUnit(_nodeValue) constructor { #region
|
|||
} #endregion
|
||||
|
||||
function nodeValue(_name, _node, _connect, _type, _value, _tooltip = "") { return new NodeValue(_name, _node, _connect, _type, _value, _tooltip); }
|
||||
function nodeValueMap(_name, _node) { return new NodeValue(_name, _node, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone).setVisible(false, false); }
|
||||
|
||||
function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constructor {
|
||||
static DISPLAY_DATA_KEYS = [ "linked", "angle_display", "bone_id", "area_type", "unit", "atlas_crop" ];
|
||||
|
@ -1280,7 +1281,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
node.triggerRender();
|
||||
})
|
||||
.setIcon( THEME.value_use_surface, [ function() { return attributes.mapped; } ], COLORS._main_icon )
|
||||
.setTooltip("Use map");
|
||||
.setTooltip("Toggle map");
|
||||
|
||||
mapWidget = new vectorBox(2, function(index, val) { return setValueDirect(val, index); });
|
||||
mapWidget.side_button = mapButton;
|
||||
|
@ -1295,8 +1296,11 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
editWidget = attributes.mapped? mapWidget : editWidgetRaw;
|
||||
setArrayDepth(attributes.mapped);
|
||||
|
||||
if(node.inputs[| attributes.map_index].visible != attributes.mapped) {
|
||||
node.inputs[| attributes.map_index].visible = attributes.mapped;
|
||||
var inp = node.inputs[| attributes.map_index];
|
||||
var vis = attributes.mapped && show_in_inspector;
|
||||
|
||||
if(inp.visible != vis) {
|
||||
inp.visible = vis;
|
||||
node.setHeight();
|
||||
}
|
||||
} #endregion
|
||||
|
|
|
@ -928,6 +928,8 @@ function PanelContent() constructor { #region
|
|||
|
||||
function drawGUI() {}
|
||||
|
||||
static onFullScreen = function() {}
|
||||
|
||||
function close() { panel.remove(self); }
|
||||
|
||||
static checkClosable = function() { return true; }
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#region data
|
||||
globalvar PANEL_MAIN, PANEL_MENU, PANEL_PREVIEW, PANEL_INSPECTOR, PANEL_GRAPH, PANEL_ANIMATION, PANEL_COLLECTION;
|
||||
globalvar FULL_SCREEN_CONTENT;
|
||||
globalvar FULL_SCREEN_PANEL, FULL_SCREEN_CONTENT;
|
||||
|
||||
PANEL_MAIN = 0;
|
||||
FULL_SCREEN_PANEL = noone;
|
||||
FULL_SCREEN_CONTENT = noone;
|
||||
#endregion
|
||||
|
||||
|
@ -355,27 +356,36 @@
|
|||
|
||||
#region fullscreen
|
||||
function set_focus_fullscreen() {
|
||||
if(FULL_SCREEN_CONTENT != noone) {
|
||||
if(FULL_SCREEN_PANEL != noone) {
|
||||
PANEL_MAIN.childs[| 1].content = [];
|
||||
FULL_SCREEN_CONTENT = noone;
|
||||
PANEL_MAIN.refreshSize();
|
||||
|
||||
FULL_SCREEN_CONTENT.onFullScreen();
|
||||
|
||||
FULL_SCREEN_PANEL = noone;
|
||||
FULL_SCREEN_CONTENT = noone;
|
||||
return;
|
||||
}
|
||||
|
||||
var panel = PREFERENCES.expand_hover? HOVER : FOCUS;
|
||||
|
||||
if(panel == noone) return;
|
||||
if(!is_struct(panel)) return;
|
||||
if(instanceof(panel) != "Panel") return;
|
||||
if(panel == noone) return;
|
||||
if(!is_struct(panel)) return;
|
||||
if(instanceof(panel) != "Panel") return;
|
||||
if(array_length(panel.content) == 0) return;
|
||||
if(!panel.getContent().expandable) return;
|
||||
|
||||
PANEL_MAIN.childs[| 1].setContent(panel.getContent());
|
||||
FULL_SCREEN_CONTENT = panel;
|
||||
var content = panel.getContent();
|
||||
if(!content.expandable) return;
|
||||
|
||||
PANEL_MAIN.childs[| 1].setContent(content);
|
||||
FULL_SCREEN_PANEL = panel;
|
||||
FULL_SCREEN_CONTENT = content;
|
||||
|
||||
content.onFullScreen();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region function
|
||||
#region focus hover
|
||||
function panelHover(content) {
|
||||
if(!HOVER) return false;
|
||||
if(instanceof(HOVER) != "Panel") return false;
|
||||
|
|
|
@ -2119,6 +2119,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
ds_list_add(nodes_list, node);
|
||||
} #endregion
|
||||
|
||||
static onFullScreen = function() { run_in(1, fullView); }
|
||||
|
||||
function close() { #region
|
||||
var panels = findPanels("Panel_Graph");
|
||||
for( var i = 0, n = array_length(panels); i < n; i++ ) {
|
||||
|
|
|
@ -1457,6 +1457,8 @@ function Panel_Preview() : PanelContent() constructor {
|
|||
drawToolBar(tool);
|
||||
} #endregion
|
||||
|
||||
static onFullScreen = function() { run_in(1, fullView); }
|
||||
|
||||
function copyCurrentFrame() { #region
|
||||
var prevS = getNodePreviewSurface();
|
||||
if(!is_surface(prevS)) return;
|
||||
|
|
|
@ -7,6 +7,7 @@ function rotator(_onModify, _step = -1) : widget() constructor {
|
|||
drag_sv = 0;
|
||||
real_val = 0;
|
||||
slide_speed = 1 / 10;
|
||||
side_button = noone;
|
||||
|
||||
spr_bg = THEME.rotator_bg;
|
||||
spr_knob = THEME.rotator_knob;
|
||||
|
@ -37,6 +38,12 @@ function rotator(_onModify, _step = -1) : widget() constructor {
|
|||
|
||||
var _r = ui(28);
|
||||
|
||||
if(side_button) {
|
||||
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);
|
||||
}
|
||||
|
||||
switch(halign) {
|
||||
case fa_left : _x += _r; break;
|
||||
case fa_center : _x += _w / 2; break;
|
||||
|
|
|
@ -4,22 +4,53 @@
|
|||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform vec2 noiseAmount;
|
||||
uniform vec2 position;
|
||||
uniform float angle;
|
||||
uniform float seed;
|
||||
uniform vec2 position;
|
||||
|
||||
uniform vec2 noiseX;
|
||||
uniform int noiseXUseSurf;
|
||||
uniform sampler2D noiseXSurf;
|
||||
|
||||
uniform vec2 noiseY;
|
||||
uniform int noiseYUseSurf;
|
||||
uniform sampler2D noiseYSurf;
|
||||
|
||||
uniform vec2 angle;
|
||||
uniform int angleUseSurf;
|
||||
uniform sampler2D angleSurf;
|
||||
|
||||
float random1D (in vec2 st, float _seed) { return fract(sin(dot(st.xy, vec2(12.9898, 78.233)) * mod(_seed, 32.156) * 12.588) * 43758.5453123); }
|
||||
|
||||
float random (in vec2 st) { return mix(random1D(st, floor(seed)), random1D(st, floor(seed) + 1.), fract(seed)); }
|
||||
|
||||
void main() {
|
||||
vec2 pos = v_vTexcoord - position, _pos;
|
||||
_pos.x = pos.x * cos(angle) - pos.y * sin(angle);
|
||||
_pos.y = pos.x * sin(angle) + pos.y * cos(angle);
|
||||
#region params
|
||||
float nsx = noiseX.x;
|
||||
if(noiseXUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( noiseXSurf, v_vTexcoord );
|
||||
nsx = mix(noiseX.x, noiseX.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
float yy = floor(_pos.y * noiseAmount.y);
|
||||
float xx = (_pos.x + random1D(vec2(yy), floor(seed))) * noiseAmount.x;
|
||||
float nsy = noiseY.y;
|
||||
if(noiseYUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( noiseYSurf, v_vTexcoord );
|
||||
nsy = mix(noiseY.x, noiseY.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
float ang = angle.x;
|
||||
if(angleUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( angleSurf, v_vTexcoord );
|
||||
ang = mix(angle.x, angle.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
ang = radians(ang);
|
||||
#endregion
|
||||
|
||||
vec2 pos = v_vTexcoord - position, _pos;
|
||||
_pos.x = pos.x * cos(ang) - pos.y * sin(ang);
|
||||
_pos.y = pos.x * sin(ang) + pos.y * cos(ang);
|
||||
|
||||
float yy = floor(_pos.y * nsy);
|
||||
float xx = (_pos.x + random1D(vec2(yy), floor(seed))) * nsx;
|
||||
float x0 = floor(xx);
|
||||
float x1 = floor(xx) + 1.;
|
||||
|
||||
|
|
|
@ -9,15 +9,16 @@ varying vec4 v_vColour;
|
|||
uniform vec2 dimension;
|
||||
uniform vec2 scale;
|
||||
uniform vec2 shift;
|
||||
uniform float height;
|
||||
uniform int slope;
|
||||
uniform int sampleMode;
|
||||
|
||||
float bright(in vec4 col) {
|
||||
return (col.r + col.g + col.b) / 3. * col.a;
|
||||
}
|
||||
uniform vec2 height;
|
||||
uniform int heightUseSurf;
|
||||
uniform sampler2D heightSurf;
|
||||
|
||||
vec4 sampleTexture(vec2 pos) {
|
||||
float bright(in vec4 col) { return (col.r + col.g + col.b) / 3. * col.a; }
|
||||
|
||||
vec4 sampleTexture(vec2 pos) { #region
|
||||
if(pos.x >= 0. && pos.y >= 0. && pos.x <= 1. && pos.y <= 1.)
|
||||
return texture2D(gm_BaseTexture, pos);
|
||||
|
||||
|
@ -29,9 +30,17 @@ vec4 sampleTexture(vec2 pos) {
|
|||
return texture2D(gm_BaseTexture, fract(pos));
|
||||
|
||||
return vec4(0.);
|
||||
}
|
||||
} #endregion
|
||||
|
||||
void main() {
|
||||
float hei = height.x;
|
||||
float heiMax = max(height.x, height.y);
|
||||
|
||||
if(heightUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( heightSurf, v_vTexcoord );
|
||||
hei = mix(height.x, height.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
vec2 pixelStep = 1. / dimension;
|
||||
|
||||
vec4 col = texture2D(gm_BaseTexture, v_vTexcoord);
|
||||
|
@ -39,12 +48,12 @@ void main() {
|
|||
gl_FragColor = col;
|
||||
bool done = false;
|
||||
|
||||
vec2 shiftPx = -shift / dimension;
|
||||
float b0 = bright(col);
|
||||
vec2 shiftPx = -shift / dimension;
|
||||
float b0 = bright(col);
|
||||
float shift_angle = atan(shiftPx.y, shiftPx.x);
|
||||
float shift_distance = length(shiftPx);
|
||||
float slope_distance = height * b0;
|
||||
float max_distance = height;
|
||||
float slope_distance = hei * b0;
|
||||
float max_distance = hei;
|
||||
|
||||
if(b0 == 0.) return;
|
||||
|
||||
|
@ -52,7 +61,9 @@ void main() {
|
|||
float added_distance, _b1;
|
||||
vec2 shf, pxs;
|
||||
|
||||
for(float i = 1.; i < height; i++) {
|
||||
for(float i = 1.; i < heiMax; i++) {
|
||||
if(i >= hei) break;
|
||||
|
||||
float base = 1.;
|
||||
float top = 0.;
|
||||
for(float j = 0.; j <= 64.; j++) {
|
||||
|
@ -73,10 +84,10 @@ void main() {
|
|||
|
||||
if(_b1 < b1) {
|
||||
slope_distance = min(slope_distance, i);
|
||||
max_distance = min(max_distance, (b0 - _b1) * height);
|
||||
max_distance = min(max_distance, (b0 - _b1) * hei);
|
||||
b1 = min(b1, _b1);
|
||||
|
||||
i = height;
|
||||
i = hei;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,14 +4,17 @@
|
|||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform float strength;
|
||||
uniform vec2 dimension;
|
||||
|
||||
uniform vec2 strength;
|
||||
uniform int strengthUseSurf;
|
||||
uniform sampler2D strengthSurf;
|
||||
|
||||
const float GoldenAngle = 2.39996323;
|
||||
const float Iterations = 400.0;
|
||||
const float Iterations = 400.0;
|
||||
|
||||
const float ContrastAmount = 150.0;
|
||||
const vec3 ContrastFactor = vec3(9.0);
|
||||
const vec3 ContrastFactor = vec3(9.0);
|
||||
const float Smooth = 2.0;
|
||||
|
||||
vec4 bokeh(sampler2D tex, vec2 uv, float radius) {
|
||||
|
@ -47,5 +50,11 @@ vec4 bokeh(sampler2D tex, vec2 uv, float radius) {
|
|||
}
|
||||
|
||||
void main() {
|
||||
gl_FragColor = bokeh(gm_BaseTexture, v_vTexcoord, strength);
|
||||
float str = strength.x;
|
||||
if(strengthUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( strengthSurf, v_vTexcoord );
|
||||
str = mix(strength.x, strength.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
gl_FragColor = bokeh(gm_BaseTexture, v_vTexcoord, str);
|
||||
}
|
||||
|
|
|
@ -5,11 +5,18 @@ varying vec2 v_vTexcoord;
|
|||
varying vec4 v_vColour;
|
||||
|
||||
uniform float size;
|
||||
uniform float strength;
|
||||
uniform float direction;
|
||||
|
||||
uniform vec2 strength;
|
||||
uniform int strengthUseSurf;
|
||||
uniform sampler2D strengthSurf;
|
||||
|
||||
uniform vec2 direction;
|
||||
uniform int directionUseSurf;
|
||||
uniform sampler2D directionSurf;
|
||||
|
||||
uniform int sampleMode;
|
||||
|
||||
vec4 sampleTexture(vec2 pos) {
|
||||
vec4 sampleTexture(vec2 pos) { #region
|
||||
if(pos.x >= 0. && pos.y >= 0. && pos.x <= 1. && pos.y <= 1.)
|
||||
return texture2D(gm_BaseTexture, pos);
|
||||
|
||||
|
@ -21,9 +28,9 @@ vec4 sampleTexture(vec2 pos) {
|
|||
return texture2D(gm_BaseTexture, fract(pos));
|
||||
|
||||
return vec4(0.);
|
||||
}
|
||||
} #endregion
|
||||
|
||||
vec4 dirBlur(vec2 angle) {
|
||||
vec4 dirBlur(vec2 angle) { #region
|
||||
vec4 acc = vec4(0.);
|
||||
float delta = 1. / size;
|
||||
float weight = 0.;
|
||||
|
@ -37,11 +44,23 @@ vec4 dirBlur(vec2 angle) {
|
|||
acc.a /= size * 2.;
|
||||
|
||||
return acc;
|
||||
}
|
||||
} #endregion
|
||||
|
||||
void main() {
|
||||
float r = radians(direction);
|
||||
vec2 dirr = vec2(sin(r), cos(r));
|
||||
float str = strength.x;
|
||||
if(strengthUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( strengthSurf, v_vTexcoord );
|
||||
str = mix(strength.x, strength.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
gl_FragColor = dirBlur(strength * dirr);
|
||||
float dir = direction.x;
|
||||
if(directionUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( directionSurf, v_vTexcoord );
|
||||
dir = mix(direction.x, direction.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
float r = radians(dir + 90.);
|
||||
vec2 dirr = vec2(sin(r), cos(r)) * str;
|
||||
|
||||
gl_FragColor = dirBlur(dirr);
|
||||
}
|
|
@ -6,12 +6,16 @@ varying vec4 v_vColour;
|
|||
|
||||
uniform vec2 center;
|
||||
uniform vec2 dimension;
|
||||
uniform float strength;
|
||||
uniform int sampleMode;
|
||||
|
||||
uniform vec2 strength;
|
||||
uniform int strengthUseSurf;
|
||||
uniform sampler2D strengthSurf;
|
||||
|
||||
|
||||
#define ITERATION 64.
|
||||
|
||||
/////////////// SAMPLING ///////////////
|
||||
#region /////////////// SAMPLING ///////////////
|
||||
|
||||
const float PI = 3.14159265358979323846;
|
||||
uniform int interpolation;
|
||||
|
@ -57,9 +61,9 @@ vec4 texture2Dintp( sampler2D texture, vec2 uv ) {
|
|||
return texture2D( texture, uv );
|
||||
}
|
||||
|
||||
/////////////// SAMPLING ///////////////
|
||||
#endregion /////////////// SAMPLING ///////////////
|
||||
|
||||
vec4 sampleTexture(vec2 pos) {
|
||||
vec4 sampleTexture(vec2 pos) { #region
|
||||
if(pos.x >= 0. && pos.y >= 0. && pos.x <= 1. && pos.y <= 1.)
|
||||
return texture2Dintp(gm_BaseTexture, pos);
|
||||
|
||||
|
@ -71,9 +75,16 @@ vec4 sampleTexture(vec2 pos) {
|
|||
return texture2Dintp(gm_BaseTexture, fract(pos));
|
||||
|
||||
return vec4(0.);
|
||||
}
|
||||
} #endregion
|
||||
|
||||
void main() {
|
||||
float str = strength.x;
|
||||
float strMax = max(strength.x, strength.y);
|
||||
if(strengthUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( strengthSurf, v_vTexcoord );
|
||||
str = mix(strength.x, strength.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
vec2 pxPos = v_vTexcoord * dimension;
|
||||
vec2 pxCen = center * dimension;
|
||||
vec2 vecPc = pxPos - pxCen;
|
||||
|
@ -83,7 +94,10 @@ void main() {
|
|||
vec4 clr = vec4(0.);
|
||||
float weight = 0.;
|
||||
|
||||
for(float i = -strength; i <= strength; i++) {
|
||||
for(float i = -strMax; i <= strMax; i++) {
|
||||
if(i < -str) continue;
|
||||
if(i > str) break;
|
||||
|
||||
float ang = angle + i / 100.;
|
||||
vec4 col = sampleTexture((pxCen + vec2(cos(ang), sin(ang)) * dist) / dimension);
|
||||
|
||||
|
|
|
@ -4,11 +4,14 @@
|
|||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform float strength;
|
||||
uniform vec2 center;
|
||||
uniform int sampleMode;
|
||||
uniform int blurMode;
|
||||
|
||||
uniform vec2 strength;
|
||||
uniform int strengthUseSurf;
|
||||
uniform sampler2D strengthSurf;
|
||||
|
||||
uniform int useMask;
|
||||
uniform sampler2D mask;
|
||||
|
||||
|
@ -52,13 +55,19 @@ vec4 sampleTexture(vec2 pos) { #region
|
|||
} #endregion
|
||||
|
||||
void main() { #region
|
||||
float str = strength.x;
|
||||
if(strengthUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( strengthSurf, v_vTexcoord );
|
||||
str = mix(strength.x, strength.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
vec2 uv = v_vTexcoord - center;
|
||||
|
||||
float str = sampleParameter(0, strength) * sampleMask();
|
||||
float nsamples = 64.;
|
||||
float scale_factor = str * (1. / (nsamples * 2. - 1.));
|
||||
vec4 color = vec4(0.0);
|
||||
float blrStart = 0.;
|
||||
float _str = sampleParameter(0, str) * sampleMask();
|
||||
float nsamples = 64.;
|
||||
float scale_factor = _str * (1. / (nsamples * 2. - 1.));
|
||||
vec4 color = vec4(0.0);
|
||||
float blrStart = 0.;
|
||||
|
||||
if(blurMode == 0) blrStart = 0.;
|
||||
else if(blurMode == 1) blrStart = -nsamples;
|
||||
|
@ -66,7 +75,7 @@ void main() { #region
|
|||
|
||||
for(float i = 0.; i < nsamples * 2. + 1.; i++) {
|
||||
float scale = 1.0 + ((blrStart + i) * scale_factor);
|
||||
vec2 pos = uv * scale + center;
|
||||
vec2 pos = uv * scale + center;
|
||||
color += sampleTexture(pos);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,12 +4,15 @@
|
|||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform vec2 dimension;
|
||||
uniform vec2 position;
|
||||
uniform float scale;
|
||||
uniform int pattern;
|
||||
uniform vec2 dimension;
|
||||
uniform vec2 position;
|
||||
uniform int pattern;
|
||||
uniform float time;
|
||||
|
||||
uniform vec2 scale;
|
||||
uniform int scaleUseSurf;
|
||||
uniform sampler2D scaleSurf;
|
||||
|
||||
uniform float contrast;
|
||||
uniform float middle;
|
||||
|
||||
|
@ -24,11 +27,20 @@ vec2 random2( vec2 p ) { return fract(sin(vec2(dot(p, vec2(127.1, 311.7)), dot(p
|
|||
float random (in vec2 st) { return fract(sin(dot(st.xy, vec2(12.9898, 78.233))) * 43758.5453123); }
|
||||
|
||||
void main() {
|
||||
#region params
|
||||
float sca = scale.x;
|
||||
float scaMax = max(scale.x, scale.y);
|
||||
if(scaleUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( scaleSurf, v_vTexcoord );
|
||||
sca = mix(scale.x, scale.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
#endregion
|
||||
|
||||
vec2 pos = position / dimension;
|
||||
vec2 st = v_vTexcoord - pos;
|
||||
vec3 color = vec3(.0);
|
||||
|
||||
st *= scale;
|
||||
st *= sca;
|
||||
|
||||
float m_dist = 1.;
|
||||
|
||||
|
@ -39,7 +51,7 @@ void main() {
|
|||
for (int y = -1; y <= 1; y++) {
|
||||
for (int x = -1; x <= 1; x++) {
|
||||
vec2 neighbor = vec2(float(x),float(y));
|
||||
vec2 point = random2(mod(i_st + neighbor, scale));
|
||||
vec2 point = random2(mod(i_st + neighbor, scaMax));
|
||||
point = 0.5 + 0.5 * sin(time + 6.2831 * point);
|
||||
|
||||
vec2 _diff = neighbor + point - f_st;
|
||||
|
@ -48,11 +60,11 @@ void main() {
|
|||
}
|
||||
}
|
||||
} else if(pattern == 1) {
|
||||
for (int j = 0; j <= int(scale / 2.); j++) {
|
||||
int _amo = int(scale) + int(float(j) * radiusShatter);
|
||||
for (int j = 0; j <= int(sca / 2.); j++) {
|
||||
int _amo = int(sca) + int(float(j) * radiusShatter);
|
||||
for (int i = 0; i <= _amo; i++) {
|
||||
float ang = TAU / float(_amo) * float(i) + float(j) + random(vec2(0.684, 1.387)) + time;
|
||||
float rad = pow(float(j) / scale, radiusScale) * scale * .5 + random(vec2(ang)) * 0.1;
|
||||
float rad = pow(float(j) / sca, radiusScale) * sca * .5 + random(vec2(ang)) * 0.1;
|
||||
vec2 point = vec2(cos(ang) * rad, sin(ang) * rad) + pos;
|
||||
|
||||
vec2 _diff = point - v_vTexcoord;
|
||||
|
|
|
@ -8,7 +8,10 @@ varying vec4 v_vColour;
|
|||
|
||||
uniform vec2 dimension;
|
||||
uniform vec2 position;
|
||||
uniform float scale;
|
||||
|
||||
uniform vec2 scale;
|
||||
uniform int scaleUseSurf;
|
||||
uniform sampler2D scaleSurf;
|
||||
|
||||
#define K 0.142857142857 // 1/7
|
||||
#define Ko 0.428571428571 // 3/7
|
||||
|
@ -19,7 +22,7 @@ vec2 mod289(vec2 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
|
|||
vec3 mod7(vec3 x) { return x - floor(x * (1.0 / 7.0)) * 7.0; }
|
||||
vec3 permute(vec3 x) { return mod289((34.0 * x + 10.0) * x); }
|
||||
|
||||
vec2 cellular(vec2 P) {
|
||||
vec2 cellular(vec2 P) { #region
|
||||
vec2 Pi = mod289(floor(P));
|
||||
vec2 Pf = fract(P);
|
||||
vec3 oi = vec3(-1.0, 0.0, 1.0);
|
||||
|
@ -31,34 +34,47 @@ vec2 cellular(vec2 P) {
|
|||
vec3 dx = Pf.x + 0.5 + jitter * ox;
|
||||
vec3 dy = Pf.y - of + jitter * oy;
|
||||
vec3 d1 = dx * dx + dy * dy; // d11, d12 and d13, squared
|
||||
|
||||
p = permute(px.y + Pi.y + oi); // p21, p22, p23
|
||||
ox = fract(p * K) - Ko;
|
||||
oy = mod7(floor(p * K)) * K - Ko;
|
||||
dx = Pf.x - 0.5 + jitter * ox;
|
||||
dy = Pf.y - of + jitter * oy;
|
||||
|
||||
vec3 d2 = dx * dx + dy * dy; // d21, d22 and d23, squared
|
||||
p = permute(px.z + Pi.y + oi); // p31, p32, p33
|
||||
ox = fract(p * K) - Ko;
|
||||
oy = mod7(floor(p * K)) * K - Ko;
|
||||
dx = Pf.x - 1.5 + jitter * ox;
|
||||
dy = Pf.y - of + jitter * oy;
|
||||
|
||||
vec3 d3 = dx * dx + dy * dy; // d31, d32 and d33, squared
|
||||
// Sort out the two smallest distances (F1, F2)
|
||||
vec3 d1a = min(d1, d2);
|
||||
d2 = max(d1, d2); // Swap to keep candidates for F2
|
||||
d2 = min(d2, d3); // neither F1 nor F2 are now in d3
|
||||
d1 = min(d1a, d2); // F1 is now in d1
|
||||
d2 = max(d1a, d2); // Swap to keep candidates for F2
|
||||
|
||||
d2 = max(d1, d2); // Swap to keep candidates for F2
|
||||
d2 = min(d2, d3); // neither F1 nor F2 are now in d3
|
||||
d1 = min(d1a, d2); // F1 is now in d1
|
||||
d2 = max(d1a, d2); // Swap to keep candidates for F2
|
||||
d1.xy = (d1.x < d1.y) ? d1.xy : d1.yx; // Swap if smaller
|
||||
d1.xz = (d1.x < d1.z) ? d1.xz : d1.zx; // F1 is in d1.x
|
||||
d1.yz = min(d1.yz, d2.yz); // F2 is now not in d2.yz
|
||||
d1.y = min(d1.y, d1.z); // nor in d1.z
|
||||
d1.y = min(d1.y, d2.x); // F2 is in d1.y, we're done.
|
||||
d1.y = min(d1.y, d1.z); // nor in d1.z
|
||||
d1.y = min(d1.y, d2.x); // F2 is in d1.y, we're done.
|
||||
|
||||
return sqrt(d1.xy);
|
||||
}
|
||||
} #endregion
|
||||
|
||||
void main() {
|
||||
vec2 p = (v_vTexcoord - position / dimension) * scale * 2.0 - 1.0;
|
||||
#region params
|
||||
float sca = scale.x;
|
||||
if(scaleUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( scaleSurf, v_vTexcoord );
|
||||
sca = mix(scale.x, scale.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
#endregion
|
||||
|
||||
vec2 p = (v_vTexcoord - position / dimension) * sca * 2.0 - 1.0;
|
||||
float n = cellular(p).y;
|
||||
|
||||
gl_FragColor = vec4(vec3(n), 1.);
|
||||
|
|
|
@ -3,15 +3,18 @@
|
|||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform vec2 dimension;
|
||||
uniform vec2 position;
|
||||
uniform float scale;
|
||||
uniform vec2 dimension;
|
||||
uniform vec2 position;
|
||||
uniform float time;
|
||||
uniform float contrast;
|
||||
uniform float middle;
|
||||
uniform float radiusScale;
|
||||
uniform float radiusShatter;
|
||||
uniform int pattern;
|
||||
uniform int pattern;
|
||||
|
||||
uniform vec2 scale;
|
||||
uniform int scaleUseSurf;
|
||||
uniform sampler2D scaleSurf;
|
||||
|
||||
#define TAU 6.283185307179586
|
||||
#define PI 3.14159265359
|
||||
|
@ -21,10 +24,19 @@ vec2 random2( vec2 p ) { return fract(sin(vec2(dot(p, vec2(127.1, 311.7)), dot(p
|
|||
float random (in vec2 st) { return fract(sin(dot(st.xy, vec2(12.9898, 78.233))) * 43758.5453123); }
|
||||
|
||||
void main() {
|
||||
#region params
|
||||
float sca = scale.x;
|
||||
float scaMax = max(scale.x, scale.y);
|
||||
if(scaleUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( scaleSurf, v_vTexcoord );
|
||||
sca = mix(scale.x, scale.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
#endregion
|
||||
|
||||
vec2 pos = position / dimension;
|
||||
vec2 st = v_vTexcoord - pos;
|
||||
|
||||
st *= scale;
|
||||
st *= sca;
|
||||
|
||||
float md = 8.;
|
||||
vec2 mg, mr;
|
||||
|
@ -36,7 +48,7 @@ void main() {
|
|||
for (int y = -1; y <= 1; y++)
|
||||
for (int x = -1; x <= 1; x++) {
|
||||
vec2 neighbor = vec2(float(x), float(y));
|
||||
vec2 point = random2(mod(i_st + neighbor, scale));
|
||||
vec2 point = random2(mod(i_st + neighbor, scaMax));
|
||||
point = 0.5 + 0.5 * sin(time + TAU * point);
|
||||
|
||||
vec2 _diff = neighbor + point - f_st;
|
||||
|
@ -53,7 +65,7 @@ void main() {
|
|||
for(int y = -2; y <= 2; y++)
|
||||
for(int x = -2; x <= 2; x++) {
|
||||
vec2 g = mg + vec2(float(x), float(y));
|
||||
vec2 point = random2(mod(i_st + g, scale));
|
||||
vec2 point = random2(mod(i_st + g, scaMax));
|
||||
point = 0.5 + 0.5 * sin(time + TAU * point);
|
||||
|
||||
vec2 r = g + point - f_st;
|
||||
|
@ -61,11 +73,11 @@ void main() {
|
|||
md = min( md, dot( 0.5 * (mr + r), normalize(r - mr)) );
|
||||
}
|
||||
} else if(pattern == 1) {
|
||||
for (int j = 0; j <= int(scale / 2.); j++) {
|
||||
int _amo = int(scale) + int(float(j) * radiusShatter);
|
||||
for (int j = 0; j <= int(sca / 2.); j++) {
|
||||
int _amo = int(sca) + int(float(j) * radiusShatter);
|
||||
for (int i = 0; i <= _amo; i++) {
|
||||
float ang = TAU / float(_amo) * float(i) + float(j) + time;
|
||||
float rad = pow(float(j) / scale, radiusScale) * scale * .5 + random(vec2(ang)) * 0.1;
|
||||
float rad = pow(float(j) / sca, radiusScale) * sca * .5 + random(vec2(ang)) * 0.1;
|
||||
vec2 neighbor = vec2(cos(ang) * rad, sin(ang) * rad);
|
||||
vec2 point = neighbor + pos;
|
||||
|
||||
|
@ -81,11 +93,11 @@ void main() {
|
|||
}
|
||||
|
||||
md = 1.;
|
||||
for (int j = 0; j <= int(scale / 2.); j++) {
|
||||
int _amo = int(scale) + int(float(j) * radiusShatter);
|
||||
for (int j = 0; j <= int(sca / 2.); j++) {
|
||||
int _amo = int(sca) + int(float(j) * radiusShatter);
|
||||
for (int i = 0; i <= _amo; i++) {
|
||||
float ang = TAU / float(_amo) * float(i) + float(j) + random(vec2(0.684, 1.387)) + time;
|
||||
float rad = pow(float(j) / scale, radiusScale) * scale * .5 + random(vec2(ang)) * 0.1;
|
||||
float rad = pow(float(j) / sca, radiusScale) * sca * .5 + random(vec2(ang)) * 0.1;
|
||||
vec2 neighbor = vec2(cos(ang) * rad, sin(ang) * rad);
|
||||
vec2 point = neighbor + pos;
|
||||
|
||||
|
|
|
@ -4,16 +4,19 @@
|
|||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform vec2 dimension;
|
||||
uniform vec2 position;
|
||||
uniform float scale;
|
||||
uniform vec2 dimension;
|
||||
uniform vec2 position;
|
||||
uniform float time;
|
||||
uniform float contrast;
|
||||
uniform float middle;
|
||||
uniform float radiusScale;
|
||||
uniform float radiusShatter;
|
||||
uniform int pattern;
|
||||
uniform int colored;
|
||||
uniform int pattern;
|
||||
uniform int colored;
|
||||
|
||||
uniform vec2 scale;
|
||||
uniform int scaleUseSurf;
|
||||
uniform sampler2D scaleSurf;
|
||||
|
||||
#define TAU 6.283185307179586
|
||||
|
||||
|
@ -30,10 +33,19 @@ vec3 colorNoise(in vec2 st) {
|
|||
}
|
||||
|
||||
void main() {
|
||||
#region params
|
||||
float sca = scale.x;
|
||||
float scaMax = max(scale.x, scale.y);
|
||||
if(scaleUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( scaleSurf, v_vTexcoord );
|
||||
sca = mix(scale.x, scale.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
#endregion
|
||||
|
||||
vec2 pos = position / dimension;
|
||||
vec2 st = v_vTexcoord - pos;
|
||||
vec3 color = vec3(.0);
|
||||
st *= scale;
|
||||
st *= sca;
|
||||
|
||||
vec2 i_st = floor(st);
|
||||
vec2 f_st = fract(st);
|
||||
|
@ -45,7 +57,7 @@ void main() {
|
|||
for (int y = -1; y <= 1; y++) {
|
||||
for (int x = -1; x <= 1; x++) {
|
||||
vec2 neighbor = vec2(float(x),float(y));
|
||||
vec2 point = random2(mod(i_st + neighbor, scale));
|
||||
vec2 point = random2(mod(i_st + neighbor, scaMax));
|
||||
point = 0.5 + 0.5 * sin(time + 6.2831 * point);
|
||||
|
||||
vec2 _diff = neighbor + point - f_st;
|
||||
|
@ -58,11 +70,11 @@ void main() {
|
|||
}
|
||||
}
|
||||
} else if(pattern == 1) {
|
||||
for (int j = 0; j <= int(scale / 2.); j++) {
|
||||
int _amo = int(scale) + int(float(j) * radiusShatter);
|
||||
for (int j = 0; j <= int(sca / 2.); j++) {
|
||||
int _amo = int(sca) + int(float(j) * radiusShatter);
|
||||
for (int i = 0; i <= _amo; i++) {
|
||||
float ang = TAU / float(_amo) * float(i) + float(j) + random(vec2(0.684, 1.387)) + time;
|
||||
float rad = pow(float(j) / scale, radiusScale) * scale * .5 + random(vec2(ang)) * 0.1;
|
||||
float rad = pow(float(j) / sca, radiusScale) * sca * .5 + random(vec2(ang)) * 0.1;
|
||||
vec2 point = vec2(cos(ang) * rad, sin(ang) * rad) + pos;
|
||||
|
||||
vec2 _diff = point - v_vTexcoord;
|
||||
|
|
|
@ -6,9 +6,12 @@ varying vec4 v_vColour;
|
|||
|
||||
uniform vec2 dimension;
|
||||
uniform vec2 center;
|
||||
uniform float strength;
|
||||
|
||||
/////////////// SAMPLING ///////////////
|
||||
uniform vec2 strength;
|
||||
uniform int strengthUseSurf;
|
||||
uniform sampler2D strengthSurf;
|
||||
|
||||
#region /////////////// SAMPLING ///////////////
|
||||
|
||||
const float PI = 3.14159265358979323846;
|
||||
uniform int interpolation;
|
||||
|
@ -54,14 +57,20 @@ vec4 texture2Dintp( sampler2D texture, vec2 uv ) {
|
|||
return texture2D( texture, uv );
|
||||
}
|
||||
|
||||
/////////////// SAMPLING ///////////////
|
||||
#endregion /////////////// SAMPLING ///////////////
|
||||
|
||||
void main() {
|
||||
float str = strength.x;
|
||||
if(strengthUseSurf == 1) {
|
||||
vec4 _vMap = texture2Dintp( strengthSurf, v_vTexcoord );
|
||||
str = mix(strength.x, strength.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
vec2 texel = 1.0 / dimension;
|
||||
vec2 coords = (v_vTexcoord - center / dimension) * 2.0;
|
||||
float coordDot = dot(coords, coords);
|
||||
|
||||
vec2 precompute = strength * coordDot * coords;
|
||||
vec2 precompute = str * coordDot * coords;
|
||||
vec2 uvR = v_vTexcoord - texel.xy * precompute;
|
||||
vec2 uvB = v_vTexcoord + texel.xy * precompute;
|
||||
|
||||
|
|
|
@ -6,9 +6,12 @@ varying vec4 v_vColour;
|
|||
|
||||
uniform vec4 colorFrom[32];
|
||||
uniform int colorFrom_amo;
|
||||
uniform float treshold;
|
||||
uniform int invert;
|
||||
|
||||
uniform vec2 treshold;
|
||||
uniform int tresholdUseSurf;
|
||||
uniform sampler2D tresholdSurf;
|
||||
|
||||
vec3 rgb2xyz( vec3 c ) {
|
||||
vec3 tmp;
|
||||
tmp.x = ( c.r > 0.04045 ) ? pow( ( c.r + 0.055 ) / 1.055, 2.4 ) : c.r / 12.92;
|
||||
|
@ -35,6 +38,12 @@ vec3 rgb2lab(vec3 c) {
|
|||
}
|
||||
|
||||
void main() {
|
||||
float trh = treshold.x;
|
||||
if(tresholdUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( tresholdSurf, v_vTexcoord );
|
||||
trh = mix(treshold.x, treshold.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
vec4 col = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
|
||||
vec4 baseColor;
|
||||
baseColor = col;
|
||||
|
@ -49,7 +58,7 @@ void main() {
|
|||
min_df = min(min_df, df);
|
||||
}
|
||||
|
||||
if((invert == 0 && min_df <= treshold) || (invert == 1 && min_df > treshold))
|
||||
if((invert == 0 && min_df <= trh) || (invert == 1 && min_df > trh))
|
||||
gl_FragColor = vec4(0.);
|
||||
else
|
||||
gl_FragColor = baseColor;
|
||||
|
|
|
@ -5,15 +5,18 @@ varying vec2 v_vTexcoord;
|
|||
varying vec4 v_vColour;
|
||||
|
||||
#define GRADIENT_LIMIT 128
|
||||
|
||||
uniform int gradient_blend;
|
||||
uniform vec4 gradient_color[GRADIENT_LIMIT];
|
||||
uniform int gradient_blend;
|
||||
uniform vec4 gradient_color[GRADIENT_LIMIT];
|
||||
uniform float gradient_time[GRADIENT_LIMIT];
|
||||
uniform int gradient_keys;
|
||||
uniform float gradient_shift;
|
||||
uniform int multiply_alpha;
|
||||
uniform int gradient_keys;
|
||||
|
||||
vec3 rgb2hsv(vec3 c) {
|
||||
uniform int multiply_alpha;
|
||||
|
||||
uniform vec2 gradient_shift;
|
||||
uniform int gradient_shiftUseSurf;
|
||||
uniform sampler2D gradient_shiftSurf;
|
||||
|
||||
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));
|
||||
|
@ -21,21 +24,21 @@ vec3 rgb2hsv(vec3 c) {
|
|||
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) {
|
||||
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 hueDist(float a0, float a1, float t) {
|
||||
float hueDist(float a0, float a1, float t) { #region
|
||||
float da = fract(a1 - a0);
|
||||
float ds = fract(2. * da) - da;
|
||||
return a0 + ds * t;
|
||||
}
|
||||
} #endregion
|
||||
|
||||
vec3 hsvMix(vec3 c1, vec3 c2, float t) {
|
||||
vec3 hsvMix(vec3 c1, vec3 c2, float t) { #region
|
||||
vec3 h1 = rgb2hsv(c1);
|
||||
vec3 h2 = rgb2hsv(c2);
|
||||
|
||||
|
@ -45,9 +48,9 @@ vec3 hsvMix(vec3 c1, vec3 c2, float t) {
|
|||
h.z = mix(h1.z, h2.z, t);
|
||||
|
||||
return hsv2rgb(h);
|
||||
}
|
||||
} #endregion
|
||||
|
||||
vec4 gradientEval(in float prog) {
|
||||
vec4 gradientEval(in float prog) { #region
|
||||
vec4 col = vec4(0.);
|
||||
|
||||
for(int i = 0; i < GRADIENT_LIMIT; i++) {
|
||||
|
@ -75,11 +78,17 @@ vec4 gradientEval(in float prog) {
|
|||
}
|
||||
|
||||
return col;
|
||||
}
|
||||
} #endregion
|
||||
|
||||
void main() {
|
||||
vec4 _col = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
|
||||
float prog = abs(dot(_col.rgb, vec3(0.2126, 0.7152, 0.0722)) + gradient_shift);
|
||||
void main() { #region
|
||||
float shf = gradient_shift.x;
|
||||
if(gradient_shiftUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( gradient_shiftSurf, v_vTexcoord );
|
||||
shf = mix(gradient_shift.x, gradient_shift.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
vec4 _col = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
|
||||
float prog = abs(dot(_col.rgb, vec3(0.2126, 0.7152, 0.0722)) + shf);
|
||||
if(multiply_alpha == 1)
|
||||
prog *= _col.a;
|
||||
|
||||
|
@ -94,4 +103,4 @@ void main() {
|
|||
col.a = _col.a;
|
||||
|
||||
gl_FragColor = col;
|
||||
}
|
||||
} #endregion
|
|
@ -4,7 +4,6 @@
|
|||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform float base;
|
||||
uniform int mode;
|
||||
uniform sampler2D samplerR;
|
||||
uniform sampler2D samplerG;
|
||||
|
@ -16,15 +15,25 @@ uniform int useG;
|
|||
uniform int useB;
|
||||
uniform int useA;
|
||||
|
||||
uniform vec2 base;
|
||||
uniform int baseUseSurf;
|
||||
uniform sampler2D baseSurf;
|
||||
|
||||
float sample(vec4 col, int ch) {
|
||||
if(mode == 0) return (col[0] + col[1] + col[2]) / 3. * col[3];
|
||||
return col[ch];
|
||||
}
|
||||
|
||||
void main() {
|
||||
float r = (useR == 1)? sample(texture2D( samplerR, v_vTexcoord ), 0) : base;
|
||||
float g = (useG == 1)? sample(texture2D( samplerG, v_vTexcoord ), 1) : base;
|
||||
float b = (useB == 1)? sample(texture2D( samplerB, v_vTexcoord ), 2) : base;
|
||||
float bse = base.x;
|
||||
if(baseUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( baseSurf, v_vTexcoord );
|
||||
bse = mix(base.x, base.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
float r = (useR == 1)? sample(texture2D( samplerR, v_vTexcoord ), 0) : bse;
|
||||
float g = (useG == 1)? sample(texture2D( samplerG, v_vTexcoord ), 1) : bse;
|
||||
float b = (useB == 1)? sample(texture2D( samplerB, v_vTexcoord ), 2) : bse;
|
||||
float a = (useA == 1)? sample(texture2D( samplerA, v_vTexcoord ), 3) : 1.;
|
||||
|
||||
gl_FragColor = vec4(r, g, b, a);
|
||||
|
|
|
@ -4,13 +4,19 @@
|
|||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform vec2 dimension;
|
||||
uniform vec2 center;
|
||||
uniform float strength;
|
||||
uniform float radius;
|
||||
uniform int sampleMode;
|
||||
uniform vec2 dimension;
|
||||
uniform vec2 center;
|
||||
uniform int sampleMode;
|
||||
|
||||
/////////////// SAMPLING ///////////////
|
||||
uniform vec2 radius;
|
||||
uniform int radiusUseSurf;
|
||||
uniform sampler2D radiusSurf;
|
||||
|
||||
uniform vec2 strength;
|
||||
uniform int strengthUseSurf;
|
||||
uniform sampler2D strengthSurf;
|
||||
|
||||
#region /////////////// SAMPLING ///////////////
|
||||
|
||||
const float PI = 3.14159265358979323846;
|
||||
uniform int interpolation;
|
||||
|
@ -56,9 +62,9 @@ vec4 texture2Dintp( sampler2D texture, vec2 uv ) {
|
|||
return texture2D( texture, uv );
|
||||
}
|
||||
|
||||
/////////////// SAMPLING ///////////////
|
||||
#endregion /////////////// SAMPLING ///////////////
|
||||
|
||||
vec4 sampleTexture(vec2 pos) {
|
||||
vec4 sampleTexture(vec2 pos) { #region
|
||||
if(pos.x >= 0. && pos.y >= 0. && pos.x <= 1. && pos.y <= 1.)
|
||||
return texture2Dintp(gm_BaseTexture, pos);
|
||||
|
||||
|
@ -70,15 +76,27 @@ vec4 sampleTexture(vec2 pos) {
|
|||
return texture2Dintp(gm_BaseTexture, fract(pos));
|
||||
|
||||
return vec4(0.);
|
||||
}
|
||||
} #endregion
|
||||
|
||||
void main() {
|
||||
float rad = radius.x;
|
||||
if(radiusUseSurf == 1) {
|
||||
vec4 _vMap = texture2Dintp( radiusSurf, v_vTexcoord );
|
||||
rad = mix(radius.x, radius.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
float str = strength.x;
|
||||
if(strengthUseSurf == 1) {
|
||||
vec4 _vMap = texture2Dintp( strengthSurf, v_vTexcoord );
|
||||
str = mix(strength.x, strength.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
vec2 pixelPos = v_vTexcoord * dimension;
|
||||
vec2 to = center - pixelPos;
|
||||
float dis = distance(center, pixelPos);
|
||||
float eff = 1. - clamp(dis / radius, 0., 1.);
|
||||
float eff = 1. - clamp(dis / rad, 0., 1.);
|
||||
|
||||
vec2 tex = pixelPos + to * eff * strength;
|
||||
vec2 tex = pixelPos + to * eff * str;
|
||||
tex /= dimension;
|
||||
gl_FragColor = sampleTexture( tex );
|
||||
}
|
||||
|
|
|
@ -5,29 +5,38 @@ varying vec2 v_vTexcoord;
|
|||
varying vec4 v_vColour;
|
||||
|
||||
uniform vec2 dimension;
|
||||
uniform float size;
|
||||
uniform int border;
|
||||
uniform int alpha;
|
||||
uniform int border;
|
||||
uniform int alpha;
|
||||
|
||||
uniform vec2 size;
|
||||
uniform int sizeUseSurf;
|
||||
uniform sampler2D sizeSurf;
|
||||
|
||||
#define TAU 6.283185307179586
|
||||
|
||||
float bright(in vec4 col) {
|
||||
return dot(col.rgb, vec3(0.2126, 0.7152, 0.0722)) * col.a;
|
||||
}
|
||||
float bright(in vec4 col) { return dot(col.rgb, vec3(0.2126, 0.7152, 0.0722)) * col.a; }
|
||||
|
||||
void main() {
|
||||
vec2 pixelPosition = v_vTexcoord * dimension;
|
||||
vec4 point = texture2D( gm_BaseTexture, v_vTexcoord );
|
||||
vec4 fill = vec4(0.);
|
||||
vec4 fill = vec4(0.);
|
||||
|
||||
if(alpha == 0) fill.a = 1.;
|
||||
gl_FragColor = point;
|
||||
|
||||
if(alpha == 0 && length(point.rgb) <= 0.)
|
||||
return;
|
||||
if(alpha == 1 && point.a <= 0.)
|
||||
return;
|
||||
if(alpha == 0 && length(point.rgb) <= 0.) return;
|
||||
if(alpha == 1 && point.a <= 0.) return;
|
||||
|
||||
float siz = size.x;
|
||||
float sizMax = max(size.x, size.y);
|
||||
if(sizeUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( sizeSurf, v_vTexcoord );
|
||||
siz = mix(size.x, size.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
for(float i = 1.; i < sizMax; i++) {
|
||||
if(i >= siz) break;
|
||||
|
||||
for(float i = 1.; i < size; i++) {
|
||||
float base = 1.;
|
||||
float top = 0.;
|
||||
for(float j = 0.; j <= 64.; j++) {
|
||||
|
|
|
@ -7,20 +7,35 @@ varying vec4 v_vColour;
|
|||
#define TAU 6.283185307179586
|
||||
|
||||
uniform vec2 center;
|
||||
uniform float angle;
|
||||
uniform float radius;
|
||||
uniform float shift;
|
||||
uniform int type;
|
||||
|
||||
uniform vec2 angle;
|
||||
uniform int angleUseSurf;
|
||||
uniform sampler2D angleSurf;
|
||||
|
||||
uniform vec2 radius;
|
||||
uniform int radiusUseSurf;
|
||||
uniform sampler2D radiusSurf;
|
||||
|
||||
uniform vec2 shift;
|
||||
uniform int shiftUseSurf;
|
||||
uniform sampler2D shiftSurf;
|
||||
|
||||
uniform vec2 scale;
|
||||
uniform int scaleUseSurf;
|
||||
uniform sampler2D scaleSurf;
|
||||
|
||||
uniform int type;
|
||||
uniform int gradient_loop;
|
||||
|
||||
float sca;
|
||||
|
||||
#region ////////////////////////////////////////// GRADIENT BEGIN //////////////////////////////////////////
|
||||
|
||||
#define GRADIENT_LIMIT 128
|
||||
uniform int gradient_blend;
|
||||
uniform vec4 gradient_color[GRADIENT_LIMIT];
|
||||
uniform int gradient_blend;
|
||||
uniform vec4 gradient_color[GRADIENT_LIMIT];
|
||||
uniform float gradient_time[GRADIENT_LIMIT];
|
||||
uniform int gradient_keys;
|
||||
uniform int gradient_keys;
|
||||
|
||||
vec3 rgb2hsv(vec3 c) {
|
||||
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||||
|
@ -57,17 +72,26 @@ vec3 hsvMix(vec3 c1, vec3 c2, float t) {
|
|||
}
|
||||
|
||||
vec4 gradientEval(in float prog) {
|
||||
vec4 col = vec4(0.);
|
||||
vec4 col = vec4(0.);
|
||||
float _ptime = 0.;
|
||||
|
||||
for(int i = 0; i < GRADIENT_LIMIT; i++) {
|
||||
if(gradient_time[i] == prog) {
|
||||
if(i >= gradient_keys) {
|
||||
col = gradient_color[i - 1];
|
||||
break;
|
||||
}
|
||||
|
||||
float _time = gradient_time[i];
|
||||
_time = 0.5 + (_time - 0.5) * sca;
|
||||
|
||||
if(_time == prog) {
|
||||
col = gradient_color[i];
|
||||
break;
|
||||
} else if(gradient_time[i] > prog) {
|
||||
} else if(_time > prog) {
|
||||
if(i == 0)
|
||||
col = gradient_color[i];
|
||||
else {
|
||||
float t = (prog - gradient_time[i - 1]) / (gradient_time[i] - gradient_time[i - 1]);
|
||||
float t = (prog - _ptime) / (_time - _ptime);
|
||||
if(gradient_blend == 0)
|
||||
col = mix(gradient_color[i - 1], gradient_color[i], t);
|
||||
else if(gradient_blend == 1)
|
||||
|
@ -77,10 +101,8 @@ vec4 gradientEval(in float prog) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
if(i >= gradient_keys - 1) {
|
||||
col = gradient_color[gradient_keys - 1];
|
||||
break;
|
||||
}
|
||||
|
||||
_ptime = _time;
|
||||
}
|
||||
|
||||
return col;
|
||||
|
@ -89,25 +111,51 @@ vec4 gradientEval(in float prog) {
|
|||
#endregion ////////////////////////////////////////// GRADIENT END //////////////////////////////////////////
|
||||
|
||||
void main() {
|
||||
#region params
|
||||
float ang = angle.x;
|
||||
if(angleUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( angleSurf, v_vTexcoord );
|
||||
ang = mix(angle.x, angle.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
ang = radians(ang);
|
||||
|
||||
float rad = radius.x;
|
||||
if(radiusUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( radiusSurf, v_vTexcoord );
|
||||
rad = mix(radius.x, radius.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
rad *= sqrt(2.);
|
||||
|
||||
float shf = shift.x;
|
||||
if(shiftUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( shiftSurf, v_vTexcoord );
|
||||
shf = mix(shift.x, shift.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
sca = scale.x;
|
||||
if(scaleUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( scaleSurf, v_vTexcoord );
|
||||
sca = mix(scale.x, scale.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
#endregion
|
||||
|
||||
float prog = 0.;
|
||||
if(type == 0) {
|
||||
prog = .5 + (v_vTexcoord.x - center.x) * cos(angle) - (v_vTexcoord.y - center.y) * sin(angle);
|
||||
prog = .5 + (v_vTexcoord.x - center.x) * cos(ang) - (v_vTexcoord.y - center.y) * sin(ang);
|
||||
} else if(type == 1) {
|
||||
prog = distance(v_vTexcoord, center) / radius;
|
||||
prog = distance(v_vTexcoord, center) / rad;
|
||||
} else if(type == 2) {
|
||||
vec2 _p = v_vTexcoord - center;
|
||||
float _a = atan(_p.y, _p.x) + angle;
|
||||
float _a = atan(_p.y, _p.x) + ang;
|
||||
prog = (_a - floor(_a / TAU) * TAU) / TAU;
|
||||
}
|
||||
prog = prog + shift;
|
||||
|
||||
prog += shf;
|
||||
|
||||
if(gradient_loop == 1) {
|
||||
prog = abs(prog);
|
||||
if(prog > 1.) {
|
||||
if(prog == floor(prog))
|
||||
prog = 1.;
|
||||
else
|
||||
prog = fract(prog);
|
||||
}
|
||||
if(prog > 1.)
|
||||
prog = prog == floor(prog)? 1. : fract(prog);
|
||||
}
|
||||
|
||||
vec4 col = gradientEval(prog);
|
||||
|
|
|
@ -8,15 +8,27 @@ varying vec4 v_vColour;
|
|||
|
||||
uniform vec2 position;
|
||||
uniform vec2 dimension;
|
||||
uniform vec2 scale;
|
||||
uniform float angle;
|
||||
uniform float width;
|
||||
uniform float shift;
|
||||
uniform float seed;
|
||||
uniform int shiftAxis;
|
||||
uniform int mode;
|
||||
uniform int aa;
|
||||
|
||||
uniform vec2 scale;
|
||||
uniform int scaleUseSurf;
|
||||
uniform sampler2D scaleSurf;
|
||||
|
||||
uniform vec2 angle;
|
||||
uniform int angleUseSurf;
|
||||
uniform sampler2D angleSurf;
|
||||
|
||||
uniform vec2 width;
|
||||
uniform int widthUseSurf;
|
||||
uniform sampler2D widthSurf;
|
||||
|
||||
uniform vec2 shift;
|
||||
uniform int shiftUseSurf;
|
||||
uniform sampler2D shiftSurf;
|
||||
|
||||
uniform vec4 gapCol;
|
||||
uniform int gradient_use;
|
||||
uniform int gradient_blend;
|
||||
|
@ -91,26 +103,57 @@ vec4 gradientEval(in float prog) { #region
|
|||
} #endregion
|
||||
|
||||
void main() { #region
|
||||
#region params
|
||||
vec2 sca = scale;
|
||||
if(scaleUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( scaleSurf, v_vTexcoord );
|
||||
sca = vec2(mix(scale.x, scale.y, (_vMap.r + _vMap.g + _vMap.b) / 3.));
|
||||
}
|
||||
|
||||
float ang = angle.x;
|
||||
if(angleUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( angleSurf, v_vTexcoord );
|
||||
ang = mix(angle.x, angle.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
ang = radians(ang);
|
||||
|
||||
float wid = width.x;
|
||||
if(widthUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( widthSurf, v_vTexcoord );
|
||||
wid = mix(width.x, width.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
float shf = shift.x;
|
||||
if(shiftUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( shiftSurf, v_vTexcoord );
|
||||
shf = mix(shift.x, shift.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
#endregion
|
||||
|
||||
vec2 pos = v_vTexcoord - position, _pos;
|
||||
float ratio = dimension.x / dimension.y;
|
||||
_pos.x = pos.x * ratio * cos(angle) - pos.y * sin(angle);
|
||||
_pos.y = pos.x * ratio * sin(angle) + pos.y * cos(angle);
|
||||
_pos.x = pos.x * ratio * cos(ang) - pos.y * sin(ang);
|
||||
_pos.y = pos.x * ratio * sin(ang) + pos.y * cos(ang);
|
||||
|
||||
if(shiftAxis == 0) {
|
||||
float cellY = floor(_pos.y * scale.y);
|
||||
float shiftX = mod(cellY, 2.) * shift;
|
||||
shf /= sca.x;
|
||||
|
||||
float cellY = floor(_pos.y * sca.y);
|
||||
float shiftX = mod(cellY, 2.) * shf;
|
||||
|
||||
_pos.x += shiftX;
|
||||
} else {
|
||||
float cellX = floor(_pos.x * scale.x);
|
||||
float shiftY = mod(cellX, 2.) * shift;
|
||||
shf /= sca.y;
|
||||
|
||||
float cellX = floor(_pos.x * sca.x);
|
||||
float shiftY = mod(cellX, 2.) * shf;
|
||||
|
||||
_pos.y += shiftY;
|
||||
}
|
||||
|
||||
vec2 sqSt = floor(_pos * scale) / scale;
|
||||
vec2 sqSt = floor(_pos * sca) / sca;
|
||||
vec2 _dist = _pos - sqSt;
|
||||
vec2 nPos = abs(_dist * scale - vec2(0.5)) * 2.; //distance in x, y axis
|
||||
vec2 nPos = abs(_dist * sca - vec2(0.5)) * 2.; //distance in x, y axis
|
||||
float dist = 1. - max(nPos.x, nPos.y);
|
||||
|
||||
vec4 colr;
|
||||
|
@ -123,7 +166,7 @@ void main() { #region
|
|||
if(mode == 0) {
|
||||
colr = vec4(gradientEval(random(sqSt)).rgb, 1.);
|
||||
} else if(mode == 2) {
|
||||
vec2 uv = fract(_pos * scale);
|
||||
vec2 uv = fract(_pos * sca);
|
||||
colr = texture2D( gm_BaseTexture, uv );
|
||||
} else if(mode == 3) {
|
||||
vec2 uv = fract(sqSt);
|
||||
|
@ -131,5 +174,5 @@ void main() { #region
|
|||
}
|
||||
|
||||
float _aa = 4. / max(dimension.x, dimension.y);
|
||||
gl_FragColor = mix(gapCol, colr, aa == 1? smoothstep(width - _aa, width, dist) : step(width, dist));
|
||||
gl_FragColor = mix(gapCol, colr, aa == 1? smoothstep(wid - _aa, wid, dist) : step(wid, dist));
|
||||
} #endregion
|
||||
|
|
|
@ -5,13 +5,22 @@ varying vec4 v_vColour;
|
|||
|
||||
uniform vec2 dimension;
|
||||
uniform vec2 position;
|
||||
uniform vec2 scale;
|
||||
uniform float angle;
|
||||
uniform float thick;
|
||||
uniform float seed;
|
||||
uniform int mode;
|
||||
uniform int aa;
|
||||
|
||||
uniform vec2 scale;
|
||||
uniform int scaleUseSurf;
|
||||
uniform sampler2D scaleSurf;
|
||||
|
||||
uniform vec2 angle;
|
||||
uniform int angleUseSurf;
|
||||
uniform sampler2D angleSurf;
|
||||
|
||||
uniform vec2 thick;
|
||||
uniform int thickUseSurf;
|
||||
uniform sampler2D thickSurf;
|
||||
|
||||
uniform vec4 gapCol;
|
||||
uniform int gradient_use;
|
||||
uniform int gradient_blend;
|
||||
|
@ -112,10 +121,31 @@ vec4 HexCoords(vec2 uv) { #region
|
|||
} #endregion
|
||||
|
||||
void main() { #region
|
||||
vec2 pos = (v_vTexcoord - position) * scale, _pos;
|
||||
#region params
|
||||
vec2 sca = scale;
|
||||
if(scaleUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( scaleSurf, v_vTexcoord );
|
||||
sca = vec2(mix(scale.x, scale.y, (_vMap.r + _vMap.g + _vMap.b) / 3.));
|
||||
}
|
||||
|
||||
float ang = angle.x;
|
||||
if(angleUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( angleSurf, v_vTexcoord );
|
||||
ang = mix(angle.x, angle.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
ang = radians(ang);
|
||||
|
||||
float thk = thick.x;
|
||||
if(thickUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( thickSurf, v_vTexcoord );
|
||||
thk = mix(thick.x, thick.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
#endregion
|
||||
|
||||
vec2 pos = (v_vTexcoord - position) * sca, _pos;
|
||||
float ratio = dimension.x / dimension.y;
|
||||
_pos.x = pos.x * ratio * cos(angle) - pos.y * sin(angle);
|
||||
_pos.y = pos.x * ratio * sin(angle) + pos.y * cos(angle);
|
||||
_pos.x = pos.x * ratio * cos(ang) - pos.y * sin(ang);
|
||||
_pos.y = pos.x * ratio * sin(ang) + pos.y * cos(ang);
|
||||
|
||||
vec4 hc = HexCoords(_pos);
|
||||
vec4 colr;
|
||||
|
@ -126,11 +156,11 @@ void main() { #region
|
|||
}
|
||||
|
||||
if(mode == 0) {
|
||||
vec2 uv = abs(hc.zw) / scale;
|
||||
vec2 uv = abs(hc.zw) / sca;
|
||||
uv.x = fract(uv.x);
|
||||
uv.y = clamp(uv.y, 0., 1.);
|
||||
|
||||
float tileY = floor(scale.y * 4. / 3.);
|
||||
float tileY = floor(sca.y * 4. / 3.);
|
||||
uv.y = mod(floor(uv.y * (tileY + 1.)), tileY) / tileY;
|
||||
|
||||
colr = vec4(gradientEval(random(uv)).rgb, 1.);
|
||||
|
@ -140,10 +170,10 @@ void main() { #region
|
|||
|
||||
colr = texture2D( gm_BaseTexture, uv );
|
||||
} else if(mode == 3) {
|
||||
vec2 uv = clamp(abs(hc.zw) / scale, 0., 1.);
|
||||
vec2 uv = clamp(abs(hc.zw) / sca, 0., 1.);
|
||||
colr = texture2D( gm_BaseTexture, uv );
|
||||
}
|
||||
|
||||
float _aa = 3. / max(dimension.x, dimension.y);
|
||||
gl_FragColor = mix(gapCol, colr, aa == 1? smoothstep(thick - _aa, thick, hc.y) : step(thick, hc.y));
|
||||
gl_FragColor = mix(gapCol, colr, aa == 1? smoothstep(thk - _aa, thk, hc.y) : step(thk, hc.y));
|
||||
} #endregion
|
|
@ -10,13 +10,21 @@ varying vec4 v_vColour;
|
|||
|
||||
uniform vec2 position;
|
||||
uniform vec2 dimension;
|
||||
uniform vec2 scale;
|
||||
uniform float angle;
|
||||
uniform float width;
|
||||
uniform float seed;
|
||||
uniform int mode;
|
||||
uniform int aa;
|
||||
|
||||
uniform int mode;
|
||||
uniform vec2 scale;
|
||||
uniform int scaleUseSurf;
|
||||
uniform sampler2D scaleSurf;
|
||||
|
||||
uniform vec2 angle;
|
||||
uniform int angleUseSurf;
|
||||
uniform sampler2D angleSurf;
|
||||
|
||||
uniform vec2 width;
|
||||
uniform int widthUseSurf;
|
||||
uniform sampler2D widthSurf;
|
||||
|
||||
uniform vec4 gapCol;
|
||||
uniform int gradient_use;
|
||||
|
@ -109,10 +117,31 @@ vec3 triGrid(vec2 p){ #region
|
|||
} #endregion
|
||||
|
||||
void main() { #region
|
||||
vec2 pos = (v_vTexcoord - position) * scale, _pos;
|
||||
#region params
|
||||
vec2 sca = scale;
|
||||
if(scaleUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( scaleSurf, v_vTexcoord );
|
||||
sca = vec2(mix(scale.x, scale.y, (_vMap.r + _vMap.g + _vMap.b) / 3.));
|
||||
}
|
||||
|
||||
float ang = angle.x;
|
||||
if(angleUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( angleSurf, v_vTexcoord );
|
||||
ang = mix(angle.x, angle.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
ang = radians(ang);
|
||||
|
||||
float wid = width.x;
|
||||
if(widthUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( widthSurf, v_vTexcoord );
|
||||
wid = mix(width.x, width.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
#endregion
|
||||
|
||||
vec2 pos = (v_vTexcoord - position) * sca, _pos;
|
||||
float ratio = dimension.x / dimension.y;
|
||||
_pos.x = pos.x * ratio * cos(angle) - pos.y * sin(angle);
|
||||
_pos.y = pos.x * ratio * sin(angle) + pos.y * cos(angle);
|
||||
_pos.x = pos.x * ratio * cos(ang) - pos.y * sin(ang);
|
||||
_pos.y = pos.x * ratio * sin(ang) + pos.y * cos(ang);
|
||||
|
||||
vec3 tri = triGrid(_pos);
|
||||
float dist = max(0., tri.z);
|
||||
|
@ -124,16 +153,16 @@ void main() { #region
|
|||
}
|
||||
|
||||
if(mode == 0) {
|
||||
vec2 uv = fract(tri.xy / scale);
|
||||
vec2 uv = fract(tri.xy / sca);
|
||||
colr = vec4(gradientEval(random(uv)).rgb, 1.);
|
||||
} else if(mode == 2) {
|
||||
vec2 uv = fract((_pos * vec2(1., c30) - tri.xy) + vec2(0.5, 0.));
|
||||
colr = texture2D( gm_BaseTexture, uv );
|
||||
} else if(mode == 3) {
|
||||
vec2 uv = clamp(tri.xy / scale, 0., 1.);
|
||||
vec2 uv = clamp(tri.xy / sca, 0., 1.);
|
||||
colr = texture2D( gm_BaseTexture, uv );
|
||||
}
|
||||
|
||||
float _aa = 3. / max(dimension.x, dimension.y);
|
||||
gl_FragColor = mix(gapCol, colr, aa == 1? smoothstep(width * 2. - _aa, width * 2., dist) : step(width * 2., dist));
|
||||
gl_FragColor = mix(gapCol, colr, aa == 1? smoothstep(wid * 2. - _aa, wid * 2., dist) : step(wid * 2., dist));
|
||||
} #endregion
|
|
@ -4,15 +4,32 @@
|
|||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform float middle;
|
||||
uniform float range;
|
||||
uniform vec2 middle;
|
||||
uniform int middleUseSurf;
|
||||
uniform sampler2D middleSurf;
|
||||
|
||||
uniform vec2 range;
|
||||
uniform int rangeUseSurf;
|
||||
uniform sampler2D rangeSurf;
|
||||
|
||||
void main() {
|
||||
vec4 col = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
|
||||
float mid = middle.x;
|
||||
if(middleUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( middleSurf, v_vTexcoord );
|
||||
mid = mix(middle.x, middle.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
float rng = range.x;
|
||||
if(rangeUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( rangeSurf, v_vTexcoord );
|
||||
rng = mix(range.x, range.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
vec4 col = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
|
||||
float bright = dot(col.rgb, vec3(0.2126, 0.7152, 0.0722));
|
||||
if(bright > middle + range || bright < middle - range)
|
||||
gl_FragColor = vec4(0., 0., 0., 1.);
|
||||
|
||||
if(bright > mid + rng || bright < mid - rng)
|
||||
gl_FragColor = vec4(0., 0., 0., col.a);
|
||||
else
|
||||
gl_FragColor = vec4(1., 1., 1., 1.);
|
||||
gl_FragColor.a = col.a;
|
||||
gl_FragColor = vec4(1., 1., 1., col.a);
|
||||
}
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform vec2 dimension;
|
||||
uniform int algorithm;
|
||||
uniform int shape;
|
||||
uniform vec2 dimension;
|
||||
uniform int algorithm;
|
||||
uniform int shape;
|
||||
uniform float size;
|
||||
|
||||
uniform int sampleMode;
|
||||
|
||||
vec4 sampleTexture(vec2 pos) {
|
||||
vec4 sampleTexture(vec2 pos) { #region
|
||||
if(pos.x >= 0. && pos.y >= 0. && pos.x <= 1. && pos.y <= 1.)
|
||||
return texture2D(gm_BaseTexture, pos);
|
||||
|
||||
|
@ -23,18 +23,16 @@ vec4 sampleTexture(vec2 pos) {
|
|||
return texture2D(gm_BaseTexture, fract(pos));
|
||||
|
||||
return vec4(0.);
|
||||
}
|
||||
} #endregion
|
||||
|
||||
float bright(in vec4 col) {
|
||||
return dot(col.rgb, vec3(0.2126, 0.7152, 0.0722)) * col.a;
|
||||
}
|
||||
float bright(in vec4 col) { return dot(col.rgb, vec3(0.2126, 0.7152, 0.0722)) * col.a; }
|
||||
|
||||
void main() {
|
||||
vec2 tex = 1. / dimension;
|
||||
vec4 acc = vec4(0.);
|
||||
vec4 maxx = vec4(0.), minn = vec4(1.);
|
||||
vec2 tex = 1. / dimension;
|
||||
vec4 acc = vec4(0.);
|
||||
vec4 maxx = vec4(0.), minn = vec4(1.);
|
||||
float weight = 0., _w;
|
||||
vec4 col = sampleTexture(v_vTexcoord);
|
||||
vec4 col = sampleTexture(v_vTexcoord);
|
||||
|
||||
for(float i = -size; i <= size; i++)
|
||||
for(float j = -size; j <= size; j++) {
|
||||
|
|
|
@ -6,12 +6,18 @@ varying vec2 v_vTexcoord;
|
|||
varying vec4 v_vColour;
|
||||
|
||||
uniform float seed;
|
||||
|
||||
uniform float alignment;
|
||||
|
||||
uniform float sharpness;
|
||||
|
||||
uniform float rotation;
|
||||
|
||||
uniform vec2 u_resolution;
|
||||
uniform vec2 position;
|
||||
|
||||
uniform vec2 scale;
|
||||
|
||||
uniform vec2 augment;
|
||||
|
||||
vec2 hash(vec2 p) { return fract(sin(vec2(
|
||||
|
|
|
@ -5,29 +5,37 @@ varying vec2 v_vTexcoord;
|
|||
varying vec4 v_vColour;
|
||||
|
||||
uniform vec2 dimension;
|
||||
uniform float borderStart;
|
||||
uniform float borderSize;
|
||||
uniform vec4 borderColor;
|
||||
|
||||
uniform vec2 borderStart;
|
||||
uniform int borderStartUseSurf;
|
||||
uniform sampler2D borderStartSurf;
|
||||
|
||||
uniform vec2 borderSize;
|
||||
uniform int borderSizeUseSurf;
|
||||
uniform sampler2D borderSizeSurf;
|
||||
|
||||
uniform vec4 borderColor;
|
||||
uniform int side;
|
||||
uniform int crop_border;
|
||||
|
||||
uniform int is_aa;
|
||||
uniform int is_blend;
|
||||
uniform float blend_alpha;
|
||||
uniform int sampleMode;
|
||||
|
||||
uniform vec2 blend_alpha;
|
||||
uniform int blend_alphaUseSurf;
|
||||
uniform sampler2D blend_alphaSurf;
|
||||
|
||||
uniform int sampleMode;
|
||||
uniform int outline_only;
|
||||
|
||||
#define TAU 6.283185307179586
|
||||
|
||||
vec2 round(in vec2 v) {
|
||||
vec2 round(in vec2 v) { #region
|
||||
v.x = fract(v.x) > 0.5? ceil(v.x) : floor(v.x);
|
||||
v.y = fract(v.y) > 0.5? ceil(v.y) : floor(v.y);
|
||||
return v;
|
||||
}
|
||||
} #endregion
|
||||
|
||||
vec4 sampleTexture(vec2 pos) {
|
||||
vec4 sampleTexture(vec2 pos) { #region
|
||||
if(pos.x >= 0. && pos.y >= 0. && pos.x <= 1. && pos.y <= 1.)
|
||||
return texture2D(gm_BaseTexture, pos);
|
||||
|
||||
|
@ -39,16 +47,33 @@ vec4 sampleTexture(vec2 pos) {
|
|||
return texture2D(gm_BaseTexture, fract(pos));
|
||||
|
||||
return vec4(0.);
|
||||
}
|
||||
} #endregion
|
||||
|
||||
void main() { #region
|
||||
#region params
|
||||
float bStr = borderStart.x;
|
||||
if(borderStartUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( borderStartSurf, v_vTexcoord );
|
||||
bStr = mix(borderStart.x, borderStart.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
float bSiz = borderSize.x;
|
||||
if(borderSizeUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( borderSizeSurf, v_vTexcoord );
|
||||
bSiz = mix(borderSize.x, borderSize.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
float bld = blend_alpha.x;
|
||||
if(blend_alphaUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( blend_alphaSurf, v_vTexcoord );
|
||||
bld = mix(blend_alpha.x, blend_alpha.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
void main() {
|
||||
vec2 pixelPosition = v_vTexcoord * dimension;
|
||||
vec4 point = texture2D( gm_BaseTexture, v_vTexcoord );
|
||||
vec4 col;
|
||||
if(outline_only == 0)
|
||||
col = point;
|
||||
else
|
||||
col = vec4(0.);
|
||||
vec4 col = outline_only == 0? point : vec4(0.);
|
||||
|
||||
bool isOutline = false;
|
||||
float outline_alpha = 1.;
|
||||
|
@ -66,10 +91,10 @@ void main() {
|
|||
}
|
||||
#endregion
|
||||
|
||||
if(borderSize + borderStart > 0.) {
|
||||
if(bSiz + bStr > 0.) {
|
||||
outline_alpha = 0.;
|
||||
for(float i = 1.; i <= 32.; i++) {
|
||||
if(i > borderStart + borderSize) break;
|
||||
if(i > bStr + bSiz) break;
|
||||
|
||||
float base = 1.;
|
||||
float top = 0.;
|
||||
|
@ -88,7 +113,7 @@ void main() {
|
|||
if(side == 0 && sam.a > 0.) continue; //inside border, skip if current pixel is filled
|
||||
if(side == 1 && sam.a < 1.) continue; //outside border, skip if current pixel is empty
|
||||
|
||||
if(i < borderStart) {
|
||||
if(i < bStr) {
|
||||
i = 9999.;
|
||||
break;
|
||||
}
|
||||
|
@ -99,8 +124,8 @@ void main() {
|
|||
closetColor = sam;
|
||||
}
|
||||
|
||||
if(i == borderSize) outline_alpha += sam.a;
|
||||
else outline_alpha = 1.;
|
||||
if(i == bSiz) outline_alpha += sam.a;
|
||||
else outline_alpha = 1.;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -149,9 +174,9 @@ void main() {
|
|||
else if(side == 1)
|
||||
bcol = closetColor;
|
||||
|
||||
float blend = blend_alpha * outline_alpha;
|
||||
float blend = bld * outline_alpha;
|
||||
if(is_aa == 0)
|
||||
blend = blend_alpha;
|
||||
blend = bld;
|
||||
|
||||
float alpha = bcol.a + blend * (1. - bcol.a);
|
||||
col = (borderColor * blend + bcol * bcol.a * ( 1. - blend )) / alpha;
|
||||
|
@ -159,4 +184,4 @@ void main() {
|
|||
}
|
||||
|
||||
gl_FragColor = col;
|
||||
}
|
||||
} #endregion
|
|
@ -6,7 +6,11 @@ varying vec4 v_vColour;
|
|||
|
||||
uniform vec2 position;
|
||||
uniform vec2 u_resolution;
|
||||
uniform vec2 scale;
|
||||
|
||||
uniform vec2 scale;
|
||||
uniform int scaleUseSurf;
|
||||
uniform sampler2D scaleSurf;
|
||||
|
||||
uniform int iteration;
|
||||
uniform float seed;
|
||||
uniform int tile;
|
||||
|
@ -16,6 +20,8 @@ uniform vec2 colorRanR;
|
|||
uniform vec2 colorRanG;
|
||||
uniform vec2 colorRanB;
|
||||
|
||||
vec2 sca;
|
||||
|
||||
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);
|
||||
|
@ -57,7 +63,7 @@ float perlin(in vec2 st) { #region
|
|||
float amp = pow(2., float(iteration) - 1.) / (pow(2., float(iteration)) - 1.);
|
||||
float n = 0.;
|
||||
vec2 pos = st;
|
||||
vec2 sc = scale;
|
||||
vec2 sc = sca;
|
||||
|
||||
for(int i = 0; i < iteration; i++) {
|
||||
n += noise(pos, sc) * amp;
|
||||
|
@ -73,19 +79,27 @@ float perlin(in vec2 st) { #region
|
|||
} #endregion
|
||||
|
||||
void main() { #region
|
||||
#region params
|
||||
sca = scale;
|
||||
if(scaleUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( scaleSurf, v_vTexcoord );
|
||||
sca = vec2(mix(scale.x, scale.y, (_vMap.r + _vMap.g + _vMap.b) / 3.));
|
||||
}
|
||||
#endregion
|
||||
|
||||
if(colored == 0) {
|
||||
vec2 pos = (v_vTexcoord + position) * scale;
|
||||
vec2 pos = (v_vTexcoord + position) * sca;
|
||||
gl_FragColor = vec4(vec3(perlin(pos)), 1.0);
|
||||
} else if(colored == 1) {
|
||||
float randR = colorRanR[0] + perlin((v_vTexcoord + position) * scale) * (colorRanR[1] - colorRanR[0]);
|
||||
float randG = colorRanG[0] + perlin((v_vTexcoord + position + vec2(1.7227, 4.55529)) * scale) * (colorRanG[1] - colorRanG[0]);
|
||||
float randB = colorRanB[0] + perlin((v_vTexcoord + position + vec2(6.9950, 6.82063)) * scale) * (colorRanB[1] - colorRanB[0]);
|
||||
float randR = colorRanR[0] + perlin((v_vTexcoord + position) * sca) * (colorRanR[1] - colorRanR[0]);
|
||||
float randG = colorRanG[0] + perlin((v_vTexcoord + position + vec2(1.7227, 4.55529)) * sca) * (colorRanG[1] - colorRanG[0]);
|
||||
float randB = colorRanB[0] + perlin((v_vTexcoord + position + vec2(6.9950, 6.82063)) * sca) * (colorRanB[1] - colorRanB[0]);
|
||||
|
||||
gl_FragColor = vec4(randR, randG, randB, 1.0);
|
||||
} else if(colored == 2) {
|
||||
float randH = colorRanR[0] + perlin((v_vTexcoord + position) * scale) * (colorRanR[1] - colorRanR[0]);
|
||||
float randS = colorRanG[0] + perlin((v_vTexcoord + position + vec2(1.7227, 4.55529)) * scale) * (colorRanG[1] - colorRanG[0]);
|
||||
float randV = colorRanB[0] + perlin((v_vTexcoord + position + vec2(6.9950, 6.82063)) * scale) * (colorRanB[1] - colorRanB[0]);
|
||||
float randH = colorRanR[0] + perlin((v_vTexcoord + position) * sca) * (colorRanR[1] - colorRanR[0]);
|
||||
float randS = colorRanG[0] + perlin((v_vTexcoord + position + vec2(1.7227, 4.55529)) * sca) * (colorRanG[1] - colorRanG[0]);
|
||||
float randV = colorRanB[0] + perlin((v_vTexcoord + position + vec2(6.9950, 6.82063)) * sca) * (colorRanB[1] - colorRanB[0]);
|
||||
|
||||
gl_FragColor = vec4(hsv2rgb(vec3(randH, randS, randV)), 1.0);
|
||||
}
|
||||
|
|
|
@ -4,10 +4,13 @@
|
|||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
uniform int invert;
|
||||
uniform float blend;
|
||||
uniform int distMode;
|
||||
uniform int swap;
|
||||
|
||||
uniform vec2 blend;
|
||||
uniform int blendUseSurf;
|
||||
uniform sampler2D blendSurf;
|
||||
|
||||
#region /////////////// SAMPLING ///////////////
|
||||
|
||||
const float PI = 3.14159265358979323846;
|
||||
|
@ -60,6 +63,12 @@ void main() {
|
|||
vec2 center = vec2(0.5, 0.5);
|
||||
vec2 coord;
|
||||
|
||||
float bld = blend.x;
|
||||
if(blendUseSurf == 1) {
|
||||
vec4 _vMap = texture2Dintp( blendSurf, v_vTexcoord );
|
||||
bld = mix(blend.x, blend.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
if(invert == 0) {
|
||||
float dist = distance(v_vTexcoord, center) / (sqrt(2.) * .5);
|
||||
if(distMode == 1) dist = sqrt(dist);
|
||||
|
@ -80,5 +89,5 @@ void main() {
|
|||
}
|
||||
|
||||
if(swap == 1) coord.xy = coord.yx;
|
||||
gl_FragColor = texture2Dintp( gm_BaseTexture, mix(v_vTexcoord, coord, blend) );
|
||||
gl_FragColor = texture2Dintp( gm_BaseTexture, mix(v_vTexcoord, coord, bld) );
|
||||
}
|
||||
|
|
|
@ -6,13 +6,22 @@ varying vec4 v_vColour;
|
|||
|
||||
uniform int colors;
|
||||
uniform int alpha;
|
||||
uniform float gamma;
|
||||
|
||||
uniform vec2 gamma;
|
||||
uniform int gammaUseSurf;
|
||||
uniform sampler2D gammaSurf;
|
||||
|
||||
void main() {
|
||||
float gam = gamma.x;
|
||||
if(gammaUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( gammaSurf, v_vTexcoord );
|
||||
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(gamma)) * float(colors));
|
||||
c = pow(c / float(colors), vec4(1.0 / gamma));
|
||||
c = floor(pow(c, vec4(gam)) * float(colors));
|
||||
c = pow(c / float(colors), vec4(1.0 / gam));
|
||||
|
||||
if(alpha == 1) gl_FragColor = c;
|
||||
else gl_FragColor = vec4(c.rgb, _col.a);
|
||||
|
|
|
@ -13,11 +13,17 @@
|
|||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform vec2 scale;
|
||||
uniform vec3 position;
|
||||
uniform int iteration;
|
||||
uniform int layerMode;
|
||||
|
||||
uniform vec2 scale;
|
||||
uniform int scaleUseSurf;
|
||||
uniform sampler2D scaleSurf;
|
||||
|
||||
uniform vec2 iteration;
|
||||
uniform int iterationUseSurf;
|
||||
uniform sampler2D iterationSurf;
|
||||
|
||||
vec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
|
||||
vec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
|
||||
vec4 permute(vec4 x) { return mod289(((x * 34.0) + 10.0) * x); }
|
||||
|
@ -28,13 +34,16 @@ uniform vec2 colorRanR;
|
|||
uniform vec2 colorRanG;
|
||||
uniform vec2 colorRanB;
|
||||
|
||||
vec3 hsv2rgb(vec3 c) {
|
||||
vec2 sca;
|
||||
float itrMax, itr;
|
||||
|
||||
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 snoise(vec3 vec) {
|
||||
float snoise(vec3 vec) { #region
|
||||
vec3 v = vec * 4.;
|
||||
|
||||
const vec2 C = vec2(1.0 / 6.0, 1.0 / 3.0);
|
||||
|
@ -110,19 +119,21 @@ float snoise(vec3 vec) {
|
|||
float n = 105.0 * dot( m * m, vec4( dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3) ) );
|
||||
n = mix(0.0, 0.5 + 0.5 * n, smoothstep(0.0, 0.003, vec.z));
|
||||
return n;
|
||||
}
|
||||
} #endregion
|
||||
|
||||
float simplex(in vec2 st) {
|
||||
vec2 p = ((st + position.xy) / scale) * 2.0 - 1.0;
|
||||
float simplex(in vec2 st) { #region
|
||||
vec2 p = ((st + position.xy) / sca) * 2.0 - 1.0;
|
||||
float _z = 1. + position.z;
|
||||
vec3 xyz = vec3(p, _z);
|
||||
|
||||
float amp = pow(2., float(iteration) - 1.) / (pow(2., float(iteration)) - 1.);
|
||||
float amp = pow(2., float(itr) - 1.) / (pow(2., float(itr)) - 1.);
|
||||
float n = 0.;
|
||||
if(layerMode == 0) n = 0.;
|
||||
else if(layerMode == 1) n = 1.;
|
||||
|
||||
for(int i = 0; i < iteration; i++) {
|
||||
for(float i = 0.; i < itrMax; i++) {
|
||||
if(i >= itr) break;
|
||||
|
||||
if(layerMode == 0) n += snoise(xyz) * amp;
|
||||
else if(layerMode == 1) n *= (snoise(xyz) * amp) + (1. - amp);
|
||||
|
||||
|
@ -131,9 +142,25 @@ float simplex(in vec2 st) {
|
|||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
} #endregion
|
||||
|
||||
void main() { #region
|
||||
#region params
|
||||
sca = scale;
|
||||
if(scaleUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( scaleSurf, v_vTexcoord );
|
||||
sca = vec2(mix(scale.x, scale.y, (_vMap.r + _vMap.g + _vMap.b) / 3.));
|
||||
}
|
||||
|
||||
itr = iteration.x;
|
||||
itrMax = max(iteration.x, iteration.y);
|
||||
if(iterationUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( iterationSurf, v_vTexcoord );
|
||||
itr = mix(iteration.x, iteration.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
void main() {
|
||||
if(colored == 0) {
|
||||
gl_FragColor = vec4(vec3(simplex(v_vTexcoord)), 1.0);
|
||||
} else if(colored == 1) {
|
||||
|
@ -149,4 +176,4 @@ void main() {
|
|||
|
||||
gl_FragColor = vec4(hsv2rgb(vec3(randH, randS, randV)), 1.0);
|
||||
}
|
||||
}
|
||||
} #endregion
|
|
@ -76,15 +76,15 @@ vec4 sampleTexture(vec2 pos) { #region
|
|||
} #endregion
|
||||
|
||||
void main() {
|
||||
vec2 pos = v_vTexcoord;
|
||||
vec2 cnt = center / dimension;
|
||||
|
||||
float amo = amount.x;
|
||||
if(amountUseSurf == 1) {
|
||||
vec4 _vMap = texture2Dintp( amountSurf, v_vTexcoord );
|
||||
amo = mix(amount.x, amount.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
vec2 pos = v_vTexcoord;
|
||||
vec2 cnt = center / dimension;
|
||||
|
||||
if(axis == 0) pos.x += (pos.y - cnt.y) * amo;
|
||||
else pos.y += (pos.x - cnt.x) * amo;
|
||||
|
||||
|
|
|
@ -8,23 +8,34 @@ varying vec4 v_vColour;
|
|||
|
||||
uniform vec2 dimension;
|
||||
uniform vec2 position;
|
||||
uniform float angle;
|
||||
uniform float amount;
|
||||
uniform float ratio;
|
||||
uniform float randomAmount;
|
||||
uniform int blend;
|
||||
|
||||
#define GRADIENT_LIMIT 128
|
||||
uniform vec2 amount;
|
||||
uniform int amountUseSurf;
|
||||
uniform sampler2D amountSurf;
|
||||
|
||||
uniform vec2 angle;
|
||||
uniform int angleUseSurf;
|
||||
uniform sampler2D angleSurf;
|
||||
|
||||
uniform vec2 randomAmount;
|
||||
uniform int randomAmountUseSurf;
|
||||
uniform sampler2D randomAmountSurf;
|
||||
|
||||
uniform vec2 ratio;
|
||||
uniform int ratioUseSurf;
|
||||
uniform sampler2D ratioSurf;
|
||||
|
||||
uniform vec4 color0;
|
||||
uniform vec4 color1;
|
||||
|
||||
#define GRADIENT_LIMIT 128
|
||||
uniform int gradient_use;
|
||||
uniform int gradient_blend;
|
||||
uniform vec4 gradient_color[GRADIENT_LIMIT];
|
||||
uniform float gradient_time[GRADIENT_LIMIT];
|
||||
uniform int gradient_keys;
|
||||
|
||||
uniform vec4 color0;
|
||||
uniform vec4 color1;
|
||||
|
||||
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));
|
||||
|
@ -92,21 +103,48 @@ vec4 gradientEval(in float prog) { #region
|
|||
float random (in vec2 st) { return fract(sin(dot(st.xy, vec2(12.9898, 78.233))) * 43758.5453123); }
|
||||
|
||||
void main() { #region
|
||||
#region params
|
||||
float amo = amount.x;
|
||||
if(amountUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( amountSurf, v_vTexcoord );
|
||||
amo = mix(amount.x, amount.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
float ang = angle.x;
|
||||
if(angleUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( angleSurf, v_vTexcoord );
|
||||
ang = mix(angle.x, angle.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
ang = radians(ang);
|
||||
|
||||
float rnd = randomAmount.x;
|
||||
if(randomAmountUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( randomAmountSurf, v_vTexcoord );
|
||||
rnd = mix(randomAmount.x, randomAmount.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
float rat = ratio.x;
|
||||
if(ratioUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( ratioSurf, v_vTexcoord );
|
||||
rat = mix(ratio.x, ratio.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
#endregion
|
||||
|
||||
vec2 pos = v_vTexcoord - position;
|
||||
float aspect = dimension.x / dimension.y;
|
||||
float prog = pos.x * aspect * cos(angle) - pos.y * sin(angle);
|
||||
float _a = 1. / amount;
|
||||
float prog = pos.x * aspect * cos(ang) - pos.y * sin(ang);
|
||||
float _a = 1. / amo;
|
||||
|
||||
float slot = floor(prog / _a);
|
||||
float ground = (slot + (random(vec2(slot + 0.)) * 2. - 1.) * randomAmount * 0.5 + 0.) * _a;
|
||||
float ceiling = (slot + (random(vec2(slot + 1.)) * 2. - 1.) * randomAmount * 0.5 + 1.) * _a;
|
||||
float ground = (slot + (random(vec2(slot + 0.)) * 2. - 1.) * rnd * 0.5 + 0.) * _a;
|
||||
float ceiling = (slot + (random(vec2(slot + 1.)) * 2. - 1.) * rnd * 0.5 + 1.) * _a;
|
||||
float _s = (prog - ground) / (ceiling - ground);
|
||||
|
||||
if(gradient_use == 0) {
|
||||
if(blend == 0) gl_FragColor = _s > ratio? color0 : color1;
|
||||
if(blend == 0) gl_FragColor = _s > rat? color0 : color1;
|
||||
else gl_FragColor = vec4(vec3(sin(_s * 2. * PI) * 0.5 + 0.5), 1.);
|
||||
} else {
|
||||
if(_s > ratio) gl_FragColor = vec4(gradientEval(random(vec2(slot))).rgb, 1.);
|
||||
if(_s > rat) gl_FragColor = vec4(gradientEval(random(vec2(slot))).rgb, 1.);
|
||||
else gl_FragColor = vec4(gradientEval(random(vec2(slot + 1.))).rgb, 1.);
|
||||
}
|
||||
} #endregion
|
||||
|
|
|
@ -4,26 +4,42 @@
|
|||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform int bright;
|
||||
uniform float brightThreshold;
|
||||
uniform float brightSmooth;
|
||||
uniform int bright;
|
||||
uniform vec2 brightThreshold;
|
||||
uniform int brightThresholdUseSurf;
|
||||
uniform sampler2D brightThresholdSurf;
|
||||
uniform float brightSmooth;
|
||||
|
||||
uniform int alpha;
|
||||
uniform float alphaThreshold;
|
||||
uniform float alphaSmooth;
|
||||
uniform int alpha;
|
||||
uniform vec2 alphaThreshold;
|
||||
uniform int alphaThresholdUseSurf;
|
||||
uniform sampler2D alphaThresholdSurf;
|
||||
uniform float alphaSmooth;
|
||||
|
||||
float _step( in float threshold, in float val ) { return val <= threshold? 0. : 1.; }
|
||||
|
||||
void main() {
|
||||
float bri = brightThreshold.x;
|
||||
if(brightThresholdUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( brightThresholdSurf, v_vTexcoord );
|
||||
bri = mix(brightThreshold.x, brightThreshold.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
float alp = alphaThreshold.x;
|
||||
if(alphaThresholdUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( alphaThresholdSurf, v_vTexcoord );
|
||||
alp = mix(alphaThreshold.x, alphaThreshold.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
vec4 col = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
|
||||
|
||||
if(bright == 1) {
|
||||
float bright = dot(col.rgb, vec3(0.2126, 0.7152, 0.0722));
|
||||
col.rgb = vec3(brightSmooth == 0.? _step(brightThreshold, bright) : smoothstep(brightThreshold - brightSmooth, brightThreshold + brightSmooth, bright));
|
||||
col.rgb = vec3(brightSmooth == 0.? _step(bri, bright) : smoothstep(bri - brightSmooth, bri + brightSmooth, bright));
|
||||
}
|
||||
|
||||
if(alpha == 1) {
|
||||
col.a = alphaSmooth == 0.? _step(alphaThreshold, col.a) : smoothstep(alphaThreshold - alphaSmooth, alphaThreshold + alphaSmooth, col.a);
|
||||
col.a = alphaSmooth == 0.? _step(alp, col.a) : smoothstep(alp - alphaSmooth, alp + alphaSmooth, col.a);
|
||||
}
|
||||
|
||||
gl_FragColor = col;
|
||||
|
|
|
@ -4,12 +4,19 @@
|
|||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform vec2 dimension;
|
||||
uniform vec2 center;
|
||||
uniform float strength;
|
||||
uniform float radius;
|
||||
uniform int sampleMode;
|
||||
/////////////// SAMPLING ///////////////
|
||||
uniform vec2 dimension;
|
||||
uniform vec2 center;
|
||||
uniform int sampleMode;
|
||||
|
||||
uniform vec2 radius;
|
||||
uniform int radiusUseSurf;
|
||||
uniform sampler2D radiusSurf;
|
||||
|
||||
uniform vec2 strength;
|
||||
uniform int strengthUseSurf;
|
||||
uniform sampler2D strengthSurf;
|
||||
|
||||
#region /////////////// SAMPLING ///////////////
|
||||
|
||||
const float PI = 3.14159265358979323846;
|
||||
uniform int interpolation;
|
||||
|
@ -55,8 +62,9 @@ vec4 texture2Dintp( sampler2D texture, vec2 uv ) {
|
|||
return texture2D( texture, uv );
|
||||
}
|
||||
|
||||
/////////////// SAMPLING ///////////////
|
||||
vec4 sampleTexture(vec2 pos) {
|
||||
#endregion /////////////// SAMPLING ///////////////
|
||||
|
||||
vec4 sampleTexture(vec2 pos) { #region
|
||||
if(pos.x >= 0. && pos.y >= 0. && pos.x <= 1. && pos.y <= 1.)
|
||||
return texture2Dintp(gm_BaseTexture, pos);
|
||||
|
||||
|
@ -68,14 +76,26 @@ vec4 sampleTexture(vec2 pos) {
|
|||
return texture2Dintp(gm_BaseTexture, fract(pos));
|
||||
|
||||
return vec4(0.);
|
||||
}
|
||||
} #endregion
|
||||
|
||||
void main() {
|
||||
float rad = radius.x;
|
||||
if(radiusUseSurf == 1) {
|
||||
vec4 _vMap = texture2Dintp( radiusSurf, v_vTexcoord );
|
||||
rad = mix(radius.x, radius.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
float str = strength.x;
|
||||
if(strengthUseSurf == 1) {
|
||||
vec4 _vMap = texture2Dintp( strengthSurf, v_vTexcoord );
|
||||
str = mix(strength.x, strength.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
vec2 pixelPos = v_vTexcoord * dimension;
|
||||
vec2 to = pixelPos - center;
|
||||
float dis = distance(center, pixelPos);
|
||||
float eff = 1. - clamp(dis / radius, 0., 1.);
|
||||
float ang = atan(to.y, to.x) + eff * strength;
|
||||
float eff = 1. - clamp(dis / rad, 0., 1.);
|
||||
float ang = atan(to.y, to.x) + eff * str;
|
||||
|
||||
vec2 tex = center + vec2(cos(ang), sin(ang)) * distance(center, pixelPos);
|
||||
gl_FragColor = sampleTexture( tex / dimension );
|
||||
|
|