niri
Clone
https://git.tahinli.com/Tahinli/niri.git
0 watching0 forksRustGPL-3.012.1 MiB9d8f4f8Ivan Molodetskikh1 month ago2997 commits
| 1 | #version 100 |
| 2 | |
| 3 | //_DEFINES_ |
| 4 | |
| 5 | #if defined(EXTERNAL) |
| 6 | #extension GL_OES_EGL_image_external : require |
| 7 | #endif |
| 8 | |
| 9 | precision highp float; |
| 10 | #if defined(EXTERNAL) |
| 11 | uniform samplerExternalOES tex; |
| 12 | #else |
| 13 | uniform sampler2D tex; |
| 14 | #endif |
| 15 | |
| 16 | uniform float alpha; |
| 17 | varying vec2 v_coords; |
| 18 | |
| 19 | #if defined(DEBUG_FLAGS) |
| 20 | uniform float tint; |
| 21 | #endif |
| 22 | |
| 23 | // x is left edge, y is right edge of the gradient. |
| 24 | uniform vec2 cutoff; |
| 25 | |
| 26 | void main() { |
| 27 | // Sample the texture. |
| 28 | vec4 color = texture2D(tex, v_coords); |
| 29 | #if defined(NO_ALPHA) |
| 30 | color = vec4(color.rgb, 1.0); |
| 31 | #endif |
| 32 | |
| 33 | if (cutoff.x < cutoff.y) { |
| 34 | float fade = clamp((cutoff.y - v_coords.x) / (cutoff.y - cutoff.x), 0.0, 1.0); |
| 35 | color = color * fade; |
| 36 | } |
| 37 | |
| 38 | // Apply final alpha and tint. |
| 39 | color = color * alpha; |
| 40 | |
| 41 | #if defined(DEBUG_FLAGS) |
| 42 | if (tint == 1.0) |
| 43 | color = vec4(0.0, 0.2, 0.0, 0.2) + color * 0.8; |
| 44 | #endif |
| 45 | |
| 46 | gl_FragColor = color; |
| 47 | } |