#include "tail.fxh"

VertexShaderOutput VSMain(VertexShaderInput input)
{
    VertexShaderOutput output;
    
    float age;
    float normalizedAge;

	GetParticleAge(input.TexCoord.y, age, normalizedAge);

	output.Position = ComputeParticlePosition(input.Position, input.Direction, input.TexCoord.x, normalizedAge);
    output.Color = ComputeParticleColor(normalizedAge);
	
    output.Color.a = CurrentTime<=Life ? 1:0;//*= saturate( 5- 5*CurrentTime / Life);
	//output.Color = frac(normalizedAge);
	//output.Color.a = 1;
	output.TexCoord = input.TexCoord;
	output.TexCoord.x = normalizedAge * LenTilling;

    return output;
}

float4 PSMain(PS_Input input) : COLOR0
{
    return input.Color;
}

technique Tail
{
    pass P0
    {
        VertexShader = compile vs_2_0 VSMain();
        PixelShader = compile ps_2_0 PSMain();
    }
}
