| 1 |
#version 440 |
| 2 |
|
| 3 |
layout(location = 0) in vec2 coord; |
| 4 |
|
| 5 |
layout(location = 0) out vec4 fragColor; |
| 6 |
|
| 7 |
layout(std140, binding = 0) uniform buf { |
| 8 |
mat4 qt_Matrix; |
| 9 |
float qt_Opacity; |
| 10 |
float shift; |
| 11 |
float maximumValue; |
| 12 |
vec4 color; |
| 13 |
float threshold; |
| 14 |
vec4 aboveThresholdColor; |
| 15 |
}; |
| 16 |
|
| 17 |
layout(binding = 1) uniform sampler2D texture0; |
| 18 |
|
| 19 |
void main() { |
| 20 |
vec4 tex = texture(texture0, vec2(coord.x, coord.y)); |
| 21 |
float value = tex.r * 255.0; |
| 22 |
float isOn = 1.0 - step(value / maximumValue, 1.0 - coord.y); |
| 23 |
float isAboveThreshold = step(threshold, value); |
| 24 |
|
| 25 |
fragColor = mix(vec4(0.0), mix(color, aboveThresholdColor, isAboveThreshold), isOn) * qt_Opacity; |
| 26 |
} |