#version 150
#extension GL_ARB_explicit_attrib_location : enable

uniform sampler2D Tex0;
uniform sampler2D TexLightMap;

in vertexData
{
	vec2 UV0;
	vec2 UVLightMap;
} v;

out vec4 outColor;


uniform float dgA;
uniform float dgB;
uniform float dgC;
uniform float dgD;

void main(void)
{	
	//vec4 diffuseFactor = texture2D(TexLightMap, v.UVLightMap);
	vec4 diffuseFactor = vec4(texture2D(TexLightMap, v.UVLightMap).r)*vec4(3.0f);
	vec4 texColor = pow(texture2D(Tex0, v.UV0), vec4(2.2f));
	/*
	if(diffuseFactor <= dgA) diffuseFactor = dgA;
	else if (diffuseFactor < dgB) diffuseFactor = dgB;
	else if (diffuseFactor < dgC) diffuseFactor = dgC;
	else diffuseFactor = dgD;
	*/
	

	outColor = diffuseFactor*texColor;
	outColor = pow(outColor, vec4(1/2.2f));
	//outColor += vec4(specudgArFactor, 1.0);
}