#version 330 core


uniform mat4  model_matrix;
uniform mat4  modelview_matrix;
uniform mat4  perspective_matrix;

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

out vec3  ex_normal;
out vec3  ex_eye;
out vec2  fragment_texcoord;

out vec4 worldspace_pos;

void main(void) {

	worldspace_pos = model_matrix * in_position;

	fragment_texcoord = in_texcoord;

	ex_normal = (model_matrix * vec4(in_normal, 0.0)).xyz;

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

	gl_Position = perspective_matrix * modelview_matrix * in_position;

}