//Vertex shader for terrain texturing - file "texture_terrain.vert"
//

#version 150 core

uniform mat4 perspective_matrix;
uniform mat4 modelview_matrix;
uniform mat4 lightview_matrix;

in vec4 in_position;
in vec3 in_normal;
in vec2 in_texcoord;

out vec4 out_lightspace_position;
out vec3 out_normal;
out vec3 out_eye;
out vec2 fragment_texcoord;

void main(void)
{
	fragment_texcoord = in_texcoord;

	out_normal = (modelview_matrix * vec4(in_normal, 0.0)).xyz;

	out_eye = (modelview_matrix * in_position).xyz;
	out_eye = -normalize(out_eye);

	out_lightspace_position = lightview_matrix * in_position;

	gl_Position = perspective_matrix * modelview_matrix * in_position;

}//end of main