Created
February 16, 2019 22:36
-
-
Save grondag/068cb7cffd804632d6e1ce5bf482e27a to your computer and use it in GitHub Desktop.
blending
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vec4 diffuseColor() | |
{ | |
#ifdef SOLID | |
float non_mipped = bitValue(v_flags, 3) * -4.0; | |
vec4 a = texture2D(u_textures, v_texcoord_0, non_mipped); | |
float cutout = bitValue(v_flags, 4); | |
if(cutout == 1.0 && a.a < 0.5) | |
discard; | |
#else | |
vec4 a = texture2D(u_textures, v_texcoord_0); | |
#endif | |
vec4 shade = shadeColor(v_color_0, 0); | |
a *= shade; | |
#if LAYER_COUNT > 1 | |
vec4 b = texture2D(u_textures, v_texcoord_1) * shadeColor(v_color_1, 1); | |
a = mix(a, b, b.a); | |
#endif | |
#if LAYER_COUNT > 2 | |
vec4 c = texture2D(u_textures, v_texcoord_2) * shadeColor(v_color_2, 2); | |
a = mix(a, c, c.a); | |
#endif | |
return a; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment