#version 120
uniform mat4 P;
uniform mat4 MV;
attribute vec4 aPos; // In object space
attribute vec3 aNor; // In object space
varying vec3 color;
uniform float t;
void main()
{
vec4 temp = aPos;
temp.z = (cos(20*aPos.x + t) + sin(20*aPos.y + t))/20.0;
gl_Position = P * MV * temp;
vec3 l = vec3(0.0, 0.0, 1.0); // In camera space
vec3 tempn = aNor;
tempn.z = (cos(20*aPos.x + t) + sin(20*aPos.y + t))/20.0;
vec4 n = MV * vec4(tempn, 0.0);
color = vec3((n.x*l.x + n.y*l.y + n.z*l.z), (n.x*l.x + n.y*l.y + n.z*l.z), (n.x*l.x + n.y*l.y + n.z*l.z));
}