From 252e93cc9c59efd8175a48002c70d8ce3e88ea25 Mon Sep 17 00:00:00 2001 From: Variable <77773850+Variable-ind@users.noreply.github.com> Date: Wed, 27 Apr 2022 22:03:56 +0100 Subject: [PATCH] Transparency improvements (#680) * add limit change with brush * Delete Draw.gd * Delete BaseTool.gd * added error calculation * revert last commit * Error calculations * Update UITransparency.gdshader * Update UITransparency.gdshader * Update UITransparency.gdshader * used "screen_uv" instead of "UV" --- src/Shaders/UITransparency.gdshader | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Shaders/UITransparency.gdshader b/src/Shaders/UITransparency.gdshader index f94461555..baf420116 100644 --- a/src/Shaders/UITransparency.gdshader +++ b/src/Shaders/UITransparency.gdshader @@ -5,15 +5,17 @@ uniform float alpha = 0.0; uniform vec2 screen_resolution = vec2(1280, 720); uniform vec2 position = vec2(100.0, 100.0); uniform vec2 size = vec2(100.0, 100.0); -//1280, 720 + void fragment(){ if ( - UV.x >= (position.x)/(screen_resolution.x) && UV.y >= (position.y)/(screen_resolution.y) - && - UV.x <= (position.x + size.x)/(screen_resolution.x) && UV.y <= (position.y + size.y)/(screen_resolution.y) + SCREEN_UV.x >= (position.x)/(screen_resolution.x) + && (1.0 - SCREEN_UV.y) >= (position.y)/(screen_resolution.y) + + && SCREEN_UV.x <= (position.x + size.x)/(screen_resolution.x) + && (1.0 - SCREEN_UV.y) <= (position.y + size.y)/(screen_resolution.y) ){ COLOR.a = alpha; } -} \ No newline at end of file +}