blob: fa901f6ec983ed857eed85ef55fbab44bd9c4dfd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
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)
{
// Here we intentionally decrease precision of 'pivot' calculation
// to eliminate jittering effect in process of billboard reconstruction.
lowp vec4 pivot = vec4(a_position, 1) * modelView;
vec4 offset = vec4(a_normal, 0, 0) * projection;
vec4 projectedPivot = pivot * projection;
vec4 transformedPivot = pivotTransform * vec4(projectedPivot.xy, 0.0, 1.0);
vec4 scale = pivotTransform * vec4(1.0, -1.0, 0, 1.0);
gl_Position = transformedPivot + vec4(offset.xy * transformedPivot.w / scale.w * scale.x, 0, 0);
v_colorTexCoords = a_colorTexCoords;
}
|