mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-01-23 19:38:05 +01:00
- [RGB Combine] Fix mode property not functional.
- [Color adjust] Fix node picking up random surface as mask when no mask attached.
This commit is contained in:
parent
bb2bbd2fb4
commit
a7bb431b86
5 changed files with 42 additions and 37 deletions
|
@ -25,10 +25,10 @@
|
|||
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER, LATEST_VERSION;
|
||||
|
||||
LATEST_VERSION = 11500;
|
||||
VERSION = 11582;
|
||||
VERSION = 11583;
|
||||
SAVE_VERSION = 11570;
|
||||
VERSION_STRING = "1.16rc2";
|
||||
BUILD_NUMBER = 11582;
|
||||
VERSION_STRING = "1.16rc3";
|
||||
BUILD_NUMBER = 11583;
|
||||
|
||||
globalvar APPEND_MAP;
|
||||
APPEND_MAP = ds_map_create();
|
||||
|
|
|
@ -44,12 +44,16 @@ function Node_Color_adjust(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
|
|||
inputs[| 14] = nodeValue("Blend mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
.setDisplay(VALUE_DISPLAY.enum_scroll, BLEND_TYPES);
|
||||
|
||||
inputs[| 15] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111)
|
||||
.setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) });
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
outputs[| 1] = nodeValue("Color out", self, JUNCTION_CONNECT.output, VALUE_TYPE.color, [])
|
||||
.setDisplay(VALUE_DISPLAY.palette);
|
||||
|
||||
input_display_list = [11, 12, 0, 8, 13, 9,
|
||||
input_display_list = [11, 12, 15, 9,
|
||||
["Surface", false], 0, 8, 13,
|
||||
["Brightness", false], 1, 10, 2,
|
||||
["HSV", false], 3, 4, 5,
|
||||
["Color blend", false], 6, 14, 7
|
||||
|
@ -141,7 +145,7 @@ function Node_Color_adjust(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
|
|||
shader_set_color("blend", _bl, _bla);
|
||||
shader_set_i("blendMode", _blm);
|
||||
|
||||
shader_set_i("use_mask", _m != DEF_SURFACE);
|
||||
shader_set_i("use_mask", is_surface(_m));
|
||||
shader_set_surface("mask", _m);
|
||||
|
||||
gpu_set_colorwriteenable(1, 1, 1, 0);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
function Node_Combine_RGB(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "RGB Combine";
|
||||
|
||||
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);
|
||||
inputs[| 3] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
inputs[| 0] = nodeValue("Red", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
|
||||
inputs[| 1] = nodeValue("Green", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
|
||||
inputs[| 2] = nodeValue("Blue", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
|
||||
inputs[| 3] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
|
||||
|
||||
inputs[| 4] = nodeValue("Sampling type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
.setDisplay(VALUE_DISPLAY.enum_scroll, ["Brightness", "Channel value"]);
|
||||
|
@ -19,20 +19,20 @@ function Node_Combine_RGB(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
|||
attribute_surface_depth();
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
var _r = _data[0];
|
||||
var _g = _data[1];
|
||||
var _b = _data[2];
|
||||
var _a = _data[3];
|
||||
var _r = _data[0];
|
||||
var _g = _data[1];
|
||||
var _b = _data[2];
|
||||
var _a = _data[3];
|
||||
var _mode = _data[4];
|
||||
|
||||
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_surface("samplerR", _r);
|
||||
shader_set_surface("samplerG", _g);
|
||||
shader_set_surface("samplerB", _b);
|
||||
shader_set_surface("samplerA", _a);
|
||||
|
||||
shader_set_i("useA", _mode);
|
||||
shader_set_i("mode", is_surface(_a));
|
||||
shader_set_i("useA", is_surface(_a));
|
||||
shader_set_i("mode", _mode);
|
||||
|
||||
draw_sprite_stretched(s_fx_pixel, 0, 0, 0, surface_get_width_safe(_outSurf), surface_get_height_safe(_outSurf));
|
||||
surface_reset_shader();
|
||||
|
|
|
@ -81,14 +81,14 @@ function shader_set_surface(sampler, surface, linear = false, _repeat = false) {
|
|||
INLINE
|
||||
|
||||
var shader = shader_current();
|
||||
if(shader == -1) return;
|
||||
|
||||
if(is_struct(shader) && is_instanceof(shader, dynaSurf))
|
||||
shader = shader.surfaces[0];
|
||||
if(!is_surface(surface)) return;
|
||||
if(shader == -1) return noone;
|
||||
|
||||
var t = shader_get_sampler_index(shader, sampler);
|
||||
|
||||
if(is_instanceof(surface, dynaSurf))
|
||||
surface = surface.surfaces[0];
|
||||
if(!is_surface(surface)) return t;
|
||||
|
||||
texture_set_stage(t, surface_get_texture(surface));
|
||||
gpu_set_tex_filter_ext(t, linear);
|
||||
gpu_set_tex_repeat_ext(t, _repeat);
|
||||
|
|
|
@ -6,28 +6,29 @@ varying vec4 v_vColour;
|
|||
|
||||
uniform int useA;
|
||||
uniform int mode;
|
||||
uniform sampler2D samR, samG, samB, samA;
|
||||
uniform sampler2D samplerR;
|
||||
uniform sampler2D samplerG;
|
||||
uniform sampler2D samplerB;
|
||||
uniform sampler2D samplerA;
|
||||
|
||||
float samC(vec4 col, int ch) {
|
||||
if(mode == 0)
|
||||
return (col[0] + col[1] + col[2]) / 3.;
|
||||
|
||||
float sample(vec4 col, int ch) {
|
||||
if(mode == 0) return (col[0] + col[1] + col[2]) / 3.;
|
||||
return col[ch];
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec4 _r = texture2D( samR, v_vTexcoord );
|
||||
vec4 _g = texture2D( samG, v_vTexcoord );
|
||||
vec4 _b = texture2D( samB, v_vTexcoord );
|
||||
vec4 _r = texture2D( samplerR, v_vTexcoord );
|
||||
vec4 _g = texture2D( samplerG, v_vTexcoord );
|
||||
vec4 _b = texture2D( samplerB, v_vTexcoord );
|
||||
|
||||
float r = samC(_r, 0);
|
||||
float g = samC(_g, 1);
|
||||
float b = samC(_b, 2);
|
||||
float r = sample(_r, 0);
|
||||
float g = sample(_g, 1);
|
||||
float b = sample(_b, 2);
|
||||
float a = 1.;
|
||||
|
||||
if(useA == 1) {
|
||||
vec4 _a = texture2D( samA, v_vTexcoord );
|
||||
a = samC(_a, 3);
|
||||
vec4 _a = texture2D( samplerA, v_vTexcoord );
|
||||
a = sample(_a, 3);
|
||||
}
|
||||
|
||||
gl_FragColor = vec4(r, g, b, a);
|
||||
|
|
Loading…
Reference in a new issue