2018-10-16 20:23:31 +00:00
|
|
|
#version 120
|
|
|
|
|
2021-03-13 01:31:35 +00:00
|
|
|
#if @useGPUShader4
|
2021-03-13 23:02:48 +00:00
|
|
|
#extension GL_EXT_gpu_shader4: require
|
2021-03-13 01:31:35 +00:00
|
|
|
#endif
|
2021-01-05 22:21:54 +00:00
|
|
|
|
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;
|
2023-02-25 19:03:39 +00:00
|
|
|
uniform float alphaRef;
|
2018-10-16 20:23:31 +00:00
|
|
|
|
2023-02-25 19:03:39 +00:00
|
|
|
#include "lib/material/alpha.glsl"
|
2020-12-16 23:44:15 +00:00
|
|
|
|
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
|
|
|
|
2023-02-26 22:31:41 +00:00
|
|
|
gl_FragData[0].a = alphaTest(gl_FragData[0].a, alphaRef);
|
2020-12-16 23:44:15 +00:00
|
|
|
|
|
|
|
// 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
|
|
|
}
|