2016-12-24 15:03:37 +00:00
|
|
|
#ifdef GL_ES
|
|
|
|
// Set default precision to medium
|
|
|
|
precision mediump int;
|
|
|
|
precision mediump float;
|
|
|
|
#endif
|
|
|
|
|
2017-02-06 13:53:05 +00:00
|
|
|
uniform mat4 viewProjection;
|
|
|
|
uniform mat4 normalizeModel;
|
|
|
|
uniform mat4 modelMatrix;
|
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;
|
2017-02-06 13:53:05 +00:00
|
|
|
attribute vec3 a_polyNorm;
|
|
|
|
attribute vec3 a_polyTan;
|
|
|
|
attribute vec3 a_polyBiTan;
|
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;
|
2017-02-06 13:53:05 +00:00
|
|
|
varying vec3 v_polyNorm;
|
|
|
|
varying vec3 v_polyTan;
|
|
|
|
varying vec3 v_polyBiTan;
|
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-02-06 13:53:05 +00:00
|
|
|
gl_Position = viewProjection * normalizeModel * modelMatrix * 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;
|
2017-02-06 13:53:05 +00:00
|
|
|
v_surfacePosition = vec3(normalizeModel * modelMatrix * a_position);
|
2017-01-18 16:01:43 +00:00
|
|
|
v_surfaceNormal = a_normal;
|
2017-02-06 13:53:05 +00:00
|
|
|
v_polyNorm = a_polyNorm;
|
|
|
|
v_polyTan = a_polyTan;
|
|
|
|
v_polyBiTan = a_polyBiTan;
|
2016-12-24 15:03:37 +00:00
|
|
|
}
|