Transform, composite optimization

This commit is contained in:
MakhamDev 2023-10-03 16:27:36 +07:00
parent 864e79d8a4
commit d32fc6130a
23 changed files with 171 additions and 158 deletions

View file

@ -7,7 +7,6 @@
{"name":"Math","order":1,"path":"folders/_extensions/BBMOD/Math.yy",},
{"name":"GMD3D11","order":11,"path":"folders/_extensions/GMD3D11.yy",},
{"name":"MAC","order":6,"path":"folders/_extensions/MAC.yy",},
{"name":"Shader replace","order":12,"path":"folders/_extensions/Shader replace.yy",},
{"name":"addons","order":10,"path":"folders/addons.yy",},
{"name":"custom","order":4,"path":"folders/addons/custom.yy",},
{"name":"key displayer","order":2,"path":"folders/addons/key displayer.yy",},
@ -129,6 +128,7 @@
{"name":"value","order":4,"path":"folders/nodes/data/value.yy",},
{"name":"array","order":1,"path":"folders/nodes/data/value/array.yy",},
{"name":"atlas","order":10,"path":"folders/nodes/data/value/atlas.yy",},
{"name":"audio","order":13,"path":"folders/nodes/data/value/audio.yy",},
{"name":"bool","order":2,"path":"folders/nodes/data/value/bool.yy",},
{"name":"buffer","order":12,"path":"folders/nodes/data/value/buffer.yy",},
{"name":"color","order":3,"path":"folders/nodes/data/value/color.yy",},
@ -215,7 +215,6 @@
{"name":"biterator","order":2,"path":"folders/VCT/biterator.yy",},
{"name":"widget","order":3,"path":"folders/VCT/widget.yy",},
{"name":"widgets","order":5,"path":"folders/widgets.yy",},
{"name":"audio","order":13,"path":"folders/nodes/data/value/audio.yy",},
],
"ResourceOrderSettings": [
{"name":"s_node_corner","order":16,"path":"sprites/s_node_corner/s_node_corner.yy",},
@ -433,7 +432,6 @@
{"name":"fd_rectangle_update_view","order":5,"path":"scripts/fd_rectangle_update_view/fd_rectangle_update_view.yy",},
{"name":"s_node_rigidSim_renderer","order":1,"path":"sprites/s_node_rigidSim_renderer/s_node_rigidSim_renderer.yy",},
{"name":"__init_background","order":4,"path":"scripts/__init_background/__init_background.yy",},
{"name":"shader_replace_simple_macros","order":2,"path":"scripts/shader_replace_simple_macros/shader_replace_simple_macros.yy",},
{"name":"s_textbox","order":1,"path":"sprites/s_textbox/s_textbox.yy",},
{"name":"__node","order":8,"path":"scripts/__node/__node.yy",},
{"name":"fd_rectangle_add_velocity","order":5,"path":"scripts/fd_rectangle_add_velocity/fd_rectangle_add_velocity.yy",},
@ -955,7 +953,6 @@
{"name":"s_node_noise_fbm","order":26,"path":"sprites/s_node_noise_fbm/s_node_noise_fbm.yy",},
{"name":"sh_color_select_content","order":1,"path":"shaders/sh_color_select_content/sh_color_select_content.yy",},
{"name":"s_node_hlsl","order":32,"path":"sprites/s_node_hlsl/s_node_hlsl.yy",},
{"name":"scr_cmd_arg","order":3,"path":"scripts/scr_cmd_arg/scr_cmd_arg.yy",},
{"name":"sh_outline","order":18,"path":"shaders/sh_outline/sh_outline.yy",},
{"name":"s_node_strandSim_break","order":8,"path":"sprites/s_node_strandSim_break/s_node_strandSim_break.yy",},
{"name":"s_node_scatter_point","order":4,"path":"sprites/s_node_scatter_point/s_node_scatter_point.yy",},
@ -1532,7 +1529,6 @@
{"name":"sprite_loader","order":11,"path":"scripts/sprite_loader/sprite_loader.yy",},
{"name":"fd_rectangle_get_material_surface","order":12,"path":"scripts/fd_rectangle_get_material_surface/fd_rectangle_get_material_surface.yy",},
{"name":"fd_rectangle_clear","order":6,"path":"scripts/fd_rectangle_clear/fd_rectangle_clear.yy",},
{"name":"shader_replace_simple","order":1,"path":"extensions/shader_replace_simple/shader_replace_simple.yy",},
{"name":"d3d_cone","order":5,"path":"scripts/d3d_cone/d3d_cone.yy",},
{"name":"__rectangle","order":7,"path":"scripts/__rectangle/__rectangle.yy",},
{"name":"node_PCX_fn_random","order":1,"path":"scripts/node_PCX_fn_random/node_PCX_fn_random.yy",},

View file

@ -28,7 +28,6 @@
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"Gameframe","folderPath":"folders/_extensions/Gameframe.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"GMD3D11","folderPath":"folders/_extensions/GMD3D11.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"MAC","folderPath":"folders/_extensions/MAC.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"Shader replace","folderPath":"folders/_extensions/Shader replace.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"addons","folderPath":"folders/addons.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"custom","folderPath":"folders/addons/custom.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"key displayer","folderPath":"folders/addons/key displayer.yy",},
@ -157,6 +156,7 @@
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"value","folderPath":"folders/nodes/data/value.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"array","folderPath":"folders/nodes/data/value/array.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"atlas","folderPath":"folders/nodes/data/value/atlas.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"audio","folderPath":"folders/nodes/data/value/audio.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"bool","folderPath":"folders/nodes/data/value/bool.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"buffer","folderPath":"folders/nodes/data/value/buffer.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"color","folderPath":"folders/nodes/data/value/color.yy",},
@ -248,7 +248,6 @@
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"biterator","folderPath":"folders/VCT/biterator.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"widget","folderPath":"folders/VCT/widget.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"widgets","folderPath":"folders/widgets.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"audio","folderPath":"folders/nodes/data/value/audio.yy",},
],
"IncludedFiles": [
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"ApolloHelp.html","ConfigValues":{"Itch":{"CopyToMask":"0",},},"CopyToMask":-1,"filePath":"datafiles",},
@ -987,7 +986,6 @@
{"id":{"name":"fd_rectangle_update_view","path":"scripts/fd_rectangle_update_view/fd_rectangle_update_view.yy",},},
{"id":{"name":"s_node_rigidSim_renderer","path":"sprites/s_node_rigidSim_renderer/s_node_rigidSim_renderer.yy",},},
{"id":{"name":"__init_background","path":"scripts/__init_background/__init_background.yy",},},
{"id":{"name":"shader_replace_simple_macros","path":"scripts/shader_replace_simple_macros/shader_replace_simple_macros.yy",},},
{"id":{"name":"s_textbox","path":"sprites/s_textbox/s_textbox.yy",},},
{"id":{"name":"__node","path":"scripts/__node/__node.yy",},},
{"id":{"name":"fd_rectangle_add_velocity","path":"scripts/fd_rectangle_add_velocity/fd_rectangle_add_velocity.yy",},},
@ -1585,7 +1583,6 @@
{"id":{"name":"s_node_noise_fbm","path":"sprites/s_node_noise_fbm/s_node_noise_fbm.yy",},},
{"id":{"name":"sh_color_select_content","path":"shaders/sh_color_select_content/sh_color_select_content.yy",},},
{"id":{"name":"s_node_hlsl","path":"sprites/s_node_hlsl/s_node_hlsl.yy",},},
{"id":{"name":"scr_cmd_arg","path":"scripts/scr_cmd_arg/scr_cmd_arg.yy",},},
{"id":{"name":"sh_outline","path":"shaders/sh_outline/sh_outline.yy",},},
{"id":{"name":"s_node_strandSim_break","path":"sprites/s_node_strandSim_break/s_node_strandSim_break.yy",},},
{"id":{"name":"s_node_scatter_point","path":"sprites/s_node_scatter_point/s_node_scatter_point.yy",},},
@ -1699,7 +1696,6 @@
{"id":{"name":"number_function","path":"scripts/number_function/number_function.yy",},},
{"id":{"name":"s_node_array_shift","path":"sprites/s_node_array_shift/s_node_array_shift.yy",},},
{"id":{"name":"s_node_statistic","path":"sprites/s_node_statistic/s_node_statistic.yy",},},
{"id":{"name":"execute_program_pipe","path":"extensions/execute_program_pipe/execute_program_pipe.yy",},},
{"id":{"name":"s_node_cache_array","path":"sprites/s_node_cache_array/s_node_cache_array.yy",},},
{"id":{"name":"sh_blend_alpha_addition","path":"shaders/sh_blend_alpha_addition/sh_blend_alpha_addition.yy",},},
{"id":{"name":"widget","path":"scripts/widget/widget.yy",},},
@ -2254,7 +2250,6 @@
{"id":{"name":"fd_rectangle_get_material_surface","path":"scripts/fd_rectangle_get_material_surface/fd_rectangle_get_material_surface.yy",},},
{"id":{"name":"fd_rectangle_clear","path":"scripts/fd_rectangle_clear/fd_rectangle_clear.yy",},},
{"id":{"name":"instance_create","path":"scripts/instance_create/instance_create.yy",},},
{"id":{"name":"shader_replace_simple","path":"extensions/shader_replace_simple/shader_replace_simple.yy",},},
{"id":{"name":"d3d_cone","path":"scripts/d3d_cone/d3d_cone.yy",},},
{"id":{"name":"__rectangle","path":"scripts/__rectangle/__rectangle.yy",},},
{"id":{"name":"node_PCX_fn_random","path":"scripts/node_PCX_fn_random/node_PCX_fn_random.yy",},},

