uniform sampler2D tex;

varying vec3 normal;
varying vec3 position;

vec3 ambient = vec3(0.75, 0.25, 0.0);
vec3 light = vec3(4.0, 2.0, -8.0);
vec3 eye = vec3(0.0, 0.0, -1.0);

float shine = 16.0;
float i_a = 0.3;
float i_d = 0.4;
float i_s = 0.6;

void main()
{
	vec3 n = normalize(normal);
//	vec3 ldir = normalize(position - light);

	vec2 plane = vec2(n.x, n.y);

	vec2 tc = vec2(0.5 + plane.x, 0.5 + plane.y);
	vec4 emap = vec4(texture2D(tex, tc).a);



//	float dif = dot(n,ldir);

//	vec3 r = reflect(ldir, n);
//	float spec = pow(max(dot(r,eye), 0.0), shine);

//	vec3 c = i_a*ambient + i_d*vec3(dif) + i_s * vec3(spec);

	gl_FragColor = emap; //vec4(c, 1.0);
}
