Add alpha scissor

This commit is contained in:
Dane Johnson
2021-01-20 20:49:12 -06:00
parent 25c5d925fb
commit 087a75eaab
13 changed files with 42 additions and 6 deletions

View File

@@ -2,24 +2,27 @@
in vec3 UV;
out vec4 FragColor;
struct Material {
vec3 color;
bool usesColor;
sampler2D tex;
bool usesTex;
float alphaScissor;
};
uniform Material material;
void main() {
gl_FragColor = vec4(0.0);
FragColor = vec4(0.0);
if (material.usesColor) {
gl_FragColor += vec4(material.color, 1.0);
FragColor += vec4(material.color, 1.0);
}
if (material.usesTex) {
gl_FragColor += texture(material.tex, UV.xy / UV.z);
FragColor += texture(material.tex, UV.xy / UV.z);
}
if (gl_FragColor.w < 0.99) {
if (FragColor.w < material.alphaScissor) {
discard;
}
}