View file

@ -90,7 +90,7 @@ function buttonClass(_onClick, _icon = noone) : widget() constructor {
var aa = interactable * 0.25 + 0.75;
if(icon) {
var ind = is_real(icon_index)? icon_index : icon_index();
var ind = is_array(icon_index)? icon_index[0]() : icon_index;
draw_sprite_ui_uniform(icon, ind, _x + _w / 2, _y + _h / 2,, icon_blend, aa);
}

View file

@ -112,7 +112,7 @@ function buttonColor(_onApply, dialog = noone) : widget() constructor {
if(is_array(current_color))
drawPalette(current_color, _x + ui(6), _y + ui(6), _cw - ui(12), _h - ui(12));
else
else if(is_real(current_color))
draw_sprite_stretched_ext(THEME.button_color_overlay, 0, _x + ui(4), _y + ui(4), _cw - ui(8), _h - ui(8), current_color, 1);
if(WIDGET_CURRENT == self)

View file

@ -45,14 +45,13 @@ function draw_surface_blend(background, foreground, blend = 0, alpha = 1, _pre_a
}
function draw_surface_blend_ext(bg, fg, _x, _y, _sx = 1, _sy = 1, _rot = 0, _col = c_white, _alpha = 1, _blend = 0) {
var _tmpS = surface_create_size(bg);
static _tempS = surface_create(1, 1);
_tempS = surface_verify(_tempS, surface_get_width_safe(bg), surface_get_height_safe(bg));
surface_set_shader(_tmpS);
surface_set_shader(_tempS);
shader_set_interpolation(fg);
draw_surface_ext_safe(fg, _x, _y, _sx, _sy, _rot, _col, 1);
surface_reset_shader();
draw_surface_blend(bg, _tmpS, _blend, _alpha, false);
surface_free(_tmpS);
draw_surface_blend(bg, _tempS, _blend, _alpha, false);
}

View file

@ -10,7 +10,7 @@ function gradientKey(time, value) constructor {
static clone = function() { return new gradientKey(time, value); }
static serialize = function() { return {time, value}; }
static serialize = function() { return { time, value }; }
}
function gradientObject(color = c_black) constructor {
@ -116,10 +116,10 @@ function gradientObject(color = c_black) constructor {
static toArray = function() {
var _grad_color = [], _grad_time = [];
for(var i = 0; i < array_length(keys); i++) {
if(is_undefined(keys[i].value)) continue;
_grad_color[i * 4 + 0] = color_get_red(keys[i].value) / 255;
_grad_color[i * 4 + 1] = color_get_green(keys[i].value) / 255;
_grad_color[i * 4 + 2] = color_get_blue(keys[i].value) / 255;
@ -175,7 +175,7 @@ function gradientObject(color = c_black) constructor {
}
static serialize = function() {
var s = {type};
var s = { type: type };
s.keys = [];
for( var i = 0, n = array_length(keys); i < n; i++ )
s.keys[i] = keys[i].serialize();
@ -198,10 +198,14 @@ function gradientObject(color = c_black) constructor {
return self;
}
type = s.type;
keys = [];
for( var i = 0, n = array_length(s.keys); i < n; i++ )
keys[i] = new gradientKey(s.keys[i].time, s.keys[i].value);
type = struct_try_get(s, "type");
keys = array_create(array_length(s.keys));
for( var i = 0, n = array_length(s.keys); i < n; i++ ) {
var _time = real(s.keys[i].time);
var _value = real(s.keys[i].value);
keys[i] = new gradientKey(_time, _value);
}
return self;
}

View file

@ -62,6 +62,7 @@
function attribute_interpolation(label = false) {
attributes.interpolation = 0;
attributes.oversample = 0;
if(label) array_push(attributeEditors, "Surface");
array_push(attributeEditors, ["Texture interpolation", function() { return attributes.interpolation; },
@ -72,6 +73,7 @@
}
function attribute_oversample(label = false) {
attributes.interpolation = 0;
attributes.oversample = 0;
if(label) array_push(attributeEditors, "Surface");

View file

@ -17,7 +17,7 @@ function Node_Audio_Window(_x, _y, _group = noone) : Node(_x, _y, _group) constr
inputs[| 2].display_data.side_button.tooltip.index = inputs[| 2].display_data.unit;
update();
}).setTooltip( new tooltipSelector("Unit", [ "Bit", "Second", "Progress" ]) )
.setIcon( THEME.unit_audio, function() { return inputs[| 2].display_data.unit; }, COLORS._main_icon )
.setIcon( THEME.unit_audio, [ function() { return inputs[| 2].display_data.unit; } ], COLORS._main_icon )
}
);

View file

@ -458,7 +458,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
cached_manual = false;
if(!use_cache && PROJECT.onion_skin) {
if(!use_cache && PROJECT.onion_skin.enabled) {
for( var i = 0; i < ds_list_size(outputs); i++ ) {
if(outputs[| i].type != VALUE_TYPE.surface) continue;
cacheCurrentFrame(outputs[| i].getValue());

View file

@ -39,16 +39,19 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
/*Boolean*/ [ "Default" ],
/*Color*/ [ "Default", "Gradient", "Palette" ],
/*Surface*/ [ "Default", ],
/*Path*/ [ "Default", ],
/*Curve*/ [ "Default", ],
/*Text*/ [ "Default", ],
/*Object*/ [ "Default", ],
/*Node*/ [ "Default", ],
/*3D*/ [ "Default", ],
/*Any*/ [ "Default", ],
/*Pathnode*/[ "Default", ],
/*Particle*/[ "Default", ],
/*Rigid*/ [ "Default", ],
/*Fdomain*/ [ "Default", ],
/*Struct*/ [ "Default", ],
/*Strand*/ [ "Default", ],
@ -143,10 +146,7 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
_to.removeFrom();
}
inputs[| 0].display_data.data = array_safe_get(display_list, _val_type);
inputs[| 0].editWidget.data_list = array_safe_get(display_list, _val_type);
inputs[| 0].setValue(0);
_dtype = 0;
}
_dtype = array_safe_get(array_safe_get(display_list, _val_type, []), _dtype);
@ -276,6 +276,11 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
static step = function() { #region
if(is_undefined(inParent)) return;
var _type = getInputData(2);
var _val_type = data_type_map[_type];
inputs[| 0].display_data.data = array_safe_get(display_list, _val_type);
inputs[| 0].editWidget.data_list = array_safe_get(display_list, _val_type);
if(inParent.name != display_name) {
inParent.name = display_name;
group.inputMap[? string_replace_all(display_name, " ", "_")] = inParent;
@ -301,15 +306,9 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
doTrigger = 0;
}
}
} #endregion
PATCH_STATIC
static update = function(frame = PROJECT.animator.current_frame) { #region
if(is_undefined(inParent)) return;
var _dstype = getInputData(0);
var _data = getInputData(2);
var _data = getInputData(2);
_dstype = array_safe_get(array_safe_get(display_list, _data, []), _dstype);
var _datype = data_type_map[_data];
@ -338,30 +337,21 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
}
} #endregion
static postDeserialize = function() { #region
createInput(false);
var _inputs = load_map.inputs;
inputs[| 5].applyDeserialize(_inputs[5], load_scale);
if(PROJECT.version < 11520) attributes.input_priority = getInputData(5);
group.sortIO();
inputs[| 2].applyDeserialize(_inputs[2], load_scale);
onValueUpdate(2);
PATCH_STATIC
static update = function(frame = PROJECT.animator.current_frame) { #region
if(is_undefined(inParent)) return;
} #endregion
static applyDeserialize = function() { #region
var _inputs = load_map.inputs;
var amo = min(array_length(_inputs), ds_list_size(inputs));
for(var i = 0; i < amo; i++) {
if(i == 2 || i == 5) continue;
inputs[| i].applyDeserialize(_inputs[i], load_scale);
}
static postDeserialize = function() { createInput(false); }
static doApplyDeserialize = function() {
inParent.name = name;
onValueUpdate(0);
} #endregion
getInputs();
if(PROJECT.version < 11520) attributes.input_priority = getInputData(5);
onValueUpdate();
group.sortIO();
}
static onDestroy = function() { #region
if(is_undefined(inParent)) return;

View file

@ -15,7 +15,7 @@ function Node_Pixel_Sort(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
.setDisplay(VALUE_DISPLAY.slider);
inputs[| 3] = nodeValue("Direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.rotation, 90);
.setDisplay(VALUE_DISPLAY.rotation, { step: 90 });
inputs[| 4] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);

View file

@ -32,6 +32,9 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
static getInputData = function(index, def = 0) { return array_safe_get(inputs_data, index, def); }
static processData_prebatch = function() {}
static processData_postbatch = function() {}
static processData = function(_outSurf, _data, _output_index, _array_index = 0) { return _outSurf; }
static getSingleValue = function(_index, _arr = 0, output = false) { #region
@ -270,8 +273,10 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
} #endregion
static update = function(frame = PROJECT.animator.current_frame) { #region
processData_prebatch();
if(batch_output) processBatchOutput();
else processOutput();
processData_postbatch();
postUpdate();
} #endregion

View file

@ -20,11 +20,14 @@ function Node_Texture_Remap(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
attribute_surface_depth();
attribute_interpolation();
static processData_prebatch = function() { shader_preset_interpolation(shader); }
static processData_postbatch = function() { shader_postset_interpolation(); }
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
if(!is_surface(_data[1])) return _outSurf;
surface_set_shader(_outSurf, shader);
shader_set_interpolation(_data[0]);
shader_set_interpolation_surface(_data[0]);
texture_set_stage(uniform_map, surface_get_texture(_data[1]));
draw_surface_safe(_data[0], 0, 0);
surface_reset_shader();

View file

@ -122,16 +122,19 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
}
} #endregion
static processData_prebatch = function() { shader_preset_interpolation(); }
static processData_postbatch = function() { shader_postset_interpolation(); }
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
var ins = _data[0];
var out_type = _data[9];
var out = _data[1];
var pos = array_clone(_data[2]);
var pos = [ _data[2][0], _data[2][1] ];
var pos_exact = _data[10];
var anc = array_clone(_data[3]);
var anc = [ _data[3][0], _data[3][1] ];
var rot_vel = vel * _data[8];
var rot = _data[5] + rot_vel;
@ -205,7 +208,7 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
var _cc = point_rotate(-_px, -_py, _ww / 2, _hh / 2, rot);
surface_set_shader(_outSurf);
shader_set_interpolation(_s);
shader_set_interpolation_surface(_s);
draw_surface_ext_safe(_s, _cc[0], _cc[1], 1, 1, rot, c_white, 1);
surface_reset_shader();
@ -221,7 +224,7 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
}
surface_set_shader(_outSurf);
shader_set_interpolation(ins);
shader_set_interpolation_surface(ins);
draw_surface_ext_safe(ins, draw_x, draw_y, sca[0], sca[1], rot, c_white, 1);
if(mode == 2) {
@ -268,11 +271,13 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
_surf_out = _surf_out[preview_index];
}
var pos = array_clone(getInputData(2));
var _pos = [ pos[0], pos[1] ];
var __pos = getInputData(2)
var pos = [ __pos[0], __pos[1] ];
var _pos = [ __pos[0], __pos[1] ];
var anc = array_clone(getInputData(3));
var _anc = [ anc[0], anc[1] ];
var __anc = getInputData(3);
var anc = [ __anc[0], __anc[1] ];
var _anc = [ __anc[0], __anc[1] ];
var rot = getInputData(5);
var sca = getInputData(6);

View file

@ -812,9 +812,11 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
break; #endregion
case VALUE_DISPLAY.rotation : #region
var _step = struct_try_get(display_data, "step", -1);
editWidget = new rotator(function(val) {
return setValueDirect(val);
}, display_data );
}, _step );
extract_node = "Node_Number";
break; #endregion
@ -1183,8 +1185,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
#region color compatibility [ color, palette, gradient ]
if(type == VALUE_TYPE.gradient && typeFrom == VALUE_TYPE.color) {
if(is_struct(value) && instanceof(value) == "gradientObject")
if(is_instanceof(value, gradientObject))
return value;
if(is_array(value)) {
var amo = array_length(value);
var grad = array_create(amo);
@ -1194,9 +1197,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
g.keys = grad;
return g;
}
var grad = new gradientObject(value);
return grad;
if(is_real(value)) return new gradientObject(value);
return new gradientObject(0);
}
if(display_type == VALUE_DISPLAY.palette && !is_array(value)) {
@ -1470,8 +1473,15 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
} #endregion
static isAnimated = function() { #region
gml_pragma("forceinline");
if(value_from == noone) return __anim();
else return value_from.isAnimated() || value_from.__anim() || value_from.node.anim_last_step;
var from_anim = value_from.isAnimated();
var from_self_anim = value_from.__anim();
var from_node_anim = value_from.node.anim_last_step;
return from_anim || from_self_anim || from_node_anim;
} #endregion
static showValue = function() { #region

View file

@ -106,11 +106,11 @@ function Render(partial = false, runAction = false) { #region
if(!_node.active) continue;
if(!_node.isRenderActive()) continue;
if(_node.rendered && !_node.isAnimated()) {
_node.anim_last_step = false;
LOG_IF(global.FLAG.render, $"Skip rendered {_node.internalName}");
continue;
}
//if(__nodeInLoop(_node)) continue;
if(_node.group != noone) continue;
LOG_BLOCK_START();

View file

@ -1,7 +0,0 @@
/// @param string
function scr_cmd_arg(argument0) {
var s = argument0;
if (string_pos(" ", s)) {
return @'"' + s + @'"';
} else return s;
}

View file

@ -1,11 +0,0 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "scr_cmd_arg",
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "Shader replace",
"path": "folders/_extensions/Shader replace.yy",
},
}

View file

@ -1,4 +1,6 @@
function shader_set_i(uniform, value) {
gml_pragma("forceinline");
var shader = shader_current();
if(shader == -1) return;
@ -6,23 +8,28 @@ function shader_set_i(uniform, value) {
shader_set_i_array(shader, uniform, value);
return;
}
if(argument_count > 2) {
var array = [];
for( var i = 1; i < argument_count; i++ )
array_push(array, argument[i]);
shader_set_i_array(shader, uniform, array)
return;
}
shader_set_uniform_i(shader_get_uniform(shader, uniform), value);
switch(argument_count) {
case 2 : shader_set_uniform_i(shader_get_uniform(shader, uniform), value); break;
case 3 : shader_set_uniform_i(shader_get_uniform(shader, uniform), value, argument[2]); break;
case 4 : shader_set_uniform_i(shader_get_uniform(shader, uniform), value, argument[2], argument[3]); break;
default:
var array = array_create(argument_count - 1);
for( var i = 1; i < argument_count; i++ )
array[i - 1] = argument[i];
shader_set_i_array(shader, uniform, array)
}
}
function shader_set_i_array(shader, uniform, array) {
gml_pragma("forceinline");
shader_set_uniform_i_array(shader_get_uniform(shader, uniform), array);
}
function shader_set_f(uniform, value) {
gml_pragma("forceinline");
var shader = shader_current();
if(shader == -1) return;
@ -31,27 +38,48 @@ function shader_set_f(uniform, value) {
return;
}
if(argument_count > 2) {
var array = [];
for( var i = 1; i < argument_count; i++ )
array_push(array, argument[i]);
shader_set_uniform_f_array_safe(shader_get_uniform(shader, uniform), array)
return;
switch(argument_count) {
case 2 : shader_set_uniform_f(shader_get_uniform(shader, uniform), value); break;
case 3 : shader_set_uniform_f(shader_get_uniform(shader, uniform), value, argument[2]); break;
case 4 : shader_set_uniform_f(shader_get_uniform(shader, uniform), value, argument[2], argument[3]); break;
case 5 : shader_set_uniform_f(shader_get_uniform(shader, uniform), value, argument[2], argument[3], argument[4]); break;
default:
var array = array_create(argument_count - 1);
for( var i = 1; i < argument_count; i++ )
array[i - 1] = argument[i];
shader_set_uniform_f_array(shader_get_uniform(shader, uniform), array)
}
shader_set_uniform_f(shader_get_uniform(shader, uniform), value);
if(argument_count == 2)
shader_set_uniform_f(shader_get_uniform(shader, uniform), value);
else if(argument_count == 3)
shader_set_uniform_f(shader_get_uniform(shader, uniform), value, argument[2]);
else if(argument_count == 4)
shader_set_uniform_f(shader_get_uniform(shader, uniform), value, argument[2], argument[3]);
else {
var array = array_create(argument_count - 1);
for( var i = 1; i < argument_count; i++ )
array[i - 1] = argument[i];
shader_set_uniform_f_array(shader_get_uniform(shader, uniform), array);
}
}
function shader_set_uniform_f_array_safe(uniform, array, max_length = 128) {
gml_pragma("forceinline");
if(!is_array(array)) return;
if(array_length(array) == 0) return;
if(array_length(array) > max_length)
var _len = array_length(array);
if(_len == 0) return;
if(_len > max_length)
array_resize(array, max_length)
shader_set_uniform_f_array(uniform, array);
}
function shader_set_surface(sampler, surface, linear = false, _repeat = false) {
gml_pragma("forceinline");
var shader = shader_current();
if(shader == -1) return;
@ -83,6 +111,8 @@ function shader_set_surface(sampler, surface, linear = false, _repeat = false) {
//}
function shader_set_surface_dimension(uniform, surface) {
gml_pragma("forceinline");
var shader = shader_current();
if(!is_surface(surface)) return;
if(shader == -1) return;
@ -98,16 +128,22 @@ function shader_set_surface_dimension(uniform, surface) {
}
function shader_set_dim(uniform = "dimension", surf = noone) {
gml_pragma("forceinline");
if(!is_surface(surf)) return;
shader_set_f(uniform, surface_get_width_safe(surf), surface_get_height_safe(surf));
}
function shader_set_color(uniform, col, alpha = 1) {
gml_pragma("forceinline");
shader_set_f(uniform, colToVec4(col, alpha));
}
function shader_set_palette(pal, pal_uni = "palette", amo_uni = "paletteAmount", max_length = 128) {
gml_pragma("forceinline");
shader_set_i(amo_uni, min(max_length, array_length(pal)));
var _pal = [];
@ -127,13 +163,37 @@ function shader_set_palette(pal, pal_uni = "palette", amo_uni = "paletteAmount",
alphamulp,
}
function shader_preset_interpolation(shader = sh_sample) {
gml_pragma("forceinline");
var intp = attributes.interpolation;
gpu_set_tex_filter(intp);
shader_set_uniform_i(shader_get_uniform(shader, "interpolation"), intp);
shader_set_uniform_i(shader_get_uniform(shader, "sampleMode"), attributes.oversample);
}
function shader_postset_interpolation() {
gml_pragma("forceinline");
gpu_set_tex_filter(false);
}
function shader_set_interpolation_surface(surface) {
gml_pragma("forceinline");
shader_set_f("sampleDimension", surface_get_width_safe(surface), surface_get_height_safe(surface));
}
function shader_set_interpolation(surface) {
gml_pragma("forceinline");
var intp = attributes.interpolation;
gpu_set_tex_filter(intp);
shader_set_i("interpolation", intp);
shader_set_f("sampleDimension", surface_get_width_safe(surface), surface_get_height_safe(surface));
shader_set_i("sampleMode", struct_try_get(attributes, "oversample"));
shader_set_i("sampleMode", attributes.oversample);
}
function surface_set_shader(surface, shader = sh_sample, clear = true, blend = BLEND.alpha) {
@ -164,7 +224,6 @@ function shader_set_palette(pal, pal_uni = "palette", amo_uni = "paletteAmount",
function surface_reset_shader() {
if(!__surface_set) return;
gpu_set_tex_filter(false);
BLEND_NORMAL;
surface_reset_target();

View file

@ -1,18 +0,0 @@
#macro shader_set shader_replace_simple_set_hook
#macro shader_replace_simple_set_base shader_set
#macro shader_reset shader_replace_simple_reset_hook
#macro shader_replace_simple_reset_base shader_reset
function shader_replace_simple_reset_hook() {
shader_replace_simple_reset_base();
shader_replace_simple_sync(-1);
}
function shader_replace_simple_set_hook() {
shader_replace_simple_set_base(argument0);
shader_replace_simple_sync(argument0);
}
function shader_replace_simple_macros(){
if (false) {
shader_replace_simple_set_base(0);
shader_replace_simple_reset_base();
}
}

View file

@ -1,11 +0,0 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "shader_replace_simple_macros",
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "Shader replace",
"path": "folders/_extensions/Shader replace.yy",
},
}

View file

@ -36,6 +36,8 @@ function struct_try_get(struct, key, def = 0) {
function struct_try_override(original, override, key) {
gml_pragma("forceinline");
if(!is_struct(original) || !is_struct(override)) return;
if(!struct_has(override, key)) return;
original[$ key] = override[$ key];
}

View file

@ -147,24 +147,15 @@ function surface_get_height_safe(s) {
function is_surface(s) {
gml_pragma("forceinline");
if(is_undefined(s)) return false;
if(is_array(s)) return false;
if(is_struct(s) && is_instanceof(s, dynaSurf)) return true;
if(!is_real(s)) return false;
if(!s) return false;
if(!surface_exists(s)) return false;
return true;
if(is_real(s) && s > 0 && surface_exists(s)) return true;
return false;
}
function surface_verify(surf, w, h, format = surface_rgba8unorm) {
gml_pragma("forceinline");
w = max(1, round(w));
h = max(1, round(h));
var s = is_surface(surf);
if(!s) return surface_create_valid(w, h, format);
if(!is_surface(surf)) return surface_create_valid(w, h, format);
return surface_size_to(surf, w, h, format, true);
}
@ -388,7 +379,7 @@ function surface_mirror(surf, _h, _v) {
function surface_copy_size(dest, source, format = noone) {
gml_pragma("forceinline");
if(!is_surface(dest)) return;
if(!is_surface(dest)) return;
if(!is_surface(source)) return;
surface_size_to(dest, surface_get_width_safe(source), surface_get_height_safe(source), format);
@ -402,9 +393,8 @@ function surface_copy_size(dest, source, format = noone) {
function surface_valid_size(s) {
gml_pragma("forceinline");
if(!is_real(s)) return 1;
if(is_infinity(s)) return 1;
s = toNumber(s);
if(!is_real(s)) return 1;
return clamp(s, 1, 8196);
}