
// Shader output, position and diffuse color
struct VS_OUTPUT
{
    float4 pos  : POSITION;
    float4 diff : COLOR0;
    float2 Txcoord0 : TEXCOORD0;
};

// The world view and projection matrices
float4x4 World;
float4x4 ViewProj;


float4 DiffuseIn;

float TweenPos;

float GlowSize;

VS_OUTPUT TweenGlow(float4 Pos0  : POSITION0, float3 Normal0 : NORMAL0, float2 Txcoord0 : TEXCOORD0, float4 Pos1  : POSITION1, float3 Normal1 : NORMAL1, float2 Txcoord1 : TEXCOORD1, float4 Pos2  : POSITION2, float3 Normal2 : NORMAL2, float2 Txcoord2 : TEXCOORD2)
{
    VS_OUTPUT Out = (VS_OUTPUT)0;
	
	float invTweenPos = 1 - TweenPos;
	float4 pos01 = invTweenPos*Pos0 + TweenPos*Pos1;
	float3 normal01 = invTweenPos*Normal0 + TweenPos*Normal1;	
	
		
	float3 wPos = mul(pos01, World);
	float3 wNormal = mul(normal01, World);
	wNormal = normalize(wNormal);				
			
	wPos += wNormal*GlowSize;
	
    Out.pos = mul(float4(wPos.xyz, 1.0f), ViewProj);	
    Out.Txcoord0 = Txcoord0;
    
	Out.diff = DiffuseIn;		

    return Out;
}


technique TweenGlow
{
    pass P0
    {    
        // shaders
        VertexShader = compile vs_1_1 TweenGlow();
        PixelShader  = NULL;
    }
} 