2018-10-16 20:23:31 +00:00
#version 120
varying vec2 diffuseMapUV ;
varying float alphaPassthrough ;
uniform int colorMode ;
2023-05-25 22:46:04 +00:00
uniform bool useTreeAnim ;
2020-04-21 17:18:55 +00:00
uniform bool useDiffuseMapForShadowAlpha = true ;
uniform bool alphaTestShadows = true ;
2018-10-16 20:23:31 +00:00
void main ( void )
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex ;
vec4 viewPos = ( gl_ModelViewMatrix * gl_Vertex ) ;
gl_ClipVertex = viewPos ;
2020-04-21 17:18:55 +00:00
if ( useDiffuseMapForShadowAlpha )
2018-10-16 20:23:31 +00:00
diffuseMapUV = ( gl_TextureMatrix [ 0 ] * gl_MultiTexCoord0 ) . xy ;
else
diffuseMapUV = vec2 ( 0.0 ) ; // Avoid undefined behaviour if running on hardware predating the concept of dynamically uniform expressions
2020-04-21 17:18:55 +00:00
if ( colorMode == 2 )
2023-05-25 22:46:04 +00:00
alphaPassthrough = useTreeAnim ? 1.0 : gl_Color . a ;
2018-10-16 20:23:31 +00:00
else
// This is uniform, so if it's too low, we might be able to put the position/clip vertex outside the view frustum and skip the fragment shader and rasteriser
alphaPassthrough = gl_FrontMaterial . diffuse . a ;
}