// Copyright 2006-2010 (C) - Frictional Games
//
// This file is part of HPL1 Engine
//
// For conditions of distribution and use, see copyright notice in LICENSE-shaders
//

///////////////////////////////////////////////////////
/// SIMPLE DIFFUSE COLOR VERTEX PROGRAM ////////////
///////////////////////////////////////////////////////

vec4 position = gl_Vertex;
vec3 normal = gl_Normal;
vec3 color = gl_Color.xyz;
vec3 uv = gl_MultiTexCoord0.xyz;

out vec3 vColor;
out vec3 vUv;
out vec3 vUv2;

uniform mat4 worldViewProj;
uniform mat4 objectWorldMatrix;
uniform vec3 eyeWorldPos;

void main()
{
	gl_Position = (worldViewProj * position);

	vColor = clamp(color, vec3(0.0), vec3(1.0));

    mat3 rotation = mat3(objectWorldMatrix);

	vec3 worldPos = (objectWorldMatrix * position).xyz;
	vec3 worldNormal = (rotation * normal);
	vec3 eyeDir = worldPos - eyeWorldPos;

	vUv = uv;
	vUv2 = reflect(eyeDir, worldNormal);
}