blob: ee0709bd23a1afce82c76476dad6c043b1838cfd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
attribute vec3 a_position;
attribute vec2 a_normal;
attribute vec2 a_colorTexCoords;
uniform mat4 modelView;
uniform mat4 projection;
uniform mat4 pivotTransform;
varying vec2 v_colorTexCoords;
void main(void)
{
lowp vec4 pos = vec4(a_position, 1) * modelView;
highp vec4 norm = vec4(a_normal, 0, 0) * modelView;
highp vec4 shiftedPos = norm + pos;
shiftedPos = shiftedPos * projection;
float w = shiftedPos.w;
shiftedPos.xyw = (pivotTransform * vec4(shiftedPos.xy, 0.0, w)).xyw;
shiftedPos.z *= shiftedPos.w / w;
gl_Position = shiftedPos;
v_colorTexCoords = a_colorTexCoords;
}
|