1
attribute vec3 position;
2
attribute vec2 texcoord;
4
attribute vec3 tangent;
6
uniform mat4 ModelViewProjectionMatrix;
7
uniform mat4 NormalMatrix;
9
varying vec2 TextureCoord;
10
varying vec3 NormalEye;
11
varying vec3 TangentEye;
12
varying vec3 BitangentEye;
16
TextureCoord = texcoord;
18
// Transform normal, tangent and bitangent to eye space, keeping
19
// all of them perpendicular to the Normal. That is why we use
20
// NormalMatrix, instead of ModelView, to transform the tangent and
22
NormalEye = normalize(vec3(NormalMatrix * vec4(normal, 1.0)));
23
TangentEye = normalize(vec3(NormalMatrix * vec4(tangent, 1.0)));
24
BitangentEye = normalize(vec3(NormalMatrix * vec4(cross(normal, tangent), 1.0)));
26
// Transform the position to clip coordinates
27
gl_Position = ModelViewProjectionMatrix * vec4(position, 1.0);