float4x3			c_mWorld											: WORLD;				///< für statische Meshes
float4x4			c_mWorldViewProj									: WORLDVIEWPROJECTION;
float4x4			c_mViewProj											: VIEWPROJECTION;


texture2D g_tTexture;

sampler2D g_sTextureSampler =
sampler_state
{
    Texture = <g_tTexture>;
    MinFilter = Linear;
    MagFilter = Linear;
    MipFilter = Linear;
};

struct VS_INPUT
{
    float3  vPositionOS     : POSITION;
    float2  vTexCoord       : TEXCOORD0;
    float4  vColor          : COLOR0;
};

struct VS_OUTPUT
{
    float4 vPositionPS      : POSITION0;
    float2 vTexCoord        : TEXCOORD0;
    float4 vColor           : COLOR0;
};


VS_OUTPUT vsMain(VS_INPUT i)
{
    VS_OUTPUT o;
    o.vPositionPS = mul(float4(i.vPositionOS, 1), c_mWorldViewProj);
    o.vTexCoord = i.vTexCoord;
    o.vColor = i.vColor;
    
    return o;
}

float4 psMain(VS_OUTPUT i) : COLOR0
{
    return i.vColor * tex2D(g_sTextureSampler, i.vTexCoord);
}


technique ambientpass_particlemesh
{
}

technique lightpass_particlemesh
{
    pass p0
    {
        CullMode = none;
        
        VertexShader = compile vs_1_1 vsMain();
        PixelShader = NULL;
        
        Texture[0] = g_tTexture;
        MinFilter[0] = Linear;
        MagFilter[0] = Linear;
        MipFilter[0] = Linear;
        
        ColorOp[0] = Modulate;
        ColorArg1[0] = Texture;
        ColorArg2[0] = Diffuse;
        ColorOp[1] = Disable;
        
        AlphaOp[0] = Modulate;
        AlphaArg1[0] = Texture;
        AlphaArg2[0] = Diffuse;
        AlphaOp[1] = Disable;
        

        AlphaTestEnable = true;
        AlphaRef = 0;
        AlphaFunc = greater;
        
        AlphaBlendEnable = true;
        SrcBlend = SrcAlpha;
        DestBlend = One;
        
        ZEnable = true;
        ZWriteEnable = false;
        ZFunc = less;
    }
    
    pass restore
    {
        ZFunc = equal;
    }
}
