         out     vec4            fragmentColour; //!< The computed output colour of this particular pixel;
 
 
+/// <summary> Updates the ambient, diffuse and specular colours from the materialTBO for this fragment. </summary>
+void obtainMaterialProperties();
+
 /// <summary> Can be used to colour the scene using red, green or and blue triangles. </summary>
 /// <returns> A single colour based on the primitive ID of the current triangle. </returns>
 vec3 primitiveColour();

    
    // Calculate the final attenuation value.
    float attenuation = 1.0 / (kc + kl * distance + kq * distance * distance);
    
    // Comment the next line for smoothstep.
    return attenuation;    
}



//float spotLightAttenuation (const Light light, const vec3 L, const float distance, const unsigned int concentration);

const float ka  = 0.0;
const float kd  = 1.0;
const float ks  = 0.0;

vec3 ambient    = vec3 (1.0, 1.0, 1.0) * ka;
vec3 diffuse    = vec3 (1.0, 1.0, 1.0) * kd;
vec3 specular   = vec3 (1.0, 1.0, 1.0) * ks;
float shininess = 16.0;


void main()
{
    // Ensure we're using the correct colours.
    obtainMaterialProperties();

    // Parameters.
    vec3 Q = worldPosition;
    vec3 N = normalize (worldNormal);
