2018-10-16 20:23:31 +00:00
|
|
|
#version 120
|
|
|
|
|
2021-01-05 22:21:54 +00:00
|
|
|
#extension EXT_gpu_shader4: enable
|
|
|
|
|
2018-10-16 20:23:31 +00:00
|
|
|
uniform sampler2D diffuseMap;
|
|
|
|
varying vec2 diffuseMapUV;
|
|
|
|
|
|
|
|
varying float alphaPassthrough;
|
|
|
|
|
|
|
|
uniform bool useDiffuseMapForShadowAlpha;
|
2020-04-10 14:45:37 +00:00
|
|
|
uniform bool alphaTestShadows;
|
2018-10-16 20:23:31 +00:00
|
|
|
|
2020-12-16 23:44:15 +00:00
|
|
|
#include "alpha.glsl"
|
|
|
|
|
2018-10-16 20:23:31 +00:00
|
|
|
void main()
|
|
|
|
{
|
|
|
|
gl_FragData[0].rgb = vec3(1.0);
|
|
|
|
if (useDiffuseMapForShadowAlpha)
|
|
|
|
gl_FragData[0].a = texture2D(diffuseMap, diffuseMapUV).a * alphaPassthrough;
|
|
|
|
else
|
|
|
|
gl_FragData[0].a = alphaPassthrough;
|
2018-10-17 13:02:26 +00:00
|
|
|
|
2020-12-16 23:44:15 +00:00
|
|
|
alphaTest();
|
|
|
|
|
|
|
|
// Prevent translucent things casting shadow (including the player using an invisibility effect).
|
|
|
|
// This replaces alpha blending, which obviously doesn't work with depth buffers
|
2020-04-21 17:18:55 +00:00
|
|
|
if (alphaTestShadows && gl_FragData[0].a <= 0.5)
|
2018-10-17 13:02:26 +00:00
|
|
|
discard;
|
2018-10-16 20:23:31 +00:00
|
|
|
}
|