diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index c5aead319..be45b34a2 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -1560,6 +1560,8 @@ {"name":"sh_rd_render","order":2,"path":"shaders/sh_rd_render/sh_rd_render.yy",}, {"name":"sh_region_fill_border","order":5,"path":"shaders/sh_region_fill_border/sh_region_fill_border.yy",}, {"name":"sh_region_fill_color","order":1,"path":"shaders/sh_region_fill_color/sh_region_fill_color.yy",}, + {"name":"sh_region_fill_coordinate_all_init","order":9,"path":"shaders/sh_region_fill_coordinate_all_init/sh_region_fill_coordinate_all_init.yy",}, + {"name":"sh_region_fill_coordinate_all","order":10,"path":"shaders/sh_region_fill_coordinate_all/sh_region_fill_coordinate_all.yy",}, {"name":"sh_region_fill_coordinate_init","order":6,"path":"shaders/sh_region_fill_coordinate_init/sh_region_fill_coordinate_init.yy",}, {"name":"sh_region_fill_init","order":2,"path":"shaders/sh_region_fill_init/sh_region_fill_init.yy",}, {"name":"sh_region_fill_inner_remove","order":8,"path":"shaders/sh_region_fill_inner_remove/sh_region_fill_inner_remove.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 93dbd38e4..a8bd7e4c7 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -2059,6 +2059,8 @@ {"id":{"name":"sh_rd_render","path":"shaders/sh_rd_render/sh_rd_render.yy",},}, {"id":{"name":"sh_region_fill_border","path":"shaders/sh_region_fill_border/sh_region_fill_border.yy",},}, {"id":{"name":"sh_region_fill_color","path":"shaders/sh_region_fill_color/sh_region_fill_color.yy",},}, + {"id":{"name":"sh_region_fill_coordinate_all_init","path":"shaders/sh_region_fill_coordinate_all_init/sh_region_fill_coordinate_all_init.yy",},}, + {"id":{"name":"sh_region_fill_coordinate_all","path":"shaders/sh_region_fill_coordinate_all/sh_region_fill_coordinate_all.yy",},}, {"id":{"name":"sh_region_fill_coordinate_init","path":"shaders/sh_region_fill_coordinate_init/sh_region_fill_coordinate_init.yy",},}, {"id":{"name":"sh_region_fill_coordinate","path":"shaders/sh_region_fill_coordinate/sh_region_fill_coordinate.yy",},}, {"id":{"name":"sh_region_fill_init","path":"shaders/sh_region_fill_init/sh_region_fill_init.yy",},}, diff --git a/scripts/__vec3/__vec3.gml b/scripts/__vec3/__vec3.gml index adf925fd4..ca14223c0 100644 --- a/scripts/__vec3/__vec3.gml +++ b/scripts/__vec3/__vec3.gml @@ -3,7 +3,7 @@ #macro __vec3_up new __vec3(0.0, 0.0, 1.0) function __vec3(_x = 0, _y = _x, _z = _x) constructor { - static set = function(_x = 0, _y = _x, _z = _x) { #region + static set = function(_x = 0, _y = _x, _z = _x) { if(is_struct(_x) && is_instanceof(_x, __vec3)) { x = _x.x; y = _x.y; @@ -29,14 +29,14 @@ function __vec3(_x = 0, _y = _x, _z = _x) constructor { y = _y; z = _z; return self; - } set(_x, _y, _z); #endregion + } set(_x, _y, _z); - static isZero = function() { #region + static isZero = function() { INLINE return x == 0 && y == 0 && z == 0; - } #endregion + } - static setIndex = function(index, value) { #region + static setIndex = function(index, value) { INLINE switch(index) { case 0 : x = value; break; @@ -44,73 +44,73 @@ function __vec3(_x = 0, _y = _x, _z = _x) constructor { case 2 : z = value; break; } return self; - } #endregion + } - static getIndex = function(index) { #region + static getIndex = function(index) { switch(index) { case 0 : return x; case 1 : return y; case 2 : return z; } return 0; - } #endregion + } - static add = function(_vec3) { #region + static add = function(_vec3) { INLINE return new __vec3(x + _vec3.x, y + _vec3.y, z + _vec3.z); - } #endregion - static _add = function(_vec3) { #region + } + static _add = function(_vec3) { INLINE x += _vec3.x; y += _vec3.y; z += _vec3.z; return self; - } #endregion + } - static subtract = function(_vec3) { #region + static subtract = function(_vec3) { INLINE return new __vec3(x - _vec3.x, y - _vec3.y, z - _vec3.z); - } #endregion - static _subtract = function(_vec3) { #region + } + static _subtract = function(_vec3) { INLINE x -= _vec3.x; y -= _vec3.y; z -= _vec3.z; return self; - } #endregion + } - static multiply = function(_scalar) { #region + static multiply = function(_scalar) { INLINE return new __vec3(x * _scalar, y * _scalar, z * _scalar); - } #endregion - static _multiply = function(_scalar) { #region + } + static _multiply = function(_scalar) { INLINE x *= _scalar; y *= _scalar; z *= _scalar; return self; - } #endregion + } - static multiplyVec = function(_vec) { #region + static multiplyVec = function(_vec) { INLINE return new __vec3(x * _vec.x, y * _vec.y, z * _vec.z); - } #endregion - static _multiplyVec = function(_vec) { #region + } + static _multiplyVec = function(_vec) { INLINE x *= _vec.x; y *= _vec.y; z *= _vec.z; return self; - } #endregion + } - static divide = function(_scalar) { #region + static divide = function(_scalar) { INLINE if (_scalar != 0) return new __vec3(x / _scalar, y / _scalar, z / _scalar); return new __vec3(x, y, z); // Avoid division by zero - } #endregion - static _divide = function(_scalar) { #region + } + static _divide = function(_scalar) { INLINE if (_scalar != 0) { x /= _scalar; @@ -118,39 +118,39 @@ function __vec3(_x = 0, _y = _x, _z = _x) constructor { z /= _scalar; } return self; - } #endregion + } - static dot = function(_vec3) { #region + static dot = function(_vec3) { INLINE return x * _vec3.x + y * _vec3.y + z * _vec3.z; - } #endregion + } - static cross = function(_vec3) { #region + static cross = function(_vec3) { INLINE var cross_x = y * _vec3.z - z * _vec3.y; var cross_y = z * _vec3.x - x * _vec3.z; var cross_z = x * _vec3.y - y * _vec3.x; return new __vec3(cross_x, cross_y, cross_z); - } #endregion + } - static distance = function(_vec3) { #region + static distance = function(_vec3) { INLINE var dx = _vec3.x - x; var dy = _vec3.y - y; var dz = _vec3.z - z; return sqrt(dx * dx + dy * dy + dz * dz); - } #endregion + } - static length = function() { #region + static length = function() { INLINE return sqrt(x * x + y * y + z * z); - } #endregion + } - static normalize = function() { #region + static normalize = function() { INLINE return clone()._normalize(); - } #endregion - static _normalize = function() { #region + } + static _normalize = function() { INLINE var _length = length(); if (_length != 0) { @@ -159,49 +159,49 @@ function __vec3(_x = 0, _y = _x, _z = _x) constructor { z /= _length; } return self; - } #endregion + } - static _lerpTo = function(to, speed = 0.3) { #region + static _lerpTo = function(to, speed = 0.3) { INLINE x = lerp(x, to.x, speed); y = lerp(y, to.y, speed); z = lerp(z, to.z, speed); - } #endregion + } - static _lerp_float = function(to, speed = 5, pre = 0.01) { #region + static _lerp_float = function(to, speed = 5, pre = 0.01) { INLINE x = lerp_float(x, to.x, speed, pre); y = lerp_float(y, to.y, speed, pre); z = lerp_float(z, to.z, speed, pre); - } #endregion + } - static equal = function(to) { #region + static equal = function(to) { INLINE return x == to.x && y == to.y && z == to.z; - } #endregion + } - static minVal = function(vec) { #region + static minVal = function(vec) { INLINE return new __vec3( min(x, vec.x), min(y, vec.y), min(z, vec.z), ); - } #endregion + } - static maxVal = function(vec) { #region + static maxVal = function(vec) { INLINE return new __vec3( max(x, vec.x), max(y, vec.y), max(z, vec.z), ); - } #endregion + } - static clone = function() { #region + static clone = function() { INLINE return new __vec3(x, y, z); - } #endregion + } static toString = function() { return $"[__vec3] ({x}, {y}, {z})"; } diff --git a/scripts/node_3d_mesh_path_extrude/node_3d_mesh_path_extrude.gml b/scripts/node_3d_mesh_path_extrude/node_3d_mesh_path_extrude.gml index e04f98f61..21562d4f3 100644 --- a/scripts/node_3d_mesh_path_extrude/node_3d_mesh_path_extrude.gml +++ b/scripts/node_3d_mesh_path_extrude/node_3d_mesh_path_extrude.gml @@ -36,13 +36,13 @@ function Node_3D_Mesh_Path_Extrude(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y ["Material", false], in_mesh + 4, in_mesh + 2, in_mesh + 3, in_mesh + 9, ] - static step = function() { #region + static step = function() { var _caps = getInputData(in_mesh + 5); inputs[| in_mesh + 3].setVisible(_caps, _caps); - } #endregion + } - static processData = function(_output, _data, _output_index, _array_index = 0) { #region + static processData = function(_output, _data, _output_index, _array_index = 0) { var _path = _data[in_mesh + 0]; var _sides = _data[in_mesh + 1]; var _mat_sid = _data[in_mesh + 2]; @@ -104,7 +104,7 @@ function Node_3D_Mesh_Path_Extrude(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y setTransform(object, _data); return object; - } #endregion + } static getPreviewValues = function() { return array_safe_get_fast(all_inputs, in_mesh + 2, noone); } } \ No newline at end of file diff --git a/scripts/node_path/node_path.gml b/scripts/node_path/node_path.gml index 895cf7f41..70afbe35c 100644 --- a/scripts/node_path/node_path.gml +++ b/scripts/node_path/node_path.gml @@ -904,11 +904,12 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { static getLength = function() { return lengthTotal; } static getAccuLength = function() { return lengthAccs; } - static getPointDistance = function(_dist, _ind = 0, out = undefined) { #region + static getPointDistance = function(_dist, _ind = 0, out = undefined) { if(out == undefined) out = new __vec2(); else { out.x = 0; out.y = 0; } if(array_empty(lengths)) return out; var _cKey = _dist; + if(ds_map_exists(cached_pos, _cKey)) { var _p = cached_pos[? _cKey]; out.x = _p.x; @@ -933,7 +934,7 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { continue; } - var _t = _dist / lengths[i]; + var _t = lengths[i] == 0? 0 : _dist / lengths[i]; if(_a0[4] == 0 && _a0[5] == 0 && _a1[2] == 0 && _a1[3] == 0) { out.x = lerp(_a0[0], _a1[0], _t); @@ -948,12 +949,12 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { } return out; - } #endregion + } - static getPointRatio = function(_rat, _ind = 0, out = undefined) { #region + static getPointRatio = function(_rat, _ind = 0, out = undefined) { var pix = (path_loop? frac(_rat) : clamp(_rat, 0, 0.99)) * lengthTotal; return getPointDistance(pix, _ind, out); - } #endregion + } static getPointSegment = function(_rat) { #region if(array_empty(lengths)) return new __vec2(); diff --git a/scripts/node_region_fill/node_region_fill.gml b/scripts/node_region_fill/node_region_fill.gml index 6c3b00b84..91d97f4c1 100644 --- a/scripts/node_region_fill/node_region_fill.gml +++ b/scripts/node_region_fill/node_region_fill.gml @@ -27,23 +27,30 @@ function Node_Region_Fill(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou inputs[| 10] = nodeValue("Texture map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); + inputs[| 11] = nodeValue("Color Filter", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ 4, ["Surfaces", false], 0, 1, - ["Fill", false], 5, 8, 2, 9, 10, 6, + ["Regions", false, 11], 5, 6, + ["Fill", false], 8, 2, 9, 10, ["Render", false], 7, ]; temp_surface = array_create(3); - static step = function() { #region - var _filt = getInputData(8); + static step = function() { + var _filt = getInputData( 8); + var _fclr = getInputData(11); inputs[| 2].setVisible(_filt == 0); inputs[| 9].setVisible(_filt == 1, _filt == 1); inputs[| 10].setVisible(_filt == 2, _filt == 2); - } #endregion + + inputs[| 5].setVisible(_fclr); + inputs[| 6].setVisible(_fclr); + } static processData = function(_outSurf, _data, _output_index, _array_index) { var _surf = _data[0]; @@ -52,13 +59,15 @@ function Node_Region_Fill(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou var _colr = _data[2]; var _fill = _data[3]; var _seed = _data[4]; - var _targ = _data[5]; - var _innr = _data[6]; var _rnbg = _data[7]; var _filt = _data[8]; var _cmap = _data[9]; var _tmap = _data[10]; + var _fclr = _data[11]; + var _targ = _data[5]; + var _innr = _data[6]; + var _sw = surface_get_width_safe(_surf); var _sh = surface_get_height_safe(_surf) @@ -67,70 +76,97 @@ function Node_Region_Fill(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou surface_clear(temp_surface[i]); } - #region filter color - surface_set_shader(temp_surface[1], sh_region_fill_init); - shader_set_color("targetColor", _targ); - - draw_surface_safe(_surf); - surface_reset_shader(); - #endregion + var base = 0; + var cmap = temp_surface[0]; - #region inner region - var base = 0; - var amo = _sw; - - if(_innr) { - repeat( amo ) { - surface_set_shader(temp_surface[base], sh_region_fill_inner); - shader_set_f("dimension", _sw, _sh); + if(_fclr) { + #region filter color + surface_set_shader(temp_surface[1], sh_region_fill_init); + shader_set_color("targetColor", _targ); + draw_surface_safe(_surf); + surface_reset_shader(); + #endregion + + #region inner region + var amo = _sw; + + if(_innr) { + repeat( amo ) { + surface_set_shader(temp_surface[base], sh_region_fill_inner); + shader_set_f("dimension", _sw, _sh); + + draw_surface_safe(temp_surface[!base]); + surface_reset_shader(); + + base = !base; + } + + surface_set_shader(temp_surface[2], sh_region_fill_inner_remove); + draw_surface_safe(temp_surface[!base]); + surface_reset_shader(); + + } else { + surface_set_shader(temp_surface[2], sh_region_fill_inner_remove); + draw_surface_safe(temp_surface[1]); + surface_reset_shader(); + } + #endregion + + #region coordinate + surface_set_shader(temp_surface[base], sh_region_fill_coordinate_init); + draw_surface_safe(temp_surface[2]); + surface_reset_shader(); + + base = !base; + var amo = _sw + _sh; + + repeat( amo ) { + surface_set_shader(temp_surface[base], sh_region_fill_coordinate); + shader_set_f("dimension", _sw, _sh); + shader_set_surface("base", temp_surface[2]); + draw_surface_safe(temp_surface[!base]); surface_reset_shader(); base = !base; } - surface_set_shader(temp_surface[2], sh_region_fill_inner_remove); - draw_surface_safe(temp_surface[!base]); - surface_reset_shader(); - - } else { - surface_set_shader(temp_surface[2], sh_region_fill_inner_remove); - draw_surface_safe(temp_surface[1]); - surface_reset_shader(); - } - #endregion - - #region coordinate - surface_set_shader(temp_surface[base], sh_region_fill_coordinate_init); - draw_surface_safe(temp_surface[2]); - surface_reset_shader(); - - base = !base; - var amo = _sw + _sh; - - repeat( amo ) { - surface_set_shader(temp_surface[base], sh_region_fill_coordinate); - shader_set_f("dimension", _sw, _sh); - shader_set_surface("base", temp_surface[2]); + surface_set_shader(temp_surface[base], sh_region_fill_border); + shader_set_f("dimension", _sw, _sh); + shader_set_surface("original", _surf); draw_surface_safe(temp_surface[!base]); surface_reset_shader(); + + cmap = temp_surface[base]; + #endregion + } else { + + #region coordinate + surface_set_shader(temp_surface[base], sh_region_fill_coordinate_all_init); + draw_surface_safe(_surf); + surface_reset_shader(); + base = !base; - } - - surface_set_shader(temp_surface[base], sh_region_fill_border); - shader_set_f("dimension", _sw, _sh); - shader_set_surface("original", _surf); + var amo = _sw + _sh; + + repeat( amo ) { + surface_set_shader(temp_surface[base], sh_region_fill_coordinate_all); + shader_set_f("dimension", _sw, _sh); + shader_set_surface("base", _surf); + + draw_surface_safe(temp_surface[!base]); + surface_reset_shader(); + + base = !base; + } + + cmap = temp_surface[!base]; + #endregion - draw_surface_safe(temp_surface[!base]); - surface_reset_shader(); - #endregion - - var _pal = []; - for( var i = 0, n = array_length(_colr); i < n; i++ ) - array_append(_pal, colToVec4(_colr[i])); + } surface_set_target(_outSurf); DRAW_CLEAR @@ -138,29 +174,33 @@ function Node_Region_Fill(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou if(_rnbg == 2) draw_surface_safe(_surf); // render original switch(_filt) { - case 0 : + case 0 : // Random colors + var _pal = []; + for( var i = 0, n = array_length(_colr); i < n; i++ ) + array_append(_pal, colToVec4(_colr[i])); + shader_set(sh_region_fill_color); shader_set_f("colors", _pal); shader_set_f("seed", _seed); shader_set_f("colorAmount", array_length(_colr)); - draw_surface_safe(temp_surface[base]); + draw_surface_safe(cmap); shader_reset(); break; - case 1 : + case 1 : // Color Map shader_set(sh_region_fill_map); shader_set_surface("colorMap", _cmap); - draw_surface_safe(temp_surface[base]); + draw_surface_safe(cmap); shader_reset(); break; - case 2 : + case 2 : // Texture Map shader_set(sh_region_fill_rg_map); shader_set_surface("textureMap", _tmap); - draw_surface_safe(temp_surface[base]); + draw_surface_safe(cmap); shader_reset(); break; } diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index 7f2fae6d1..164632a19 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -658,7 +658,7 @@ function __initNodes() { addNodeObject(d3d, "Normal Light", s_node_normal_light, "Node_Normal_Light", [1, Node_Normal_Light],, "Light up the image using normal mapping."); addNodeObject(d3d, "Bevel", s_node_bevel, "Node_Bevel", [1, Node_Bevel],, "Apply 2D bevel on the image."); addNodeObject(d3d, "Sprite Stack", s_node_stack, "Node_Sprite_Stack", [1, Node_Sprite_Stack],, "Create sprite stack either from repeating a single image or stacking different images using array."); - + ds_list_add(d3d, "3D"); addNodeObject(d3d, "3D Camera", s_node_3d_camera, "Node_3D_Camera", [1, Node_3D_Camera],, "Create 3D camera that render scene to surface.").setVersion(11510); addNodeObject(d3d, "3D Camera Set", s_node_3d_camera_set, "Node_3D_Camera_Set", [1, Node_3D_Camera_Set],, "3D camera with built-in key and fill directional lights.").setVersion(11571); diff --git a/scripts/string_functions/string_functions.gml b/scripts/string_functions/string_functions.gml index 842491d4d..edb3cedc0 100644 --- a/scripts/string_functions/string_functions.gml +++ b/scripts/string_functions/string_functions.gml @@ -57,6 +57,8 @@ function array_to_string(arr) { } function string_partial_match(str, key) { + if(str == key) return 9999; + var amo = string_length(str); var run = 1; var consec = 0; diff --git a/shaders/sh_cell_noise_random/sh_cell_noise_random.fsh b/shaders/sh_cell_noise_random/sh_cell_noise_random.fsh index 5dd3e511b..c4ce092c7 100644 --- a/shaders/sh_cell_noise_random/sh_cell_noise_random.fsh +++ b/shaders/sh_cell_noise_random/sh_cell_noise_random.fsh @@ -92,7 +92,7 @@ void main() { } if(colored == 0) { - float c = middle + (random(mp) - middle) * contrast; + float c = middle + (random(mp + 1.) - middle) * contrast; gl_FragColor = vec4(vec3(c), 1.0); } else if(colored == 1) { gl_FragColor = vec4(colorNoise(mp), 1.); diff --git a/shaders/sh_region_fill_coordinate_all/sh_region_fill_coordinate_all.fsh b/shaders/sh_region_fill_coordinate_all/sh_region_fill_coordinate_all.fsh new file mode 100644 index 000000000..7c9c0b69a --- /dev/null +++ b/shaders/sh_region_fill_coordinate_all/sh_region_fill_coordinate_all.fsh @@ -0,0 +1,77 @@ +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +#define ITERATION 4. + +uniform sampler2D base; +uniform vec2 dimension; + +vec2 minn( in vec2 a, in vec2 b) { + if(a.y < b.y) return a; + else if(a.y > b.y) return b; + + return (a.x < b.x)? a : b; +} + +vec2 maxx( in vec2 a, in vec2 b) { + if(a.y < b.y) return b; + else if(a.y > b.y) return a; + + return (a.x < b.x)? b : a; +} + +void main() { + vec2 tx = 1. / dimension; + vec4 c = texture2D( gm_BaseTexture, v_vTexcoord ); + vec4 ba = texture2D( base, v_vTexcoord ); + + gl_FragColor = c; + + for( float i = 1.; i < ITERATION; i++ ) { + vec2 x = v_vTexcoord + vec2(tx.x * i, 0); + if(x.x < 0. || x.y < 0. || x.x > 1. || x.y > 1.) break; + + vec4 b = texture2D( base, x ); + if(b != ba) break; + + vec4 s = texture2D( gm_BaseTexture, x ); + gl_FragColor.xy = minn( gl_FragColor.xy, s.xy ); + gl_FragColor.zw = maxx( gl_FragColor.zw, s.zw ); + } + + for( float i = 1.; i < ITERATION; i++ ) { + vec2 x = v_vTexcoord - vec2(tx.x * i, 0); + if(x.x < 0. || x.y < 0. || x.x > 1. || x.y > 1.) break; + + vec4 b = texture2D( base, x ); + if(b != ba) break; + + vec4 s = texture2D( gm_BaseTexture, x ); + gl_FragColor.xy = min( gl_FragColor.xy, s.xy ); + gl_FragColor.zw = max( gl_FragColor.zw, s.zw ); + } + + for( float i = 1.; i < ITERATION; i++ ) { + vec2 x = v_vTexcoord + vec2(0, tx.y * i); + if(x.x < 0. || x.y < 0. || x.x > 1. || x.y > 1.) break; + + vec4 b = texture2D( base, x ); + if(b != ba) break; + + vec4 s = texture2D( gm_BaseTexture, x ); + gl_FragColor.xy = min( gl_FragColor.xy, s.xy ); + gl_FragColor.zw = max( gl_FragColor.zw, s.zw ); + } + + for( float i = 1.; i < ITERATION; i++ ) { + vec2 x = v_vTexcoord - vec2(0, tx.y * i); + if(x.x < 0. || x.y < 0. || x.x > 1. || x.y > 1.) break; + + vec4 b = texture2D( base, x ); + if(b != ba) break; + + vec4 s = texture2D( gm_BaseTexture, x ); + gl_FragColor.xy = min( gl_FragColor.xy, s.xy ); + gl_FragColor.zw = max( gl_FragColor.zw, s.zw ); + } +} diff --git a/shaders/sh_region_fill_coordinate_all/sh_region_fill_coordinate_all.vsh b/shaders/sh_region_fill_coordinate_all/sh_region_fill_coordinate_all.vsh new file mode 100644 index 000000000..3900c20f4 --- /dev/null +++ b/shaders/sh_region_fill_coordinate_all/sh_region_fill_coordinate_all.vsh @@ -0,0 +1,19 @@ +// +// Simple passthrough vertex shader +// +attribute vec3 in_Position; // (x,y,z) +//attribute vec3 in_Normal; // (x,y,z) unused in this shader. +attribute vec4 in_Colour; // (r,g,b,a) +attribute vec2 in_TextureCoord; // (u,v) + +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +void main() +{ + vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0); + gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos; + + v_vColour = in_Colour; + v_vTexcoord = in_TextureCoord; +} diff --git a/shaders/sh_region_fill_coordinate_all/sh_region_fill_coordinate_all.yy b/shaders/sh_region_fill_coordinate_all/sh_region_fill_coordinate_all.yy new file mode 100644 index 000000000..a5f3dfbe3 --- /dev/null +++ b/shaders/sh_region_fill_coordinate_all/sh_region_fill_coordinate_all.yy @@ -0,0 +1,12 @@ +{ + "$GMShader":"", + "%Name":"sh_region_fill_coordinate_all", + "name":"sh_region_fill_coordinate_all", + "parent":{ + "name":"region", + "path":"folders/shader/generator/region.yy", + }, + "resourceType":"GMShader", + "resourceVersion":"2.0", + "type":1, +} \ No newline at end of file diff --git a/shaders/sh_region_fill_coordinate_all_init/sh_region_fill_coordinate_all_init.fsh b/shaders/sh_region_fill_coordinate_all_init/sh_region_fill_coordinate_all_init.fsh new file mode 100644 index 000000000..e8a9654bf --- /dev/null +++ b/shaders/sh_region_fill_coordinate_all_init/sh_region_fill_coordinate_all_init.fsh @@ -0,0 +1,6 @@ +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +void main() { + gl_FragColor = vec4(v_vTexcoord, v_vTexcoord); +} \ No newline at end of file diff --git a/shaders/sh_region_fill_coordinate_all_init/sh_region_fill_coordinate_all_init.vsh b/shaders/sh_region_fill_coordinate_all_init/sh_region_fill_coordinate_all_init.vsh new file mode 100644 index 000000000..3900c20f4 --- /dev/null +++ b/shaders/sh_region_fill_coordinate_all_init/sh_region_fill_coordinate_all_init.vsh @@ -0,0 +1,19 @@ +// +// Simple passthrough vertex shader +// +attribute vec3 in_Position; // (x,y,z) +//attribute vec3 in_Normal; // (x,y,z) unused in this shader. +attribute vec4 in_Colour; // (r,g,b,a) +attribute vec2 in_TextureCoord; // (u,v) + +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +void main() +{ + vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0); + gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos; + + v_vColour = in_Colour; + v_vTexcoord = in_TextureCoord; +} diff --git a/shaders/sh_region_fill_coordinate_all_init/sh_region_fill_coordinate_all_init.yy b/shaders/sh_region_fill_coordinate_all_init/sh_region_fill_coordinate_all_init.yy new file mode 100644 index 000000000..0a3406d0b --- /dev/null +++ b/shaders/sh_region_fill_coordinate_all_init/sh_region_fill_coordinate_all_init.yy @@ -0,0 +1,12 @@ +{ + "$GMShader":"", + "%Name":"sh_region_fill_coordinate_all_init", + "name":"sh_region_fill_coordinate_all_init", + "parent":{ + "name":"region", + "path":"folders/shader/generator/region.yy", + }, + "resourceType":"GMShader", + "resourceVersion":"2.0", + "type":1, +} \ No newline at end of file diff --git a/shaders/sh_region_fill_init/sh_region_fill_init.fsh b/shaders/sh_region_fill_init/sh_region_fill_init.fsh index 09b7f42c7..6deacc5c7 100644 --- a/shaders/sh_region_fill_init/sh_region_fill_init.fsh +++ b/shaders/sh_region_fill_init/sh_region_fill_init.fsh @@ -6,8 +6,6 @@ uniform vec4 targetColor; void main() { vec4 c = texture2D( gm_BaseTexture, v_vTexcoord ); - if(targetColor.a == 0.) - gl_FragColor = c.a == 0.? vec4(1., 0., 0., 1.) : vec4(0.); - else - gl_FragColor = targetColor == c? vec4(1., 0., 0., 1.) : vec4(0.); + if(targetColor.a == 0.) gl_FragColor = c.a == 0.? vec4(1., 0., 0., 1.) : vec4(0.); + else gl_FragColor = targetColor == c? vec4(1., 0., 0., 1.) : vec4(0.); } diff --git a/shaders/sh_smear/sh_smear.fsh b/shaders/sh_smear/sh_smear.fsh index 160e69b90..d3442a337 100644 --- a/shaders/sh_smear/sh_smear.fsh +++ b/shaders/sh_smear/sh_smear.fsh @@ -47,7 +47,7 @@ vec4 smear(vec2 angle) { #region if(modulateStr != 2) { if(alpha == 0) col.rgb *= 1. - i; - else col.a *= 1. - i; + else col.a *= 1. - i; } float bright = (col.r + col.g + col.b) / 3. * col.a;