add 'u_alphaClip' to entity shader

This commit is contained in:
MihailRis 2024-11-19 14:33:14 +03:00
parent 495e444d1f
commit 0144709e03
2 changed files with 3 additions and 1 deletions

View File

@ -9,6 +9,7 @@ uniform samplerCube u_cubemap;
uniform vec3 u_fogColor;
uniform float u_fogFactor;
uniform float u_fogCurve;
uniform bool u_alphaClip;
void main() {
vec3 fogColor = texture(u_cubemap, a_dir).rgb;
@ -16,7 +17,7 @@ void main() {
float depth = (a_distance/256.0);
float alpha = a_color.a * tex_color.a;
// anyway it's any alpha-test alternative required
if (alpha < 0.5f)
if (alpha < (u_alphaClip ? 0.5f : 0.2f))
discard;
f_color = mix(a_color * tex_color, vec4(fogColor,1.0),
min(1.0, pow(depth*u_fogFactor, u_fogCurve)));

View File

@ -153,6 +153,7 @@ void WorldRenderer::renderLevel(
frustumCulling->update(camera.getProjView());
}
entityShader.uniform1i("u_alphaClip", true);
level.entities->render(
assets,
*modelBatch,