blob: eb13a2842521aa2ed069f3dcda2328738698a489 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#version 330
in vec3 vertexPosition;
in vec2 vertexTexCoord;
in vec3 vertexNormal;
in vec4 vertexColor;
uniform mat4 mvp;
uniform mat4 matNormal;
out vec2 frag_texcoord;
out vec4 frag_colour;
out vec3 frag_world_normal;
void
main() {
frag_texcoord = vertexTexCoord;
frag_colour = vertexColor;
/*
* Do not necessarily normalize here. Interpolation changes the
* length, so the fragment shader must normalize it regardless.
*/
frag_world_normal =
(matNormal * vec4(vertexNormal, 0.0)).xyz;
gl_Position = mvp * vec4(vertexPosition, 1.0);
}
|