render timing, particle, shape sep improvement

This commit is contained in:
MakhamDev 2022-01-16 20:28:57 +07:00
parent f27fb8aeee
commit 200ff704c1
43 changed files with 189 additions and 111 deletions

View file

@ -21,6 +21,7 @@ if !ready exit;
var xx = dialog_x + 16 + 16 + i * (grid_size + grid_space);
var yy = dialog_y + 44 + 16;
PANEL_GRAPH.stepBegin();
var nx = PANEL_GRAPH.mouse_grid_x;
var ny = PANEL_GRAPH.mouse_grid_y;

View file

@ -35,7 +35,7 @@ if !ready exit;
if(target) {
var paths = paths_to_array(dir_paths, dir_recursive, dir_filter);
target.updatePaths(paths);
target.update();
target.doUpdate();
}
instance_destroy();
}

View file

@ -114,7 +114,7 @@ event_inherited();
array_delete(arr, dragging, 1);
array_insert(arr, dragging < inb_hover? inb_hover - 1 : inb_hover, val);
target.inputs[| 0].setValue(arr);
target.update();
target.doUpdate();
dragging = -1;
}
}

View file

@ -85,6 +85,15 @@ event_inherited();
})
]);
ds_list_add(pref_global, [
"Show node render time",
"node_show_time",
new checkBox(function() {
PREF_MAP[? "node_show_time"] = !PREF_MAP[? "node_show_time"];
PREF_SAVE();
})
]);
//NODE
ds_list_add(pref_node, [

View file

@ -80,6 +80,7 @@ display_reset(0, 1);
setPath(path);
}
} else {
PANEL_GRAPH.stepBegin();
var ext = filename_ext(path);
switch(ext) {

View file

@ -13,7 +13,7 @@ function Node_3D_Obj(_x, _y) : Node(_x, _y) constructor {
inputs[| 1] = nodeValue(1, "Generate", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.button, [ function() {
updateObj();
update();
doUpdate();
}, "Generate"] );
inputs[| 2] = nodeValue(2, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2, VALUE_TAG.dimension_2d)

View file

@ -521,7 +521,7 @@ function Node_Canvas(_x, _y) : Node(_x, _y) constructor {
} else
surface_size_to(_outSurf, surface_valid(_dim[0]), surface_valid(_dim[1]));
}
update();
doUpdate();
static doSerialize = function(_map) {
_map[? "surface"] = buffer_base64_encode(surface_buffer, 0, buffer_get_size(surface_buffer));

View file

@ -41,5 +41,5 @@ function Node_Checker(_x, _y) : Node(_x, _y) constructor {
shader_reset();
surface_reset_target();
}
update();
doUpdate();
}

View file

@ -28,8 +28,10 @@ function Node_Collection(_x, _y) : Node(_x, _y) constructor {
}
function step() {
render_time = 0;
for(var i = 0; i < ds_list_size(nodes); i++) {
nodes[| i].step();
render_time += nodes[| i].render_time;
}
if(PANEL_GRAPH.node_focus == self && FOCUS == PANEL_GRAPH.panel && DOUBLE_CLICK) {

View file

@ -56,7 +56,7 @@ function Node_Composite(_x, _y) : Node_Processor(_x, _y) constructor {
.setDisplay(VALUE_DISPLAY.vector)
.setVisible(false);
array_push(input_display_list, ["Surface " + string(_s), false], index + 0, index + 1, index + 2, index + 3);
array_push(input_display_list, ["Surface " + string(_s), true], index + 0, index + 1, index + 2, index + 3);
}
createNewSurface();

View file

@ -48,6 +48,7 @@ function Node(_x, _y) constructor {
rendered = false;
auto_update = true;
update_on_frame = false;
render_time = 0;
use_cache = false;
cached_output = [];
@ -122,8 +123,10 @@ function Node(_x, _y) constructor {
static focusStep = function() {}
static doUpdate = function() {
var t = get_timer();
update();
rendered = true;
render_time = get_timer() - t;
}
static onValueUpdate = function(index) {}
@ -156,6 +159,38 @@ function Node(_x, _y) constructor {
return point_in_rectangle(_mx, _my, xx, yy, xx + w, yy + h);
}
static preDraw = function(_x, _y, _s) {
var yy = y * _s + _y;
var _in = yy + junction_shift_y * _s;
var amo = input_display_list == -1? ds_list_size(inputs) : max(ds_list_size(inputs), array_length(input_display_list));
for(var i = 0; i < amo; i++) {
if(input_display_list == -1)
jun = inputs[| i];
else {
var jun_list_arr = input_display_list[i];
if(is_array(jun_list_arr)) continue;
jun = inputs[| input_display_list[i]];
}
if(jun.isVisible()) {
jun.y = _in;
_in += 24 * _s;
}
}
var _in = yy + junction_shift_y * _s;
for(var i = 0; i < ds_list_size(outputs); i++) {
var jun = outputs[| i];
if(jun.isVisible()) {
jun.y = _in;
_in += 24 * _s;
}
}
}
static drawNodeBase = function(xx, yy, _s) {
draw_sprite_stretched_ext(bg_spr, 0, xx, yy, w * _s, h * _s, color, 0.75);
}
@ -180,10 +215,8 @@ function Node(_x, _y) constructor {
static drawJunctions = function(_x, _y, _mx, _my, _s) {
var ss = max(0.5, _s);
var xx = x * _s + _x;
var yy = y * _s + _y;
var hover = noone;
var _in = yy + junction_shift_y * _s;
var amo = input_display_list == -1? ds_list_size(inputs) : max(ds_list_size(inputs), array_length(input_display_list));
var _show_in = show_input_name;
@ -193,10 +226,8 @@ function Node(_x, _y) constructor {
show_input_name = false;
show_output_name = false;
var jx = xx;
for(var i = 0; i < amo; i++) {
var jx = xx;
var jy = _in;
if(input_display_list == -1)
jun = inputs[| i];
else {
@ -205,9 +236,9 @@ function Node(_x, _y) constructor {
jun = inputs[| input_display_list[i]];
}
var jy = jun.y;
if(jun.isVisible()) {
jun.y = jy;
if(point_in_rectangle(_mx, _my, jx - 12 * _s, jy - 12 * _s, jx + 12 * _s, jy + 12 * _s) || DEBUG) {
_draw_cc = c_white;
hover = jun;
@ -222,19 +253,15 @@ function Node(_x, _y) constructor {
draw_set_text(f_p1, fa_right, fa_center, _draw_cc);
draw_text(jx - 12 * _s, jy, jun.name);
}
_in += 24 * _s;
}
}
var _in = yy + junction_shift_y * _s;
var jx = xx + w * _s;
for(var i = 0; i < ds_list_size(outputs); i++) {
var jx = xx + w * _s;
var jy = _in;
var jun = outputs[| i];
if(jun.isVisible()) {
jun.y = jy;
var jy = jun.y;
if(point_in_rectangle(_mx, _my, jx - 12 * _s, jy - 12 * _s, jx + 12 * _s, jy + 12 * _s) || DEBUG) {
_draw_cc = c_white;
@ -254,8 +281,6 @@ function Node(_x, _y) constructor {
draw_set_text(f_p1, fa_left, fa_center, _draw_cc);
draw_text(jx + 12 * _s, jy, jun.name);
}
_in += 24 * _s;
}
}
@ -312,7 +337,28 @@ function Node(_x, _y) constructor {
if(_s * w > 48) {
draw_set_text(_s >= 1? f_p1 : f_p2, fa_center, fa_top, c_ui_blue_grey);
draw_text(xx + w * _s / 2, yy + h * _s + 4 * _s, string(pw) + " x " + string(ph) + "px");
var tx = xx + w * _s / 2;
var ty = yy + (h + 4) * _s;
draw_text(round(tx), round(ty), string(pw) + " x " + string(ph) + "px");
if(PREF_MAP[? "node_show_time"]) {
ty += string_height("l")
var rt, unit;
if(render_time < 1000) {
rt = round(render_time / 10) * 10;
unit = "us";
draw_set_color(c_ui_lime);
} else if(render_time < 1000000) {
rt = round(render_time / 1000);
unit = "ms";
draw_set_color(c_ui_orange);
} else {
rt = round(render_time / 1000000);
unit = "s";
draw_set_color(c_ui_red);
}
draw_text(round(tx), round(ty), string(rt) + " " + unit);
}
}
}
}

View file

@ -104,5 +104,5 @@ function Node_Gradient(_x, _y) : Node(_x, _y) constructor {
shader_reset();
surface_reset_target();
}
update();
doUpdate();
}

View file

@ -53,5 +53,5 @@ function Node_Grid(_x, _y) : Node(_x, _y) constructor {
shader_reset();
surface_reset_target();
}
update();
doUpdate();
}

View file

@ -7,7 +7,7 @@ function Node_create_Image(_x, _y) {
var node = new Node_Image(_x, _y);
node.inputs[| 0].setValue(path);
node.update();
node.doUpdate();
ds_list_add(PANEL_GRAPH.nodes_list, node);
return node;
@ -18,7 +18,7 @@ function Node_create_Image_path(_x, _y, path) {
var node = new Node_Image(_x, _y);
node.inputs[| 0].setValue(path);
node.update();
node.doUpdate();
ds_list_add(PANEL_GRAPH.nodes_list, node);
return node;
@ -46,7 +46,7 @@ function Node_Image(_x, _y) : Node(_x, _y) constructor {
on_dragdrop_file = function(path) {
if(updatePaths(path)) {
update();
doUpdate();
return true;
}

View file

@ -8,7 +8,7 @@ function Node_create_Image_Animated(_x, _y) {
var node = new Node_Image_Animated(_x, _y);
var paths = paths_to_array(path);
node.inputs[| 0].setValue(paths);
node.update();
node.doUpdate();
ds_list_add(PANEL_GRAPH.nodes_list, node);
return node;
@ -18,7 +18,7 @@ function Node_create_Image_Animated_path(_x, _y, _path) {
var node = new Node_Image_Animated(_x, _y);
node.inputs[| 0].setValue(_path);
node.update();
node.doUpdate();
ds_list_add(PANEL_GRAPH.nodes_list, node);
return node;
@ -78,7 +78,7 @@ function Node_Image_Animated(_x, _y) : Node(_x, _y) constructor {
var paths = paths_to_array(path);
if(updatePaths(paths)) {
update();
doUpdate();
return true;
}

View file

@ -7,7 +7,7 @@ function Node_create_Image_gif(_x, _y) {
var node = new Node_Image_gif(_x, _y);
node.inputs[| 0].setValue(path);
node.update();
node.doUpdate();
ds_list_add(PANEL_GRAPH.nodes_list, node);
return node;
@ -18,7 +18,7 @@ function Node_create_Image_gif_path(_x, _y, path) {
var node = new Node_Image_gif(_x, _y);
node.inputs[| 0].setValue(path);
node.update();
node.doUpdate();
ds_list_add(PANEL_GRAPH.nodes_list, node);
return node;
@ -52,7 +52,7 @@ function Node_Image_gif(_x, _y) : Node(_x, _y) constructor {
on_dragdrop_file = function(path) {
if(updatePaths(path)) {
update();
doUpdate();
return true;
}
@ -94,7 +94,7 @@ function Node_Image_gif(_x, _y) : Node(_x, _y) constructor {
if(loading == 2 && spr_builder != noone) {
if(spr_builder.building()) {
spr = spr_builder._spr;
update();
doUpdate();
loading = 0;
delete spr_builder;

View file

@ -8,7 +8,7 @@ function Node_create_Image_Sequence(_x, _y) {
var node = new Node_Image_Sequence(_x, _y);
var paths = paths_to_array(path);
node.inputs[| 0].setValue(paths);
node.update();
node.doUpdate();
ds_list_add(PANEL_GRAPH.nodes_list, node);
return node;
@ -17,7 +17,7 @@ function Node_create_Image_Sequence(_x, _y) {
function Node_create_Image_Sequence_path(_x, _y, _path) {
var node = new Node_Image_Sequence(_x, _y);
node.inputs[| 0].setValue(_path);
node.update();
node.doUpdate();
ds_list_add(PANEL_GRAPH.nodes_list, node);
return node;
@ -82,7 +82,7 @@ function Node_Image_Sequence(_x, _y) : Node(_x, _y) constructor {
var paths = paths_to_array(path);
if(updatePaths(paths)) {
update();
doUpdate();
return true;
}

View file

@ -66,7 +66,7 @@ function Node_Image_Sheet(_x, _y) : Node(_x, _y) constructor {
inputs[| 2].setValue(amo);
inputs[| 3].setValue(row);
update();
doUpdate();
}, "Generate"] );
input_display_list = [

View file

@ -187,5 +187,5 @@ function Node_Line(_x, _y) : Node(_x, _y) constructor {
}
surface_reset_target();
}
update();
doUpdate();
}

View file

@ -53,5 +53,5 @@ function Node_Noise_Aniso(_x, _y) : Node(_x, _y) constructor {
shader_reset();
surface_reset_target();
}
update();
doUpdate();
}

View file

@ -112,5 +112,5 @@ function Node_Cellular(_x, _y) : Node(_x, _y) constructor {
shader_reset();
surface_reset_target();
}
update();
doUpdate();
}

View file

@ -61,5 +61,5 @@ function Node_Grid_Noise(_x, _y) : Node(_x, _y) constructor {
shader_reset();
surface_reset_target();
}
update();
doUpdate();
}

View file

@ -16,7 +16,7 @@ function __part() constructor {
g = 0;
wig = 0;
boundary_data = [];
boundary_data = -1;
fx = 0;
fy = 0;
@ -368,6 +368,8 @@ function Node_Particle(_x, _y) : Node(_x, _y) constructor {
var sp = area_get_random_point(_spawn_area, _distrib, _scatter, spawn_index, _spawn_amount);
xx = sp[0];
yy = sp[1];
parts[| i].boundary_data = -1;
}
var _lif = random_range(_life[0], _life[1]);
@ -422,7 +424,7 @@ function Node_Particle(_x, _y) : Node(_x, _y) constructor {
var jun = outputs[| 1];
for(var j = 0; j < ds_list_size(jun.value_to); j++) {
if(jun.value_to[| j].value_from == jun) {
jun.value_to[| j].node.update();
jun.value_to[| j].node.doUpdate();
}
}
@ -536,6 +538,6 @@ function Node_Particle(_x, _y) : Node(_x, _y) constructor {
function update() {
reset();
}
update();
doUpdate();
render();
}

View file

@ -209,7 +209,7 @@ function Node_Particle_Effector(_x, _y) : Node(_x, _y) constructor {
var jun = outputs[| 0];
for(var j = 0; j < ds_list_size(jun.value_to); j++) {
if(jun.value_to[| j].value_from == jun) {
jun.value_to[| j].node.update();
jun.value_to[| j].node.doUpdate();
}
}

View file

@ -191,7 +191,7 @@ function Node_Path(_x, _y) : Node(_x, _y) constructor {
if(_active && mouse_check_button_pressed(mb_left)) {
ds_list_delete(inputs, list_start + anchor_hover);
update();
doUpdate();
}
} else {
draw_sprite(s_cursor_path_move, 0, _mx + 16, _my + 16);

View file

@ -55,5 +55,5 @@ function Node_Perlin(_x, _y) : Node(_x, _y) constructor {
shader_reset();
surface_reset_target();
}
update();
doUpdate();
}

View file

@ -55,5 +55,5 @@ function Node_Perlin_Smear(_x, _y) : Node(_x, _y) constructor {
shader_reset();
surface_reset_target();
}
update();
doUpdate();
}

View file

@ -25,5 +25,5 @@ function Node_Pin(_x, _y) : Node(_x, _y) constructor {
outputs[| 0].value_from = inputs[| 0].value_from;
}
}
update();
doUpdate();
}

View file

@ -30,11 +30,7 @@ function Node_Seperate_Shape(_x, _y) : Node(_x, _y) constructor {
function get_color_buffer(_x, _y, w, h) {
buffer_seek(surface_buffer, buffer_seek_start, (w * _y + _x) * 4);
var c = buffer_read(surface_buffer, buffer_u32);
var _r = c & 255;
var _g = (c >> 8) & 255;
var _b = (c >> 16) & 255;
return make_color_rgb(_r, _g, _b);
return c;
}
_prev_type = -1;
@ -42,6 +38,7 @@ function Node_Seperate_Shape(_x, _y) : Node(_x, _y) constructor {
function update() {
var _inSurf = inputs[| 0].getValue();
var _out_type = inputs[| 1].getValue();
var t = current_time;
if(!is_surface(_inSurf)) return;
@ -49,8 +46,8 @@ function Node_Seperate_Shape(_x, _y) : Node(_x, _y) constructor {
var hh = surface_get_height(_inSurf);
for(var i = 0; i < 2; i++) {
if(!is_surface(temp_surf[i])) temp_surf[i] = surface_create(surface_get_width(_inSurf), surface_get_height(_inSurf));
else surface_size_to(temp_surf[i], surface_get_width(_inSurf), surface_get_height(_inSurf));
if(!is_surface(temp_surf[i])) temp_surf[i] = surface_create(ww, hh);
else surface_size_to(temp_surf[i], ww, hh);
surface_set_target(temp_surf[i]);
draw_clear_alpha(0, 0);
@ -64,10 +61,11 @@ function Node_Seperate_Shape(_x, _y) : Node(_x, _y) constructor {
shader_reset();
shader_set(sh_seperate_shape_ite);
shader_set_uniform_f_array(uniform_it_dim, [ surface_get_width(_inSurf), surface_get_height(_inSurf) ]);
shader_set_uniform_f_array(uniform_it_dim, [ ww, hh ]);
shader_reset();
var res_index, iteration = surface_get_width(_inSurf) + surface_get_height(_inSurf);
t = get_timer();
var res_index = 0, iteration = ww + hh;
for(var i = 0; i <= iteration; i++) {
var bg = i % 2;
var fg = (i + 1) % 2;
@ -83,19 +81,23 @@ function Node_Seperate_Shape(_x, _y) : Node(_x, _y) constructor {
res_index = bg;
}
//show_debug_message("iteration time : " + string(get_timer() - t));
t = get_timer();
var _pixel_surface = surface_create(PREF_MAP[? "shape_separation_max"], 1);
surface_set_target(_pixel_surface);
draw_clear_alpha(0, 0);
BLEND_ADD
shader_set(sh_seperate_shape_counter);
texture_set_stage(shader_get_sampler_index(sh_seperate_shape_counter, "surface"), surface_get_texture(temp_surf[res_index]));
shader_set_uniform_f_array(shader_get_uniform(sh_seperate_shape_counter, "dimension"), [ surface_get_width(_inSurf), surface_get_height(_inSurf) ]);
shader_set_uniform_f_array(shader_get_uniform(sh_seperate_shape_counter, "dimension"), [ ww, hh ]);
draw_sprite_ext(s_fx_pixel, 0, 0, 0, PREF_MAP[? "shape_separation_max"], 1, 0, c_white, 1);
shader_reset();
BLEND_NORMAL
surface_reset_target();
//show_debug_message("count time : " + string(get_timer() - t));
var px = surface_getpixel(_pixel_surface, 0, 0);
if(px > 0) {
@ -119,13 +121,12 @@ function Node_Seperate_Shape(_x, _y) : Node(_x, _y) constructor {
}
var _boundary = array_create(px);
var _sw = surface_get_width(temp_surf[res_index]);
var _sh = surface_get_height(temp_surf[res_index]);
buffer_delete(surface_buffer);
surface_buffer = buffer_create(_sw * _sh * 4, buffer_fixed, 2);
surface_buffer = buffer_create(ww * hh * 4, buffer_fixed, 2);
buffer_get_surface(surface_buffer, temp_surf[res_index], 0);
t = get_timer();
for(var i = 0; i < px; i++) {
if(_out_type == 0) {
if(i >= ds_list_size(outputs)) {
@ -143,24 +144,31 @@ function Node_Seperate_Shape(_x, _y) : Node(_x, _y) constructor {
draw_clear_alpha(0, 0);
BLEND_ADD
shader_set(sh_seperate_shape_sep);
var cc = surface_getpixel(_pixel_surface, 1 + i, 0);
var ccx = surface_getpixel_ext(_pixel_surface, 1 + i, 0);
var alpha = (ccx >> 24) & 255;
var blue = (ccx >> 16) & 255;
var green = (ccx >> 8) & 255;
var red = ccx & 255;
#region boundary search (brute force)
#region boundary search
if(_out_type == 1) {
var t = _sh;
var b = 0;
var l = 0;
var r = _sw;
for( var j = 0; j < surface_get_width(_inSurf); j++ ) {
for( var k = 0; k < surface_get_height(_inSurf); k++ ) {
var _sc = get_color_buffer(j, k, _sw, _sh);
if(_sc == cc) {
t = min(t, k);
b = max(b, k);
l = max(l, j);
r = min(r, j);
}
var min_x = floor(red / 255 * ww);
var min_y = floor(green / 255 * hh);
var max_x = ceil(blue / 255 * ww);
var max_y = ceil(alpha / 255 * hh);
var t = max_y;
var b = min_y;
var l = max_x;
var r = min_x;
for( var j = min_x; j < max_x; j++ )
for( var k = min_y; k < max_y; k++ ) {
var _sc = get_color_buffer(j, k, ww, hh);
if(_sc == ccx) {
t = min(t, k);
b = max(b, k);
l = min(l, j);
r = max(r, j);
}
}
@ -169,7 +177,7 @@ function Node_Seperate_Shape(_x, _y) : Node(_x, _y) constructor {
#endregion
texture_set_stage(shader_get_sampler_index(sh_seperate_shape_sep, "original"), surface_get_texture(_inSurf));
shader_set_uniform_f_array(shader_get_uniform(sh_seperate_shape_sep, "color"), [ color_get_red(cc), color_get_green(cc) ]);
shader_set_uniform_f(shader_get_uniform(sh_seperate_shape_sep, "color"), red, green, blue, alpha);
draw_surface_safe(temp_surf[res_index], 0, 0);
shader_reset();
BLEND_NORMAL
@ -180,5 +188,7 @@ function Node_Seperate_Shape(_x, _y) : Node(_x, _y) constructor {
outputs[| 2].setValue(_boundary);
}
}
//show_debug_message("separate time : " + string(get_timer() - t));
}
}

View file

@ -159,5 +159,5 @@ function Node_Shape(_x, _y) : Node_Processor(_x, _y) constructor {
shader_reset();
surface_reset_target();
}
update();
doUpdate();
}

View file

@ -29,5 +29,5 @@ function Node_Solid(_x, _y) : Node(_x, _y) constructor {
draw_clear(_col);
surface_reset_target();
}
update();
doUpdate();
}

View file

@ -46,5 +46,5 @@ function Node_Stripe(_x, _y) : Node(_x, _y) constructor {
shader_reset();
surface_reset_target();
}
update();
doUpdate();
}

View file

@ -24,7 +24,7 @@ function Node_Surface_data(_x, _y) : Node(_x, _y) constructor {
var len = array_length(_insurf);
var _dim = array_create(len);
for( var i = 0; i < len; i++ ) {
for( var i = 0; i < len; i++ ) {
_dim[i][0] = surface_get_width(_insurf[i]);
_dim[i][1] = surface_get_height(_insurf[i]);
}
@ -38,5 +38,5 @@ function Node_Surface_data(_x, _y) : Node(_x, _y) constructor {
outputs[| 0].setValue([ surface_get_width(_insurf), surface_get_height(_insurf) ]);
}
update();
doUpdate();
}

View file

@ -20,7 +20,7 @@ function Node_Mesh_Warp(_x, _y) : Node(_x, _y) constructor {
.setDisplay(VALUE_DISPLAY.slider, [ 0, 1, 0.01 ] );
inputs[| 3] = nodeValue(3, "Mesh", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.button, [ function() { setTriangle(); update(); }, "Generate"] );
.setDisplay(VALUE_DISPLAY.button, [ function() { setTriangle(); doUpdate(); }, "Generate"] );
control_index = ds_list_size(inputs);

View file

@ -35,5 +35,5 @@ function Node_Zigzag(_x, _y) : Node(_x, _y) constructor {
shader_reset();
surface_reset_target();
}
update();
doUpdate();
}

View file

@ -201,6 +201,10 @@ function Panel_Graph(_panel) : PanelContent(_panel) constructor {
var gr_x = graph_x * graph_s;
var gr_y = graph_y * graph_s;
for(var i = 0; i < ds_list_size(nodes_list); i++) {
nodes_list[| i].preDraw(gr_x, gr_y, graph_s);
}
#region hover
node_hovering = noone;
for(var i = 0; i < ds_list_size(nodes_list); i++) {

View file

@ -27,6 +27,7 @@
PREF_MAP[? "panel_collection"] = true;
PREF_MAP[? "node_snapping"] = 32;
PREF_MAP[? "node_show_time"] = true;
PREF_MAP[? "shape_separation_max"] = 32;
#endregion

View file

@ -46,7 +46,7 @@ function renderAll() {
if(_ready) {
if(!rendering.rendered && (LOADING || APPENDING || rendering.auto_update))
rendering.update();
rendering.doUpdate();
} else {
ds_queue_enqueue(render_q, rendering);
}
@ -119,9 +119,9 @@ function renderNodeBackward(_node) {
_rendering.rendered = true;
if(_rendering.use_cache) {
if(!_rendering.recoverCache())
_rendering.update();
_rendering.doUpdate();
} else
_rendering.update();
_rendering.doUpdate();
ds_stack_pop(render_st);
}
}

View file

@ -175,7 +175,7 @@ function LOAD_PATH(path, readonly = false) {
var _node = NODE_MAP[? _key];
if(_node.is_dynamic_output) {
_node.connect();
_node.update();
_node.doUpdate();
}
_key = ds_map_find_next(NODE_MAP, _key);

View file

@ -8,21 +8,22 @@ uniform vec2 dimension;
uniform sampler2D surface;
void main() {
vec4 zero = vec4(0.);
vec2 pxPos = v_vTexcoord * vec2(32., 1.);
int amo = 0;
vec2 list[32];
vec4 list[32];
for(float i = 0.; i <= dimension.x; i++)
for(float j = 0.; j <= dimension.y; j++) {
if(amo > 32) break;
vec4 col = texture2D( surface, vec2(i, j) / dimension );
if(col.a > 0.) {
if(col != zero) {
bool dup = false;
for(int k = 0; k < amo; k++) {
if(col.rg == list[k]) {
if(col == list[k]) {
dup = true;
break;
}
@ -33,7 +34,7 @@ void main() {
amo = 999;
break;
}
list[amo] = col.rg;
list[amo] = col;
amo++;
}
}

View file

@ -8,7 +8,7 @@ void main() {
vec4 col = texture2D( gm_BaseTexture, v_vTexcoord );
if(length(col.rgb * col.a) > 0.2)
gl_FragColor = vec4(v_vTexcoord, (col.r + col.g + col.b) / 3., 1.);
gl_FragColor = vec4(v_vTexcoord.x, v_vTexcoord.y, v_vTexcoord.x, v_vTexcoord.y);
else
gl_FragColor = vec4(0.);
}

View file

@ -7,23 +7,24 @@ varying vec4 v_vColour;
uniform vec2 dimension;
void main() {
vec2 _index = v_vTexcoord;
vec4 zero = vec4(0.);
vec4 col = texture2D( gm_BaseTexture, v_vTexcoord );
float bright = dot(col.rgb, vec3(0.2126, 0.7152, 0.0722));
if(col.a > 0. && bright > 0.) {
if(col != zero) {
vec2 _index_min = v_vTexcoord;
vec2 _index_max = v_vTexcoord;
for(float i = -1.; i <= 1.; i++)
for(float j = -1.; j <= 1.; j++) {
vec4 _col = texture2D( gm_BaseTexture, v_vTexcoord + vec2(i, j) / dimension );
float _bright = dot(_col.rgb, vec3(0.2126, 0.7152, 0.0722));
if(_col.a > 0. && abs(bright - _bright) < 0.1) {
_index.x = min(_index.x, _col.r);
_index.y = min(_index.y, _col.g);
vec4 _col = texture2D( gm_BaseTexture, clamp(v_vTexcoord + vec2(i, j) / dimension, 0., 1.) );
if(_col != zero) {
_index_min.x = min(_index_min.x, _col.r);
_index_min.y = min(_index_min.y, _col.g);
_index_max.x = max(_index_max.x, _col.b);
_index_max.y = max(_index_max.y, _col.a);
}
}
gl_FragColor = vec4(_index, 1., 1.);
} else {
gl_FragColor = vec4(0.);
gl_FragColor = vec4(_index_min.x, _index_min.y, _index_max.x, _index_max.y );
}
}

View file

@ -5,12 +5,12 @@ varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform sampler2D original;
uniform vec2 color;
uniform vec4 color;
void main() {
vec4 col = texture2D( gm_BaseTexture, v_vTexcoord );
if(distance(col.rg * 255., color) < 1.) {
if(distance(col * 255., color) < 1.) {
gl_FragColor = texture2D( original, v_vTexcoord );
} else
gl_FragColor = vec4(0.);