Cubyz/assets/cubyz/shaders/ui/window_border.fs
IntegratedQuantum 9898db654b Specify the location of all shader in/out parameters.
also normalized the version and layout formatting
progress towards #1376
2025-05-02 14:53:57 +02:00

20 lines
689 B
GLSL

#version 460
layout(location = 0) out vec4 frag_color;
layout(location = 0) flat in vec2 startCoord;
layout(location = 1) flat in vec2 endCoord;
layout(location = 2) flat in vec4 fColor;
uniform vec2 start;
uniform vec2 size;
uniform float scale;
uniform vec2 effectLength;
void main() {
vec2 distanceToBorder = min(gl_FragCoord.xy - startCoord, endCoord - gl_FragCoord.xy)/effectLength/scale;
float reducedDistance = distanceToBorder.x*distanceToBorder.y/(distanceToBorder.x + distanceToBorder.y); // Inspired by the reduced mass from physics, to give a sort of curvy look to the outline.
float opacity = max(1 - reducedDistance, 0);
frag_color = fColor*vec4(1, 1, 1, opacity);
}