2 * \file gouraud_frag.glsl
3 * \brief Gouraud fragment shader, use external function applyTexture().
8 smooth in vec4 emissionAmbientDiffuse;
9 smooth in vec4 specular;
10 smooth in vec4 texCoord0;
12 uniform mat4 colorMatrix;
17 // --- declarations ---
20 vec4 applyTexture(const in vec4 texCoord, const in vec4 emissionAmbientDiffuse,
21 const in vec4 specular);
24 // --- implementations ---
29 // apply texture and determine color (to be defined in separate shader)
30 vec4 color = applyTexture(texCoord0, emissionAmbientDiffuse, specular);
32 // transform color by color matrix
33 vec4 transformedColor = colorMatrix * vec4(color.rgb, 1.);
34 transformedColor /= transformedColor.a; // perspective division
36 // set final fragment color
37 fragColor = clamp(vec4(transformedColor.rgb, color.a), 0., 1.);