{"version":3,"sources":["jsdelivr-header.js","/npm/camera-unproject@1.0.1/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,IAAI,UAAY,QAAQ,qBAoBxB,SAAS,UAAW,EAAK,EAAK,EAAU,GACtC,IAAI,EAAQ,EAAS,GACnB,EAAQ,EAAS,GACjB,EAAY,EAAS,GACrB,EAAa,EAAS,GAEpB,EAAI,EAAI,GACV,EAAI,EAAI,GACR,EAAI,EAAI,GASV,OAPA,GAAQ,EACR,EAAI,EAAa,EAAI,EACrB,GAAQ,EAER,EAAI,GAAM,EAAI,EAAK,EAAY,EAC/B,EAAI,GAAM,EAAI,EAAK,EAAa,EAChC,EAAI,GAAK,EAAI,EAAI,EACV,UAAU,EAAK,EAAK,EAC7B,CApCA,OAAO,QAAU","file":"/npm/camera-unproject@1.0.1/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.19.2.\n * Original file: /npm/camera-unproject@1.0.1/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","var transform = require('./lib/projectMat4')\n\nmodule.exports = unproject\n\n/**\n * Unproject a point from screen space to 3D space.\n * The point should have its x and y properties set to\n * 2D screen space, and the z either at 0 (near plane)\n * or 1 (far plane). The provided matrix is assumed to already\n * be combined, i.e. projection * view.\n *\n * After this operation, the out vector's [x, y, z] components will\n * represent the unprojected 3D coordinate.\n *\n * @param  {vec3} out               the output vector\n * @param  {vec3} vec               the 2D space vector to unproject\n * @param  {vec4} viewport          screen x, y, width and height in pixels\n * @param  {mat4} invProjectionView combined projection and view matrix\n * @return {vec3}                   the output vector\n */\nfunction unproject (out, vec, viewport, invProjectionView) {\n  var viewX = viewport[0],\n    viewY = viewport[1],\n    viewWidth = viewport[2],\n    viewHeight = viewport[3]\n\n  var x = vec[0],\n    y = vec[1],\n    z = vec[2]\n\n  x = x - viewX\n  y = viewHeight - y - 1\n  y = y - viewY\n\n  out[0] = (2 * x) / viewWidth - 1\n  out[1] = (2 * y) / viewHeight - 1\n  out[2] = 2 * z - 1\n  return transform(out, out, invProjectionView)\n}\n"]}