gKit2 light
Loading...
Searching...
No Matches
indirect_elements.glsl
1#version 430
2
3#ifdef VERTEX_SHADER
4
5layout(location= 0) in vec3 position;
6layout(location= 2) in vec3 normal;
7out vec3 vertex_normal;
8
9uniform mat4 mvpMatrix;
10uniform mat4 mvMatrix;
11
12void main( )
13{
14 gl_Position= mvpMatrix * vec4(position, 1);
15
16 vertex_normal= mat3(mvMatrix) * normal;
17}
18#endif
19
20
21#ifdef FRAGMENT_SHADER
22
23in vec3 vertex_normal;
24out vec4 fragment_color;
25
26void main( )
27{
28 vec3 normal= normalize( vertex_normal );
29
30 // matiere diffuse...
31 vec3 color= vec3(0.8, 0.8, 0.8);
32 float cos_theta= max(0.0, normal.z);
33 color= color * cos_theta;
34
35 fragment_color= vec4(color, 1);
36}
37
38#endif
Point max(const Point &a, const Point &b)
renvoie la plus grande composante de chaque point { max(a.x, b.x), max(a.y, b.y), max(a....
Definition vec.cpp:35
Vector normalize(const Vector &v)
renvoie un vecteur unitaire / longueur == 1.
Definition vec.cpp:167
vecteur generique, utilitaire.
Definition vec.h:169
vecteur generique 4d, ou 3d homogene, utilitaire.
Definition vec.h:192