7 uniform mat4 mvpMatrix;
8 uniform mat4 modelMatrix;
10 layout(location= 0) in
vec3 position;
11 layout(location= 2) in
vec3 normal;
12 out
vec3 vertex_position;
13 out
vec3 vertex_normal;
17 gl_Position= mvpMatrix *
vec4(position, 1);
18 vertex_position=
vec3(modelMatrix *
vec4(position, 1));
19 vertex_normal= mat3(modelMatrix) * normal;
24 #ifdef FRAGMENT_SHADER
25 uniform
vec3 camera_position;
26 uniform samplerCube texture0;
28 const float alpha= 22;
31 in
vec3 vertex_position;
32 in
vec3 vertex_normal;
33 out
vec4 fragment_color;
37 vec3 v= vertex_position - camera_position;
39 vec3 m= reflect(v, n);
41 vec3 color= texture(texture0, n).rgb;
51 fragment_color=
vec4(color, 1);
Vector normalize(const Vector &v)
renvoie un vecteur unitaire / longueur == 1.
vecteur generique, utilitaire.
vecteur generique 4d, ou 3d homogene, utilitaire.