From acb898ad9b7903884afb6c87e06ec49a43ba0f63 Mon Sep 17 00:00:00 2001 From: falsycat Date: Sat, 19 Oct 2019 00:00:00 +0000 Subject: [PATCH] [update] Implemented smoothing of SquareElement. --- sjplayer/src/sjplayer/ShapeElementProgram.d | 2 +- sjplayer/src/sjplayer/SquareElement.d | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sjplayer/src/sjplayer/ShapeElementProgram.d b/sjplayer/src/sjplayer/ShapeElementProgram.d index 39d0f27..b6a917e 100644 --- a/sjplayer/src/sjplayer/ShapeElementProgram.d +++ b/sjplayer/src/sjplayer/ShapeElementProgram.d @@ -131,7 +131,7 @@ struct ShapeElementProgramInstance { /// align(1) float weight = 1; /// - align(1) float smooth = 0.001; + align(1) float smooth = 0.01; /// align(1) vec4 color = vec4(0, 0, 0, 0); } diff --git a/sjplayer/src/sjplayer/SquareElement.d b/sjplayer/src/sjplayer/SquareElement.d index b712497..e7d6cd4 100644 --- a/sjplayer/src/sjplayer/SquareElement.d +++ b/sjplayer/src/sjplayer/SquareElement.d @@ -58,8 +58,8 @@ alias SquareElementProgram = ShapeElementProgram!(q{ float w = 1-weight_; float s = smooth_; return clamp( - smoothstep(w-s, w, abs(uv_.x)) + - smoothstep(w-s, w, abs(uv_.y)), 0, 1); + smoothstep(w-s, w, abs(uv_.x))*(1-smoothstep(1-s, 1, abs(uv_.x))) + + smoothstep(w-s, w, abs(uv_.y))*(1-smoothstep(1-s, 1, abs(uv_.y))), 0, 1); }); ///