//
//morphlet_Fist
//

vertexshader vshader;
pixelshader pshader;

texture morphlet_texture;

float4x4 proj_matrix;

sampler Sampler_morphlet_texture = sampler_state
{
    Texture   = (morphlet_texture);
    MipFilter = LINEAR;
    MinFilter = LINEAR;
    MagFilter = LINEAR;
    ADDRESSU = BORDER;
    ADDRESSV = BORDER;
    BORDERCOLOR = 0;
};

struct VS_INPUT
{
    float3 pos : POSITION;
    float opacity : TEXCOORD0;
    float2 tex0 : TEXCOORD1;
};

struct VS_OUTPUT
{
    float4 pos   : POSITION;
    float opacity : TEXCOORD0;
    float2 tex0 : TEXCOORD1;
};

VS_OUTPUT VS(VS_INPUT vertex_in)
{
    VS_OUTPUT vertex_out = (VS_OUTPUT)0;

    vertex_out.pos = float4(vertex_in.pos,1);
    vertex_out.pos = mul(vertex_out.pos,proj_matrix);

    //vertex_out.tex0 = vertex_in.tex0;
    vertex_out.tex0 = (vertex_in.tex0 + 1.)/2.;

    vertex_out.opacity = vertex_in.opacity;

    return vertex_out;
}

struct PS_INPUT
{
  float opacity : TEXCOORD0;
    float2 tex0 : TEXCOORD1;
};

struct PS_OUTPUT
{
  float4 color : COLOR;
};


PS_OUTPUT PS(PS_INPUT ps_in)
{
   PS_OUTPUT ps_out = (PS_OUTPUT)0;

   ps_out.color.x = tex2D(Sampler_morphlet_texture, ps_in.tex0).x*ps_in.opacity;

   return ps_out;
}


technique T0
{

    pass P0
    {
        Lighting     = false;
        CullMode     = NONE;
        ZWriteEnable = false;
        ZENABLE = false;
        CLIPPING = false;
        FILLMODE = SOLID;

        AlphaBlendEnable = true;
        SRCBLEND = ONE;
        DESTBLEND = ONE;
        
        COLOROP[0] = SELECTARG1;
        COLORARG1[0] = TEXTURE;
        ALPHAOP[0] = DISABLE;
        
        COLOROP[1] = MODULATE;
        COLORARG1[1] = CURRENT;
        COLORARG2[1] = DIFFUSE;

        VertexShader = (vshader);
        PixelShader  = (pshader);
    }
}


