diff options
author | syeyoung <cyoung06@naver.com> | 2023-01-26 03:05:00 +0900 |
---|---|---|
committer | syeyoung <cyoung06@naver.com> | 2023-01-26 03:05:00 +0900 |
commit | 500611d7684d7cf136f96f0049fee65529be3080 (patch) | |
tree | fbe642554cad4d1f927ac5bcad3a05901dcc2861 /mod/src/main/resources/assets/dungeonsguide/shaders | |
parent | 8f2366c1fd9850c0689306419343265099cfca7a (diff) | |
download | Skyblock-Dungeons-Guide-500611d7684d7cf136f96f0049fee65529be3080.tar.gz Skyblock-Dungeons-Guide-500611d7684d7cf136f96f0049fee65529be3080.tar.bz2 Skyblock-Dungeons-Guide-500611d7684d7cf136f96f0049fee65529be3080.zip |
Rounded Rectangles!
Signed-off-by: syeyoung <cyoung06@naver.com>
Diffstat (limited to 'mod/src/main/resources/assets/dungeonsguide/shaders')
-rw-r--r-- | mod/src/main/resources/assets/dungeonsguide/shaders/roundrect.frag | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/mod/src/main/resources/assets/dungeonsguide/shaders/roundrect.frag b/mod/src/main/resources/assets/dungeonsguide/shaders/roundrect.frag new file mode 100644 index 00000000..9a41104a --- /dev/null +++ b/mod/src/main/resources/assets/dungeonsguide/shaders/roundrect.frag @@ -0,0 +1,16 @@ +#version 110 +uniform float radius; +uniform vec2 halfSize; +uniform vec2 centerPos; +uniform float smoothness; + +float roundedBoxSDF(vec2 CenterPosition, vec2 Size, float Radius) { + return length(max(abs(CenterPosition)-Size+Radius,0.0))-Radius; +} + +void main() { + float distance = roundedBoxSDF(gl_FragCoord.xy - centerPos, halfSize, radius); + float smoothedAlpha = smoothstep(-smoothness,0.0, -distance); +// gl_FragColor = mix(vec4(1.0, 1.0, 1.0, 1.0), vec4(0.0, 0.2, 1.0, smoothedAlpha), smoothedAlpha); + gl_FragColor = gl_Color * vec4(1.0, 1.0, 1.0, smoothedAlpha); +}
\ No newline at end of file |