
shader()
{
    cull("none")
    sortweight("blended_alphatest") // trzeba zostawic bo wykrzacza sie na gf2

    pass()
    {
        stream()
        {
            position( "float3", "SS_POSITION" )
            texcoord( 0, "float2", "SS_TEXCOORD0" )
        }

        tmu()
        {
            texture()
            {
                image( txGrassTexture )
                addressfunc("clamp", "clamp", "clamp")
            }

            ColorOp( "arg1", "texture", "current", "current" )
            AlphaOp( "arg1", "texture", "current", "current" )
        }

        tmu()
        {
            TexGen("planar")
            TexMod("scale", "const", fTerrainInvSize, 0, 0, "const", fTerrainInvSize, 0, 0)

            texture()
            {
                image( txTerrainColor )
                addressfunc("clamp", "clamp", "clamp")
            }

            ColorOp( "mul", "texture", "current", "current" )
            AlphaOp( "arg2", "texture", "current", "current" )
        }

        AlphaFunc( "gequal", 128 )
    }

    lightpass()

    light("spot_shadowmap")
    {
        pass()
        {
            stream()
            {
                position( "float3", "SS_POSITION" )
            }

            tmu()
            {
                texture()
                {
                    shadowmap()
                    addressfunc("clamp", "clamp", "clamp")
                }

                texgen("spotlight")

                colorop("arg1", "texture", "current", "current")
                alphaop("arg1", "texture", "current", "current")
            }

            tmu()
            {
                texture()
                {
                    image("spot_z_inv.png")
                    addressfunc("clamp", "clamp", "clamp")
                    filtering("no_filtering")
                }

                texgen("shadowmap_z")

                colorop("mul", "texture", "current", "current")
                alphaop("mul", "texture", "current", "current")
            }

            blendfunc("zero", "inv_src_color")
            depthfunc("equal", 0)
            blackfog()
        }
    }
}


/*
shader()
{
    cull("none")
    // trzeba zostawic bo wykrzacza sie na gf2
    sortweight("blended_alphatest")

    pass()
    {
        stream()
        {
            position( "float3", "SS_POSITION" )
            diffuse( "color", "SS_DIFFUSE" )
            texcoord( 0, "float2", "SS_TEXCOORD0" )
        }

        tmu()
        {
            texture()
            {
                image( TEXTURE1 )
                addressfunc("clamp", "clamp", "clamp")
            }

            ColorOp( "mul", "texture", "diffuse", "current" )
            AlphaOp( "mul", "texture", "diffuse", "current" )
        }

        BlendFunc( "src_alpha", "inv_src_alpha" )
        AlphaFunc( "greater", 64 )
    }

    lightpass()

    light("spot_shadowmap")
    {
        pass()
        {
            stream()
            {
                position( "float3", "SS_POSITION" )
                diffuse( "color", "SS_DIFFUSE" )
                texcoord( 2, "float2", "SS_TEXCOORD0" )
            }

            tmu()
            {
                texture()
                {
                    shadowmap()
                    addressfunc("clamp", "clamp", "clamp")
                }

                texgen("spotlight")

                colorop("arg1", "texture", "current", "current")
                alphaop("arg1", "texture", "current", "current")
            }

            tmu()
            {
                texture()
                {
                    image("spot_z_inv.png")
                    addressfunc("clamp", "clamp", "clamp")
                    filtering("no_filtering")
                }

                texgen("shadowmap_z")

                colorop("mul", "texture", "current", "current")
                alphaop("mul", "texture", "current", "current")
            }

            tmu()
            {
                texture()
                {
                    image( TEXTURE1 )
                }

                colorop("arg1", "current", "current", "current")
                alphaop("arg1", "texture", "current", "current")
            }

            alphafunc("greater", 64)
            blendfunc("zero", "inv_src_color")
            depthfunc("lequal", 0)

            blackfog()
        }
    }
}

shader()
{
    cull("none")
    // trzeba zostawic bo wykrzacza sie na gf2
    sortweight("blended_alphatest")

    pass()
    {
        stream()
        {
            position( "float3", "SS_POSITION" )
            diffuse( "color", "SS_DIFFUSE" )
            texcoord( 0, "float2", "SS_TEXCOORD0" )
        }

        tmu()
        {
            texture()
            {
                image( TEXTURE1 )
            }

            ColorOp( "mul", "texture", "diffuse", "current" )
            AlphaOp( "mul", "texture", "diffuse", "current" )
        }

        BlendFunc( "src_alpha", "inv_src_alpha" )
        AlphaFunc( "greater", 64 )
    }
}
*/
