// $LastChangedDate: 2010-11-12 11:27:22 -0500 (Fri, 12 Nov 2010) $

    // Apply shadow.
    if ( uni_shadowMode != SHADOW_MODE_DISABLED )
    {
        float SHADOW_FACTOR = 0.3;  // dark gray instead of black
        float f;

        if ( uni_shadowMode == SHADOW_MODE_SAMPLE4 )
        {
            float b = 0.0015;  // bias
            vec4 i = gl_TexCoord[TEXTURE_UNIT_SHADOW];
            f = 0.0;
            f += shadow2DProj( uni_texture_shadow, vec4(i.x-b, i.y-b, i.z, i.w) ).r;
            f += shadow2DProj( uni_texture_shadow, vec4(i.x-b, i.y+b, i.z, i.w) ).r;
            f += shadow2DProj( uni_texture_shadow, vec4(i.x+b, i.y-b, i.z, i.w) ).r;
            f += shadow2DProj( uni_texture_shadow, vec4(i.x+b, i.y+b, i.z, i.w) ).r;
            f *= 0.25;
        }
        else  // SHADOW_MODE_SAMPLE1
        {
            f = shadow2DProj( uni_texture_shadow, gl_TexCoord[TEXTURE_UNIT_SHADOW] ).r;
        }

        f = max( SHADOW_FACTOR, f );            // dark gray instead of solid black
        gl_FragColor.rgb *= vec3( f, f, f );    // apply shadow to color fragment
    }
