uniform sampler2D spcTex1;
uniform sampler2D spcTex2;
varying vec3 LightDir;
varying vec3 EyeDir;
varying vec3 color;


uniform float SpecularFactor;

void main(void)
{
	vec3 litColor;

	
	vec4 nmap2 = texture2D(spcTex1,vec2(gl_TexCoord[0]));
	vec4 col = texture2D(spcTex2,gl_TexCoord[0].xy);
	
	vec3  nmap= vec3(nmap2);
	litColor = color * max(dot(nmap,LightDir),0.0);
	vec3 reflectDir = reflect(LightDir,nmap);
	
	float spec = max(dot(EyeDir,reflectDir),0.0);
	spec = pow(spec,8.0);
	spec*=SpecularFactor;
	litColor = min(litColor + spec*0.5,vec3(1.0));//*/
	col = min(col + spec*0.5,vec3(1.0)); 
	
//	litColor+=vec3(0.02,0.02,0.02);
	vec3 mmorpgpiss = litColor*vec3(col)*1.8+vec3(nmap2)*0.01;
	//mmorpgpiss = vec3(0.6,0.6,0.8);
	//mmorpgpiss = col;
	//mmorpgpiss.r=0.3;

/*mmorpgpiss.r+=0.01;
mmorpgpiss.g+=0.01;
mmorpgpiss.b+=0.02;*/
	gl_FragColor =vec4(mmorpgpiss,1.0);
}

