// shader.vert

#version 150 core

// uniform shader-parameters
uniform mat4 modelViewProjection;
uniform mat3 normalMatrix;
uniform mat4 SM_matrix; // shiftrange * lightProjection * lightView * model

// vertex-shader input variables
in vec4 vertex;
in vec4 normal;
in vec2 texCoord;

// vertex-shader output variables (passed to fragment-shader)
out vec3 world_normal;
out vec2 frag_texCoord;
out vec4 SM_texCoord;

void main()
{
	// transform normal into world space
    world_normal = normalMatrix*(normal.xyz);// (transpose(inverse(model))*normal).xyz;

	// just pass the texture coordinates to fragment-shader
	frag_texCoord = texCoord;

	// shadow texture coords in projected light space
	SM_texCoord = SM_matrix * vertex;

    // transform vertex down the pipeline
    gl_Position = modelViewProjection * vertex;
}
