// [COMBO] {"material":"ui_editor_properties_fog","combo":"FOG","default":1} #include "common_fragment.h" #include "common_fog.h" uniform sampler2D g_Texture0; // {"material":"ui_editor_properties_albedo","default":"util/white"} uniform float g_Overbright; // {"material":"ui_editor_properties_overbright","default":1.0,"range":[0,5]} varying vec2 v_TexCoord; varying vec4 v_Color; #if FOG_DIST || FOG_HEIGHT varying vec4 v_ViewDir; #endif void main() { vec4 color = v_Color * ConvertTexture0Format(texSample2D(g_Texture0, v_TexCoord.xy)); color.rgb *= g_Overbright; #if FOG_HEIGHT || FOG_DIST vec2 fogPixelState = CalculateFogPixelState(length(v_ViewDir.xyz), v_ViewDir.w); color.rgb = ApplyFog(color.rgb, fogPixelState); color.a = ApplyFogAlpha(color.a, fogPixelState); #endif gl_FragColor = color; #if ALPHATOCOVERAGE gl_FragColor.a = (gl_FragColor.a - 0.5) / max(fwidth(gl_FragColor.a), 0.0001) + 0.5; #if GLSL if (gl_FragColor.a < 0.5) discard; #endif #endif }