#ifdef VSPS_3
shared float4x4 projTM: register(c0);
shared float4x4 worldTM: register(c4);
shared float4x4 worldITM: register(c8);
shared float4x4 Bones[ 32 ]: register(c12);
shared float4 eyePosns[ 32 ]: register(c140);
shared float4 lightPosns[ 32 ]: register(c172);
shared float4 eyePos: register(c204);
shared float4 lightPos: register(c205);

shared float4 uvOffset_0: register(c206);
shared float4 uvOffset_1: register(c207);

shared float4 combo: register(c208);
// shared float Reflect_amt: register(c208);
// shared float Lighting: register(c209);
// shared float Bump: register(c210);
// shared float uvOffsetY: register(c211);
shared float4 Color_1: register(c212);
shared float4 Color_2: register(c213);
shared float4 Specular_Color: register(c214);
#else
shared float4x4 projTM;
shared float4x4 worldTM;
shared float4x4 worldITM;
shared float4x4 Bones[ 32 ];
shared float4 eyePosns[ 32 ];
shared float4 lightPosns[ 32 ];
shared float4 eyePos;
shared float4 lightPos;

shared float4 uvOffset_0;
shared float4 uvOffset_1;

shared float4 combo;
// shared float Reflect_amt;
// shared float Lighting;
// shared float Bump;
// shared float uvOffsetY;
shared float4 Color_1;
shared float4 Color_2;
shared float4 Specular_Color;
#endif


struct Technique1_Pass1_VS_OUT 
{
	float4 position : POSITION;
	float4 vCol : COLOR0;
};


Technique1_Pass1_VS_OUT Technique1_Pass1_VS(
		float4 posB : POSITION,
#if USEVERTCOLOUR == 1
		float4 vCol : COLOR0,
#endif
		float3 norm : NORMAL,
		int BoneNum : BLENDINDICES
		)
{
	Technique1_Pass1_VS_OUT OUT;

	OUT.position = mul( posB, Bones[BoneNum]);
	float4 surface1 = posB;
	float3 norm1 = normalize(norm.xyz);

	float3 eyeVect = normalize(eyePosns[BoneNum].xyz-surface1.xyz);

	float fall1 = 1.0001f-dot(eyeVect, norm1);
// FalloffAmount
	float fall2 = pow(fall1, Color_2.w);
	float4 fallcol1 = lerp(Color_1, Color_2, fall2);
#if USEVERTCOLOUR == 1
	OUT.vCol = fallcol1*vCol;
#else
	OUT.vCol = fallcol1;
#endif
	return OUT;
}


float4 Technique1_Pass1_PS(
		float4 vCol : COLOR0
		) : COLOR
{
	return vCol;
}


technique Technique1
{
	pass Pass1
	{
#ifdef VSPS_3
		VertexShader = compile vs_3_0 Technique1_Pass1_VS();
		PixelShader = compile ps_3_0 Technique1_Pass1_PS();
#else
		VertexShader = compile vs_2_0 Technique1_Pass1_VS();
		PixelShader = compile ps_2_0 Technique1_Pass1_PS();
#endif
	}
}
