/*******************************************************************
*	ColorPhong.fx
*	Author - Pongthep Charnchaichujit
*	Created on - ?
*
*   All content © 2007 - 2008 DigiPen (USA) Corporation, all rights reserved.
*******************************************************************/
#include "Scene.h"

//CONSTANTS
float4x4 WorldViewProjection;

texture SpriteTex;

sampler SpriteSampler = sampler_state
{
	texture = <SpriteTex>;
};

struct VS_IN
{
	float4 pos : POSITION;
	float4 color : COLOR0;
};

struct PS_IN
{
	float4 pos : POSITION;
	float2 tex : TEXCOORD0;
	float4 color : COLOR0;
};

PS_IN ParticleVertexShader(VS_IN input)
{
	PS_IN output;
	output.pos = mul(input.pos, WorldViewProjection);
	output.tex = output.pos.xy;
	output.color = input.color;
	
	return output;
}

float4 ParticlePixelShader(PS_IN input) : COLOR
{
	float4 texColor = tex2D(SpriteSampler, input.tex);

	return float4(texColor.r*input.color.r, texColor.g*input.color.g, texColor.b*input.color.b, texColor.a);
}

//Phong Technique
technique PointSprite
{
	pass P0
	{
		VertexShader = compile vs_2_a ParticleVertexShader();
		PixelShader = compile ps_2_a ParticlePixelShader();
	}
}
