jeu-de-combat/shaders/StylishShaders/HorizontalProgressBarGradientSquareFrag.glsl
2021-06-17 20:42:16 +02:00

42 lines
806 B
GLSL

#version 410
in vec4 color;
in vec2 fragCoord;
out vec4 FragColor;
uniform float time;
uniform float fill;
uniform bool leftToRight;
uniform float height;
void main()
{ //Rectangle plus large que haut
vec4 colorTemp = color;
float ouverture = 0.8f;
// Effet "tube"
float lum = -pow(fragCoord.y + height/2f, 2f) * 5f /height + ouverture;
colorTemp.xyz *= lum;
// Effet flash sur la surface
float flash = abs(sin(time)) + 0.4f;
colorTemp.xyz *= flash;
if (leftToRight){
if (fill > fragCoord.x){
FragColor = colorTemp;
}
else {
FragColor = vec4(0f);
}
} else {
if (fill < fragCoord.x){
FragColor = colorTemp;
}
else {
FragColor = vec4(0f);
}
}
}