3 precision mediump float;
6 uniform mat4 uMvpMatrix;
7 uniform mat3 uNormalMatrix;
10 uniform vec3 uDepth_InvDepth_Near;
12 #define DEPTH uDepth_InvDepth_Near.x
13 #define INV_DEPTH uDepth_InvDepth_Near.y
14 #define NEAR uDepth_InvDepth_Near.z
22 vec4 Map(vec4 v) // projection space -> texture
24 return vec4(v.xyz / (2.f * v.w) + vec3(.5f), (v.w - NEAR) * INV_DEPTH);
29 vec4 position = uMvpMatrix * vec4(aPosition * uSize, 1.f);
30 vPosition = Map(position);
31 gl_Position = position;
33 vNormal = normalize(uNormalMatrix * aNormal);