//
// Fresnel, diffuseMap (texture), cubeMap (env), hemisphere lighting, bumpmap
// Per-fragment lighting
// The fresnel calculation determines the amount of reflection mixing
// 19-09-08: Created (Ruud van Gaal)
//

void main(
	float4 inPosition : POSITION,
	float3 innormal : NORMAL,
	out float4 outPosition : POSITION,
	out float4 texCoordProj : TEXCOORD0,
	out float4 diffuseLighting : TEXCOORD1,
	uniform float3 Kd,
	uniform float4x4 modelViewProj,
	uniform float3 lightDirection,
	uniform float3 lightColor,
	uniform float4x4 modelMatrix
)
{
// Transform vertex
outPosition=mul(modelViewProj, inPosition);

float3 lightDirectionw = normalize(lightDirection - inPosition.xyz);
diffuseLighting.xyz = Kd * dot(lightDirectionw, innormal);
// Compute shadow map texture coordinates
texCoordProj = mul(modelMatrix, inPosition);
}
