gKit2 light
Toggle main menu visibility
Loading...
Searching...
No Matches
gkit2_tutos
draw_cubemap.glsl
Go to the documentation of this file.
1
3
#version 330
4
5
#ifdef VERTEX_SHADER
6
7
void
main( )
8
{
9
// repere projectif
10
vec2
positions[3]=
vec2
[3](
vec2
(-1,-1),
vec2
(3, -1),
vec2
(-1, 3) );
11
// place le point sur le plan far / z=1... a l'infini
12
gl_Position=
vec4
(positions[gl_VertexID], 1, 1);
13
}
14
#endif
15
16
#ifdef FRAGMENT_SHADER
17
18
uniform mat4 invMatrix;
19
uniform
vec3
camera_position;
20
uniform samplerCube texture0;
21
22
out
vec4
fragment_color;
23
24
void
main( )
25
{
26
vec4
p= invMatrix *
vec4
(gl_FragCoord.xyz, 1);
27
vec3
pixel= p.xyz / p.w;
28
29
vec3
direction=
normalize
(pixel - camera_position);
30
fragment_color= texture(texture0, direction);
31
}
32
#endif
normalize
Vector normalize(const Vector &v)
renvoie un vecteur unitaire / longueur == 1.
Definition
vec.cpp:167
vec2
vecteur generique, utilitaire.
Definition
vec.h:152
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