diff options
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 |