
varying vec3 NormalOut;
varying vec3 VertexToLight;
varying vec4 ColorOut;
varying vec3 PosOut;

#vertexshader

//attribute vec4 Vertex;


void main()
{
	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
	NormalOut = gl_NormalMatrix * gl_Normal;
	
	ColorOut = gl_Color;
	PosOut = gl_Position.xyz;
	
	vec4 VertexModelView = gl_ModelViewMatrix * gl_Vertex;
	VertexToLight = (gl_ModelViewMatrix * vec4(100.0,100.0,100.0,1.0) - VertexModelView).xyz;
	gl_TexCoord[0] = gl_MultiTexCoord0;
}

#fragmentshader

uniform float someval;
uniform sampler2D texture;
void main()
{
	vec3 LightDir = normalize(VertexToLight);
	vec3 Normal = normalize(NormalOut);
	vec2 TexCoord = gl_TexCoord[0].xy;
	TexCoord.y += someval * 0.2;
	vec3 Col = texture2D(texture, TexCoord).xyz*ColorOut.xyz;//lerp(ColorOut.xyz,texture2D(texture, TexCoord).xyz, 1.0);
	vec3 c = clamp(dot(LightDir, Normal),0.0,1.0) * Col.xyz;// * 0.7;
	gl_FragColor = vec4(c,1);
}
