#version 400
layout (location = 0) in vec3 VertexPosition;
layout (location = 1) in vec3 VertexNormal;
layout (location = 2) in vec2 VertexTexCoord;
layout (location = 3) in vec4 VertexTangent;
// .. Other uniforms
void main(void)
{
// Transform normal and tangent to eye space
vec3 norm = normalize(NormalMatrix * VertexNormal);
vec3 tang = normalize(NormalMatrix * vec3(VertexTangent));
// Compute the binormal
vec3 binormal = normalize(cross( norm, tang ))
* VertexTangent.w;
mat3 toObjectLocal = mat3(
tang.x, binormal.x, norm.x,
tang.y, binormal.y, norm.y,
tang.z, binormal.z, norm.z
);
// .. continues
}