// This is C3E2v_varying from "The Cg Tutorial" (Addison-Wesley, ISBN
// 0321194969) by Randima Fernando and Mark J. Kilgard.  See page 65.

/************* UN-TWEAKABLES **************/

float4x4 WorldITXf : WorldInverseTranspose	< string UIWidget="None"; >;
float4x4 WvpXf     : WorldViewProjection	< string UIWidget="None"; >;
float4x4 WorldXf   : World					< string UIWidget="None"; >;
float4x4 ViewIXf   : ViewInverse			< string UIWidget="None"; >;

uniform float3 globalAmbient;
uniform float3 lightColor;
uniform float3 lightPosition;
uniform float3 eyePosition;
uniform float3 Ke;
uniform float3 Ka;
uniform float3 Kd;
uniform float3 Ks;
uniform float  shininess;

struct VertexInput
{
	float4 position  : POSITION;
	float3 normal    : NORMAL;
	float2 texCoord : TEXCOORD0;
};


struct VertexOutput {
  float4 position : POSITION;
  float3 color    : COLOR;
  float2 texCoord : TEXCOORD0;
};

VertexOutput C3E2v_varying(in VertexInput IN)
{
  VertexOutput OUT;
  float4 modelPos = float4(IN.position.xyz, 1);
  
  OUT.position = mul(modelPos, WvpXf);
  OUT.color = Ka;
  OUT.texCoord = IN.texCoord;
  return OUT;	
}

