42 lines
806 B
GLSL
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);
|
|
}
|
|
}
|
|
|
|
|
|
} |