scg3  0.6
cube_map_frag.glsl
Go to the documentation of this file.
1 /**
2  * \file cube_map_frag.glsl
3  * \brief Cube map fragment shader without shading.
4  */
5 
6 #version 150
7 
8 smooth in vec3 texCoord0;
9 
10 uniform mat4 colorMatrix;
11 uniform samplerCube texture0;
12 
13 out vec4 fragColor;
14 
15 
16 void main(void) {
17 
18  // apply cube map and determine color
19  vec4 color = texture(texture0, texCoord0);
20 
21  // transform color by color matrix
22  vec4 transformedColor = colorMatrix * vec4(color.rgb, 1.);
23  transformedColor /= transformedColor.a; // perspective division
24 
25  // set final fragment color
26  fragColor = clamp(vec4(transformedColor.rgb, color.a), 0., 1.);
27 }