2016-12-24 15:03:37 +00:00
|
|
|
#ifdef GL_ES
|
|
|
|
// Set default precision to medium
|
|
|
|
precision mediump int;
|
|
|
|
precision mediump float;
|
|
|
|
#endif
|
|
|
|
|
2016-12-31 11:31:38 +00:00
|
|
|
uniform mat4 vp_matrix;
|
2017-01-02 16:03:23 +00:00
|
|
|
uniform mat4 norm_matrix;
|
2016-12-31 11:31:38 +00:00
|
|
|
uniform mat4 m_matrix;
|
2016-12-24 15:03:37 +00:00
|
|
|
|
|
|
|
attribute vec4 a_position;
|
|
|
|
attribute vec2 a_texcoord;
|
2017-01-08 13:41:53 +00:00
|
|
|
attribute vec3 a_normal;
|
2016-12-24 15:03:37 +00:00
|
|
|
|
2017-01-18 16:01:43 +00:00
|
|
|
varying vec2 v_surfaceUV;
|
|
|
|
varying vec3 v_surfacePosition;
|
|
|
|
varying vec3 v_surfaceNormal;
|
2016-12-24 15:03:37 +00:00
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2016-12-31 11:31:38 +00:00
|
|
|
// Calculate vertex position in screen space
|
2017-01-02 16:03:23 +00:00
|
|
|
gl_Position = vp_matrix * norm_matrix * m_matrix * a_position;
|
2016-12-24 15:03:37 +00:00
|
|
|
|
2017-01-17 10:15:30 +00:00
|
|
|
// Pass data to fragment shader
|
2016-12-31 11:31:38 +00:00
|
|
|
// Value will be automatically interpolated to fragments inside polygon faces
|
2017-01-18 16:01:43 +00:00
|
|
|
v_surfaceUV = a_texcoord;
|
|
|
|
v_surfacePosition = vec3(norm_matrix * m_matrix * a_position);
|
|
|
|
v_surfaceNormal = a_normal;
|
2016-12-24 15:03:37 +00:00
|
|
|
}
|