5 layout(location= 0) in
vec3 position;
6 layout(location= 1) in
vec2 texcoord;
7 layout(location= 2) in
vec3 normal;
9 uniform mat4 mvpMatrix;
10 uniform mat4 mvMatrix;
11 uniform mat4 normalMatrix;
13 out
vec3 vertex_position;
14 out
vec2 vertex_texcoord;
15 out
vec3 vertex_normal;
19 gl_Position= mvpMatrix *
vec4(position, 1);
20 vertex_position=
vec3(mvMatrix *
vec4(position, 1));
21 vertex_texcoord= texcoord;
22 vertex_normal= mat3(normalMatrix) * normal;
27 #ifdef FRAGMENT_SHADER
28 uniform sampler2D color_texture;
30 in
vec3 vertex_position;
31 in
vec2 vertex_texcoord;
32 in
vec3 vertex_normal;
34 out
vec4 fragment_color;
41 vec4 color= texture(color_texture, vertex_texcoord);
42 fragment_color= cos_theta * color;
Vector normalize(const Vector &v)
renvoie un vecteur unitaire / longueur == 1.
vecteur generique, utilitaire.
vecteur generique, utilitaire.
vecteur generique 4d, ou 3d homogene, utilitaire.
float dot(const Vector &u, const Vector &v)
renvoie le produit scalaire de 2 vecteurs.