uniform sampler2D texture0;

uniform float textureInfluence;

void main()
{
	//For correct colour mixing, we want to average the weighted texture channels together.
	vec4 textureColour = texture2D(texture0, gl_TexCoord[0].xy);
	
	textureColour.xyz *= gl_Color.xyz;
	float intensity = (textureColour.x + textureColour.y + textureColour.z) / (gl_Color.x + gl_Color.y + gl_Color.z);
	intensity = intensity * 0.8 + 0.2;
	
	gl_FragColor = vec4(gl_Color.r, gl_Color.g, gl_Color.b, gl_Color.a);
	gl_FragColor.xyz *= intensity;
	
}