uniform sampler2D texture;
uniform float under_attack;

varying vec3 normal, pos;

void main() {
	float opacity = 1.0 - abs(dot(normalize(normal), normalize(pos)));
	opacity *= 0.5 + (0.5 * under_attack);
	
	gl_FragColor.rgba = gl_FrontMaterial.diffuse * gl_Color * texture2D(texture, gl_TexCoord[0].xy) * opacity;
}