/********************************************************************************
FILE		:	Particle.fx
AUTHOR		:	Chad Taylor
DATE		:	10/30/06
TEAM		:	Double Hawk Games

All content (c) 2006-2007 DigiPen (USA) Corporation, all rights reserved.
********************************************************************************/
uniform extern float4x4 matViewProject;
uniform extern float4x4 matWorld;
uniform extern float4	colAmbient;
uniform extern texture	txTexture;

sampler TexSample = sampler_state
{
	Texture   = <txTexture>;
	MinFilter = LINEAR;
	MagFilter = LINEAR;
	AddressU  = CLAMP;
	AddressV  = CLAMP;
};
	
struct VS_OUTPUT
{
	float4 posH:	POSITION;
	float2 tex0:	TEXCOORD1;
};

VS_OUTPUT VS(	float3 posL:	POSITION,
				float2 tex0:	TEXCOORD0 )
{
	VS_OUTPUT outVS = (VS_OUTPUT)0;
	
	// Transform position to world space
	outVS.posH = mul(float4(posL, 1.0f), matWorld);

	// Transform to position to homogeneous clip space
	outVS.posH = mul(outVS.posH,  matViewProject);

	outVS.tex0 = tex0;
	
	return outVS;
}

float4 PS(	float3 normalW	: TEXCOORD0,
			float2 tex0		: TEXCOORD1,
			float3 lightW	: TEXCOORD2 ) : COLOR
{
	// Grab the texture color here
	float4 texColor = tex2D( TexSample, tex0 );
	return texColor * colAmbient;
}

technique ParticleTech
{
	pass Addative
	{
		vertexShader = compile vs_2_0 VS();
		pixelShader  = compile ps_2_0 PS();
	    ZWriteEnable = false;
		
   	    AlphaBlendEnable = true;
	    SeparateAlphaBlendEnable = true;
	    
	    BlendOp = Add;
		SrcBlend = SrcAlpha;
		DestBlend = One;
	}
	
	pass Subtractive
	{
		vertexShader = compile vs_2_0 VS();
		pixelShader  = compile ps_2_0 PS();
	    ZWriteEnable = false;

		
   
	    AlphaBlendEnable = true;
	    SeparateAlphaBlendEnable = true;
	    
	    BlendOp = RevSubtract;
		SrcBlend = SrcAlpha;
		DestBlend = One;
	}
}
