Scatter performance improvement

This commit is contained in:
Tanasart 2024-01-24 12:19:34 +07:00
parent d58834ef9c
commit d33137233d
40 changed files with 587 additions and 215 deletions

View file

@ -174,6 +174,7 @@
{"name":"3D","order":133,"path":"folders/nodes/icons/3D.yy",},
{"name":"animation","order":135,"path":"folders/nodes/icons/animation.yy",},
{"name":"filter","order":141,"path":"folders/nodes/icons/filter.yy",},
{"name":"blur","order":64,"path":"folders/nodes/icons/filter/blur.yy",},
{"name":"fluidSim","order":147,"path":"folders/nodes/icons/fluidSim.yy",},
{"name":"generator","order":142,"path":"folders/nodes/icons/generator.yy",},
{"name":"IO","order":143,"path":"folders/nodes/icons/IO.yy",},
@ -345,6 +346,7 @@
{"name":"node_array","order":5,"path":"scripts/node_array/node_array.yy",},
{"name":"discordBridge","order":8,"path":"extensions/discordBridge/discordBridge.yy",},
{"name":"pack_corner","order":3,"path":"scripts/pack_corner/pack_corner.yy",},
{"name":"s_node_blur_slope","order":4,"path":"sprites/s_node_blur_slope/s_node_blur_slope.yy",},
{"name":"s_node_websocket","order":18,"path":"sprites/s_node_websocket/s_node_websocket.yy",},
{"name":"sh_colorize","order":9,"path":"shaders/sh_colorize/sh_colorize.yy",},
{"name":"node_string","order":2,"path":"scripts/node_string/node_string.yy",},
@ -673,7 +675,6 @@
{"name":"sh_color_remove","order":7,"path":"shaders/sh_color_remove/sh_color_remove.yy",},
{"name":"o_dialog_migration","order":11,"path":"objects/o_dialog_migration/o_dialog_migration.yy",},
{"name":"s_node_color_mix","order":19,"path":"sprites/s_node_color_mix/s_node_color_mix.yy",},
{"name":"s_node_blur","order":9,"path":"sprites/s_node_blur/s_node_blur.yy",},
{"name":"FirebaseREST_Firestore_path_isDocument","order":15,"path":"scripts/FirebaseREST_Firestore_path_isDocument/FirebaseREST_Firestore_path_isDocument.yy",},
{"name":"s_node_gradient_4points","order":2,"path":"sprites/s_node_gradient_4points/s_node_gradient_4points.yy",},
{"name":"s_node_gradient_out","order":9,"path":"sprites/s_node_gradient_out/s_node_gradient_out.yy",},
@ -1010,7 +1011,7 @@
{"name":"sh_posterize","order":10,"path":"shaders/sh_posterize/sh_posterize.yy",},
{"name":"s_node_mirror","order":3,"path":"sprites/s_node_mirror/s_node_mirror.yy",},
{"name":"s_node_stagger","order":6,"path":"sprites/s_node_stagger/s_node_stagger.yy",},
{"name":"s_node_blur_simple","order":43,"path":"sprites/s_node_blur_simple/s_node_blur_simple.yy",},
{"name":"s_node_blur_simple","order":3,"path":"sprites/s_node_blur_simple/s_node_blur_simple.yy",},
{"name":"theme_definition","order":14,"path":"scripts/theme_definition/theme_definition.yy",},
{"name":"project_data","order":17,"path":"scripts/project_data/project_data.yy",},
{"name":"sh_vignette","order":38,"path":"shaders/sh_vignette/sh_vignette.yy",},
@ -1398,10 +1399,10 @@
{"name":"s_node_FXAA","order":57,"path":"sprites/s_node_FXAA/s_node_FXAA.yy",},
{"name":"logger","order":1,"path":"scripts/logger/logger.yy",},
{"name":"s_node_smokeSim_emitter","order":8,"path":"sprites/s_node_smokeSim_emitter/s_node_smokeSim_emitter.yy",},
{"name":"s_node_blur_directional","order":11,"path":"sprites/s_node_blur_directional/s_node_blur_directional.yy",},
{"name":"s_node_blur_directional","order":2,"path":"sprites/s_node_blur_directional/s_node_blur_directional.yy",},
{"name":"node_offset","order":17,"path":"scripts/node_offset/node_offset.yy",},
{"name":"s_biterator_dim_label","order":10,"path":"sprites/s_biterator_dim_label/s_biterator_dim_label.yy",},
{"name":"s_node_average","order":50,"path":"sprites/s_node_average/s_node_average.yy",},
{"name":"s_node_average","order":6,"path":"sprites/s_node_average/s_node_average.yy",},
{"name":"s_node_sprite_sheet","order":1,"path":"sprites/s_node_sprite_sheet/s_node_sprite_sheet.yy",},
{"name":"node_noise_gabor","order":11,"path":"scripts/node_noise_gabor/node_noise_gabor.yy",},
{"name":"sh_rd_propagate","order":1,"path":"shaders/sh_rd_propagate/sh_rd_propagate.yy",},
@ -1513,7 +1514,7 @@
{"name":"__vector","order":10,"path":"scripts/__vector/__vector.yy",},
{"name":"s_node_pin","order":2,"path":"sprites/s_node_pin/s_node_pin.yy",},
{"name":"node_local_analyze","order":16,"path":"scripts/node_local_analyze/node_local_analyze.yy",},
{"name":"s_node_blur_contrast","order":10,"path":"sprites/s_node_blur_contrast/s_node_blur_contrast.yy",},
{"name":"s_node_blur_contrast","order":1,"path":"sprites/s_node_blur_contrast/s_node_blur_contrast.yy",},
{"name":"fd_y","order":5,"path":"scripts/fd_y/fd_y.yy",},
{"name":"node_string_regex_search","order":8,"path":"scripts/node_string_regex_search/node_string_regex_search.yy",},
{"name":"s_node_text_render","order":17,"path":"sprites/s_node_text_render/s_node_text_render.yy",},
@ -1730,7 +1731,7 @@
{"name":"node_perlin_extra","order":10,"path":"scripts/node_perlin_extra/node_perlin_extra.yy",},
{"name":"node_palette_replacement","order":2,"path":"scripts/node_palette_replacement/node_palette_replacement.yy",},
{"name":"s_node_scatter","order":19,"path":"sprites/s_node_scatter/s_node_scatter.yy",},
{"name":"s_node_bokeh","order":51,"path":"sprites/s_node_bokeh/s_node_bokeh.yy",},
{"name":"s_node_bokeh","order":5,"path":"sprites/s_node_bokeh/s_node_bokeh.yy",},
{"name":"s_node_3d_sphere_uv","order":16,"path":"sprites/s_node_3d_sphere_uv/s_node_3d_sphere_uv.yy",},
{"name":"s_biterator_toggler","order":13,"path":"sprites/s_biterator_toggler/s_biterator_toggler.yy",},
{"name":"s_node_smokeSim_render","order":9,"path":"sprites/s_node_smokeSim_render/s_node_smokeSim_render.yy",},

View file

