//-----------------------------------------------------------------------------
// icon.sha
// 
// UI buttons
//-----------------------------------------------------------------------------

texture tOn;
texture tOff;
texture tActiveOn;
texture tActiveOff;
DWord cActivePulse;

technique off
{
    pass P0
    {
        // Stage0
        Texture[0]   = <tOff>;
	    MinFilter[0] = Linear;
	    MagFilter[0] = Linear;
        ColorOp[0]   = SelectArg1;
        ColorArg1[0] = Texture;
        AlphaOp[0]   = SelectArg1;
        AlphaArg1[0] = Texture;

        ColorOp[1] = Disable;
            
        // Dest
        AlphaBlendEnable = True;
        SrcBlend = SrcAlpha;
        DestBlend = InvSrcAlpha;
    }
}

technique active
{
    pass P0
    {
        TextureFactor = <cActivePulse>;

        // Stage0
        Texture[0]   = <tActiveOff>;
	    MinFilter[0] = Linear;
	    MagFilter[0] = Linear;
        ColorOp[0]   = SelectArg1;
        ColorArg1[0] = Texture;
        AlphaOp[0]   = SelectArg1;
        AlphaArg1[0] = Texture;

        // Stage1
        TexCoordIndex[1] = 0;
	    MinFilter[1] = Linear;
	    MagFilter[1] = Linear;
        Texture[1]   = <tActiveOn>;
        ColorOp[1]   = Lerp;
        ColorArg0[1] = TFactor;
        ColorArg1[1] = Current;
        ColorArg2[1] = Texture;
        AlphaOp[1]   = Lerp;
        ColorArg0[1] = TFactor;
        AlphaArg1[1] = Current;
        AlphaArg2[1] = Texture;

        ColorOp[2] = Disable;
            
        // Dest
        AlphaBlendEnable = True;
        SrcBlend = SrcAlpha;
        DestBlend = InvSrcAlpha;
    }
}

technique on
{
    pass P0
    {
        // Stage0
        Texture[0]   = <tOn>;
	    MinFilter[0] = Linear;
	    MagFilter[0] = Linear;
        ColorOp[0]   = SelectArg1;
        ColorArg1[0] = Texture;
        AlphaOp[0]   = SelectArg1;
        AlphaArg1[0] = Texture;

        ColorOp[1] = Disable;
            
        // Dest
        AlphaBlendEnable = True;
        SrcBlend = SrcAlpha;
        DestBlend = InvSrcAlpha;
    }
}
