5 uniform mat4 mvpMatrix;
7 layout(location= 0) in
vec3 position;
8 layout(location= 1) in
vec2 texcoords;
10 out
vec3 vertex_position;
11 out
vec2 vertex_texcoords;
12 out
vec3 view_position;
16 gl_Position= mvpMatrix *
vec4(position, 1);
17 vertex_position= position;
18 vertex_texcoords= texcoords;
19 view_position=
vec3(mvMatrix *
vec4(position, 1));
25 #ifdef FRAGMENT_SHADER
26 out
vec4 fragment_color;
27 in
vec3 vertex_position;
28 in
vec2 vertex_texcoords;
29 in
vec3 view_position;
31 uniform sampler2D alpha;
33 float hash2D( in
vec2 v ) {
return fract(1.0e4*sin(17.0*v.x + 0.1*v.y) * (0.1 + abs(sin(13.0*v.y + v.x)))); }
34 float hash3D( in
vec3 v ) {
return hash2D(
vec2(hash2D(v.xy), v.z)); }
51 vec4 color= texture(alpha, vertex_texcoords);
53 float i= floor(color.a * msaa);
58 float rng=
min(msaa, (color.a * msaa + hash3D(
vec3(vertex_position.xy, view_position.z)) - 0.5)) / float(msaa);
62 fragment_color=
vec4(color.rgb, rng);
Point min(const Point &a, const Point &b)
renvoie la plus petite composante de chaque point. x, y, z= min(a.x, b.x), min(a.y,...
vecteur generique, utilitaire.
vecteur generique, utilitaire.
vecteur generique 4d, ou 3d homogene, utilitaire.