From be9dc150659167325ea845c3440c8301de344905 Mon Sep 17 00:00:00 2001 From: Tanasart <22589759+Ttanasart-pt@users.noreply.github.com> Date: Mon, 29 May 2023 13:25:16 +0200 Subject: [PATCH] Raise gradient key limit --- scripts/gradients_function/gradients_function.gml | 4 ---- scripts/panel_inspector/panel_inspector.gml | 3 ++- shaders/sh_colorize/sh_colorize.fsh | 8 +++++--- shaders/sh_gradient/sh_gradient.fsh | 7 ++++--- shaders/sh_gradient_display/sh_gradient_display.fsh | 7 ++++--- shaders/sh_grid/sh_grid.fsh | 8 +++++--- shaders/sh_grid_hex/sh_grid_hex.fsh | 8 +++++--- shaders/sh_grid_tri/sh_grid_tri.fsh | 7 ++++--- shaders/sh_pixel_cloud/sh_pixel_cloud.fsh | 8 +++++--- shaders/sh_stripe/sh_stripe.fsh | 8 +++++--- 10 files changed, 39 insertions(+), 29 deletions(-) diff --git a/scripts/gradients_function/gradients_function.gml b/scripts/gradients_function/gradients_function.gml index a99dad690..1f16d4600 100644 --- a/scripts/gradients_function/gradients_function.gml +++ b/scripts/gradients_function/gradients_function.gml @@ -83,10 +83,6 @@ function gradientObject(color = c_black) constructor { } static draw = function(_x, _y, _w, _h, _a = 1) { - static RES = 48; - var _step = _w / RES; - var _ox, _oc; - var uniform_grad_blend = shader_get_uniform(sh_gradient_display, "gradient_blend"); var uniform_grad = shader_get_uniform(sh_gradient_display, "gradient_color"); var uniform_grad_time = shader_get_uniform(sh_gradient_display, "gradient_time"); diff --git a/scripts/panel_inspector/panel_inspector.gml b/scripts/panel_inspector/panel_inspector.gml index cee271db9..4fa38eee2 100644 --- a/scripts/panel_inspector/panel_inspector.gml +++ b/scripts/panel_inspector/panel_inspector.gml @@ -547,7 +547,8 @@ function Panel_Inspector() : PanelContent() constructor { draw_text_add(w / 2, ui(76), inspecting.internalName); draw_set_alpha(1); - var lx = w / 2 - string_width(inspecting.name) / 2 - ui(16); + draw_set_font(f_p1); + var lx = w / 2 - string_width(inspecting.name) / 2 - ui(10); var ly = ui(56 - 8); if(buttonInstant(THEME.button_hide, lx, ly, ui(16), ui(16), [mx, my], pFOCUS, pHOVER, "Lock", THEME.lock, !locked, locked? COLORS._main_icon_light : COLORS._main_icon,, 0.5) == 2) locked = !locked; diff --git a/shaders/sh_colorize/sh_colorize.fsh b/shaders/sh_colorize/sh_colorize.fsh index ce8683f3b..41a29f4ea 100644 --- a/shaders/sh_colorize/sh_colorize.fsh +++ b/shaders/sh_colorize/sh_colorize.fsh @@ -4,9 +4,11 @@ varying vec2 v_vTexcoord; varying vec4 v_vColour; +#define GRADIENT_LIMIT 128 + uniform int gradient_blend; -uniform vec4 gradient_color[16]; -uniform float gradient_time[16]; +uniform vec4 gradient_color[GRADIENT_LIMIT]; +uniform float gradient_time[GRADIENT_LIMIT]; uniform int gradient_keys; uniform float gradient_shift; uniform int multiply_alpha; @@ -48,7 +50,7 @@ vec3 hsvMix(vec3 c1, vec3 c2, float t) { vec4 gradientEval(in float prog) { vec4 col = vec4(0.); - for(int i = 0; i < 16; i++) { + for(int i = 0; i < GRADIENT_LIMIT; i++) { if(gradient_time[i] == prog) { col = gradient_color[i]; break; diff --git a/shaders/sh_gradient/sh_gradient.fsh b/shaders/sh_gradient/sh_gradient.fsh index dcf445bf9..63d7db008 100644 --- a/shaders/sh_gradient/sh_gradient.fsh +++ b/shaders/sh_gradient/sh_gradient.fsh @@ -5,10 +5,11 @@ varying vec2 v_vTexcoord; varying vec4 v_vColour; #define TAU 6.283185307179586 +#define GRADIENT_LIMIT 128 uniform int gradient_blend; -uniform vec4 gradient_color[16]; -uniform float gradient_time[16]; +uniform vec4 gradient_color[GRADIENT_LIMIT]; +uniform float gradient_time[GRADIENT_LIMIT]; uniform int gradient_keys; uniform int gradient_loop; @@ -55,7 +56,7 @@ vec3 hsvMix(vec3 c1, vec3 c2, float t) { vec4 gradientEval(in float prog) { vec4 col = vec4(0.); - for(int i = 0; i < 16; i++) { + for(int i = 0; i < GRADIENT_LIMIT; i++) { if(gradient_time[i] == prog) { col = gradient_color[i]; break; diff --git a/shaders/sh_gradient_display/sh_gradient_display.fsh b/shaders/sh_gradient_display/sh_gradient_display.fsh index 1c70bfbbf..f21af4ee9 100644 --- a/shaders/sh_gradient_display/sh_gradient_display.fsh +++ b/shaders/sh_gradient_display/sh_gradient_display.fsh @@ -5,10 +5,11 @@ varying vec2 v_vTexcoord; varying vec4 v_vColour; #define TAU 6.283185307179586 +#define GRADIENT_LIMIT 128 uniform int gradient_blend; -uniform vec4 gradient_color[16]; -uniform float gradient_time[16]; +uniform vec4 gradient_color[GRADIENT_LIMIT]; +uniform float gradient_time[GRADIENT_LIMIT]; uniform int gradient_keys; vec3 rgb2hsv(vec3 c) { @@ -48,7 +49,7 @@ vec3 hsvMix(vec3 c1, vec3 c2, float t) { vec3 gradientEval(in float prog) { vec4 col = vec4(0.); - for(int i = 0; i < 16; i++) { + for(int i = 0; i < GRADIENT_LIMIT; i++) { if(gradient_time[i] == prog) { col = gradient_color[i]; break; diff --git a/shaders/sh_grid/sh_grid.fsh b/shaders/sh_grid/sh_grid.fsh index ec57ba22b..aef2c9d06 100644 --- a/shaders/sh_grid/sh_grid.fsh +++ b/shaders/sh_grid/sh_grid.fsh @@ -4,6 +4,8 @@ varying vec2 v_vTexcoord; varying vec4 v_vColour; +#define GRADIENT_LIMIT 128 + uniform vec2 position; uniform vec2 dimension; uniform vec2 scale; @@ -18,8 +20,8 @@ uniform int mode; uniform vec4 gapCol; uniform int gradient_use; uniform int gradient_blend; -uniform vec4 gradient_color[16]; -uniform float gradient_time[16]; +uniform vec4 gradient_color[GRADIENT_LIMIT]; +uniform float gradient_time[GRADIENT_LIMIT]; uniform int gradient_keys; float random (in vec2 st) { @@ -63,7 +65,7 @@ vec3 hsvMix(vec3 c1, vec3 c2, float t) { vec4 gradientEval(in float prog) { vec4 col = vec4(0.); - for(int i = 0; i < 16; i++) { + for(int i = 0; i < GRADIENT_LIMIT; i++) { if(gradient_time[i] == prog) { col = gradient_color[i]; break; diff --git a/shaders/sh_grid_hex/sh_grid_hex.fsh b/shaders/sh_grid_hex/sh_grid_hex.fsh index ce654a29d..f08f813cc 100644 --- a/shaders/sh_grid_hex/sh_grid_hex.fsh +++ b/shaders/sh_grid_hex/sh_grid_hex.fsh @@ -1,6 +1,8 @@ varying vec2 v_vTexcoord; varying vec4 v_vColour; +#define GRADIENT_LIMIT 128 + uniform vec2 dimension; uniform vec2 position; uniform vec2 scale; @@ -13,8 +15,8 @@ uniform int mode; uniform vec4 gapCol; uniform int gradient_use; uniform int gradient_blend; -uniform vec4 gradient_color[16]; -uniform float gradient_time[16]; +uniform vec4 gradient_color[GRADIENT_LIMIT]; +uniform float gradient_time[GRADIENT_LIMIT]; uniform int gradient_keys; #define PI 3.14159265359 @@ -60,7 +62,7 @@ vec3 hsvMix(vec3 c1, vec3 c2, float t) { vec4 gradientEval(in float prog) { vec4 col = vec4(0.); - for(int i = 0; i < 16; i++) { + for(int i = 0; i < GRADIENT_LIMIT; i++) { if(gradient_time[i] == prog) { col = gradient_color[i]; break; diff --git a/shaders/sh_grid_tri/sh_grid_tri.fsh b/shaders/sh_grid_tri/sh_grid_tri.fsh index 580b37864..9d97acca1 100644 --- a/shaders/sh_grid_tri/sh_grid_tri.fsh +++ b/shaders/sh_grid_tri/sh_grid_tri.fsh @@ -6,6 +6,7 @@ varying vec4 v_vColour; #define c30 (1.0 / 0.86602540378) #define PI 3.14159265359 +#define GRADIENT_LIMIT 128 uniform vec2 position; uniform vec2 dimension; @@ -19,8 +20,8 @@ uniform int mode; uniform vec4 gapCol; uniform int gradient_use; uniform int gradient_blend; -uniform vec4 gradient_color[16]; -uniform float gradient_time[16]; +uniform vec4 gradient_color[GRADIENT_LIMIT]; +uniform float gradient_time[GRADIENT_LIMIT]; uniform int gradient_keys; float random (in vec2 st) { @@ -64,7 +65,7 @@ vec3 hsvMix(vec3 c1, vec3 c2, float t) { vec4 gradientEval(in float prog) { vec4 col = vec4(0.); - for(int i = 0; i < 16; i++) { + for(int i = 0; i < GRADIENT_LIMIT; i++) { if(gradient_time[i] == prog) { col = gradient_color[i]; break; diff --git a/shaders/sh_pixel_cloud/sh_pixel_cloud.fsh b/shaders/sh_pixel_cloud/sh_pixel_cloud.fsh index 251c5a1b1..8c9df1c5c 100644 --- a/shaders/sh_pixel_cloud/sh_pixel_cloud.fsh +++ b/shaders/sh_pixel_cloud/sh_pixel_cloud.fsh @@ -4,6 +4,8 @@ varying vec2 v_vTexcoord; varying vec4 v_vColour; +#define GRADIENT_LIMIT 128 + uniform float seed; uniform float strength; uniform float dist; @@ -11,8 +13,8 @@ uniform int useMap; uniform sampler2D strengthMap; uniform int gradient_blend; -uniform vec4 gradient_color[16]; -uniform float gradient_time[16]; +uniform vec4 gradient_color[GRADIENT_LIMIT]; +uniform float gradient_time[GRADIENT_LIMIT]; uniform int gradient_keys; uniform float alpha_curve[64]; @@ -139,7 +141,7 @@ vec3 hsvMix(vec3 c1, vec3 c2, float t) { vec4 gradientEval(in float prog) { vec4 col = vec4(0.); - for(int i = 0; i < 16; i++) { + for(int i = 0; i < GRADIENT_LIMIT; i++) { if(gradient_time[i] == prog) { col = gradient_color[i]; break; diff --git a/shaders/sh_stripe/sh_stripe.fsh b/shaders/sh_stripe/sh_stripe.fsh index 26ff193b9..501925ed7 100644 --- a/shaders/sh_stripe/sh_stripe.fsh +++ b/shaders/sh_stripe/sh_stripe.fsh @@ -4,10 +4,12 @@ varying vec2 v_vTexcoord; varying vec4 v_vColour; +#define GRADIENT_LIMIT 128 + uniform int gradient_use; uniform int gradient_blend; -uniform vec4 gradient_color[16]; -uniform float gradient_time[16]; +uniform vec4 gradient_color[GRADIENT_LIMIT]; +uniform float gradient_time[GRADIENT_LIMIT]; uniform int gradient_keys; uniform vec4 color0; @@ -63,7 +65,7 @@ vec3 hsvMix(vec3 c1, vec3 c2, float t) { vec4 gradientEval(in float prog) { vec4 col = vec4(0.); - for(int i = 0; i < 16; i++) { + for(int i = 0; i < GRADIENT_LIMIT; i++) { if(gradient_time[i] == prog) { col = gradient_color[i]; break;