]> git.tdb.fi Git - libs/gl.git/blobdiff - shaderlib/unlit.glsl
Add the shader for UnlitMaterial
[libs/gl.git] / shaderlib / unlit.glsl
diff --git a/shaderlib/unlit.glsl b/shaderlib/unlit.glsl
new file mode 100644 (file)
index 0000000..57be8b1
--- /dev/null
@@ -0,0 +1,28 @@
+import msp_interface;
+import common;
+
+uniform sampler2D texture;
+uniform vec4 tint;
+
+layout(constant_id=auto) const bool use_texture = false;
+layout(constant_id=auto) const bool use_vertex_color = false;
+layout(constant_id=auto) const bool use_fog = false;
+
+#pragma MSP stage(fragment)
+vec4 get_color()
+{
+       vec4 result = tint;
+       if(use_texture)
+               result *= texture(texture, texcoord.xy);
+       if(use_vertex_color)
+               result *= color;
+       return result;
+}
+
+void main()
+{
+       vec4 color = get_color();
+       if(use_fog)
+               color.rgb = apply_fog(color.rgb);
+       frag_color = color;
+}