matrix  mWVP;
DWORD   cColor = 0xffffffff;
texture tBase;
texture tGloss;
texture tNormal;

vertexshader vSdr = 
    decl
    {
        stream 0;
        float    v0[3];  // Position
        D3DCOLOR v3;     // Normal
        float    v7[2];  // Tex coord 0
        D3DCOLOR v8;     // Binormal
        D3DCOLOR v9;     // Tangent
    }
    asm
    {
        ; Constants:
        ; 16..19 - Composite World-View-Projection Matrix

        vs.1.0
        m4x4 oPos, v0, c16
        mov oT0.xy, v7
    };

String Solid_desc = "Solid color";

technique Solid
{
    pass P0
    {
        vertexshader = <vSdr>;	
        VertexShaderConstant[16] = <mWVP>;
	    TextureFactor = <cColor>;


        // Stage0
        ColorOp[0]   = SelectArg1;
        ColorArg1[0] = TFactor;
        AlphaOp[0]   = SelectArg1;
        AlphaArg1[0] = TFactor;
    }
}

String Base_desc = "Base texture";

technique Base
{
    pass P0
    {
        vertexshader = <vSdr>;	
        VertexShaderConstant[16] = <mWVP>;

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

String Gloss_desc = "Gloss texture";

technique Gloss
{
    pass P0
    {
        vertexshader = <vSdr>;	
        VertexShaderConstant[16] = <mWVP>;

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

String Bump_desc = "Bump texture";

technique Bump
{
    pass P0
    {
        vertexshader = <vSdr>;	
        VertexShaderConstant[16] = <mWVP>;

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

