stk-code_catmod/data/shaders/normalmap.vert

30 lines
769 B
GLSL
Raw Normal View History

2014-04-10 11:34:57 -04:00
uniform mat4 ModelMatrix;
uniform mat4 InverseModelMatrix;
2014-06-27 12:14:24 -04:00
#if __VERSION__ >= 330
layout(location = 0) in vec3 Position;
layout(location = 3) in vec2 Texcoord;
layout(location = 5) in vec3 Tangent;
layout(location = 6) in vec3 Bitangent;
2014-06-27 12:14:24 -04:00
#else
in vec3 Position;
in vec2 Texcoord;
in vec3 Tangent;
in vec3 Bitangent;
#endif
out vec3 tangent;
out vec3 bitangent;
out vec2 uv;
void main()
{
2014-04-10 11:34:57 -04:00
mat4 ModelViewProjectionMatrix = ProjectionMatrix * ViewMatrix * ModelMatrix;
mat4 TransposeInverseModelView = transpose(InverseModelMatrix * InverseViewMatrix);
2014-01-17 17:50:06 -05:00
uv = Texcoord;
tangent = (TransposeInverseModelView * vec4(Tangent, 1.)).xyz;
bitangent = (TransposeInverseModelView * vec4(Bitangent, 1.)).xyz;
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
}