2018-10-16 20:23:31 +00:00
|
|
|
#version 120
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
gl_FragData[0].rgb = vec3(1.0);
|
2020-04-10 14:45:37 +00:00
|
|
|
if (!alphaTestShadows)
|
|
|
|
{
|
|
|
|
gl_FragData[0].a = 1.0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-10-16 20:23:31 +00:00
|
|
|
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
|
|
|
|
|
|
|
// Prevent translucent things casting shadow (including the player using an invisibility effect)
|
2018-11-03 16:20:56 +00:00
|
|
|
if (gl_FragData[0].a <= 0.5)
|
2018-10-17 13:02:26 +00:00
|
|
|
discard;
|
2018-10-16 20:23:31 +00:00
|
|
|
}
|