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