]> git.tdb.fi Git - libs/gl.git/blob - shaderlib/unlit.glsl
57be8b1ba1acc571b7d0dbbbdcd691a1d1a7dd96
[libs/gl.git] / shaderlib / unlit.glsl
1 import msp_interface;
2 import common;
3
4 uniform sampler2D texture;
5 uniform vec4 tint;
6
7 layout(constant_id=auto) const bool use_texture = false;
8 layout(constant_id=auto) const bool use_vertex_color = false;
9 layout(constant_id=auto) const bool use_fog = false;
10
11 #pragma MSP stage(fragment)
12 vec4 get_color()
13 {
14         vec4 result = tint;
15         if(use_texture)
16                 result *= texture(texture, texcoord.xy);
17         if(use_vertex_color)
18                 result *= color;
19         return result;
20 }
21
22 void main()
23 {
24         vec4 color = get_color();
25         if(use_fog)
26                 color.rgb = apply_fog(color.rgb);
27         frag_color = color;
28 }