summaryrefslogtreecommitdiffhomepage
path: root/shaders/shader.frag
blob: 98c18e10ef37cbc663c8d85631f038d8f7c145c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
precision highp float;

layout (location = 0) uniform vec2 scale;
layout (location = 1) uniform vec3 offset;
layout (location = 2) uniform vec4 tint;
layout (location = 3) uniform bool enable_lightmap;
layout (location = 4) uniform sampler2D sampler;
layout (location = 5) uniform sampler2D lightmap_sampler;

layout (location = 0) noperspective in vec2 frag_texcoords;
layout (location = 1) noperspective in vec2 frag_light_coord;
out vec4 color;
//layout (depth_greater) out float gl_FragDepth;

layout(pixel_center_integer) in vec4 gl_FragCoord;

void main() {
    vec4 light = tint;
    if (enable_lightmap)
        light *= vec4(texture(lightmap_sampler, frag_light_coord).rgb, 1);
    color = texture(sampler, frag_texcoords) * light;
    if (color.a == 0)
        discard;
}