gKit2 light
Toggle main menu visibility
Loading...
Searching...
No Matches
gkit2_tutos
M2
indirect_elements.glsl
1
#version 430
2
3
#ifdef VERTEX_SHADER
4
5
layout(location= 0) in
vec3
position;
6
layout(location= 2) in
vec3
normal;
7
out
vec3
vertex_normal;
8
9
uniform mat4 mvpMatrix;
10
uniform mat4 mvMatrix;
11
12
void
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
23
in
vec3
vertex_normal;
24
out
vec4
fragment_color;
25
26
void
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
max
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
normalize
Vector normalize(const Vector &v)
renvoie un vecteur unitaire / longueur == 1.
Definition
vec.cpp:167
vec3
vecteur generique, utilitaire.
Definition
vec.h:169
vec4
vecteur generique 4d, ou 3d homogene, utilitaire.
Definition
vec.h:192
Generated on
for gKit2 light by
1.17.0