You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
614 B
27 lines
614 B
#version 150
|
|
|
|
uniform sampler2D tex0;
|
|
uniform float greyscale;
|
|
|
|
in vec2 tex_c;
|
|
|
|
out vec4 outputColor;
|
|
|
|
|
|
void main()
|
|
{
|
|
vec4 texColor = texture(tex0, tex_c);
|
|
|
|
// Discard fragments with alpha below a threshold
|
|
if (texColor.a < 0.1) {
|
|
discard;
|
|
}
|
|
|
|
// Convert to grayscale if is_nearest is true
|
|
if (greyscale < 0.5) { // Using 0.5 as threshold since GLSL doesn't have bool
|
|
float gray = dot(texColor.rgb, vec3(0.299, 0.587, 0.114)); // Standard grayscale conversion
|
|
outputColor = vec4(vec3(gray), texColor.a);
|
|
} else {
|
|
outputColor = texColor;
|
|
}
|
|
}
|
|
|