Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private final String quadVS =
- "precision mediump float;\n" +
- "attribute vec4 vPosition;\n" +
- "uniform vec4 uRatio;\n" +
- "varying vec4 Position;\n" +
- "void main() {\n" +
- " gl_Position = vPosition;\n" +
- " Position = vPosition / uRatio;\n" +
- "}\n";
- private final String quadFS =
- "#extension GL_OES_EGL_image_external : require\n" +
- "precision mediump float;\n" +
- "uniform samplerExternalOES uTexture0;\n" +
- "uniform sampler2D uTexture1;\n" +
- "uniform sampler2D uTexture2;\n" +
- "uniform vec3 uRotate;\n" +
- "varying vec4 Position;\n" +
- "void main() {\n" +
- " float sx = Position.x;\n" +
- " float sy = -Position.y;\n" +
- " float sz = sqrt(1.0 + sx * sx + sy * sy);\n" +
- " float rx = sx / sz;\n" +
- " float ry = sy / sz;\n" +
- " float rz = sqrt(1.0 - rx * rx - ry * ry);\n" +
- " float tx = (1.0 + rx) * 0.5;\n" +
- " float y = (rz * uRotate.y - ry * uRotate.z);\n" +
- " float z = (ry * uRotate.y + rz * uRotate.z);\n" +
- " vec2 vCoord;\n" +
- " if (abs(z) > abs(y)) {\n" +
- " vec4 vTex = texture2D(uTexture1, vec2(tx, (1.0 - y) * 0.5));\n" +
- " vec4 vOff = floor(vTex * 255.0 + 0.5);\n" +
- " vCoord = vec2(\n" +
- " (vOff.y * 256.0 + vOff.x) / 4095.0,\n" +
- " (vOff.w * 256.0 + vOff.z) / 4095.0);\n" +
- " if (z < 0.0) { vCoord.x = 1.0 - vCoord.x; }\n" +
- " }\n" +
- " else {\n" +
- " vec4 vTex = texture2D(uTexture2, vec2(tx, (1.0 + z) * 0.5));\n" +
- " vec4 vOff = floor(vTex * 255.0 + 0.5);\n" +
- " vCoord = vec2(\n" +
- " (vOff.y * 256.0 + vOff.x) / 4095.0,\n" +
- " (vOff.w * 256.0 + vOff.z) / 4095.0);\n" +
- " if (y < 0.0) { vCoord.y = 1.0 - vCoord.y; }\n" +
- " }\n" +
- " vCoord.x += uRotate.x;\n" +
- " if (vCoord.x >= 1.0) { vCoord.x -= 1.0; }\n" +
- " gl_FragColor = texture2D(uTexture0, vCoord);\n" +
- "}\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement