From 6a527ccf20ba922da644725ce5683e50c6699a79 Mon Sep 17 00:00:00 2001 From: Yoshman29 <81191621+YoshiCrafter29@users.noreply.github.com> Date: Fri, 17 Mar 2023 00:35:58 +0100 Subject: [PATCH] no more blur glitches --- assets/shaders/editorBlur.frag | 13 +++++++++++-- buildnumber.txt | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/assets/shaders/editorBlur.frag b/assets/shaders/editorBlur.frag index 761c4b15..f29cf77f 100644 --- a/assets/shaders/editorBlur.frag +++ b/assets/shaders/editorBlur.frag @@ -4,13 +4,22 @@ int steps = 16; int stepsInside = 2; float strength = 0.0075; +vec4 getColor(vec2 pos) { + if (pos.x < 0) pos.x = 0; + else if (pos.x > 1.0 - (1.0 / openfl_TextureSize.x)) pos.x = 1.0 - (1.0 / openfl_TextureSize.x); + if (pos.y < 0) pos.y = 0; + else if (pos.y > 1.0 - (1.0 / openfl_TextureSize.y)) pos.y = 1.0 - (1.0 / openfl_TextureSize.y); + return textureCam(bitmap, pos); +} void main() { - vec4 color = flixel_texture2D(bitmap, openfl_TextureCoordv); + vec2 camPos = getCamPos(openfl_TextureCoordv); + + vec4 color = getColor(camPos); float fsteps = steps; for(float inside = 1; inside < stepsInside+1; inside++) { for(int i = 0; i < steps; i++) { float fi = i; - color += flixel_texture2D(bitmap, openfl_TextureCoordv + vec2(strength * (inside / stepsInside) * cos(fi / fsteps * (PI * 2.0)), strength * (inside / stepsInside) * sin(fi / fsteps * (PI * 2.0)))); + color += getColor(camPos + vec2(strength * (inside / stepsInside) * cos(fi / fsteps * (PI * 2.0)), strength * (inside / stepsInside) * sin(fi / fsteps * (PI * 2.0)))); } } diff --git a/buildnumber.txt b/buildnumber.txt index 46e6ac85..451dc0c1 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -2551 \ No newline at end of file +2552 \ No newline at end of file