From: Mikko Rasa Date: Wed, 3 Mar 2021 23:50:31 +0000 (+0200) Subject: Add the shader for UnlitMaterial X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=5fc03c5a41df2934696921b2f7d5a65023a4506a;p=libs%2Fgl.git Add the shader for UnlitMaterial This was supposed to be in 2f198e3 --- diff --git a/shaderlib/unlit.glsl b/shaderlib/unlit.glsl new file mode 100644 index 00000000..57be8b1b --- /dev/null +++ b/shaderlib/unlit.glsl @@ -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; +}