uniform float offset;
uniform sampler2D T0;
varying vec4 worldPosition;
varying vec4 modelPosition;
varying vec4 lightCol;
varying vec3 normal;
uniform float amp;


void main(void) 
{
  vec3 lightpos = vec3(10,0,0);

  float l = length(worldPosition)*.5;
  //gl_FragColor = cos(offset);
 
  float dx = cos(worldPosition.z*500.0)*.3;
  float dy = sin(l*50.0)*.3;

  vec2 texCoord = vec2(normal.x, normal.y)*.5;
  vec4 texel =texture2D(T0, texCoord);

  float ld = 10.0/length(lightpos - worldPosition.xyz);
  vec3 ln = normalize(lightpos-worldPosition.xyz);
  float li = dot(ln,normal);


  float d = dot(normal, vec3(0.0,0.0,1.0));
  gl_FragColor =  vec4(vec3(d*ld*li*amp),0.0);
}
                            
