//----------------------------------------------------
// Input constants
//----------------------------------------------------
extern float4x4 mWorldViewProjBillboard;

// Material
extern float4 MatDiffuse;

//----------------------------------------------------
// Input struct
//----------------------------------------------------
struct VS_INPUT
{
    float4 Position   : POSITION;
    float4 Normal     : NORMAL;
    float4 Color      : COLOR0;
    float2 Texture    : TEXCOORD0;
};

//----------------------------------------------------
// Output struct
//----------------------------------------------------
struct VS_OUTPUT
{
    float4 Position   : POSITION;
    float2 Texture    : TEXCOORD0;
    float4 Color	  : COLOR0;
};

//----------------------------------------------------
// Vertex shader phong lighting
//----------------------------------------------------
VS_OUTPUT vs_main( VS_INPUT In )
{
	VS_OUTPUT Out;
	
	float4 vPosition		= In.Position;
	Out.Texture				= In.Texture;
	Out.Position			= mul( mWorldViewProjBillboard, vPosition );
	
//	float4 TmpColor = { 1,0.5,0.3,1 };
	float4 TmpColor = { 1,1,1,1 };
	
	Out.Color.rgb = TmpColor * In.Color;
	Out.Color.a = In.Color.a;

    return Out;                         //return output vertex
}

//--------------------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////////////
//--------------------------------------------------------------------------------------

// Pixel shader input structure
struct PS_INPUT
{
    float4 Position   : POSITION;
    float2 Texture    : TEXCOORD0;
    float4 Diffuse	  : COLOR0;
};

// Pixel shader output structure
struct PS_OUTPUT
{
    float4 Color   : COLOR0;
};

// Global variables
sampler2D Tex0;

// Name: Simple Pixel Shader
// Type: Pixel shader
// Desc: Fetch texture and blend with constant color
PS_OUTPUT ps_main( in PS_INPUT In )
{
    PS_OUTPUT Out;                             //create an output pixel

    Out.Color = tex2D( Tex0, In.Texture ) * In.Diffuse;       //do a texture lookup
    
    return Out;                                //return output pixel
}
