2 * \file cube_map_gouraud_frag.glsl
3 * \brief Cube map fragment shader with Gouraud shading.
8 smooth in vec4 emissionAmbientDiffuse;
9 smooth in vec4 specular;
10 smooth in vec3 texCoord0;
12 uniform mat4 colorMatrix;
13 uniform samplerCube texture0;
20 // apply cube map and determine color
21 vec4 texColor = texture(texture0, texCoord0);
22 vec4 color = clamp(mix(texColor, emissionAmbientDiffuse, 0.5) + specular, 0., 1.);
24 // transform color by color matrix
25 vec4 transformedColor = colorMatrix * vec4(color.rgb, 1.);
26 transformedColor /= transformedColor.a; // perspective division
28 // set final fragment color
29 fragColor = clamp(vec4(transformedColor.rgb, color.a), 0., 1.);