mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-09-25 21:01:03 -04:00

* Move to glslang's convention for shader file suffix * Update ci.yml * Oops, a mistake in the shader, how could that happen? * Does the command error on its own? * Update ci.yml * Revert "Oops, a mistake in the shader, how could that happen?" This reverts commit 869c3323f3d3b5fa607b40e7847c389a12b01f33. * Update ci.yml
21 lines
774 B
GLSL
21 lines
774 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;
|
|
|
|
layout(location = 0) uniform vec2 start;
|
|
layout(location = 1) uniform vec2 size;
|
|
|
|
layout(location = 4) uniform float scale;
|
|
layout(location = 5) 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);
|
|
}
|