precision mediump float;

varying vec3 v_normal;
uniform sampler2D u_texture;
 
uniform mat4 u_mvp;

//@{vertex

attribute vec3 a_position;
attribute vec3 a_vnormal;

const float scale = 1.0;


void main()
{
  gl_Position = u_mvp * vec4(a_position.xzy * scale * vec3(1.,1.,-1.), 1.0);
  v_normal = vec3(/*u_mvp * */vec4(a_vnormal.xzy * vec3(1.,1.,-1.), 0.0));
}
//@}

//@{fragment

void main()
{
vec3 color = vec3(0.5,0.5,0.5);
   vec3 light_dir = normalize(vec3(.5, 1.0, -.25));
vec3 norm = normalize(v_normal);

      float diffuse = max(0.0, dot(norm, light_dir));
      //float spec = max(0.0,dot(reflect(light_dir,norm),normalize(dir)));
      //spec = pow(spec, 6.0)*.5;
          
      color = mix(vec3(0.,.1,.3),vec3(1.,1.,.9),diffuse)*color +
         0.;//spec*vec3(1.,1.,.9);

  gl_FragColor = vec4(color,1.0);

  //gl_FragColor = vec4(1.0,1.0,1.0,1.0);

  //gl_FragColor = vec4(v_normal,1.0);

  //gl_FragColor = texture2D(u_texture, v_texCoord);
    //gl_FragColor += vec4(vec3(gl_FragCoord.z), 1.0);
}

//@}
