//
//  Sprite2d.fsh
//  PlayMate
//
//  Created by David McKibbin on 7/5/12.
//  Copyright (c) 2012 Firaxis Games. All rights reserved.
//

#ifdef GL_ES
precision mediump int;		// built-in defaults
precision highp   float;
precision lowp    sampler2D;
precision lowp    samplerCube;
#endif

uniform sampler2D BaseMap;
uniform sampler2D DecalMap;

uniform vec3  FogColor;

uniform float AlphaTest;

varying vec4  v_Color;
varying vec3  v_Light;
varying vec2  v_TexUV;
varying float v_FogDist;

void main()
{
	vec4 texel = texture2D( BaseMap, v_TexUV );

	vec4 pixel = v_Color * texel;	// blend incoming

	pixel.rgb *= v_Light;	// apply lighting last

//	pixel.rgb = mix( pixel.rgb, FogColor, v_FogDist );

	gl_FragColor = pixel;

//	if (gl_FragColor.a < AlphaTest)  discard;	// Alpha test
}
