| 1 | #version 450 |
| 2 | #extension GL_GOOGLE_include_directive : require |
| 3 | #include "push.glsl" |
| 4 | #include "clip.glsl" |
| 5 | |
| 6 | layout(set = 0, binding = 0) uniform sampler2D tex; |
| 7 | layout(location = 0) in vec2 v_uv; |
| 8 | layout(location = 0) out vec4 out_color; |
| 9 | |
| 10 | const int MOVE = 0; |
| 11 | const int SPAWN = 1; |
| 12 | const int CLOSE = 2; |
| 13 | |
| 14 | // The transition hook. Custom shaders will replace this function. |
| 15 | vec4 effect(vec4 color, vec2 uv, float progress, int kind) { |
| 16 | if (kind == SPAWN) { |
| 17 | return color * progress; |
| 18 | } |
| 19 | if (kind == CLOSE) { |
| 20 | return color * (1.0 - progress); |
| 21 | } |
| 22 | return color; |
| 23 | } |
| 24 | |
| 25 | void main() { |
| 26 | vec4 color = texture(tex, v_uv) * pc.color.a; |
| 27 | out_color = effect(color, v_uv, pc.effect.x, int(pc.effect.y)) * clip_alpha(); |
| 28 | } |