//
// Lighting+texture per-fragment lighting
//

void main(
	  float4 inPosition : POSITION,
	  float3 inNormal   : NORMAL,
	  float2 inTC0      : TEXCOORD0,
	  // Output
      out float4 outPosition      : POSITION,
      //out float4 outColor         : COLOR,
	  out float2 outTC0           : TEXCOORD0,
	  out float3 outNormal        : TEXCOORD1,
	  out float3 outPosW          : TEXCOORD2,
  
  // Params
  uniform float4x4 modelViewProj,
  uniform float4x4 modelView,
  uniform float4x4 modelViewIT,
  uniform float4x4 modelMatrixInv,
  uniform float4x4 modelMatrix
)
{
  // Transform vertex
  outPosition = mul(modelViewProj,inPosition);
  //outPosW = mul(modelView,inPosition);			// Transformed pos in world coords
  //outPosW = mul(modelMatrix,inPosition);			// Transformed pos in world coords
  //outPosW = mul(float3x3(modelMatrixInv),inPosition.xyz);			// Transformed pos in world coords
  //outPosW = mul(modelMatrixInv,inPosition);			// Transformed pos in world coords
  //float3 pos1=mul(modelMatrix,inPosition);
  //outPosW = mul(modelMatrixInv,inPosition);			// Transformed pos in world coords
  //outPosW = mul(modelView,inPosition);			// Transformed pos in world coords
  outPosW = mul(modelMatrix,inPosition);			// Object space to eye space
  //outPosW=inPosition;
  
  // Pass texcoords
  outTC0 = inTC0;

  // Transform normal with model transformation
  //outNormal = mul(float3x3(modelMatrix),inNormal);
  //outNormal = mul(float3x3(modelView),inNormal);
  //outNormal = mul(float3x3(modelViewIT),inNormal);
  outNormal = mul(modelMatrix,float4(inNormal,0));		// Don't translate
}
