atagen

monolith

public
Star0
Watch0
14dab738af1abf9b17afc995bc002f2b2ac9e444
1
ssh://brewery@pls.lobotomise.me:33/atagen/monolith.git
crates/render-vk/shaders/effect.fragGlsl27 lines695 B
1
#version 450
2
#extension GL_GOOGLE_include_directive : require
3
#include "push.glsl"
4
5
layout(set = 0, binding = 0) uniform sampler2D tex;
6
layout(location = 0) in vec2 v_uv;
7
layout(location = 0) out vec4 out_color;
8
9
const int MOVE = 0;
10
const int SPAWN = 1;
11
const int CLOSE = 2;
12
13
// The transition hook. Custom shaders will replace this function.
14
vec4 effect(vec4 color, vec2 uv, float progress, int kind) {
15
    if (kind == SPAWN) {
16
        return color * progress;
17
    }
18
    if (kind == CLOSE) {
19
        return color * (1.0 - progress);
20
    }
21
    return color;
22
}
23
24
void main() {
25
    vec4 color = texture(tex, v_uv) * pc.color.a;
26
    out_color = effect(color, v_uv, pc.effect.x, int(pc.effect.y));
27
}