varying vec2 		texcoord;
uniform sampler2D 	tex;
//uniform float		scale;
uniform vec3		color;
uniform vec4		colorMul;

#ifdef PSYSTEM

varying	float 	life;

#endif

uniform float 		alpha;

void main()
{
#ifdef PSYSTEM

	float plife=life;
	if(plife>0.0)
	{
		vec4 c=texture2D(tex,texcoord);	
		c.rgb*=color.rgb;//*scale;

		plife=clamp(plife,0.0,1.0);
		c.a*=plife;
		
		c.a*=alpha;
		gl_FragColor = c;
	}
	else
		discard;
	
#else
	
	vec4 c=texture2D(tex,texcoord);	
	c.rgb*=color.rgb*colorMul.a;//*scale;
	
	c.a*=alpha;
	gl_FragColor = c;
	
#endif
	
}
