/**
 *
 * Diplomova prace
 * Stinove techniky na dnesnim hardware a jejich porovnani
 *
 * Michal Toth
 *
 * Fakulta informacnich technologii
 * Vysoke uceni technicke v Brne
 *
 * 2013/2014
 *
 */

/**
 * Vertex shader pro stinove mapy
 * predava pozici transformovanou do souradnic stinove mapy
 */

#version 420

in vec3 pos;
in vec3 norm;
in vec2 tex;

uniform mat4 mvp;
uniform mat4 m;
uniform mat4 mNorm;

out vec2 tc;
out vec3 position;
out vec3 normal;

uniform mat4 shadowMat;
out vec4 shadowPos;

const mat4 bias = mat4(0.5, 0.0, 0.0, 0.0,
		       0.0, 0.5, 0.0, 0.0,
		       0.0, 0.0, 0.5, 0.0,
		       0.5, 0.5, 0.5, 1.0);

void main() {
    gl_Position = mvp * m * vec4(pos,1);

    tc=tex;
    position = (m * vec4(pos,1)).xyz;
    normal = (mNorm * vec4(norm,1)).xyz;


    shadowPos=bias*shadowMat* m * vec4(pos,1.0);
}
