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