29 lines
562 B
PostScript
29 lines
562 B
PostScript
|
#version 330 core
|
||
|
|
||
|
// Input
|
||
|
in vec2 TexCoord;
|
||
|
|
||
|
// Output
|
||
|
out vec4 PixelColor;
|
||
|
|
||
|
// Uniforms
|
||
|
uniform sampler2D Texture;
|
||
|
uniform sampler2D LightMask;
|
||
|
uniform vec4 LightColor;
|
||
|
uniform vec4 TintColor;
|
||
|
|
||
|
// Main
|
||
|
void main()
|
||
|
{
|
||
|
vec4 TextureColor = texture(Texture, TexCoord);
|
||
|
if (TextureColor.a < 0.25) discard;
|
||
|
|
||
|
vec4 MaskColor = texture(LightMask, TexCoord);
|
||
|
float MaskValue = (MaskColor.r + MaskColor.g + MaskColor.b) / 3;
|
||
|
vec4 MaskedColor = mix(vec4(1,1,1,1), LightColor, MaskValue);
|
||
|
|
||
|
PixelColor = TextureColor * MaskedColor * TintColor;
|
||
|
PixelColor.a = 0;
|
||
|
}
|
||
|
|