1 precision mediump float;
4 uniform mat4 uMvpMatrix;
9 uniform vec4 uUvTransform; // rotation, scale (initial, target))
11 attribute vec2 aPosition;
18 vec4 position = uMvpMatrix * vec4(aPosition * uSize.xy, 0., 1.);
20 gl_Position = position;
22 vec2 uv = position.xy / (position.ww * 2.);
25 float alpha = uFlow * .5 + .5;
26 vec2 uvRotationScale = mix(uUvTransform.xy, uUvTransform.zw, alpha);
27 float c = cos(uvRotationScale.x) * uvRotationScale.y;
28 float s = sin(uvRotationScale.x) * uvRotationScale.y;
29 vec4 uvMatrix = vec4(c, -s, s, c);
30 uv = vec2(dot(uvMatrix.xy, uv), dot(uvMatrix.zw, uv));
32 // N.B. +y is down which is well aligned with the inverted y of the off-screen render,
33 // however we need to flip the y of the uvs for the flow map.
34 vUvFlow = vec2(uv.x + .5, .5 - uv.y);