[update] Implemented smoothing of SquareElement.

This commit is contained in:
falsycat 2019-10-19 00:00:00 +00:00
parent 13782e3176
commit acb898ad9b
2 changed files with 3 additions and 3 deletions

View File

@ -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);
}

View File

@ -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);
});
///