ExperimentalGear/shaders/gauge.fs

23 lines
493 B
Forth
Raw Permalink Normal View History

2021-07-25 20:10:06 +02:00
#version 330
#extension GL_ARB_separate_shader_objects : enable
layout(location=1) in vec2 fsTex;
layout(location=0) out vec4 target;
uniform float time;
uniform float rate;
uniform sampler2D mainTex;
uniform sampler2D maskTex;
uniform vec4 barColor;
void main()
{
vec4 tex = texture(mainTex, fsTex);
float mask = texture(maskTex, fsTex).x;
mask = rate - mask;
mask *= 100;
mask = clamp(mask, 0.0, 1.0);
target.rgb = tex.rgb * barColor.rgb;
target.a = tex.a * mask;
}