
void hardwareSkinningOneWeight_vp(
	float4 position : POSITION,
	float3 normal   : NORMAL,
	float2 uv       : TEXCOORD0,
	float  blendIdx : BLENDINDICES,
	
	out float4 oPosition : POSITION,
	out float2 oUv       : TEXCOORD0,
	out float4 colour           : COLOR,
			uniform float3x4   worldMatrix3x4Array[24],
	uniform float4x4 viewProjectionMatrix,
	uniform float3   lightPos[2],
	uniform float4   lightDiffuseColour[2],
	uniform float4   ambient)
{
		float4 blendPos = float4(mul(worldMatrix3x4Array[blendIdx], position).xyz, 1.0);
		oPosition = mul(viewProjectionMatrix, blendPos);
		float3 norm = mul((float3x3)worldMatrix3x4Array[blendIdx], normal);
	float3 lightDir0 = normalize(lightPos[0] - blendPos);
	float3 lightDir1 = normalize(lightPos[1] - blendPos);
	
	oUv = uv;
	colour = ambient + 
		(saturate(dot(lightDir0, norm)) * lightDiffuseColour[0]) + 
		(saturate(dot(lightDir1, norm)) * lightDiffuseColour[1]);
	
}	
void hardwareSkinningOneWeightCaster_vp(
	float4 position : POSITION,
	float3 normal   : NORMAL,
	float  blendIdx : BLENDINDICES,
	
	out float4 oPosition : POSITION,
	out float4 colour    : COLOR,
			uniform float3x4   worldMatrix3x4Array[24],
	uniform float4x4 viewProjectionMatrix,
	uniform float4   ambient)
{
		float4 blendPos = float4(mul(worldMatrix3x4Array[blendIdx], position).xyz, 1.0);
		oPosition = mul(viewProjectionMatrix, blendPos);
	
	colour = ambient;
	
}	
void hardwareSkinningFourWeights_vp(
	float4 position : POSITION,
	float3 normal   : NORMAL,
	float2 uv       : TEXCOORD0,
	float4 blendIdx : BLENDINDICES,
	float4 blendWgt : BLENDWEIGHT,
	
	out float4 oPosition : POSITION,
	out float2 oUv       : TEXCOORD0,
	out float4 colour           : COLOR,
			uniform float3x4   worldMatrix3x4Array[24],
	uniform float4x4 viewProjectionMatrix,
	uniform float3   lightPos[2],
	uniform float4   lightDiffuseColour[2],
	uniform float4   ambient)
{
		float4 blendPos = float4(0,0,0,0);
	int i;
	for (i = 0; i < 4; ++i)
	{
		blendPos += float4(mul(worldMatrix3x4Array[blendIdx[i]], position).xyz, 1.0) * blendWgt[i];
	}
		oPosition = mul(viewProjectionMatrix, blendPos);
		float3 norm = float3(0,0,0);
	for (i = 0; i < 4; ++i)
	{
		norm += mul((float3x3)worldMatrix3x4Array[blendIdx[i]], normal) * 
		blendWgt[i];
	}
	norm = normalize(norm);
	float3 lightDir0 = normalize(lightPos[0] - blendPos);
	float3 lightDir1 = normalize(lightPos[1] - blendPos);
	
	oUv = uv;
	colour = ambient + 
		(saturate(dot(lightDir0, norm)) * lightDiffuseColour[0]) + 
		(saturate(dot(lightDir1, norm)) * lightDiffuseColour[1]);
	
}	
