From ff566da6544b694adeb1d9db617d8080f5484eea Mon Sep 17 00:00:00 2001 From: MakhamDev Date: Sun, 1 Oct 2023 11:29:53 +0700 Subject: [PATCH] - [RGB combine] Fix output error when input is not a square. --- scripts/node_combine_rgb/node_combine_rgb.gml | 34 +++++-------------- scripts/node_value/node_value.gml | 4 +-- 2 files changed, 10 insertions(+), 28 deletions(-) diff --git a/scripts/node_combine_rgb/node_combine_rgb.gml b/scripts/node_combine_rgb/node_combine_rgb.gml index e609be46b..3bce34ef0 100644 --- a/scripts/node_combine_rgb/node_combine_rgb.gml +++ b/scripts/node_combine_rgb/node_combine_rgb.gml @@ -1,15 +1,6 @@ function Node_Combine_RGB(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { name = "RGB Combine"; - shader = sh_combine_rgb; - uniform_r = shader_get_sampler_index(shader, "samR"); - uniform_g = shader_get_sampler_index(shader, "samG"); - uniform_b = shader_get_sampler_index(shader, "samB"); - uniform_a = shader_get_sampler_index(shader, "samA"); - - uniform_usea = shader_get_uniform(shader, "useA"); - uniform_mode = shader_get_uniform(shader, "mode"); - inputs[| 0] = nodeValue("Red", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 1] = nodeValue("Green", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); inputs[| 2] = nodeValue("Blue", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); @@ -34,24 +25,17 @@ function Node_Combine_RGB(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou var _a = _data[3]; var _mode = _data[4]; - surface_set_target(_outSurf); - DRAW_CLEAR - BLEND_OVERRIDE; - - shader_set(shader); - texture_set_stage(uniform_r, surface_get_texture(_r)); - texture_set_stage(uniform_g, surface_get_texture(_g)); - texture_set_stage(uniform_b, surface_get_texture(_b)); + surface_set_shader(_outSurf, sh_combine_rgb); + shader_set_surface("samR", _r); + shader_set_surface("samG", _g); + shader_set_surface("samB", _b); + shader_set_surface("samA", _a); - shader_set_uniform_i(uniform_mode, _mode); - shader_set_uniform_i(uniform_usea, is_surface(_a)); - texture_set_stage(uniform_a, surface_get_texture(_a)); + shader_set_i("useA", _mode); + shader_set_i("mode", is_surface(_a)); - draw_sprite_ext(s_fx_pixel, 0, 0, 0, surface_get_width_safe(_outSurf), surface_get_width_safe(_outSurf), 0, c_white, 1); - shader_reset(); - - BLEND_NORMAL; - surface_reset_target(); + draw_sprite_stretched(s_fx_pixel, 0, 0, 0, surface_get_width_safe(_outSurf), surface_get_height_safe(_outSurf)); + surface_reset_shader(); return _outSurf; } #endregion diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index 81f492cba..4e5c96273 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -916,9 +916,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru break; #endregion case VALUE_DISPLAY.matrix : #region editWidget = new matrixGrid(_txt, display_data, function(index, val) { - var _val = animator.getValue(); - _val[index] = val; - return setValueDirect(_val); + return setValueDirect(val, index); }, unit ); if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1);