From f83ad6920a75e67e7eb218032a532694b431453d Mon Sep 17 00:00:00 2001 From: MakhamDev Date: Wed, 19 Jan 2022 20:48:30 +0700 Subject: [PATCH] Small QoL for 0.8.2 --- Pixels Composer.yyp | 2 +- scripts/node_grid/node_grid.gml | 9 ++++++++- scripts/node_image_gif/node_image_gif.gml | 2 +- scripts/node_path/node_path.gml | 3 +-- shaders/sh_gradient/sh_gradient.fsh | 3 ++- shaders/sh_grid/sh_grid.fsh | 5 ++++- shaders/sh_grid/sh_grid.yy | 4 ++-- 7 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Pixels Composer.yyp b/Pixels Composer.yyp index a643efb6b..ab95b646c 100644 --- a/Pixels Composer.yyp +++ b/Pixels Composer.yyp @@ -151,7 +151,7 @@ {"id":{"name":"s_node_transform_single","path":"sprites/s_node_transform_single/s_node_transform_single.yy",},"order":89,}, {"id":{"name":"s_button_hide_fill","path":"sprites/s_button_hide_fill/s_button_hide_fill.yy",},"order":15,}, {"id":{"name":"sh_blur_radial","path":"shaders/sh_blur_radial/sh_blur_radial.yy",},"order":18,}, - {"id":{"name":"sh_grid","path":"shaders/sh_grid/sh_grid.yy",},"order":35,}, + {"id":{"name":"sh_grid","path":"shaders/sh_grid/sh_grid.yy",},"order":14,}, {"id":{"name":"s_button_hide","path":"sprites/s_button_hide/s_button_hide.yy",},"order":10,}, {"id":{"name":"sh_twirl","path":"shaders/sh_twirl/sh_twirl.yy",},"order":19,}, {"id":{"name":"s_checkbox","path":"sprites/s_checkbox/s_checkbox.yy",},"order":11,}, diff --git a/scripts/node_grid/node_grid.gml b/scripts/node_grid/node_grid.gml index 6e5a6b246..75b14ab2e 100644 --- a/scripts/node_grid/node_grid.gml +++ b/scripts/node_grid/node_grid.gml @@ -11,6 +11,7 @@ function Node_Grid(_x, _y) : Node(_x, _y) constructor { uniform_pos = shader_get_uniform(shader, "position"); uniform_sca = shader_get_uniform(shader, "scale"); uniform_wid = shader_get_uniform(shader, "width"); + uniform_ang = shader_get_uniform(shader, "angle"); inputs[| 0] = nodeValue(0, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2, VALUE_TAG.dimension_2d ) .setDisplay(VALUE_DISPLAY.vector); @@ -24,8 +25,12 @@ function Node_Grid(_x, _y) : Node(_x, _y) constructor { inputs[| 3] = nodeValue(3, "Gap", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.02) .setDisplay(VALUE_DISPLAY.slider, [0, 0.5, 0.01]); + inputs[| 4] = nodeValue(4, "Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + .setDisplay(VALUE_DISPLAY.rotation); + input_display_list = [ - ["Effect settings", false], 0, 1, 2, 3 + ["Effect settings", false], 0, 3, + ["Transformation", false], 1, 4, 2 ]; outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); @@ -39,6 +44,7 @@ function Node_Grid(_x, _y) : Node(_x, _y) constructor { var _pos = inputs[| 1].getValue(); var _sca = inputs[| 2].getValue(); var _wid = inputs[| 3].getValue(); + var _ang = inputs[| 4].getValue(); var _outSurf = outputs[| 0].getValue(); if(!is_surface(_outSurf)) { @@ -52,6 +58,7 @@ function Node_Grid(_x, _y) : Node(_x, _y) constructor { shader_set_uniform_f(uniform_pos, _pos[0] / _dim[0], _pos[1] / _dim[1]); shader_set_uniform_f_array(uniform_sca, _sca); shader_set_uniform_f(uniform_wid, _wid); + shader_set_uniform_f(uniform_ang, degtorad(_ang)); draw_sprite_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], 0, c_white, 1); shader_reset(); diff --git a/scripts/node_image_gif/node_image_gif.gml b/scripts/node_image_gif/node_image_gif.gml index 4b6fe07d3..d5567dcd1 100644 --- a/scripts/node_image_gif/node_image_gif.gml +++ b/scripts/node_image_gif/node_image_gif.gml @@ -43,7 +43,7 @@ function Node_Image_gif(_x, _y) : Node(_x, _y) constructor { outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1)); outputs[| 1] = nodeValue(1, "Path", self, JUNCTION_CONNECT.output, VALUE_TYPE.path, "") - .setVisible(true); + .setVisible(true, true); spr = noone; path_current = ""; diff --git a/scripts/node_path/node_path.gml b/scripts/node_path/node_path.gml index eb5056ca9..193f81672 100644 --- a/scripts/node_path/node_path.gml +++ b/scripts/node_path/node_path.gml @@ -22,9 +22,8 @@ function Node_Path(_x, _y) : Node(_x, _y) constructor { var index = ds_list_size(inputs); inputs[| index] = nodeValue(index, "Anchor", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ _x, _y, 0, 0, 0, 0 ]) - .setDisplay(VALUE_DISPLAY.vector) + .setDisplay(VALUE_DISPLAY.vector); - return inputs[| index]; } diff --git a/shaders/sh_gradient/sh_gradient.fsh b/shaders/sh_gradient/sh_gradient.fsh index cf26c182a..c23dd3e49 100644 --- a/shaders/sh_gradient/sh_gradient.fsh +++ b/shaders/sh_gradient/sh_gradient.fsh @@ -56,8 +56,9 @@ void main() { float _a = atan(_p.y, _p.x) + angle; prog = (_a - floor(_a / TAU) * TAU) / TAU; } - prog = abs(prog + shift); + prog = prog + shift; if(gradient_loop == 1) { + prog = abs(prog); if(prog > 1.) { if(prog == floor(prog)) prog = 1.; diff --git a/shaders/sh_grid/sh_grid.fsh b/shaders/sh_grid/sh_grid.fsh index 9f0d38ba2..55d97bc48 100644 --- a/shaders/sh_grid/sh_grid.fsh +++ b/shaders/sh_grid/sh_grid.fsh @@ -6,10 +6,13 @@ varying vec4 v_vColour; uniform vec2 position; uniform vec2 scale; +uniform float angle; uniform float width; void main() { - vec2 _pos = v_vTexcoord - position; + vec2 pos = v_vTexcoord - position, _pos; + _pos.x = pos.x * cos(angle) - pos.y * sin(angle); + _pos.y = pos.x * sin(angle) + pos.y * cos(angle); vec2 dist = _pos - floor(_pos * scale) / scale; float ww = width / 2.; diff --git a/shaders/sh_grid/sh_grid.yy b/shaders/sh_grid/sh_grid.yy index a23411cad..8963fff54 100644 --- a/shaders/sh_grid/sh_grid.yy +++ b/shaders/sh_grid/sh_grid.yy @@ -1,8 +1,8 @@ { "type": 1, "parent": { - "name": "filter", - "path": "folders/shader/filter.yy", + "name": "generator", + "path": "folders/shader/generator.yy", }, "resourceVersion": "1.0", "name": "sh_grid",