@ -204,6 +204,7 @@
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"3D","folderPath":"folders/nodes/icons/3D.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"animation","folderPath":"folders/nodes/icons/animation.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"filter","folderPath":"folders/nodes/icons/filter.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"blur","folderPath":"folders/nodes/icons/filter/blur.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"fluidSim","folderPath":"folders/nodes/icons/fluidSim.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"generator","folderPath":"folders/nodes/icons/generator.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"IO","folderPath":"folders/nodes/icons/IO.yy",},
@ -547,6 +548,7 @@
{"id":{"name":"discordBridge","path":"extensions/discordBridge/discordBridge.yy",},},
{"id":{"name":"pack_corner","path":"scripts/pack_corner/pack_corner.yy",},},
{"id":{"name":"s_node_mk_tile","path":"sprites/s_node_mk_tile/s_node_mk_tile.yy",},},
{"id":{"name":"s_node_blur_slope","path":"sprites/s_node_blur_slope/s_node_blur_slope.yy",},},
{"id":{"name":"s_node_websocket","path":"sprites/s_node_websocket/s_node_websocket.yy",},},
{"id":{"name":"sh_colorize","path":"shaders/sh_colorize/sh_colorize.yy",},},
{"id":{"name":"node_string","path":"scripts/node_string/node_string.yy",},},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View file

