/*! * The MIT License (MIT) * * Copyright (c) 2019 Tarek Sherif * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * the Software, and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ !function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.MercatorGL=n():e.MercatorGL=n()}(window,(function(){return function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=0)}([function(e,n,t){"use strict";t.r(n);t.d(n,"highPrecisionLngLat",(function(){return i})),t.d(n,"injectMercatorGLSL",(function(){return _})),t.d(n,"allocateMercatorUniforms",(function(){return g})),t.d(n,"updateMercatorUniforms",(function(){return u})),t.d(n,"pixelsPerMeter",(function(){return L})),t.d(n,"pixelsPerDegree",(function(){return m})),t.d(n,"lngLatToMercator",(function(){return f})),t.d(n,"mercatorToClip",(function(){return v})),t.d(n,"lngLatToClip",(function(){return s}));const r=Math.PI,o=r/4,a=r/180;let c=new Float64Array(4),l=new Float32Array(2);function i(e,n=0,t=2){let r=Math.ceil((e.length-n)/t),o=new Float32Array(2*r);for(let a=0;a= MERCATOR_GL_OFFSET_THRESHOLD) {\n mercatorPosition.w = 0.0;\n }\n vec4 clipPosition = mercator_gl_viewProjectionMatrix * mercatorPosition;\n if (mercator_gl_scale >= MERCATOR_GL_OFFSET_THRESHOLD) {\n clipPosition += mercator_gl_clipCenter;\n }\n\n return clipPosition;\n}\n\nvec4 mercator_gl_lngLatToClip(vec3 lngLatElevation, vec2 lngLatPrecision) {\n return mercator_gl_mercatorToClip(mercator_gl_lngLatToMercator(lngLatElevation, lngLatPrecision));\n}\n\nvec4 mercator_gl_lngLatToClip(vec3 lngLatElevation) {\n return mercator_gl_lngLatToClip(lngLatElevation, vec2(0.0));\n}\n\nvec4 mercator_gl_lngLatToClip(vec2 lngLat, vec2 lngLatPrecision) {\n return mercator_gl_lngLatToClip(vec3(lngLat, 0.0), lngLatPrecision);\n}\n\nvec4 mercator_gl_lngLatToClip(vec2 lngLat) {\n return mercator_gl_lngLatToClip(vec3(lngLat, 0.0));\n}\n\n")}function g(e={}){return e.mercator_gl_lngLatCenter=new Float32Array(2),e.mercator_gl_angleDerivatives=new Float32Array(3),e.mercator_gl_clipCenter=new Float32Array(4),e.mercator_gl_viewProjectionMatrix=new Float32Array(16),e.mercator_gl_scale=0,e}function u(e,n,t,r){let o=n[0],c=n[1];return e.mercator_gl_scale=Math.pow(2,t),e.mercator_gl_lngLatCenter[0]=o,e.mercator_gl_lngLatCenter[1]=c,function(e,n,t){let r=Math.cos(n*a),o=a*Math.tan(n*a)/r;m(e,n,t),e[2]=e[0]*o/2}(e.mercator_gl_angleDerivatives,c,t),l[0]=o,l[1]=c,s(e.mercator_gl_clipCenter,l,t,r),e.mercator_gl_viewProjectionMatrix.set(r),e}function L(e,n){return 512*Math.pow(2,n)/4003e4/Math.cos(e*a)}function m(e,n,t){let r=Math.pow(2,t),o=Math.cos(n*a);return e[0]=512*r/360,e[1]=e[0]/o,e}function f(e,n,t){let c=n[0],l=n[1],i=Math.pow(2,t),_=l*a,g=512*i*(c*a+r)/(2*r),u=512*i*(r-Math.log(Math.tan(o+.5*_)))/(2*r);return e[0]=g,e[1]=u,e[2]=0,e[3]=1,e}function v(e,n,t){return function(e,n,t){let r=n[0],o=n[1],a=n[2],c=n[3];e[0]=t[0]*r+t[4]*o+t[8]*a+t[12]*c,e[1]=t[1]*r+t[5]*o+t[9]*a+t[13]*c,e[2]=t[2]*r+t[6]*o+t[10]*a+t[14]*c,e[3]=t[3]*r+t[7]*o+t[11]*a+t[15]*c}(e,n,t),e}function s(e,n,t,r){return f(c,n,t),v(e,c,r),e}}])})); //# sourceMappingURL=mercator-gl.min.js.map