2026-05-07 16:31:43 +02:00
|
|
|
// Vertex shader for tilt-shift effect.
|
|
|
|
|
//
|
|
|
|
|
// uTexMatrix: applied to texcoords. For the passthrough pass it carries the
|
|
|
|
|
// SurfaceTexture transform (sensor → display rotation, plus Y-flip). For the
|
|
|
|
|
// blur passes it is identity.
|
|
|
|
|
// uMirrorX: 1.0 to horizontally mirror texcoords (front-camera selfie view),
|
|
|
|
|
// 0.0 otherwise. Applied AFTER uTexMatrix.
|
2026-01-28 15:26:41 +01:00
|
|
|
|
|
|
|
|
attribute vec4 aPosition;
|
|
|
|
|
attribute vec2 aTexCoord;
|
|
|
|
|
|
2026-05-07 16:31:43 +02:00
|
|
|
uniform mat4 uTexMatrix;
|
|
|
|
|
uniform float uMirrorX;
|
|
|
|
|
|
2026-01-28 15:26:41 +01:00
|
|
|
varying vec2 vTexCoord;
|
|
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
|
gl_Position = aPosition;
|
2026-05-07 16:31:43 +02:00
|
|
|
vec2 tc = (uTexMatrix * vec4(aTexCoord, 0.0, 1.0)).xy;
|
|
|
|
|
if (uMirrorX > 0.5) tc.x = 1.0 - tc.x;
|
|
|
|
|
vTexCoord = tc;
|
2026-01-28 15:26:41 +01:00
|
|
|
}
|