@ -1,34 +1,73 @@
function SurfaceAtlas(surface, _x = 0, _y = 0, rot = 0, sx = 1, sy = 1, blend = c_white, alpha = 1) constructor {
self.surface = new Surface(surface);
self.x = _x;
self.y = _y;
function SurfaceAtlasFast(surface, _x = 0, _y = 0, rot = 0, sx = 1, sy = 1, blend = c_white, alpha = 1) constructor {
self.surface = surface;
self.x = _x;
self.y = _y;
self.rotation = rot;
self.sx = sx;
self.sy = sy;
self.blend = blend;
self.alpha = alpha;
self.sx = sx;
self.sy = sy;
self.blend = blend;
self.alpha = alpha;
w = surface_get_width_safe(surface);
h = surface_get_height_safe(surface);
w = 1;
h = 1;
static set = function(surface, _x = 0, _y = 0, rot = 0, sx = 1, sy = 1, blend = c_white, alpha = 1, setDim = true) {
INLINE
self.surface = surface;
self.x = _x;
self.y = _y;
self.rotation = rot;
self.sx = sx;
self.sy = sy;
self.blend = blend;
self.alpha = alpha;
return self;
}
}
function SurfaceAtlas(surface, _x = 0, _y = 0, rot = 0, sx = 1, sy = 1, blend = c_white, alpha = 1, setDim = true) constructor {
self.surface = new Surface(surface);
self.x = _x;
self.y = _y;
self.rotation = rot;
self.sx = sx;
self.sy = sy;
self.blend = blend;
self.alpha = alpha;
w = 1;
h = 1;
if(setDim) {
w = surface_get_width_safe(surface);
h = surface_get_height_safe(surface);
}
oriSurf = noone;
oriSurf_w = w;
oriSurf_h = h;
static set = function(surface, _x = 0, _y = 0, rot = 0, sx = 1, sy = 1, blend = c_white, alpha = 1) {
static set = function(surface, _x = 0, _y = 0, rot = 0, sx = 1, sy = 1, blend = c_white, alpha = 1, setDim = true) {
INLINE
self.surface = new Surface(surface);
self.x = _x;
self.y = _y;
self.x = _x;
self.y = _y;
self.rotation = rot;
self.sx = sx;
self.sy = sy;
self.blend = blend;
self.alpha = alpha;
self.sx = sx;
self.sy = sy;
self.blend = blend;
self.alpha = alpha;
w = surface_get_width_safe(surface);
h = surface_get_height_safe(surface);
w = 1;
h = 1;
if(setDim) {
w = surface_get_width_safe(surface);
h = surface_get_height_safe(surface);
}
return self;
}

View file

@ -258,10 +258,9 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
//print($"[{display_name}] Frame {_time}: Spawning {_amo} particles, seed {seed}, at {_pos}");
random_set_seed(seed);
for( var i = 0; i < _amo; i++ ) {
seed += 100;
random_set_seed(seed);
parts_runner = clamp(parts_runner, 0, array_length(parts) - 1);
var part = parts[parts_runner];
@ -293,7 +292,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
yy = _spawn_area[1] + _spr.y + _spr.h / 2;
part.atlas = _spr;
} else if(_distrib < 2) {
var sp = area_get_random_point(_spawn_area, _distrib, _scatter, spawn_index, _amo, seed);
var sp = area_get_random_point(_spawn_area, _distrib, _scatter, spawn_index, _amo);
xx = sp[0];
yy = sp[1];
} else if(_distrib == 2) {

View file

@ -1,16 +1,18 @@
function angle_random_eval(range, seed = undefined) {
if(is_real(range))
return range;
if(is_real(range)) return range;
if(seed != undefined) random_set_seed(seed);
if(array_empty(range)) return 0;
var _l = array_length(range);
if(array_length(range) < 2)
if(_l < 2)
return range[0]
else if(array_length(range) == 2)
else if(_l == 2)
return irandom_range(range[0], range[1]);
else if(array_length(range) > 2) {
else if(_l > 2) {
switch(range[0]) {
case 0 : return irandom_range(range[1], range[2]);
case 1 : return irandom_range(range[1] - range[2], range[1] + range[2]);
@ -20,4 +22,14 @@ function angle_random_eval(range, seed = undefined) {
}
return array_safe_get(range, 0);
}
function angle_random_eval_fast(range) {
switch(range[0]) {
case 0 : return irandom_range(range[1], range[2]);
case 1 : return irandom_range(range[1] - range[2], range[1] + range[2]);
case 2 : return choose(irandom_range(range[1], range[2]), irandom_range(range[3], range[4]));
case 3 : return choose(irandom_range(range[1] - range[3], range[1] + range[3]), irandom_range(range[2] - range[3], range[2] + range[3]));
}
return 0;
}

View file

@ -13,7 +13,8 @@ enum AREA_INDEX {
center_x,
center_y,
half_w,
half_h
half_h,
shape
}
function areaBox(_onModify, _unit = noone) : widget() constructor {

View file

@ -14,7 +14,7 @@ function area_get_bbox(area) {
return [ area[0] - area[2], area[1] - area[3], area[0] + area[2], area[1] + area[3] ];
}
function area_get_random_point(area, distrib = AREA_DISTRIBUTION.area, scatter = AREA_SCATTER.random, index = 0, total = 1, _sed = 999) {
function area_get_random_point(area, distrib = AREA_DISTRIBUTION.area, scatter = AREA_SCATTER.random, index = 0, total = 1) {
if(total == 0) return [0, 0];
var _area_x = array_safe_get(area, 0);
@ -65,12 +65,12 @@ function area_get_random_point(area, distrib = AREA_DISTRIBUTION.area, scatter =
}
} else if(scatter == AREA_SCATTER.random) {
if(_area_t == AREA_SHAPE.rectangle) {
xx = _area_x + random_range_seed(-_area_w, _area_w, _sed); _sed++;
yy = _area_y + random_range_seed(-_area_h, _area_h, _sed); _sed++;
xx = _area_x + random_range(-_area_w, _area_w);
yy = _area_y + random_range(-_area_h, _area_h);
} else if(_area_t == AREA_SHAPE.elipse) {
var rr = random_seed(360, _sed); _sed++;
xx = _area_x + lengthdir_x(1, rr) * random_seed(_area_w, _sed); _sed++;
yy = _area_y + lengthdir_y(1, rr) * random_seed(_area_h, _sed); _sed++;
var rr = random(360);
xx = _area_x + lengthdir_x(1, rr) * random(_area_w);
yy = _area_y + lengthdir_y(1, rr) * random(_area_h);
}
}
break;
@ -114,22 +114,22 @@ function area_get_random_point(area, distrib = AREA_DISTRIBUTION.area, scatter =
} else if(scatter == AREA_SCATTER.random) {
if(_area_t == AREA_SHAPE.rectangle) {
var perimeter = _area_w * 2 + _area_h * 2;
var i = random_seed(perimeter, _sed); _sed++;
var i = random(perimeter);
if(i < _area_w) {
xx = _area_x + random_range_seed(-_area_w, _area_w, _sed); _sed++;
xx = _area_x + random_range(-_area_w, _area_w);
yy = _area_y - _area_h;
} else if(i < _area_w + _area_h) {
xx = _area_x - _area_w;
yy = _area_y + random_range_seed(-_area_h, _area_h, _sed); _sed++;
yy = _area_y + random_range(-_area_h, _area_h);
} else if(i < _area_w * 2 + _area_h) {
xx = _area_x + random_range_seed(-_area_w, _area_w, _sed); _sed++;
xx = _area_x + random_range(-_area_w, _area_w);
yy = _area_y + _area_h;
} else {
xx = _area_x + _area_w;
yy = _area_y + random_range_seed(-_area_h, _area_h, _sed); _sed++;
yy = _area_y + random_range(-_area_h, _area_h);
}
} else if(_area_t == AREA_SHAPE.elipse) {
var rr = random_seed(360, _sed); _sed++;
var rr = random(360);
xx = _area_x + lengthdir_x(_area_w, rr);
yy = _area_y + lengthdir_y(_area_h, rr);
}

View file

@ -17,8 +17,12 @@ function gradientObject(color = c_black) constructor { #region
if(is_array(color)) keys = [ new gradientKey(0, cola(color[0])), new gradientKey(1, cola(color[1])) ];
else keys = [ new gradientKey(0, cola(color)) ];
type = GRADIENT_INTER.smooth;
surf = noone;
type = GRADIENT_INTER.smooth;
surf = noone;
cacheRes = 128;
caches = array_create(cacheRes);
keyLength = 0;
static clone = function() { #region
var g = new gradientObject();
@ -82,6 +86,16 @@ function gradientObject(color = c_black) constructor { #region
return keys[array_length(keys) - 1].value; //after last color
} #endregion
static evalFast = function(position) { #region
INLINE
if(position <= keys[0].time) return keys[0].value;
if(position >= keys[keyLength - 1].time) return keys[keyLength - 1].value;
var _ind = round(position * cacheRes);
return caches[_ind];
} #endregion
static draw = function(_x, _y, _w, _h, _a = 1) { #region
var uniform_grad_blend = shader_get_uniform(sh_gradient_display, "gradient_blend");
var uniform_grad = shader_get_uniform(sh_gradient_display, "gradient_color");
@ -150,6 +164,15 @@ function gradientObject(color = c_black) constructor { #region
draw_surface(surf, _x, _y);
} #endregion
static cache = function(res = 128) { #region
cacheRes = res;
caches = array_verify(caches, cacheRes + 1);
keyLength = array_length(keys);
for( var i = 0; i <= cacheRes; i++ )
caches[i] = eval(i / cacheRes);
} #endregion
static toArray = function() { #region
var _grad_color = [], _grad_time = [];
@ -291,20 +314,18 @@ function shader_set_gradient(gradient, surface, range, junc) { #region
gradient.shader_submit();
} #endregion
function evaluate_gradient_map(_x, gradient, surface, range, junc) { #region
var use_map = junc.attributes.mapped && is_surface(surface);
function evaluate_gradient_map(_x, gradient, surface, range, junc, fast = false) { #region
var use_map = junc.attributes.mapped;
if(use_map) {
var _sw = surface_get_width(surface);
var _sh = surface_get_width(surface);
var _sx = lerp(range[0], range[2], _x) * _sw;
var _sy = lerp(range[1], range[3], _x) * _sh;
return surface_getpixel_ext(surface, _sx, _sy);
}
if(!use_map) return fast? gradient.evalFast(_x) : gradient.eval(_x);
return gradient.eval(_x);
var _sw = surface_get_width(surface);
var _sh = surface_get_height(surface);
var _sx = lerp(range[0], range[2], _x) * _sw;
var _sy = lerp(range[1], range[3], _x) * _sh;
return surface_getpixel_ext(surface, _sx, _sy);
} #endregion
globalvar GRADIENTS;

View file

@ -57,8 +57,8 @@ function Node_Grid(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
inputs[| 18] = nodeValue("Truchet seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, seed_random());
inputs[| 19] = nodeValue("Truchet threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5)
.setDisplay(VALUE_DISPLAY.slider)
inputs[| 19] = nodeValue("Flip horizontal", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5)
.setDisplay(VALUE_DISPLAY.slider);
//////////////////////////////////////////////////////////////////////////////////
@ -68,11 +68,17 @@ function Node_Grid(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
//////////////////////////////////////////////////////////////////////////////////
inputs[| 22] = nodeValue("Flip vertical", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5)
.setDisplay(VALUE_DISPLAY.slider);
inputs[| 23] = nodeValue("Texture angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ])
.setDisplay(VALUE_DISPLAY.rotation_range);
input_display_list = [
["Output", false], 0,
["Pattern", false], 1, 4, 15, 2, 13, 3, 14, 9, 8, 16,
["Render", false], 10, 11, 5, 20, 6, 7, 12,
["Truchet", true, 17], 18, 19,
["Truchet", true, 17], 18, 19, 22, 23,
];
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
@ -120,7 +126,10 @@ function Node_Grid(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
shader_set_i("aa", _data[12]);
shader_set_i("textureTruchet", _data[17]);
shader_set_f("truchetSeed", _data[18]);
shader_set_f("truchetThres", _data[19]);
shader_set_f("truchetThresX", _data[19]);
shader_set_f("truchetThresY", _data[22]);
shader_set_f("truchetAngle", _data[23]);
shader_set_color("gapCol", _col_gap);
shader_set_gradient(_data[5], _data[20], _data[21], inputs[| 5]);

View file

@ -59,11 +59,14 @@ function Node_Grid_Hex(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
//////////////////////////////////////////////////////////////////////////////////////////////////
inputs[| 19] = nodeValue("Texture angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ])
.setDisplay(VALUE_DISPLAY.rotation_range);
input_display_list = [
["Output", false], 0,
["Pattern", false], 1, 3, 12, 2, 11, 4, 13,
["Render", false], 7, 8, 5, 17, 6, 9, 10,
["Truchet", true, 14], 15, 16,
["Truchet", true, 14], 15, 16, 19,
];
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
@ -112,6 +115,7 @@ function Node_Grid_Hex(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
shader_set_i("textureTruchet", _data[14]);
shader_set_f("truchetSeed", _data[15]);
shader_set_f("truchetThres", _data[16]);
shader_set_f("truchetAngle", _data[19]);
shader_set_gradient(_data[5], _data[17], _data[18], inputs[| 5]);

View file

@ -59,11 +59,14 @@ function Node_Grid_Tri(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
//////////////////////////////////////////////////////////////////////////////////////////////////
inputs[| 19] = nodeValue("Texture angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ])
.setDisplay(VALUE_DISPLAY.rotation_range);
input_display_list = [
["Output", false], 0,
["Pattern", false], 1, 4, 13, 2, 11, 3, 12,
["Render", false], 8, 9, 5, 17, 6, 7, 10,
["Truchet", true, 14], 15, 16,
["Truchet", true, 14], 15, 16, 19,
];
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
@ -114,6 +117,7 @@ function Node_Grid_Tri(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
shader_set_i("textureTruchet", _data[14]);
shader_set_f("truchetSeed", _data[15]);
shader_set_f("truchetThres", _data[16]);
shader_set_f("truchetAngle", _data[19]);
shader_set_gradient(_data[5], _data[17], _data[18], inputs[| 5]);

View file

@ -61,11 +61,14 @@ function Node_Herringbone_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y,
//////////////////////////////////////////////////////////////////////////////////////////////////
inputs[| 20] = nodeValue("Texture angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ])
.setDisplay(VALUE_DISPLAY.rotation_range);
input_display_list = [
["Output", false], 0,
["Pattern", false], 1, 3, 12, 2, 11, 17, 4, 13,
["Render", false], 7, 8, 5, 18, 6, 9, 10,
["Truchet", true, 14], 15, 16,
["Truchet", true, 14], 15, 16, 20,
];
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
@ -115,6 +118,7 @@ function Node_Herringbone_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y,
shader_set_i("textureTruchet", _data[14]);
shader_set_f("truchetSeed", _data[15]);
shader_set_f("truchetThres", _data[16]);
shader_set_f("truchetAngle", _data[20]);
shader_set_gradient(_data[5], _data[18], _data[19], inputs[| 5]);

View file

@ -62,11 +62,14 @@ function Node_Pytagorean_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _
//////////////////////////////////////////////////////////////////////////////////////////////////
inputs[| 20] = nodeValue("Texture angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ])
.setDisplay(VALUE_DISPLAY.rotation_range);
input_display_list = [
["Output", false], 0,
["Pattern", false], 1, 3, 12, 2, 11, 17, 4, 13,
["Render", false], 7, 8, 5, 18, 6, 9, 10,
["Truchet", true, 14], 15, 16,
["Truchet", true, 14], 15, 16, 20,
];
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
@ -117,6 +120,7 @@ function Node_Pytagorean_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _
shader_set_i("textureTruchet", _data[14]);
shader_set_f("truchetSeed", _data[15]);
shader_set_f("truchetThres", _data[16]);
shader_set_f("truchetAngle", _data[20]);
shader_set_gradient(_data[5], _data[18], _data[19], inputs[| 5]);

View file

@ -59,11 +59,14 @@ function Node_Random_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
//////////////////////////////////////////////////////////////////////////////////////////////////
inputs[| 19] = nodeValue("Texture angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ])
.setDisplay(VALUE_DISPLAY.rotation_range);
input_display_list = [
["Output", false], 0,
["Pattern", false], 1, 3, 12, 2, 11, 4, 13,
["Render", false], 7, 8, 5, 17, 6, 9, 10,
["Truchet", true, 14], 15, 16,
["Truchet", true, 14], 15, 16, 19,
];
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
@ -112,6 +115,7 @@ function Node_Random_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
shader_set_i("textureTruchet", _data[14]);
shader_set_f("truchetSeed", _data[15]);
shader_set_f("truchetThres", _data[16]);
shader_set_f("truchetAngle", _data[19]);
shader_set_gradient(_data[5], _data[17], _data[18], inputs[| 5]);

View file

@ -497,7 +497,7 @@ function __initNodes() {
addNodeObject(filter, "Blur", s_node_blur, "Node_Blur", [1, Node_Blur], ["gaussian blur"], "Blur image smoothly.");
addNodeObject(filter, "Non-Uniform Blur", s_node_blur_simple, "Node_Blur_Simple", [1, Node_Blur_Simple],, "Blur image using simpler algorithm. Allowing for variable blur strength.").setVersion(1070);
addNodeObject(filter, "Directional Blur", s_node_blur_directional,"Node_Blur_Directional",[1, Node_Blur_Directional], ["motion blur"], "Blur image given a direction.");
/**/ addNodeObject(filter, "Slope Blur", s_node_blur_directional,"Node_Blur_Slope", [1, Node_Blur_Slope], ["motion blur"], "Blur along a gradient of a slope map.").setVersion(11640);
addNodeObject(filter, "Slope Blur", s_node_blur_slope, "Node_Blur_Slope", [1, Node_Blur_Slope], ["motion blur"], "Blur along a gradient of a slope map.").setVersion(11640);
addNodeObject(filter, "Zoom Blur", s_node_zoom, "Node_Blur_Zoom", [1, Node_Blur_Zoom],, "Blur image by zooming in/out from a mid point.");
addNodeObject(filter, "Radial Blur", s_node_radial, "Node_Blur_Radial", [1, Node_Blur_Radial],, "Blur image by rotating aroung a mid point.").setVersion(1110);
addNodeObject(filter, "Lens Blur", s_node_bokeh, "Node_Blur_Bokeh", [1, Node_Blur_Bokeh], ["bokeh"], "Create bokeh effect. Blur lighter color in a lens-like manner.").setVersion(1110);

View file

@ -78,11 +78,13 @@ function Node_Rigid_Object_Spawner(_x, _y, _group = noone) : Node(_x, _y, _group
var _are = getInputData(1);
var _amo = getInputData(4);
random_set_seed(seed);
repeat(_amo) {
var pos = area_get_random_point(_are,,,,, seed); seed += 10;
var pos = area_get_random_point(_are);
var _o = _obj;
if(is_array(_o))
_o = _o[irandom_range_seed(0, array_length(_o) - 1, seed++)];
_o = _o[irandom_range(0, array_length(_o) - 1)];
array_push(object, _o.spawn(pos, spawn_index++));
}

View file

@ -95,20 +95,37 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
//////////////////////////////////////////////////////////////////////////////////////////////////
inputs[| 30] = nodeValue("Uniform amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 4, 4 ])
.setDisplay(VALUE_DISPLAY.vector);
inputs[| 31] = nodeValue("Auto amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
inputs[| 32] = nodeValue("Alternate rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
inputs[| 33] = nodeValue("Random position", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0, 0, 0 ])
.setDisplay(VALUE_DISPLAY.vector_range);
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
outputs[| 1] = nodeValue("Atlas data", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, [])
.setVisible(false)
.rejectArrayProcess();
input_display_list = [
["Surfaces", true], 0, 1, 15, 10, 24, 25, 26, 27,
["Scatter", false], 5, 6, 13, 14, 17, 9, 2,
["Scatter", false], 6, 5, 13, 14, 17, 9, 31, 2, 30,
["Path", false], 19, 20, 21, 22,
["Transform", false], 3, 8, 7, 4,
["Position", false], 33,
["Rotation", false], 7, 4, 32,
["Scale", false], 3, 8,
["Render", false], 18, 11, 28, 12, 16, 23,
];
attribute_surface_depth();
attribute_interpolation();
surface_size_map = ds_map_create();
surface_valid_map = ds_map_create();
scatter_data = [];
@ -133,15 +150,20 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
} #endregion
static step = function() { #region
var _are = getInputData(5);
var _dis = getInputData(6);
var _sct = getInputData(9);
var _arr = getInputData(15);
var _amn = getInputData(26);
update_on_frame = _arr && (_amn[0] != 0 || _amn[1] != 0);
inputs[| 0].array_depth = bool(_arr);
inputs[| 13].setVisible(_dis == 2, _dis == 2);
inputs[| 14].setVisible(_dis == 3, _dis == 3);
inputs[| 17].setVisible(_dis == 3);
inputs[| 9].setVisible(_dis != 2);
inputs[| 9].setVisible(_dis != 2 && _dis != 3);
inputs[| 19].setVisible(_dis == 4, _dis == 4);
inputs[| 20].setVisible(_dis == 4);
inputs[| 21].setVisible(_dis == 4);
@ -151,7 +173,28 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
inputs[| 26].setVisible(_arr);
inputs[| 27].setVisible(_arr);
update_on_frame = _arr && (_amn[0] != 0 || _amn[1] != 0);
inputs[| 5].setVisible(_dis < 3);
inputs[| 2].setVisible( true);
inputs[| 30].setVisible(false);
inputs[| 31].setVisible(false);
inputs[| 32].setVisible(false);
if(_dis == 0 && _sct == 0) {
if(_are[AREA_INDEX.shape] == AREA_SHAPE.elipse) {
var _aut = getInputData(31);
inputs[| 2].setVisible( _aut);
inputs[| 30].setVisible(!_aut);
inputs[| 31].setVisible( true);
inputs[| 32].setVisible(!_aut);
} else {
inputs[| 2].setVisible(false);
inputs[| 30].setVisible( true);
}
} else if(_dis == 5) {
inputs[| 2].setVisible(_sct == 1);
inputs[| 30].setVisible(_sct == 0);
}
inputs[| 11].mappableStep();
} #endregion
@ -199,38 +242,92 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
var arrAnim = _data[26];
var arrAnimEnd = _data[27];
var uniAmo = _data[30];
var uniAut = _data[31];
var uniRot = _data[32];
var posWig = _data[33];
var _in_w, _in_h;
var vSca = array_exists(useV, "Scale");
var vRot = array_exists(useV, "Rotation");
var vCol = array_exists(useV, "Color");
var _posDist = [];
if(_dist == NODE_SCATTER_DIST.map) {
if(!is_surface(_distMap))
return _outSurf;
_posDist = get_points_from_dist(_distMap, _amount, seed);
}
if(_dist == 4) {
var path_valid = path != noone && struct_has(path, "getPointRatio");
if(!path_valid) return _outSurf;
var _pathProgress = 0;
var path_amount = struct_has(path, "getLineCount")? path.getLineCount() : 1;
var _pre_amount = _amount;
_amount *= path_amount;
var path_line_index = 0;
}
var surfArray = is_array(_inSurf);
if(surfArray && array_empty(_inSurf)) return;
var _sed = seed;
var _sct = array_create(_amount);
var _sct_len = 0;
var _arrLen = array_safe_length(_inSurf);
#region cache value
ds_map_clear(surface_size_map);
ds_map_clear(surface_valid_map);
if(!surfArray) {
surface_size_map[? _inSurf] = surface_get_dimension(_inSurf);
surface_valid_map[? _inSurf] = is_surface(_inSurf);
} else {
for( var i = 0, n = array_length(_inSurf); i < n; i++ ) {
surface_size_map[? _inSurf[i]] = surface_get_dimension(_inSurf[i]);
surface_valid_map[? _inSurf[i]] = is_surface(_inSurf[i]);
}
}
color.cache();
#endregion
#region data
var _posDist = [];
if(_dist == NODE_SCATTER_DIST.map) {
if(!is_surface(_distMap))
return _outSurf;
_posDist = get_points_from_dist(_distMap, seed, _amount);
}
if(_dist == NODE_SCATTER_DIST.area) { // Area
if(_scat == 0 && (!uniAut || _area[AREA_INDEX.shape] == AREA_SHAPE.rectangle))
_amount = uniAmo[0] * uniAmo[1];
} else if(_dist == NODE_SCATTER_DIST.path) { // Path
var path_valid = path != noone && struct_has(path, "getPointRatio");
if(!path_valid) return _outSurf;
var _pathProgress = 0;
var path_amount = struct_has(path, "getLineCount")? path.getLineCount() : 1;
var _pre_amount = _amount;
_amount *= path_amount;
var path_line_index = 0;
} else if(_dist == NODE_SCATTER_DIST.tile) {
if(_scat == 0) _amount = uniAmo[0] * uniAmo[1];
}
var _sed = seed;
var _sct = array_create(_amount);
var _sct_len = 0;
var _arrLen = array_safe_length(_inSurf);
random_set_seed(_sed);
var _wigX = posWig[0] != 0 || posWig[1] != 0;
var _wigY = posWig[2] != 0 || posWig[3] != 0;
var _scaUniX = _scale[0] == _scale[1];
var _scaUniY = _scale[2] == _scale[3];
var _alpUni = alpha[0] == alpha[1];
var _clrUni = !inputs[| 11].attributes.mapped && color.keyLength == 1;
var _clrSin = color.evalFast(0);
var _useAtl = outputs[| 1].visible;
var _datLen = array_length(scatter_data);
var _p = [ 0, 0 ];
#endregion
surface_set_target(_outSurf);
gpu_set_tex_filter(attributes.interpolate);
DRAW_CLEAR
switch(blend) {
case 0 :
@ -246,57 +343,100 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
var posIndex = 0;
for(var i = 0; i < _amount; i++) {
if(is_array(_inSurf) && _arrLen == 0) break;
var sp = noone, _x = 0, _y = 0;
var _v = noone;
if(_dist == NODE_SCATTER_DIST.area || _dist == NODE_SCATTER_DIST.border) {
sp = area_get_random_point(_area, _dist, _scat, i, _amount, _sed); _sed += 20;
_x = sp[0];
_y = sp[1];
} else if(_dist == NODE_SCATTER_DIST.map) {
sp = array_safe_get(_posDist, i);
if(!is_array(sp)) continue;
_x = _area[0] + _area[2] * (sp[0] * 2 - 1.);
_y = _area[1] + _area[3] * (sp[1] * 2 - 1.);
} else if(_dist == NODE_SCATTER_DIST.data) {
sp = array_safe_get(_distData, i);
if(!is_array(sp)) continue;
_x = array_safe_get(sp, 0);
_y = array_safe_get(sp, 1);
_v = array_safe_get(sp, 2, noone);
} else if(_dist == NODE_SCATTER_DIST.path) {
_pathProgress = _scat? random_seed(1, _sed) : i / max(1, _pre_amount); _sed++;
_pathProgress = frac((_pathProgress + pathShf) * 0.9999);
var pp = path.getPointRatio(_pathProgress, path_line_index);
_x = pp.x + random_range_seed(-pathDis, pathDis, _sed); _sed++;
_y = pp.y + random_range_seed(-pathDis, pathDis, _sed); _sed++;
} else if(_dist == NODE_SCATTER_DIST.tile) {
if(_scat == 0) {
var _col = ceil(sqrt(_amount));
var _row = ceil(_amount / _col);
var _iwid = _dim[0] / _col;
var _ihig = _dim[1] / _row;
switch(_dist) { #region position
case NODE_SCATTER_DIST.area :
if(_scat == 0) {
var _axc = _area[AREA_INDEX.center_x];
var _ayc = _area[AREA_INDEX.center_y];
var _aw = _area[AREA_INDEX.half_w], _aw2 = _aw * 2;
var _ah = _area[AREA_INDEX.half_h], _ah2 = _ah * 2;
var _ax0 = _axc - _aw, _ax1 = _axc + _aw;
var _ay0 = _ayc - _ah, _ay1 = _ayc + _ah;
var _acol = i % uniAmo[0];
var _arow = floor(i / uniAmo[0]);
if(_area[AREA_INDEX.shape] == AREA_SHAPE.rectangle) {
_x = uniAmo[0] == 1? _axc : _ax0 + (_acol + 0.5) * _aw2 / ( uniAmo[0] );
_y = uniAmo[1] == 1? _ayc : _ay0 + (_arow + 0.5) * _ah2 / ( uniAmo[1] );
} else if(_area[AREA_INDEX.shape] == AREA_SHAPE.elipse) {
if(uniAut) {
sp = area_get_random_point(_area, _dist, _scat, i, _amount);
_x = sp[0];
_y = sp[1];
} else {
var _ang = _acol * 360 / uniAmo[0];
var _rad = uniAmo[1] == 1? 0.5 : _arow / (uniAmo[1] - 1);
if(uniRot) _ang += (_arow % 2) * 180 / uniAmo[0];
_x += _axc + lengthdir_x(_rad * _aw, _ang);
_y += _ayc + lengthdir_y(_rad * _ah, _ang);
}
}
} else {
sp = area_get_random_point(_area, _dist, _scat, i, _amount);
_x = sp[0];
_y = sp[1];
}
break;
var _irow = floor(i / _col);
var _icol = safe_mod(i, _col);
case NODE_SCATTER_DIST.border :
sp = area_get_random_point(_area, _dist, _scat, i, _amount);
_x = sp[0];
_y = sp[1];
break;
_x = _icol * _iwid;
_y = _irow * _ihig;
} else if(_scat == 1) {
_x = random_range_seed(0, _dim[0], _sed); _sed++;
_y = random_range_seed(0, _dim[1], _sed); _sed++;
}
}
case NODE_SCATTER_DIST.map :
sp = array_safe_get(_posDist, i);
if(!is_array(sp)) continue;
var posS = _dist < 4? seed + _y * _dim[0] + _x : seed + i * 100;
var _scx = random_range_seed(_scale[0], _scale[1], posS); posS++;
var _scy = random_range_seed(_scale[2], _scale[3], posS); posS++;
_x = _area[0] + _area[2] * (sp[0] * 2 - 1.);
_y = _area[1] + _area[3] * (sp[1] * 2 - 1.);
break;
case NODE_SCATTER_DIST.data :
sp = array_safe_get(_distData, i);
if(!is_array(sp)) continue;
_x = array_safe_get(sp, 0);
_y = array_safe_get(sp, 1);
_v = array_safe_get(sp, 2, noone);
break;
case NODE_SCATTER_DIST.path :
_pathProgress = _scat? random(1) : i / max(1, _pre_amount);
_pathProgress = frac((_pathProgress + pathShf) * 0.9999);
var pp = path.getPointRatio(_pathProgress, path_line_index);
_x = pp.x + random_range(-pathDis, pathDis);
_y = pp.y + random_range(-pathDis, pathDis);
break;
case NODE_SCATTER_DIST.tile :
if(_scat == 0) {
var _acol = i % uniAmo[0];
var _arow = floor(i / uniAmo[0]);
_x = uniAmo[0] == 1? _dim[0] / 2 : (_acol + 0.5) * _dim[0] / ( uniAmo[0] );
_y = uniAmo[1] == 1? _dim[1] / 2 : (_arow + 0.5) * _dim[1] / ( uniAmo[1] );
} else if(_scat == 1) {
_x = random_range(0, _dim[0]);
_y = random_range(0, _dim[1]);
}
break;
} #endregion
if(_wigX) _x += random_range(posWig[0], posWig[1]);
if(_wigY) _y += random_range(posWig[2], posWig[3]);
var _scx = _scaUniX? _scale[0] : random_range(_scale[0], _scale[1]);
var _scy = _scaUniY? _scale[2] : random_range(_scale[2], _scale[3]);
if(_unis) _scy = _scx;
if(vSca && _v != noone) {
@ -304,7 +444,7 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
_scy *= _v;
}
var _r = (_pint? point_direction(_area[0], _area[1], _x, _y) : 0) + angle_random_eval(_rota, posS); posS++;
var _r = (_pint? point_direction(_area[0], _area[1], _x, _y) : 0) + angle_random_eval_fast(_rota);
if(vRot && _v != noone)
_r *= _v;
@ -320,17 +460,17 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
var surf = _inSurf;
var ind = 0;
if(is_array(_inSurf)) {
if(surfArray) { #region
switch(_arr) {
case 1 : ind = safe_mod(i, _arrLen); break;
case 2 : ind = irandom_seed(_arrLen - 1, posS); posS++; break;
case 3 : ind = array_safe_get(arrId, i, 0); break;
case 1 : ind = safe_mod(i, _arrLen); break;
case 2 : ind = irandom(_arrLen - 1); break;
case 3 : ind = array_safe_get(arrId, i, 0); break;
case 4 : if(useArrTex) ind = color_get_brightness(surface_get_pixel(arrTex, _x, _y)) * (_arrLen - 1); break;
}
if(arrAnim[0] != 0 || arrAnim[1] != 0) {
var _arrAnim_spd = random_range_seed(arrAnim[0], arrAnim[1], posS); posS++;
var _arrAnim_shf = random_seed(_arrLen, posS); posS++;
var _arrAnim_spd = random_range(arrAnim[0], arrAnim[1]);
var _arrAnim_shf = random(_arrLen);
var _animInd = ind + _arrAnim_shf + CURRENT_FRAME * _arrAnim_spd;
switch(arrAnimEnd) {
@ -346,27 +486,52 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
}
surf = array_safe_get(_inSurf, ind, 0);
} #endregion
if(surf == 0 || !surface_valid_map[? surf]) continue;
var dim = surface_size_map[? surf];
var sw = dim[0];
var sh = dim[1];
if(_r == 0) {
_x -= sw / 2;
_y -= sh / 2;
} else {
_p = point_rotate(_x - sw / 2 * _scx, _y - sh * _scy / 2, _x, _y, _r, _p);
_x = _p[0];
_y = _p[1];
}
var sw = surface_get_width_safe(surf);
var sh = surface_get_height_safe(surf);
var _p = point_rotate(_x - sw / 2 * _scx, _y - sh * _scy / 2, _x, _y, _r);
_x = _p[0];
_y = _p[1];
var grSamp = random_seed(1, posS); posS++;
var grSamp = random(1);
if(vCol && _v != noone)
grSamp *= _v;
var clr = evaluate_gradient_map(grSamp, color, clr_map, clr_rng, inputs[| 11]);
var alp = random_range_seed(alpha[0], alpha[1], posS); posS++;
var clr = _clrUni? _clrSin : evaluate_gradient_map(grSamp, color, clr_map, clr_rng, inputs[| 11], true);
var alp = _alpUni? alpha[0] : random_range(alpha[0], alpha[1]);
var _atl = _sct_len >= _datLen? noone : scatter_data[_sct_len];
if(_useAtl) {
if(!is_instanceof(_atl, SurfaceAtlasFast)) _atl = new SurfaceAtlasFast(surf, _x, _y, _r, _scx, _scy, clr, alp);
else _atl.set(surf, _x, _y, _r, _scx, _scy, clr, alp);
_atl.w = sw;
_atl.h = sh;
} else {
if(_atl == noone) _atl = {};
_atl.surface = surf ;
_atl.x = _x ;
_atl.y = _y ;
_atl.rotation = _r ;
_atl.sx = _scx ;
_atl.sy = _scy ;
_atl.blend = clr ;
_atl.alpha = alp ;
_atl.w = sw ;
_atl.h = sh ;
}
var _atl = array_safe_get(scatter_data, _sct_len);
if(!is_instanceof(_atl, SurfaceAtlas))
_atl = new SurfaceAtlas(surf, _x, _y, _r, _scx, _scy, clr, alp);
else
_atl.set(surf, _x, _y, _r, _scx, _scy, clr, alp);
_sct[_sct_len] = _atl;
_sct_len++;
@ -380,7 +545,7 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
for( var i = 0; i < _sct_len; i++ ) {
var _atl = _sct[i];
surf = _atl.getSurface();
surf = _atl.surface;
_x = _atl.x;
_y = _atl.y;
_scx = _atl.sx;
@ -389,34 +554,28 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
clr = _atl.blend;
alp = _atl.alpha;
draw_surface_ext_safe(surf, _x, _y, _scx, _scy, _r, clr, alp);
draw_surface_ext(surf, _x, _y, _scx, _scy, _r, clr, alp);
if(_dist == NODE_SCATTER_DIST.tile) {
var _sw = surface_get_width_safe(surf) * _scx;
var _sh = surface_get_height_safe(surf) * _scy;
var _sw = _atl.w * _scx;
var _sh = _atl.h * _scy;
if(_x < _sw) draw_surface_ext_safe(surf, _dim[0] + _x, _y, _scx, _scy, _r, clr, alp);
if(_y < _sh) draw_surface_ext_safe(surf, _x, _dim[1] + _y, _scx, _scy, _r, clr, alp);
if(_x < _sw && _y < _sh) draw_surface_ext_safe(surf, _dim[0] + _x, _dim[1] + _y, _scx, _scy, _r, clr, alp);
if(_x < _sw) draw_surface_ext(surf, _dim[0] + _x, _y, _scx, _scy, _r, clr, alp);
if(_y < _sh) draw_surface_ext(surf, _x, _dim[1] + _y, _scx, _scy, _r, clr, alp);
if(_x < _sw && _y < _sh) draw_surface_ext(surf, _dim[0] + _x, _dim[1] + _y, _scx, _scy, _r, clr, alp);
if(_x > _dim[0] - _sw) draw_surface_ext_safe(surf, _x - _dim[0], _y, _scx, _scy, _r, clr, alp);
if(_y > _dim[1] - _sh) draw_surface_ext_safe(surf, _x, _y - _dim[1], _scx, _scy, _r, clr, alp);
if(_x > _dim[0] - _sw || _y > _dim[1] - _sh) draw_surface_ext_safe(surf, _x - _dim[0], _y - _dim[1], _scx, _scy, _r, clr, alp);
if(_x > _dim[0] - _sw) draw_surface_ext(surf, _x - _dim[0], _y, _scx, _scy, _r, clr, alp);
if(_y > _dim[1] - _sh) draw_surface_ext(surf, _x, _y - _dim[1], _scx, _scy, _r, clr, alp);
if(_x > _dim[0] - _sw || _y > _dim[1] - _sh) draw_surface_ext(surf, _x - _dim[0], _y - _dim[1], _scx, _scy, _r, clr, alp);
}
}
BLEND_NORMAL;
BLEND_NORMAL
gpu_set_tex_filter(false);
surface_reset_target();
scatter_data = _sct;
return _outSurf;
} #endregion
static doApplyDeserialize = function() { #region
var _arr = getInputData(15);
inputs[| 0].array_depth = _arr;
doUpdate();
} #endregion
}

View file

@ -78,6 +78,8 @@ function Node_Scatter_Points(_x, _y, _group = noone) : Node(_x, _y, _group) cons
inputs[| 7].setVisible(_fix);
var pos = [];
random_set_seed(_seed);
if(_fix) {
var ref = getInputData(8);
ref = surface_verify(ref, _fixRef[0], _fixRef[1]);
@ -90,11 +92,11 @@ function Node_Scatter_Points(_x, _y, _group = noone) : Node(_x, _y, _group) cons
pos = [];
for( var i = 0; i < _amo; i++ ) {
if(_fix) {
var p = area_get_random_point([_fixRef[0], _fixRef[1], _fixRef[0], _fixRef[1]], _dist, _scat, i, _amo, _seed++);
var p = area_get_random_point([_fixRef[0], _fixRef[1], _fixRef[0], _fixRef[1]], _dist, _scat, i, _amo);
if(point_in_rectangle(p[0], p[1], aBox[0], aBox[1], aBox[2], aBox[3]))
array_push(pos, p);
} else
pos[i] = area_get_random_point(_area, _dist, _scat, i, _amo, _seed++);
pos[i] = area_get_random_point(_area, _dist, _scat, i, _amo);
}
} else {
pos = [];

View file

@ -1613,7 +1613,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
cache_value[1] = _time;
}
cache_value[2] = array_clone(val);
cache_value[2] = val;
cache_value[3] = applyUnit;
updateColor(val);

View file

@ -1,14 +1,27 @@
function point_rotate(px, py, ox, oy, a) {
function point_rotate(px, py, ox, oy, a, p = undefined) {
INLINE
p ??= [ px, py ];
a = angle_difference(a, 0);
if(a == 0) return [ px, py ];
if(a == 180) return [ ox + (ox - px), oy + (oy - py) ];
if(a == 0) {
p[0] = px;
p[1] = py;
return p;
}
if(a == 180) {
p[0] = ox + (ox - px);
p[1] = oy + (oy - py);
return p;
}
var cx = px - ox;
var cy = py - oy;
var d = -degtorad(a);
return [ ox + cx * cos(d) - cy * sin(d),
oy + cx * sin(d) + cy * cos(d) ];
p[0] = ox + cx * cos(d) - cy * sin(d);
p[1] = oy + cx * sin(d) + cy * cos(d);
return p;
}

View file

@ -105,7 +105,5 @@ void main() { #region
}
vec4 col = gradientEval(prog);
col.a = _col.a;
gl_FragColor = col;
} #endregion

View file

@ -38,7 +38,9 @@ uniform sampler2D gradient_map;
uniform int textureTruchet;
uniform float truchetSeed;
uniform float truchetThres;
uniform float truchetThresX;
uniform float truchetThresY;
uniform vec2 truchetAngle;
float random (in vec2 st) { return fract(sin(dot(st.xy + vec2(85.456034, 64.54065), vec2(12.9898, 78.233))) * (43758.5453123 + seed) ); }
@ -184,8 +186,11 @@ void main() { #region
float rx = random(floor(_pos * sca) + truchetSeed / 100.);
float ry = random(floor(_pos * sca) + truchetSeed / 100. + vec2(0.4864, 0.6879));
if(rx > truchetThres) uv.x = 1. - uv.x;
if(ry > truchetThres) uv.y = 1. - uv.y;
if(rx >= truchetThresX) uv.x = 1. - uv.x;
if(ry >= truchetThresY) uv.y = 1. - uv.y;
float ang = radians(truchetAngle.x + (truchetAngle.y - truchetAngle.x) * random(floor(_pos * sca) + truchetSeed / 100. + vec2(0.9843, 0.1636)));
uv = 0.5 + mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * (uv - 0.5);
}
colr = texture2D( gm_BaseTexture, uv );

View file

@ -34,6 +34,7 @@ uniform sampler2D gradient_map;
uniform int textureTruchet;
uniform float truchetSeed;
uniform float truchetThres;
uniform vec2 truchetAngle;
#define PI 3.14159265359
@ -196,6 +197,7 @@ void main() { #region
if(ra > truchetThres) ang += 60.;
if(rb > truchetThres) ang += 60.;
ang += truchetAngle.x + (truchetAngle.y - truchetAngle.x) * random(hc.zw + truchetSeed / 100. + vec2(0.9843, 0.1636));
ang = radians(ang);
uv = 0.5 + mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * (uv - 0.5);

View file

@ -1,6 +1,3 @@
//
// Simple passthrough fragment shader
//
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
@ -39,6 +36,7 @@ uniform sampler2D gradient_map;
uniform int textureTruchet;
uniform float truchetSeed;
uniform float truchetThres;
uniform vec2 truchetAngle;
float random (in vec2 st) { return fract(sin(dot(st.xy + vec2(85.456034, 64.54065), vec2(12.9898, 78.233))) * (43758.5453123 + seed) ); }
@ -174,8 +172,11 @@ void main() { #region
float rx = random(floor(tri.xy) + truchetSeed / 100.);
float ry = random(floor(tri.xy) + truchetSeed / 100. + vec2(0.4864, 0.6879));
float ang = 0.;
if(rx > truchetThres) ang += 120.;
if(ry > truchetThres) ang += 120.;
ang += truchetAngle.x + (truchetAngle.y - truchetAngle.x) * random(floor(tri.xy) + truchetSeed / 100. + vec2(0.9843, 0.1636));
ang = radians(ang);
uv = 0.5 + mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * (uv - 0.5);

View file

@ -34,6 +34,7 @@ uniform sampler2D gradient_map;
uniform int textureTruchet;
uniform float truchetSeed;
uniform float truchetThres;
uniform vec2 truchetAngle;
uniform float tileLength;
@ -187,6 +188,9 @@ void main() { #region
if(rx > truchetThres) uv.x = 1. - uv.x;
if(ry > truchetThres) uv.y = 1. - uv.y;
float ang = radians(truchetAngle.x + (truchetAngle.y - truchetAngle.x) * random(floor(hc.zw / sca) + truchetSeed / 100. + vec2(0.9843, 0.1636)));
uv = 0.5 + mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * (uv - 0.5);
}
colr = texture2D( gm_BaseTexture, uv );

View file

@ -37,6 +37,7 @@ uniform sampler2D gradient_map;
uniform int textureTruchet;
uniform float truchetSeed;
uniform float truchetThres;
uniform vec2 truchetAngle;
uniform float phase;
@ -219,11 +220,14 @@ void main() { #region
vec2 uv = hc.zw + vec2(0.5, 0.5);
if(textureTruchet == 1) {
float rx = random(hc.zw + truchetSeed / 100.);
float ry = random(hc.zw + truchetSeed / 100. + vec2(0.4864, 0.6879));
float rx = random(hc.xx + truchetSeed / 100.);
float ry = random(hc.xx + truchetSeed / 100. + vec2(0.4864, 0.6879));
if(rx > truchetThres) uv.x = 1. - uv.x;
if(ry > truchetThres) uv.y = 1. - uv.y;
float ang = radians(truchetAngle.x + (truchetAngle.y - truchetAngle.x) * random(hc.xx + truchetSeed / 100. + vec2(0.9843, 0.1636)));
uv = 0.5 + mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * (uv - 0.5);
}
colr = texture2D( gm_BaseTexture, uv );

View file

@ -34,6 +34,7 @@ uniform sampler2D gradient_map;
uniform int textureTruchet;
uniform float truchetSeed;
uniform float truchetThres;
uniform vec2 truchetAngle;
#define PI 3.14159265359
#define TAU 6.28318530718
@ -196,6 +197,9 @@ void main() { #region
if(rx > truchetThres) uv.x = 1. - uv.x;
if(ry > truchetThres) uv.y = 1. - uv.y;
float ang = radians(truchetAngle.x + (truchetAngle.y - truchetAngle.x) * random(floor(hc.zw / sca) + truchetSeed / 100. + vec2(0.9843, 0.1636)));
uv = 0.5 + mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * (uv - 0.5);
}
colr = texture2D( gm_BaseTexture, uv );

View file

@ -25,8 +25,8 @@
"nineSlice": null,
"origin": 4,
"parent": {
"name": "filter",
"path": "folders/nodes/icons/filter.yy",
"name": "blur",
"path": "folders/nodes/icons/filter/blur.yy",
},
"preMultiplyAlpha": false,
"sequence": {

View file

@ -25,8 +25,8 @@
"nineSlice": null,
"origin": 4,
"parent": {
"name": "filter",
"path": "folders/nodes/icons/filter.yy",
"name": "blur",
"path": "folders/nodes/icons/filter/blur.yy",
},
"preMultiplyAlpha": false,
"sequence": {

View file

@ -25,8 +25,8 @@
"nineSlice": null,
"origin": 4,
"parent": {
"name": "filter",
"path": "folders/nodes/icons/filter.yy",
"name": "blur",
"path": "folders/nodes/icons/filter/blur.yy",
},
"preMultiplyAlpha": false,
"sequence": {

View file

@ -25,8 +25,8 @@
"nineSlice": null,
"origin": 4,
"parent": {
"name": "filter",
"path": "folders/nodes/icons/filter.yy",
"name": "blur",
"path": "folders/nodes/icons/filter/blur.yy",
},
"preMultiplyAlpha": false,
"sequence": {

View file

@ -25,8 +25,8 @@
"nineSlice": null,
"origin": 4,
"parent": {
"name": "filter",
"path": "folders/nodes/icons/filter.yy",
"name": "blur",
"path": "folders/nodes/icons/filter/blur.yy",
},
"preMultiplyAlpha": false,
"sequence": {

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View file

@ -0,0 +1,74 @@
{
"resourceType": "GMSprite",
"resourceVersion": "1.0",
"name": "s_node_blur_slope",
"bbox_bottom": 61,
"bbox_left": 0,
"bbox_right": 63,
"bbox_top": 4,
"bboxMode": 0,
"collisionKind": 1,
"collisionTolerance": 0,
"DynamicTexturePage": false,
"edgeFiltering": false,
"For3D": false,
"frames": [
{"resourceType":"GMSpriteFrame","resourceVersion":"1.1","name":"2dcc52f4-68cb-499d-9657-2bc0ed0cae36",},
],
"gridX": 0,
"gridY": 0,
"height": 64,
"HTile": false,
"layers": [
{"resourceType":"GMImageLayer","resourceVersion":"1.0","name":"90059fb4-61be-41fd-8f81-10e2edb89354","blendMode":0,"displayName":"default","isLocked":false,"opacity":100.0,"visible":true,},
],
"nineSlice": null,
"origin": 4,
"parent": {
"name": "blur",
"path": "folders/nodes/icons/filter/blur.yy",
},
"preMultiplyAlpha": false,
"sequence": {
"resourceType": "GMSequence",
"resourceVersion": "1.4",
"name": "s_node_blur_slope",
"autoRecord": true,
"backdropHeight": 768,
"backdropImageOpacity": 0.5,
"backdropImagePath": "",
"backdropWidth": 1366,
"backdropXOffset": 0.0,
"backdropYOffset": 0.0,
"events": {"resourceType":"KeyframeStore<MessageEventKeyframe>","resourceVersion":"1.0","Keyframes":[],},
"eventStubScript": null,
"eventToFunction": {},
"length": 1.0,
"lockOrigin": false,
"moments": {"resourceType":"KeyframeStore<MomentsEventKeyframe>","resourceVersion":"1.0","Keyframes":[],},
"playback": 1,
"playbackSpeed": 30.0,
"playbackSpeedType": 0,
"showBackdrop": true,
"showBackdropImage": false,
"timeUnits": 1,
"tracks": [
{"resourceType":"GMSpriteFramesTrack","resourceVersion":"1.0","name":"frames","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"1.0","Keyframes":[
{"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"1.0","Channels":{"0":{"resourceType":"SpriteFrameKeyframe","resourceVersion":"1.0","Id":{"name":"2dcc52f4-68cb-499d-9657-2bc0ed0cae36","path":"sprites/s_node_blur_slope/s_node_blur_slope.yy",},},},"Disabled":false,"id":"d3a5a91a-54f4-4840-986e-f7c3e21747a6","IsCreationKey":false,"Key":0.0,"Length":1.0,"Stretch":false,},
],},"modifiers":[],"spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
],
"visibleRange": null,
"volume": 1.0,
"xorigin": 32,
"yorigin": 32,
},
"swatchColours": null,
"swfPrecision": 2.525,
"textureGroupId": {
"name": "Default",
"path": "texturegroups/Default",
},
"type": 0,
"VTile": false,
"width": 64,
}

View file

@ -25,8 +25,8 @@
"nineSlice": null,
"origin": 4,
"parent": {
"name": "filter",
"path": "folders/nodes/icons/filter.yy",
"name": "blur",
"path": "folders/nodes/icons/filter/blur.yy",
},
"preMultiplyAlpha": false,
"sequence": {