3879 lines
4.4 MiB
JavaScript
3879 lines
4.4 MiB
JavaScript
|
/**
|
|||
|
* plotly.js v3.0.1
|
|||
|
* Copyright 2012-2025, Plotly, Inc.
|
|||
|
* All rights reserved.
|
|||
|
* Licensed under the MIT license
|
|||
|
*/
|
|||
|
(
|
|||
|
function(root, factory) {
|
|||
|
if (typeof module === "object" && module.exports) {
|
|||
|
module.exports = factory();
|
|||
|
} else {
|
|||
|
root.moduleName = factory();
|
|||
|
}
|
|||
|
} (typeof self !== "undefined" ? self : this, () => {
|
|||
|
"use strict";var Plotly=(()=>{var VQe=Object.create;var MS=Object.defineProperty,HQe=Object.defineProperties,GQe=Object.getOwnPropertyDescriptor,jQe=Object.getOwnPropertyDescriptors,WQe=Object.getOwnPropertyNames,XQ=Object.getOwnPropertySymbols,ZQe=Object.getPrototypeOf,KQ=Object.prototype.hasOwnProperty,XQe=Object.prototype.propertyIsEnumerable;var YQ=(e,t,r)=>t in e?MS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,JQ=(e,t)=>{for(var r in t||(t={}))KQ.call(t,r)&&YQ(e,r,t[r]);if(XQ)for(var r of XQ(t))XQe.call(t,r)&&YQ(e,r,t[r]);return e},$Q=(e,t)=>HQe(e,jQe(t));var Ll=(e,t)=>()=>(e&&(t=e(e=0)),t);var ye=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),QQ=(e,t)=>{for(var r in t)MS(e,r,{get:t[r],enumerable:!0})},eee=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of WQe(t))!KQ.call(e,i)&&i!==r&&MS(e,i,{get:()=>t[i],enumerable:!(n=GQe(t,i))||n.enumerable});return e};var YQe=(e,t,r)=>(r=e!=null?VQe(ZQe(e)):{},eee(t||!e||!e.__esModule?MS(r,"default",{value:e,enumerable:!0}):r,e)),B1=e=>eee(MS({},"__esModule",{value:!0}),e);var e6=ye(tee=>{"use strict";tee.version="3.0.1"});var iee=ye((ree,t6)=>{(function(t,r,n){r[t]=r[t]||n(),typeof t6!="undefined"&&t6.exports&&(t6.exports=r[t])})("Promise",typeof window!="undefined"?window:ree,function(){"use strict";var t,r,n,i=Object.prototype.toString,a=typeof setImmediate!="undefined"?function(E){return setImmediate(E)}:setTimeout;try{Object.defineProperty({},"x",{}),t=function(E,k,A,L){return Object.defineProperty(E,k,{value:A,writable:!0,configurable:L!==!1})}}catch(p){t=function(k,A,L){return k[A]=L,k}}n=function(){var E,k,A;function L(_,C){this.fn=_,this.self=C,this.next=void 0}return{add:function(C,M){A=new L(C,M),k?k.next=A:E=A,k=A,A=void 0},drain:function(){var C=E;for(E=k=r=void 0;C;)C.fn.call(C.self),C=C.next}}}();function o(p,E){n.add(p,E),r||(r=a(n.drain))}function s(p){var E,k=typeof p;return p!=null&&(k=="object"||k=="function")&&(E=p.then),typeof E=="function"?E:!1}function l(){for(var p=0;p<this.chain.length;p++)u(this,this.state===1?this.chain[p].success:this.chain[p].failure,this.chain[p]);this.chain.length=0}function u(p,E,k){var A,L;try{E===!1?k.reject(p.msg):(E===!0?A=p.msg:A=E.call(void 0,p.msg),A===k.promise?k.reject(TypeError("Promise-chain cycle")):(L=s(A))?L.call(A,k.resolve,k.reject):k.resolve(A))}catch(_){k.reject(_)}}function c(p){var E,k=this;if(!k.triggered){k.triggered=!0,k.def&&(k=k.def);try{(E=s(p))?o(function(){var A=new d(k);try{E.call(p,function(){c.apply(A,arguments)},function(){f.apply(A,arguments)})}catch(L){f.call(A,L)}}):(k.msg=p,k.state=1,k.chain.length>0&&o(l,k))}catch(A){f.call(new d(k),A)}}}function f(p){var E=this;E.triggered||(E.triggered=!0,E.def&&(E=E.def),E.msg=p,E.state=2,E.chain.length>0&&o(l,E))}function h(p,E,k,A){for(var L=0;L<E.length;L++)(function(C){p.resolve(E[C]).then(function(g){k(C,g)},A)})(L)}function d(p){this.def=p,this.triggered=!1}function v(p){this.promise=p,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function x(p){if(typeof p!="function")throw TypeError("Not a function");if(this.__NPO__!==0)throw TypeError("Not a promise");this.__NPO__=1;var E=new v(this);this.then=function(A,L){var _={success:typeof A=="function"?A:!0,failure:typeof L=="function"?L:!1};return _.promise=new this.constructor(function(M,g){if(typeof M!="function"||typeof g!="function")throw TypeError("Not a function");_.resolve=M,_.reject=g}),E.chain.push(_),E.state!==0&&o(l,E),_.promise},this.catch=function(A){return this.then(void 0,A)};try{p.call(void 0,function(A){c.call(E,A)},function(A){f.call(E,A)})}catch(k){f.call(E,k)}}var b=t({},"constructor",x,!1);return x.prototype=b,t(b,"__NPO__",0,!1),t(x,"resolve",function(E){var k=this;return E&&typeof E=="object"&&E.__NPO__===1?E:new k(function(L,_){if(typeof L!="function"||typeof _!="function")throw TypeError("Not a function");L(E)})}),t(x,"reject",function(E){return new this(function(A,L){if(typeof A!="function"||typeof L!="function")throw TypeError("Not a function");L(E)})}),t(x,"all",function(E){var k=this;return i.call(E)!="[object Array
|
|||
|
]`),Be=Z.charCodeAt(0);function Ue(or,lr,Dr){arguments.length<3&&(Dr=lr,lr=null);var Ir=Yi(or,oe,lr==null?We:wt(lr),Dr);return Ir.row=function(oi){return arguments.length?Ir.response((lr=oi)==null?We:wt(oi)):lr},Ir}function We(or){return Ue.parse(or.responseText)}function wt(or){return function(lr){return Ue.parse(lr.responseText,or)}}Ue.parse=function(or,lr){var Dr;return Ue.parseRows(or,function(Ir,oi){if(Dr)return Dr(Ir,oi-1);var ui=function(qr){for(var Kr={},ii=Ir.length,vi=0;vi<ii;++vi)Kr[Ir[vi]]=qr[vi];return Kr};Dr=lr?function(qr,Kr){return lr(ui(qr),Kr)}:ui})},Ue.parseRows=function(or,lr){var Dr={},Ir={},oi=[],ui=or.length,qr=0,Kr=0,ii,vi;function ci(){if(qr>=ui)return Ir;if(vi)return vi=!1,Dr;var un=qr;if(or.charCodeAt(un)===34){for(var dn=un;dn++<ui;)if(or.charCodeAt(dn)===34){if(or.charCodeAt(dn+1)!==34)break;++dn}qr=dn+2;var En=or.charCodeAt(dn+1);return En===13?(vi=!0,or.charCodeAt(dn+2)===10&&++qr):En===10&&(vi=!0),or.slice(un+1,dn).replace(/""/g,'"')}for(;qr<ui;){var En=or.charCodeAt(qr++),Nn=1;if(En===10)vi=!0;else if(En===13)vi=!0,or.charCodeAt(qr)===10&&(++qr,++Nn);else if(En!==Be)continue;return or.slice(un,qr-Nn)}return or.slice(un)}for(;(ii=ci())!==Ir;){for(var Jr=[];ii!==Dr&&ii!==Ir;)Jr.push(ii),ii=ci();lr&&(Jr=lr(Jr,Kr++))==null||oi.push(Jr)}return oi},Ue.format=function(or){if(Array.isArray(or[0]))return Ue.formatRows(or);var lr=new V,Dr=[];return or.forEach(function(Ir){for(var oi in Ir)lr.has(oi)||Dr.push(lr.add(oi))}),[Dr.map(zt).join(Z)].concat(or.map(function(Ir){return Dr.map(function(oi){return zt(Ir[oi])}).join(Z)})).join(`
|
|||
|
`)},Ue.formatRows=function(or){return or.map(tt).join(`
|
|||
|
`)};function tt(or){return or.map(zt).join(Z)}function zt(or){return we.test(or)?'"'+or.replace(/\"/g,'""')+'"':or}return Ue},e.csv=e.dsv(",","text/csv"),e.tsv=e.dsv(" ","text/tab-separated-values");var Ji,ua,Fn,Sa,go=this[G(this,"requestAnimationFrame")]||function(Z){setTimeout(Z,17)};e.timer=function(){Oo.apply(this,arguments)};function Oo(Z,oe,we){var Be=arguments.length;Be<2&&(oe=0),Be<3&&(we=Date.now());var Ue=we+oe,We={c:Z,t:Ue,n:null};return ua?ua.n=We:Ji=We,ua=We,Fn||(Sa=clearTimeout(Sa),Fn=1,go(ho)),We}function ho(){var Z=Mo(),oe=xo()-Z;oe>24?(isFinite(oe)&&(clearTimeout(Sa),Sa=setTimeout(ho,oe)),Fn=0):(Fn=1,go(ho))}e.timer.flush=function(){Mo(),xo()};function Mo(){for(var Z=Date.now(),oe=Ji;oe;)Z>=oe.t&&oe.c(Z-oe.t)&&(oe.c=null),oe=oe.n;return Z}function xo(){for(var Z,oe=Ji,we=1/0;oe;)oe.c?(oe.t<we&&(we=oe.t),oe=(Z=oe).n):oe=Z?Z.n=oe.n:Ji=oe.n;return ua=Z,we}e.round=function(Z,oe){return oe?Math.round(Z*(oe=Math.pow(10,oe)))/oe:Math.round(Z)},e.geom={};function zs(Z){return Z[0]}function ks(Z){return Z[1]}e.geom.hull=function(Z){var oe=zs,we=ks;if(arguments.length)return Be(Z);function Be(Ue){if(Ue.length<3)return[];var We=ti(oe),wt=ti(we),tt,zt=Ue.length,or=[],lr=[];for(tt=0;tt<zt;tt++)or.push([+We.call(this,Ue[tt],tt),+wt.call(this,Ue[tt],tt),tt]);for(or.sort(Xs),tt=0;tt<zt;tt++)lr.push([or[tt][0],-or[tt][1]]);var Dr=Zs(or),Ir=Zs(lr),oi=Ir[0]===Dr[0],ui=Ir[Ir.length-1]===Dr[Dr.length-1],qr=[];for(tt=Dr.length-1;tt>=0;--tt)qr.push(Ue[or[Dr[tt]][2]]);for(tt=+oi;tt<Ir.length-ui;++tt)qr.push(Ue[or[Ir[tt]][2]]);return qr}return Be.x=function(Ue){return arguments.length?(oe=Ue,Be):oe},Be.y=function(Ue){return arguments.length?(we=Ue,Be):we},Be};function Zs(Z){for(var oe=Z.length,we=[0,1],Be=2,Ue=2;Ue<oe;Ue++){for(;Be>1&&Vt(Z[we[Be-2]],Z[we[Be-1]],Z[Ue])<=0;)--Be;we[Be++]=Ue}return we.slice(0,Be)}function Xs(Z,oe){return Z[0]-oe[0]||Z[1]-oe[1]}e.geom.polygon=function(Z){return ie(Z,wl),Z};var wl=e.geom.polygon.prototype=[];wl.area=function(){for(var Z=-1,oe=this.length,we,Be=this[oe-1],Ue=0;++Z<oe;)we=Be,Be=this[Z],Ue+=we[1]*Be[0]-we[0]*Be[1];return Ue*.5},wl.centroid=function(Z){var oe=-1,we=this.length,Be=0,Ue=0,We,wt=this[we-1],tt;for(arguments.length||(Z=-1/(6*this.area()));++oe<we;)We=wt,wt=this[oe],tt=We[0]*wt[1]-wt[0]*We[1],Be+=(We[0]+wt[0])*tt,Ue+=(We[1]+wt[1])*tt;return[Be*Z,Ue*Z]},wl.clip=function(Z){for(var oe,we=Cs(Z),Be=-1,Ue=this.length-Cs(this),We,wt,tt=this[Ue-1],zt,or,lr;++Be<Ue;){for(oe=Z.slice(),Z.length=0,zt=this[Be],or=oe[(wt=oe.length-we)-1],We=-1;++We<wt;)lr=oe[We],os(lr,tt,zt)?(os(or,tt,zt)||Z.push(cl(or,lr,tt,zt)),Z.push(lr)):os(or,tt,zt)&&Z.push(cl(or,lr,tt,zt)),or=lr;we&&Z.push(Z[0]),tt=zt}return Z};function os(Z,oe,we){return(we[0]-oe[0])*(Z[1]-oe[1])<(we[1]-oe[1])*(Z[0]-oe[0])}function cl(Z,oe,we,Be){var Ue=Z[0],We=we[0],wt=oe[0]-Ue,tt=Be[0]-We,zt=Z[1],or=we[1],lr=oe[1]-zt,Dr=Be[1]-or,Ir=(tt*(zt-or)-Dr*(Ue-We))/(Dr*wt-tt*lr);return[Ue+Ir*wt,zt+Ir*lr]}function Cs(Z){var oe=Z[0],we=Z[Z.length-1];return!(oe[0]-we[0]||oe[1]-we[1])}var ml,Ys,Hs,Eo=[],fs,Ql,Hu=[];function fc(){Ls(this),this.edge=this.site=this.circle=null}function ms(Z){var oe=Eo.pop()||new fc;return oe.site=Z,oe}function on(Z){ko(Z),Hs.remove(Z),Eo.push(Z),Ls(Z)}function fa(Z){var oe=Z.circle,we=oe.x,Be=oe.cy,Ue={x:we,y:Be},We=Z.P,wt=Z.N,tt=[Z];on(Z);for(var zt=We;zt.circle&&p(we-zt.circle.x)<Ye&&p(Be-zt.circle.cy)<Ye;)We=zt.P,tt.unshift(zt),on(zt),zt=We;tt.unshift(zt),ko(zt);for(var or=wt;or.circle&&p(we-or.circle.x)<Ye&&p(Be-or.circle.cy)<Ye;)wt=or.N,tt.push(or),on(or),or=wt;tt.push(or),ko(or);var lr=tt.length,Dr;for(Dr=1;Dr<lr;++Dr)or=tt[Dr],zt=tt[Dr-1],Al(or.edge,zt.site,or.site,Ue);zt=tt[0],or=tt[lr-1],or.edge=cf(zt.site,or.site,null,Ue),Zn(zt),Zn(or)}function Qu(Z){for(var oe=Z.x,we=Z.y,Be,Ue,We,wt,tt=Hs._;tt;)if(We=Rl(tt,we)-oe,We>Ye)tt=tt.L;else if(wt=oe-vo(tt,we),wt>Ye){if(!tt.R){Be=tt;break}tt=tt.R}else{We>-Ye?(Be=tt.P,Ue=tt):wt>-Ye?(Be=tt,Ue=tt.N):Be=Ue=tt;break}var zt=ms(Z);if(Hs.insert(Be,zt),!(!Be&&!Ue)){if(Be===Ue){ko(Be),Ue=ms(Be.site),Hs.insert(zt,Ue),zt.edge=Ue.edge=cf(Be.site,zt.site),Zn(Be),Zn(Ue);return
|
|||
|
`+a.year;else return ort(e,r)+`
|
|||
|
`+Jre(a.dayMonthYear,e,n,i);return Jre(t,e,n,i)};var $re=3*wp;Yf.incrementMonth=function(e,t,r){r=yy(r)&&r;var n=X1(e,wp);if(e=Math.round(e-n),r)try{var i=Math.round(e/wp)+qS,a=my.getComponentMethod("calendars","getCal")(r),o=a.fromJD(i);return t%12?a.add(o,t,"m"):a.add(o,t/12,"y"),(o.toJD()-qS)*wp+n}catch(l){qq.error("invalid ms "+e+" in calendar "+r)}var s=new Date(e+$re);return s.setUTCMonth(s.getUTCMonth()+t)+n-$re};Yf.findExactDates=function(e,t){for(var r=0,n=0,i=0,a=0,o,s,l=yy(t)&&my.getComponentMethod("calendars","getCal")(t),u=0;u<e.length;u++){if(s=e[u],!Qre(s)){a++;continue}if(!(s%wp))if(l)try{o=l.fromJD(s/wp+qS),o.day()===1?o.month()===1?r++:n++:i++}catch(f){}else o=new Date(s),o.getUTCDate()===1?o.getUTCMonth()===0?r++:n++:i++}n+=r,i+=n;var c=e.length-a;return{exactYears:r/c,exactMonths:n/c,exactDays:i/c}}});var OS=ye((ltr,rie)=>{"use strict";rie.exports=function(t){return t}});var k6=ye(_y=>{"use strict";var srt=uo(),lrt=G1(),urt=OS(),crt=es().BADNUM,Oq=1e-9;_y.findBin=function(e,t,r){if(srt(t.start))return r?Math.ceil((e-t.start)/t.size-Oq)-1:Math.floor((e-t.start)/t.size+Oq);var n=0,i=t.length,a=0,o=i>1?(t[i-1]-t[0])/(i-1):1,s,l;for(o>=0?l=r?frt:hrt:l=r?vrt:drt,e+=o*Oq*(r?-1:1)*(o>=0?1:-1);n<i&&a++<100;)s=Math.floor((n+i)/2),l(t[s],e)?n=s+1:i=s;return a>90&&lrt.log("Long binary search..."),n-1};function frt(e,t){return e<t}function hrt(e,t){return e<=t}function drt(e,t){return e>t}function vrt(e,t){return e>=t}_y.sorterAsc=function(e,t){return e-t};_y.sorterDes=function(e,t){return t-e};_y.distinctVals=function(e){var t=e.slice();t.sort(_y.sorterAsc);var r;for(r=t.length-1;r>-1&&t[r]===crt;r--);for(var n=t[r]-t[0]||1,i=n/(r||1)/1e4,a=[],o,s=0;s<=r;s++){var l=t[s],u=l-o;o===void 0?(a.push(l),o=l):u>i&&(n=Math.min(n,u),a.push(l),o=l)}return{vals:a,minDiff:n}};_y.roundUp=function(e,t,r){for(var n=0,i=t.length-1,a,o=0,s=r?0:1,l=r?1:0,u=r?Math.ceil:Math.floor;n<i&&o++<100;)a=u((n+i)/2),t[a]<=e?n=a+s:i=a-l;return t[n]};_y.sort=function(e,t){for(var r=0,n=0,i=1;i<e.length;i++){var a=t(e[i],e[i-1]);if(a<0?r=1:a>0&&(n=1),r&&n)return e.sort(t)}return n?e:e.reverse()};_y.findIndexOfMin=function(e,t){t=t||urt;for(var r=1/0,n,i=0;i<e.length;i++){var a=t(e[i]);a<r&&(r=a,n=i)}return n}});var Y1=ye((ctr,iie)=>{"use strict";iie.exports=function(t){return Object.keys(t).sort()}});var nie=ye(Kf=>{"use strict";var BS=uo(),prt=vv().isArrayOrTypedArray;Kf.aggNums=function(e,t,r,n){var i,a;if((!n||n>r.length)&&(n=r.length),BS(t)||(t=!1),prt(r[0])){for(a=new Array(n),i=0;i<n;i++)a[i]=Kf.aggNums(e,t,r[i]);r=a}for(i=0;i<n;i++)BS(t)?BS(r[i])&&(t=e(+t,+r[i])):t=r[i];return t};Kf.len=function(e){return Kf.aggNums(function(t){return t+1},0,e)};Kf.mean=function(e,t){return t||(t=Kf.len(e)),Kf.aggNums(function(r,n){return r+n},0,e)/t};Kf.geometricMean=function(e,t){return t||(t=Kf.len(e)),Math.pow(Kf.aggNums(function(r,n){return r*n},1,e),1/t)};Kf.midRange=function(e){if(!(e===void 0||e.length===0))return(Kf.aggNums(Math.max,null,e)+Kf.aggNums(Math.min,null,e))/2};Kf.variance=function(e,t,r){return t||(t=Kf.len(e)),BS(r)||(r=Kf.mean(e,t)),Kf.aggNums(function(n,i){return n+Math.pow(i-r,2)},0,e)/t};Kf.stdev=function(e,t,r){return Math.sqrt(Kf.variance(e,t,r))};Kf.median=function(e){var t=e.slice().sort();return Kf.interp(t,.5)};Kf.interp=function(e,t){if(!BS(t))throw"n should be a finite number";if(t=t*e.length-.5,t<0)return e[0];if(t>e.length-1)return e[e.length-1];var r=t%1;return r*e[Math.ceil(t)]+(1-r)*e[Math.floor(t)]}});var uie=ye((htr,lie)=>{"use strict";var aie=r3(),Bq=aie.mod,grt=aie.modHalf,NS=Math.PI,K1=2*NS;function mrt(e){return e/180*NS}function yrt(e){return e/NS*180}function Nq(e){return Math.abs(e[1]-e[0])>K1-1e-14}function oie(e,t){return grt(t-e,K1)}function _rt(e,t){return Math.abs(oie(e,t))}function sie(e,t){if(Nq(t))return!0;var r,n;t[0]<t[1]?(r=t[0],n=t[1]):(r=t[1],n=t[0]),r=Bq(r,K1),n=Bq(n,K1),r>n&&(n+=K1);var i=Bq(e,K1),a=i+K1;return i>=r&&i<=n||a>=r&&a<=n}function xrt(e,t,r,n){if(!sie(t,n))return!1;var i,a;return r[0]<r[1]?(i=r[0],a=r[1]):(i=r[1],a=r[0]),e>=i&&e<=a}function Uq(e,t,r,n,i,a,o){i=i||0,a=a||0;var s=
|
|||
|
`);if(l!==-1&&(s=o.substr(l+1),o=o.substr(0,l)),n&&(s!==void 0&&(o==="00:00:00"||o==="00:00")?(o=s,s=""):o.length===8&&(o=o.replace(/:00$/,""))),s)if(r)i==="d"?o+=", "+s:o=s+(o?", "+o:"");else if(!e._inCalcTicks||e._prevDateHead!==s)e._prevDateHead=s,o+="<br>"+s;else{var u=nM(e),c=e._trueSide||e.side;(!u&&c==="top"||u&&c==="bottom")&&(o+="<br> ")}t.text=o}function Eot(e,t,r,n,i){var a=e.dtick,o=t.x,s=e.tickformat,l=typeof a=="string"&&a.charAt(0);if(i==="never"&&(i=""),n&&l!=="L"&&(a="L3",l="L"),s||l==="L")t.text=iM(Math.pow(10,o),e,i,n);else if(ph(a)||l==="D"&&Vo.mod(o+.01,1)<.1){var u=Math.round(o),c=Math.abs(u),f=e.exponentformat;f==="power"||TL(f)&&uB(u)?(u===0?t.text=1:u===1?t.text="10":t.text="10<sup>"+(u>1?"":kb)+c+"</sup>",t.fontSize*=1.25):(f==="e"||f==="E")&&c>2?t.text="1"+f+(u>0?"+":kb)+c:(t.text=iM(Math.pow(10,o),e,"","fakehover"),a==="D1"&&e._id.charAt(0)==="y"&&(t.dy-=t.fontSize/6))}else if(l==="D")t.text=String(Math.round(Math.pow(10,Vo.mod(o,1)))),t.fontSize*=.75;else throw"unrecognized dtick "+String(a);if(e.dtick==="D1"){var h=String(t.text).charAt(0);(h==="0"||h==="1")&&(e._id.charAt(0)==="y"?t.dx-=t.fontSize/4:(t.dy+=t.fontSize/2,t.dx+=(e.range[1]>e.range[0]?1:-1)*t.fontSize*(o<0?.5:.25)))}}function kot(e,t){var r=e._categories[Math.round(t.x)];r===void 0&&(r=""),t.text=String(r)}function Cot(e,t,r){var n=Math.round(t.x),i=e._categories[n]||[],a=i[1]===void 0?"":String(i[1]),o=i[0]===void 0?"":String(i[0]);r?t.text=o+" - "+a:(t.text=a,t.text2=o)}function Lot(e,t,r,n,i){i==="never"?i="":e.showexponent==="all"&&Math.abs(t.x/e.dtick)<1e-6&&(i="hide"),t.text=iM(t.x,e,i,n)}function Pot(e,t,r,n,i){if(e.thetaunit==="radians"&&!r){var a=t.x/180;if(a===0)t.text="0";else{var o=Iot(a);if(o[1]>=100)t.text=iM(Vo.deg2rad(t.x),e,i,n);else{var s=t.x<0;o[1]===1?o[0]===1?t.text="\u03C0":t.text=o[0]+"\u03C0":t.text=["<sup>",o[0],"</sup>","\u2044","<sub>",o[1],"</sub>","\u03C0"].join(""),s&&(t.text=kb+t.text)}}}else t.text=iM(t.x,e,i,n)}function Iot(e){function t(s,l){return Math.abs(s-l)<=1e-6}function r(s,l){return t(l,0)?s:r(l,s%l)}function n(s){for(var l=1;!t(Math.round(s*l)/l,s);)l*=10;return l}var i=n(e),a=e*i,o=Math.abs(r(a,i));return[Math.round(a/o),Math.round(i/o)]}var Rot=["f","p","n","\u03BC","m","","k","M","G","T"];function TL(e){return e==="SI"||e==="B"}function uB(e){return e>14||e<-15}function iM(e,t,r,n){var i=e<0,a=t._tickround,o=r||t.exponentformat||"B",s=t._tickexponent,l=kn.getTickFormat(t),u=t.separatethousands;if(n){var c={exponentformat:o,minexponent:t.minexponent,dtick:t.showexponent==="none"?t.dtick:ph(e)&&Math.abs(e)||1,range:t.showexponent==="none"?t.range.map(t.r2d):[0,e||1]};mse(c),a=(Number(c._tickround)||0)+4,s=c._tickexponent,t.hoverformat&&(l=t.hoverformat)}if(l)return t._numFormat(l)(e).replace(/-/g,kb);var f=Math.pow(10,-a)/2;if(o==="none"&&(s=0),e=Math.abs(e),e<f)e="0",i=!1;else{if(e+=f,s&&(e*=Math.pow(10,-s),a+=s),a===0)e=String(Math.floor(e));else if(a<0){e=String(Math.round(e)),e=e.substr(0,e.length+a);for(var h=a;h<0;h++)e+="0"}else{e=String(e);var d=e.indexOf(".")+1;d&&(e=e.substr(0,d+a).replace(/\.?0+$/,""))}e=Vo.numSeparate(e,t._separators,u)}if(s&&o!=="hide"){TL(o)&&uB(s)&&(o="power");var v;s<0?v=kb+-s:o!=="power"?v="+"+s:v=String(s),o==="e"||o==="E"?e+=o+v:o==="power"?e+="\xD710<sup>"+v+"</sup>":o==="B"&&s===9?e+="B":TL(o)&&(e+=Rot[s/3+5])}return i?kb+e:e}kn.getTickFormat=function(e){var t;function r(l){return typeof l!="string"?l:Number(l.replace("M",""))*R3}function n(l,u){var c=["L","D"];if(typeof l==typeof u){if(typeof l=="number")return l-u;var f=c.indexOf(l.charAt(0)),h=c.indexOf(u.charAt(0));return f===h?Number(l.replace(/(L|D)/g,""))-Number(u.replace(/(L|D)/g,"")):f-h}else return typeof l=="number"?1:-1}function i(l,u,c){var f=c||function(v){return v},h=u[0],d=u[1];return(!h&&typeof h!="number"||f(h)<=f(l))&&(!d&&typeof d!="number"||f(d)>=f(l))}function a(l,u){var c=u[0]===null,f=u[1]===null,h=n(l,u[0])>=0,d=n(l,u[1])<=0;return(c||h)&&(f||d)}var o,s;if(e.tickformatstops&&e.tickformatstops.length>0)switch(e.type){case"date":case"linear":{for(t=0;t<e.tickformatstops.len
|
|||
|
`));var ke;L.med!==i0?ke=L.med:L.q1!==i0?L.q3!==i0?ke=(L.q1+L.q3)/2:ke=L.q1:L.q3!==i0?ke=L.q3:ke=0,L.med=ke,L.q1=L.q3=ke,L.lf=L.uf=ke,L.mean=L.sd=ke,L.ln=L.un=ke,L.min=L.max=ke}V=Math.min(V,L.min),H=Math.max(H,L.max),L.pts2=_.filter(T),o.push(L)}}r._extremes[c._id]=HI.findExtremes(c,[V,H],{padded:!0})}else{var ge=c.makeCalcdata(r,f),ie=Kyt(k,A),Te=k.length,Ee=Jyt(Te);for(l=0;l<r._length;l++)if(P=ge[l],!!SV(P)){var Ae=$f.findBin(b[l],ie);Ae>=0&&Ae<Te&&(g={v:P,i:l},o1e(g,r,l),Ee[Ae].push(g))}var ze=1/0,Ce=-1/0,me=r.quartilemethod,Re=me==="exclusive",ce=me==="inclusive";for(l=0;l<Te;l++)if(Ee[l].length>0){if(L={},L.pos=L[d]=k[l],_=L.pts=Ee[l].sort(s1e),C=L[f]=_.map(l1e),M=C.length,L.min=C[0],L.max=C[M-1],L.mean=$f.mean(C,M),L.sd=$f.stdev(C,M,L.mean)*r.sdmultiple,L.med=$f.interp(C,.5),M%2&&(Re||ce)){var Ge,nt;Re?(Ge=C.slice(0,M/2),nt=C.slice(M/2+1)):ce&&(Ge=C.slice(0,M/2+1),nt=C.slice(M/2)),L.q1=$f.interp(Ge,.5),L.q3=$f.interp(nt,.5)}else L.q1=$f.interp(C,.25),L.q3=$f.interp(C,.75);L.lf=u1e(L,C,M),L.uf=c1e(L,C,M),L.lo=f1e(L),L.uo=h1e(L);var ct=d1e(L,M);L.ln=L.med-ct,L.un=L.med+ct,ze=Math.min(ze,L.ln),Ce=Math.max(Ce,L.un),L.pts2=_.filter(T),o.push(L)}r.notched&&$f.isTypedArray(ge)&&(ge=Array.from(ge)),r._extremes[c._id]=HI.findExtremes(c,r.notched?ge.concat([ze,Ce]):ge,{padded:!0})}return $yt(o,r),o.length>0?(o[0].t={num:n[s],dPos:A,posLetter:d,valLetter:f,labels:{med:Fy(t,"median:"),min:Fy(t,"min:"),q1:Fy(t,"q1:"),q3:Fy(t,"q3:"),max:Fy(t,"max:"),mean:r.boxmean==="sd"||r.sizemode==="sd"?Fy(t,"mean \xB1 \u03C3:").replace("\u03C3",r.sdmultiple===1?"\u03C3":r.sdmultiple+"\u03C3"):Fy(t,"mean:"),lf:Fy(t,"lower fence:"),uf:Fy(t,"upper fence:")}},n[s]++,o):[{t:{empty:!0}}]};function Yyt(e,t,r,n){var i=t in e,a=t+"0"in e,o="d"+t in e;if(i||a&&o){var s=r.makeCalcdata(e,t),l=Xyt(e,r,t,s).vals;return[l,s]}var u;a?u=e[t+"0"]:"name"in e&&(r.type==="category"||SV(e.name)&&["linear","log"].indexOf(r.type)!==-1||$f.isDateTime(e.name)&&r.type==="date")?u=e.name:u=n;for(var c=r.type==="multicategory"?r.r2c_just_indices(u):r.d2c(u,0,e[t+"calendar"]),f=e._length,h=new Array(f),d=0;d<f;d++)h[d]=c;return[h]}function Kyt(e,t){for(var r=e.length,n=new Array(r+1),i=0;i<r;i++)n[i]=e[i]-t;return n[r]=e[r-1]+t,n}function Jyt(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=[];return t}var AV={text:"tx",hovertext:"htx"};function o1e(e,t,r){for(var n in AV)$f.isArrayOrTypedArray(t[n])&&(Array.isArray(r)?$f.isArrayOrTypedArray(t[n][r[0]])&&(e[AV[n]]=t[n][r[0]][r[1]]):e[AV[n]]=t[n][r])}function $yt(e,t){if($f.isArrayOrTypedArray(t.selectedpoints))for(var r=0;r<e.length;r++){for(var n=e[r].pts||[],i={},a=0;a<n.length;a++)i[n[a].i]=a;$f.tagSelected(n,t,i)}}function s1e(e,t){return e.v-t.v}function l1e(e){return e.v}function u1e(e,t,r){return r===0?e.q1:Math.min(e.q1,t[Math.min($f.findBin(2.5*e.q1-1.5*e.q3,t,!0)+1,r-1)])}function c1e(e,t,r){return r===0?e.q3:Math.max(e.q3,t[Math.max($f.findBin(2.5*e.q3-1.5*e.q1,t),0)])}function f1e(e){return 4*e.q1-3*e.q3}function h1e(e){return 4*e.q3-3*e.q1}function d1e(e,t){return t===0?0:1.57*(e.q3-e.q1)/Math.sqrt(t)}});var GI=ye((Vor,y1e)=>{"use strict";var p1e=Qa(),Qyt=Mr(),e1t=Bb().getAxisGroup,g1e=["v","h"];function t1t(e,t){for(var r=e.calcdata,n=t.xaxis,i=t.yaxis,a=0;a<g1e.length;a++){for(var o=g1e[a],s=o==="h"?i:n,l=[],u=0;u<r.length;u++){var c=r[u],f=c[0].t,h=c[0].trace;h.visible===!0&&(h.type==="box"||h.type==="candlestick")&&!f.empty&&(h.orientation||"v")===o&&h.xaxis===n._id&&h.yaxis===i._id&&l.push(u)}m1e("box",e,l,s)}}function m1e(e,t,r,n){var i=t.calcdata,a=t._fullLayout,o=n._id,s=o.charAt(0),l,u,c,f=[],h=0;for(l=0;l<r.length;l++)for(c=i[r[l]],u=0;u<c.length;u++)f.push(n.c2l(c[u].pos,!0)),h+=(c[u].pts2||[]).length;if(f.length){var d=Qyt.distinctVals(f);(n.type==="category"||n.type==="multicategory")&&(d.minDiff=1);var v=d.minDiff/2;p1e.minDtick(n,d.minDiff,d.vals[0],!0);var x=e==="violin"?"_numViolins":"_numBoxes",b=a[x],p=a[e+"mode"]==="group"&&b>1,E=1-a[e+"gap"],k=1-a[e+"groupgap"];for(l=0;l<r.length;l++){c=i[r[l]];var A=c[0].trace,L=c[0].t,_=A.width,C=A.side,M,g,P,T;if(_)M=g=T=_/2,P=0;else if(M=v,p){var F=e1t(a,
|
|||
|
`)>-1&&(a?s=s.split(`
|
|||
|
`).map(function(u){return" "+u}).join(`
|
|||
|
`).slice(2):s=`
|
|||
|
`+s.split(`
|
|||
|
`).map(function(u){return" "+u}).join(`
|
|||
|
`))):s=e.stylize("[Circular]","special")),d2(o)){if(a&&i.match(/^\d+$/))return s;o=JSON.stringify(""+i),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.slice(1,-1),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+s}function BTt(e,t,r){var n=0,i=e.reduce(function(a,o){return n++,o.indexOf(`
|
|||
|
`)>=0&&n++,a+o.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(t===""?"":t+`
|
|||
|
`)+" "+e.join(`,
|
|||
|
`)+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}Nl.types=OG();function C5e(e){return Array.isArray(e)}Nl.isArray=C5e;function HG(e){return typeof e=="boolean"}Nl.isBoolean=HG;function fR(e){return e===null}Nl.isNull=fR;function NTt(e){return e==null}Nl.isNullOrUndefined=NTt;function L5e(e){return typeof e=="number"}Nl.isNumber=L5e;function hR(e){return typeof e=="string"}Nl.isString=hR;function UTt(e){return typeof e=="symbol"}Nl.isSymbol=UTt;function d2(e){return e===void 0}Nl.isUndefined=d2;function H4(e){return o5(e)&&GG(e)==="[object RegExp]"}Nl.isRegExp=H4;Nl.types.isRegExp=H4;function o5(e){return typeof e=="object"&&e!==null}Nl.isObject=o5;function cR(e){return o5(e)&&GG(e)==="[object Date]"}Nl.isDate=cR;Nl.types.isDate=cR;function G4(e){return o5(e)&&(GG(e)==="[object Error]"||e instanceof Error)}Nl.isError=G4;Nl.types.isNativeError=G4;function lR(e){return typeof e=="function"}Nl.isFunction=lR;function VTt(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e=="undefined"}Nl.isPrimitive=VTt;Nl.isBuffer=BG();function GG(e){return Object.prototype.toString.call(e)}function UG(e){return e<10?"0"+e.toString(10):e.toString(10)}var HTt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function GTt(){var e=new Date,t=[UG(e.getHours()),UG(e.getMinutes()),UG(e.getSeconds())].join(":");return[e.getDate(),HTt[e.getMonth()],t].join(" ")}Nl.log=function(){console.log("%s - %s",GTt(),Nl.format.apply(Nl,arguments))};Nl.inherits=Uy();Nl._extend=function(e,t){if(!t||!o5(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e};function P5e(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var h2=typeof Symbol!="undefined"?Symbol("util.promisify.custom"):void 0;Nl.promisify=function(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');if(h2&&t[h2]){var r=t[h2];if(typeof r!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(r,h2,{value:r,enumerable:!1,writable:!1,configurable:!0}),r}function r(){for(var n,i,a=new Promise(function(l,u){n=l,i=u}),o=[],s=0;s<arguments.length;s++)o.push(arguments[s]);o.push(function(l,u){l?i(l):n(u)});try{t.apply(this,o)}catch(l){i(l)}return a}return Object.setPrototypeOf(r,Object.getPrototypeOf(t)),h2&&Object.defineProperty(r,h2,{value:r,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(r,E5e(t))};Nl.promisify.custom=h2;function jTt(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}function WTt(e){if(typeof e!="function")throw new TypeError('The "original" argument must be of type Function');function t(){for(var r=[],n=0;n<arguments.length;n++)r.push(arguments[n]);var i=r.pop();if(typeof i!="function")throw new TypeError("The last argument must be of type Function");var a=this,o=function(){return i.apply(a,arguments)};e.apply(this,r).then(function(s){process.nextTick(o.bind(null,null,s))},function(s){process.nextTick(jTt.bind(null,s,o))})}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.defineProperties(t,E5e(e)),t}Nl.callbackify=WTt});var z5e=ye((Jur,D5e)=>{"use strict";function I5e(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ZTt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?I5e(Object(r),!0).forEach(function(n){XTt(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):I5e(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function XTt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function YTt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function R5e(e,t){for(var r=0;r<t.length;r++){va
|
|||
|
`)>-1&&(a?s=s.split(`
|
|||
|
`).map(function(u){return" "+u}).join(`
|
|||
|
`).slice(2):s=`
|
|||
|
`+s.split(`
|
|||
|
`).map(function(u){return" "+u}).join(`
|
|||
|
`))):s=e.stylize("[Circular]","special")),b2(o)){if(a&&i.match(/^\d+$/))return s;o=JSON.stringify(""+i),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.slice(1,-1),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+s}function $At(e,t,r){var n=0,i=e.reduce(function(a,o){return n++,o.indexOf(`
|
|||
|
`)>=0&&n++,a+o.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(t===""?"":t+`
|
|||
|
`)+" "+e.join(`,
|
|||
|
`)+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}Ul.types=OG();function DAe(e){return Array.isArray(e)}Ul.isArray=DAe;function Tj(e){return typeof e=="boolean"}Ul.isBoolean=Tj;function RR(e){return e===null}Ul.isNull=RR;function QAt(e){return e==null}Ul.isNullOrUndefined=QAt;function zAe(e){return typeof e=="number"}Ul.isNumber=zAe;function DR(e){return typeof e=="string"}Ul.isString=DR;function eSt(e){return typeof e=="symbol"}Ul.isSymbol=eSt;function b2(e){return e===void 0}Ul.isUndefined=b2;function $4(e){return f5(e)&&Aj(e)==="[object RegExp]"}Ul.isRegExp=$4;Ul.types.isRegExp=$4;function f5(e){return typeof e=="object"&&e!==null}Ul.isObject=f5;function IR(e){return f5(e)&&Aj(e)==="[object Date]"}Ul.isDate=IR;Ul.types.isDate=IR;function Q4(e){return f5(e)&&(Aj(e)==="[object Error]"||e instanceof Error)}Ul.isError=Q4;Ul.types.isNativeError=Q4;function LR(e){return typeof e=="function"}Ul.isFunction=LR;function tSt(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e=="undefined"}Ul.isPrimitive=tSt;Ul.isBuffer=BG();function Aj(e){return Object.prototype.toString.call(e)}function bj(e){return e<10?"0"+e.toString(10):e.toString(10)}var rSt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function iSt(){var e=new Date,t=[bj(e.getHours()),bj(e.getMinutes()),bj(e.getSeconds())].join(":");return[e.getDate(),rSt[e.getMonth()],t].join(" ")}Ul.log=function(){console.log("%s - %s",iSt(),Ul.format.apply(Ul,arguments))};Ul.inherits=Uy();Ul._extend=function(e,t){if(!t||!f5(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e};function FAe(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var x2=typeof Symbol!="undefined"?Symbol("util.promisify.custom"):void 0;Ul.promisify=function(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');if(x2&&t[x2]){var r=t[x2];if(typeof r!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(r,x2,{value:r,enumerable:!1,writable:!1,configurable:!0}),r}function r(){for(var n,i,a=new Promise(function(l,u){n=l,i=u}),o=[],s=0;s<arguments.length;s++)o.push(arguments[s]);o.push(function(l,u){l?i(l):n(u)});try{t.apply(this,o)}catch(l){i(l)}return a}return Object.setPrototypeOf(r,Object.getPrototypeOf(t)),x2&&Object.defineProperty(r,x2,{value:r,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(r,IAe(t))};Ul.promisify.custom=x2;function nSt(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}function aSt(e){if(typeof e!="function")throw new TypeError('The "original" argument must be of type Function');function t(){for(var r=[],n=0;n<arguments.length;n++)r.push(arguments[n]);var i=r.pop();if(typeof i!="function")throw new TypeError("The last argument must be of type Function");var a=this,o=function(){return i.apply(a,arguments)};e.apply(this,r).then(function(s){process.nextTick(o.bind(null,null,s))},function(s){process.nextTick(nSt.bind(null,s,o))})}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.defineProperties(t,IAe(e)),t}Ul.callbackify=aSt});var Ej=ye((pcr,NAe)=>{"use strict";function B_(e){"@babel/helpers - typeof";return B_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},B_(e)}function qAe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,sSt(n.key),n)}}function oSt(e,t,r){return t&&qAe(e.prototype,t),r&&qAe(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function sSt(e){var t=lSt(e,"string");return B_(t)==="symbol"?t:String(t)}function lSt(e,t){if(B_(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(B_(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}
|
|||
|
`),c=nE(t).split(`
|
|||
|
`),f=0,h="";if(r==="strictEqual"&&Dp(e)==="object"&&Dp(t)==="object"&&e!==null&&t!==null&&(r="strictEqualObject"),u.length===1&&c.length===1&&u[0]!==c[0]){var d=u[0].length+c[0].length;if(d<=CSt){if((Dp(e)!=="object"||e===null)&&(Dp(t)!=="object"||t===null)&&(e!==0||t!==0))return"".concat(w2[r],`
|
|||
|
|
|||
|
`)+"".concat(u[0]," !== ").concat(c[0],`
|
|||
|
`)}else if(r!=="strictEqualObject"){var v=process.stderr&&process.stderr.isTTY?process.stderr.columns:80;if(d<v){for(;u[0][f]===c[0][f];)f++;f>2&&(h=`
|
|||
|
`.concat(kSt(" ",f),"^"),f=0)}}}for(var x=u[u.length-1],b=c[c.length-1];x===b&&(f++<2?o=`
|
|||
|
`.concat(x).concat(o):n=x,u.pop(),c.pop(),!(u.length===0||c.length===0));)x=u[u.length-1],b=c[c.length-1];var p=Math.max(u.length,c.length);if(p===0){var E=l.split(`
|
|||
|
`);if(E.length>30)for(E[26]="".concat(Gg,"...").concat(xv);E.length>27;)E.pop();return"".concat(w2.notIdentical,`
|
|||
|
|
|||
|
`).concat(E.join(`
|
|||
|
`),`
|
|||
|
`)}f>3&&(o=`
|
|||
|
`.concat(Gg,"...").concat(xv).concat(o),s=!0),n!==""&&(o=`
|
|||
|
`.concat(n).concat(o),n="");var k=0,A=w2[r]+`
|
|||
|
`.concat(rE,"+ actual").concat(xv," ").concat(iE,"- expected").concat(xv),L=" ".concat(Gg,"...").concat(xv," Lines skipped");for(f=0;f<p;f++){var _=f-a;if(u.length<f+1)_>1&&f>2&&(_>4?(i+=`
|
|||
|
`.concat(Gg,"...").concat(xv),s=!0):_>3&&(i+=`
|
|||
|
`.concat(c[f-2]),k++),i+=`
|
|||
|
`.concat(c[f-1]),k++),a=f,n+=`
|
|||
|
`.concat(iE,"-").concat(xv," ").concat(c[f]),k++;else if(c.length<f+1)_>1&&f>2&&(_>4?(i+=`
|
|||
|
`.concat(Gg,"...").concat(xv),s=!0):_>3&&(i+=`
|
|||
|
`.concat(u[f-2]),k++),i+=`
|
|||
|
`.concat(u[f-1]),k++),a=f,i+=`
|
|||
|
`.concat(rE,"+").concat(xv," ").concat(u[f]),k++;else{var C=c[f],M=u[f],g=M!==C&&(!GAe(M,",")||M.slice(0,-1)!==C);g&&GAe(C,",")&&C.slice(0,-1)===M&&(g=!1,M+=","),g?(_>1&&f>2&&(_>4?(i+=`
|
|||
|
`.concat(Gg,"...").concat(xv),s=!0):_>3&&(i+=`
|
|||
|
`.concat(u[f-2]),k++),i+=`
|
|||
|
`.concat(u[f-1]),k++),a=f,i+=`
|
|||
|
`.concat(rE,"+").concat(xv," ").concat(M),n+=`
|
|||
|
`.concat(iE,"-").concat(xv," ").concat(C),k+=2):(i+=n,n="",(_===1||f===0)&&(i+=`
|
|||
|
`.concat(M),k++))}if(k>20&&f<p-2)return"".concat(A).concat(L,`
|
|||
|
`).concat(i,`
|
|||
|
`).concat(Gg,"...").concat(xv).concat(n,`
|
|||
|
`)+"".concat(Gg,"...").concat(xv)}return"".concat(A).concat(s?L:"",`
|
|||
|
`).concat(i).concat(n).concat(o).concat(h)}var PSt=function(e,t){wSt(n,e);var r=TSt(n);function n(i){var a;if(_St(this,n),Dp(i)!=="object"||i===null)throw new ESt("options","Object",i);var o=i.message,s=i.operator,l=i.stackStartFn,u=i.actual,c=i.expected,f=Error.stackTraceLimit;if(Error.stackTraceLimit=0,o!=null)a=r.call(this,String(o));else if(process.stderr&&process.stderr.isTTY&&(process.stderr&&process.stderr.getColorDepth&&process.stderr.getColorDepth()!==1?(Gg="\x1B[34m",rE="\x1B[32m",xv="\x1B[39m",iE="\x1B[31m"):(Gg="",rE="",xv="",iE="")),Dp(u)==="object"&&u!==null&&Dp(c)==="object"&&c!==null&&"stack"in u&&u instanceof Error&&"stack"in c&&c instanceof Error&&(u=jAe(u),c=jAe(c)),s==="deepStrictEqual"||s==="strictEqual")a=r.call(this,LSt(u,c,s));else if(s==="notDeepStrictEqual"||s==="notStrictEqual"){var h=w2[s],d=nE(u).split(`
|
|||
|
`);if(s==="notStrictEqual"&&Dp(u)==="object"&&u!==null&&(h=w2.notStrictEqualObject),d.length>30)for(d[26]="".concat(Gg,"...").concat(xv);d.length>27;)d.pop();d.length===1?a=r.call(this,"".concat(h," ").concat(d[0])):a=r.call(this,"".concat(h,`
|
|||
|
|
|||
|
`).concat(d.join(`
|
|||
|
`),`
|
|||
|
`))}else{var v=nE(u),x="",b=w2[s];s==="notDeepEqual"||s==="notEqual"?(v="".concat(w2[s],`
|
|||
|
|
|||
|
`).concat(v),v.length>1024&&(v="".concat(v.slice(0,1021),"..."))):(x="".concat(nE(c)),v.length>512&&(v="".concat(v.slice(0,509),"...")),x.length>512&&(x="".concat(x.slice(0,509),"...")),s==="deepEqual"||s==="equal"?v="".concat(b,`
|
|||
|
|
|||
|
`).concat(v,`
|
|||
|
|
|||
|
should equal
|
|||
|
|
|||
|
`):x=" ".concat(s," ").concat(x)),a=r.call(this,"".concat(v).concat(x))}return Error.stackTraceLimit=f,a.generatedMessage=!o,Object.defineProperty(kj(a),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),a.code="ERR_ASSERTION",a.actual=u,a.expected=c,a.operator=s,Error.captureStackTrace&&Error.captureStackTrace(kj(a),l),a.stack,a.name="AssertionError",ZAe(a)}return xSt(n,[{key:"toString",value:function(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}},{key:t,value:function(a,o){return Lj(this,VAe(VAe({},o),{},{customInspect:!1,depth:0}))}}]),n}(Cj(Error),Lj.custom);YAe.exports=PSt});var Pj=ye((mcr,$Ae)=>{"use strict";var JAe=Object.prototype.toString;$Ae.exports=function(t){var r=JAe.call(t),n=r==="[object Arguments]";return n||(n=r!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&JAe.call(t.callee)==="[object Function]"),n}});var sSe=ye((ycr,oSe)=>{"use strict";var aSe;Object.keys||(sE=Object.prototype.hasOwnProperty,Ij=Object.prototype.toString,QAe=Pj(),Rj=Object.prototype.propertyIsEnumerable,eSe=!Rj.call({toString:null},"toString"),tSe=Rj.call(function(){},"prototype"),lE=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],qR=function(e){var t=e.constructor;return t&&t.prototype===e},rSe={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},iSe=function(){if(typeof window=="undefined")return!1;for(var e in window)try{if(!rSe["$"+e]&&sE.call(window,e)&&window[e]!==null&&typeof window[e]=="object")try{qR(window[e])}catch(t){return!0}}catch(t){return!0}return!1}(),nSe=function(e){if(typeof window=="undefined"||!iSe)return qR(e);try{return qR(e)}catch(t){return!1}},aSe=function(t){var r=t!==null&&typeof t=="object",n=Ij.call(t)==="[object Function]",i=QAe(t),a=r&&Ij.call(t)==="[object String]",o=[];if(!r&&!n&&!i)throw new TypeError("Object.keys called on a non-object");var s=tSe&&n;if(a&&t.length>0&&!sE.call(t,0))for(var l=0;l<t.length;++l)o.push(String(l));if(i&&t.length>0)for(var u=0;u<t.length;++u)o.push(String(u));else for(var c in t)!(s&&c==="prototype")&&sE.call(t,c)&&o.push(String(c));if(eSe)for(var f=nSe(t),h=0;h<lE.length;++h)!(f&&lE[h]==="constructor")&&sE.call(t,lE[h])&&o.push(lE[h]);return o});var sE,Ij,QAe,Rj,eSe,tSe,lE,qR,rSe,iSe,nSe;oSe.exports=aSe});var Dj=ye((_cr,cSe)=>{"use strict";var ISt=Array.prototype.slice,RSt=Pj(),lSe=Object.keys,OR=lSe?function(t){return lSe(t)}:sSe(),uSe=Object.keys;OR.shim=function(){if(Object.keys){var t=function(){var r=Object.keys(arguments);return r&&r.length===arguments.length}(1,2);t||(Object.keys=function(n){return RSt(n)?uSe(ISt.call(n)):uSe(n)})}else Object.keys=OR;return Object.keys||OR};cSe.exports=OR});var gSe=ye((xcr,pSe)=>{"use strict";var DSt=Dj(),dSe=B8()(),vSe=i5(),fSe=Object,zSt=vSe("Array.prototype.push"),hSe=vSe("Object.prototype.propertyIsEnumerable"),FSt=dSe?Object.getOwnPropertySymbols:null;pSe.exports=function(t,r){if(t==null)throw new TypeError("target must be an object");var n=fSe(t);if(arguments.length===1)return n;for(var i=1;i<arguments.length;++i){var a=fSe(arguments[i]),o=DSt(a),s=dSe&&(Object.getOwnPropertySymbols||FSt);if(s)for(var l=s(a),u=0;u<l.length;++u){var c=l[u];hSe(a,c)&&zSt(o,c)}for(var f=0;f<o.length;++f){var h=o[f];if(hSe(a,h)){var d=a[h];n[h]=d}}}return n}});var ySe=ye((bcr,mSe)=>{"use strict";var zj=gSe(),qSt=function(){if(!Object.assign)return!1;for(var e="abcdefghijklmnopqrst",t=e.split(""),r={},n=0;n<t.length;++n)r[t[n]]=t[n];var i=Object.assign({},r),a="";for(var o in i)a+=o;return e!==a},OSt=function(){if(!Object.assign||!Object.preventExtensions)return!1;var e=Object.preventExtensions({1:2});try{Object.assign(e,"xy")}catch(t){return e[1]==="y"}return!1};mSe.expo
|
|||
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sMt(e,t){if(e){if(typeof e=="string")return USe(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return USe(e,t)}}function USe(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function lMt(e,t){var r=e==null?null:typeof Symbol!="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw i}}return s}}function uMt(e){if(Array.isArray(e))return e}function J0(e){"@babel/helpers - typeof";return J0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},J0(e)}var cMt=/a/g.flags!==void 0,WR=function(t){var r=[];return t.forEach(function(n){return r.push(n)}),r},VSe=function(t){var r=[];return t.forEach(function(n,i){return r.push([i,n])}),r},QSe=Object.is?Object.is:PSe(),GR=Object.getOwnPropertySymbols?Object.getOwnPropertySymbols:function(){return[]},Bj=Number.isNaN?Number.isNaN:BSe();function Uj(e){return e.call.bind(e)}var fE=Uj(Object.prototype.hasOwnProperty),jR=Uj(Object.prototype.propertyIsEnumerable),HSe=Uj(Object.prototype.toString),sp=h5().types,fMt=sp.isAnyArrayBuffer,hMt=sp.isArrayBufferView,GSe=sp.isDate,NR=sp.isMap,jSe=sp.isRegExp,UR=sp.isSet,dMt=sp.isNativeError,vMt=sp.isBoxedPrimitive,WSe=sp.isNumberObject,ZSe=sp.isStringObject,XSe=sp.isBooleanObject,YSe=sp.isBigIntObject,pMt=sp.isSymbolObject,gMt=sp.isFloat32Array,mMt=sp.isFloat64Array;function yMt(e){if(e.length===0||e.length>10)return!0;for(var t=0;t<e.length;t++){var r=e.charCodeAt(t);if(r<48||r>57)return!0}return e.length===10&&e>=Math.pow(2,32)}function VR(e){return Object.keys(e).filter(yMt).concat(GR(e).filter(Object.prototype.propertyIsEnumerable.bind(e)))}function eMe(e,t){if(e===t)return 0;for(var r=e.length,n=t.length,i=0,a=Math.min(r,n);i<a;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0}var HR=void 0,_Mt=!0,xMt=!1,Nj=0,Vj=1,tMe=2,rMe=3;function bMt(e,t){return cMt?e.source===t.source&&e.flags===t.flags:RegExp.prototype.toString.call(e)===RegExp.prototype.toString.call(t)}function wMt(e,t){if(e.byteLength!==t.byteLength)return!1;for(var r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}function TMt(e,t){return e.byteLength!==t.byteLength?!1:eMe(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))===0}function AMt(e,t){return e.byteLength===t.byteLength&&eMe(new Uint8Array(e),new Uint8Array(t))===0}function SMt(e,t){return WSe(e)?WSe(t)&&QSe(Number.prototype.valueOf.call(e),Number.prototype.valueOf.call(t)):ZSe(e)?ZSe(t)&&String.prototype.valueOf.call(e)===String.prototype.valueOf.call(t):XSe(e)?XSe(t)&&Boolean.prototype.valueOf.call(e)===Boolean.prototype.valueOf.call(t):YSe(e)?YSe(t)&&BigInt.prototype.valueOf.call(e)===BigInt.prototype.valueOf.call(t):pMt(t)&&Symbol.prototype.valueOf.call(e)===Symbol.prototype.valueOf.call(t)}function $0(e,t,r,n){if(e===t)return e!==0?!0:r?QSe(e,t):!0;if(r){if(J0(e)!=="object")return typeof e=="number"&&Bj(e)&&Bj(t);if(J0(t)!=="object"||e===null||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1}else{if(e===null||J0(e)!=="object")return t===null||J0(t)!=="object"?e==t:!1;if(t===null||J0(t)!=="object")return!1}var i=HSe(e),a=HSe(t);if(i!==a)return!1;if(Array.isArray(e)){if(e.length!==t.length)return!1;var o=VR(e,HR),s=VR(t,HR);return o.length!==s.length?!1:cE(e,t,r,n,Vj,o)}if(i==="[object Object]"&&(!NR(e)&&NR(t)||!UR(e)&&UR(t)))return!1;if(GSe(e)){if(!GSe(t)||Date.prototype.getTime.call(e)!==Date.protot
|
|||
|
`)+'Actual message: "'.concat(t&&t.message,'"'),stackStartFn:e})}throw t}}sf.throws=function e(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];_Me.apply(void 0,[e,mMe(t)].concat(n))};sf.rejects=function e(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return yMe(t).then(function(a){return _Me.apply(void 0,[e,a].concat(n))})};sf.doesNotThrow=function e(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];xMe.apply(void 0,[e,mMe(t)].concat(n))};sf.doesNotReject=function e(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return yMe(t).then(function(a){return xMe.apply(void 0,[e,a].concat(n))})};sf.ifError=function e(t){if(t!=null){var r="ifError got unwanted exception: ";jg(t)==="object"&&typeof t.message=="string"?t.message.length===0&&t.constructor?r+=t.constructor.name:r+=t.message:r+=ZR(t);var n=new V_({actual:t,expected:null,operator:"ifError",message:r,stackStartFn:e}),i=t.stack;if(typeof i=="string"){var a=i.split(`
|
|||
|
`);a.shift();for(var o=n.stack.split(`
|
|||
|
`),s=0;s<a.length;s++){var l=o.indexOf(a[s]);if(l!==-1){o=o.slice(0,l);break}}n.stack="".concat(o.join(`
|
|||
|
`),`
|
|||
|
`).concat(a.join(`
|
|||
|
`))}throw n}};function bMe(e,t,r,n,i){if(!XR(t))throw new v5("regexp","RegExp",t);var a=i==="match";if(typeof e!="string"||YR(t,e)!==a){if(r instanceof Error)throw r;var o=!r;r=r||(typeof e!="string"?'The "string" argument must be of type string. Received type '+"".concat(jg(e)," (").concat(ZR(e),")"):(a?"The input did not match the regular expression ":"The input was expected to not match the regular expression ")+"".concat(ZR(t),`. Input:
|
|||
|
|
|||
|
`).concat(ZR(e),`
|
|||
|
`));var s=new V_({actual:e,expected:t,message:r,operator:i,stackStartFn:n});throw s.generatedMessage=o,s}}sf.match=function e(t,r,n){bMe(t,r,n,e,"match")};sf.doesNotMatch=function e(t,r,n){bMe(t,r,n,e,"doesNotMatch")};function wMe(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];vMe.apply(void 0,[wMe,t.length].concat(t))}sf.strict=VMt(wMe,sf,{equal:sf.strictEqual,deepEqual:sf.deepStrictEqual,notEqual:sf.notStrictEqual,notDeepEqual:sf.notDeepStrictEqual});sf.strict.strict=sf.strict});var SMe=ye((Rcr,AMe)=>{var vE=1e3,pE=vE*60,gE=pE*60,mE=gE*24,GMt=mE*365.25;AMe.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return jMt(e);if(r==="number"&&isNaN(e)===!1)return t.long?ZMt(e):WMt(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function jMt(e){if(e=String(e),!(e.length>100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*GMt;case"days":case"day":case"d":return r*mE;case"hours":case"hour":case"hrs":case"hr":case"h":return r*gE;case"minutes":case"minute":case"mins":case"min":case"m":return r*pE;case"seconds":case"second":case"secs":case"sec":case"s":return r*vE;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function WMt(e){return e>=mE?Math.round(e/mE)+"d":e>=gE?Math.round(e/gE)+"h":e>=pE?Math.round(e/pE)+"m":e>=vE?Math.round(e/vE)+"s":e+"ms"}function ZMt(e){return $R(e,mE,"day")||$R(e,gE,"hour")||$R(e,pE,"minute")||$R(e,vE,"second")||e+" ms"}function $R(e,t,r){if(!(e<t))return e<t*1.5?Math.floor(e/t)+" "+r:Math.ceil(e/t)+" "+r+"s"}});var EMe=ye(($u,MMe)=>{$u=MMe.exports=jj.debug=jj.default=jj;$u.coerce=$Mt;$u.disable=KMt;$u.enable=YMt;$u.enabled=JMt;$u.humanize=SMe();$u.names=[];$u.skips=[];$u.formatters={};var Gj;function XMt(e){var t=0,r;for(r in e)t=(t<<5)-t+e.charCodeAt(r),t|=0;return $u.colors[Math.abs(t)%$u.colors.length]}function jj(e){function t(){if(t.enabled){var r=t,n=+new Date,i=n-(Gj||n);r.diff=i,r.prev=Gj,r.curr=n,Gj=n;for(var a=new Array(arguments.length),o=0;o<a.length;o++)a[o]=arguments[o];a[0]=$u.coerce(a[0]),typeof a[0]!="string"&&a.unshift("%O");var s=0;a[0]=a[0].replace(/%([a-zA-Z%])/g,function(u,c){if(u==="%%")return u;s++;var f=$u.formatters[c];if(typeof f=="function"){var h=a[s];u=f.call(r,h),a.splice(s,1),s--}return u}),$u.formatArgs.call(r,a);var l=t.log||$u.log||console.log.bind(console);l.apply(r,a)}}return t.namespace=e,t.enabled=$u.enabled(e),t.useColors=$u.useColors(),t.color=XMt(e),typeof $u.init=="function"&&$u.init(t),t}function YMt(e){$u.save(e),$u.names=[],$u.skips=[];for(var t=(typeof e=="string"?e:"").split(/[\s,]+/),r=t.length,n=0;n<r;n++)t[n]&&(e=t[n].replace(/\*/g,".*?"),e[0]==="-"?$u.skips.push(new RegExp("^"+e.substr(1)+"$")):$u.names.push(new RegExp("^"+e+"$")))}function KMt(){$u.enable("")}function JMt(e){var t,r;for(t=0,r=$u.skips.length;t<r;t++)if($u.skips[t].test(e))return!1;for(t=0,r=$u.names.length;t<r;t++)if($u.names[t].test(e))return!0;return!1}function $Mt(e){return e instanceof Error?e.stack||e.message:e}});var LMe=ye((lp,CMe)=>{lp=CMe.exports=EMe();lp.log=t4t;lp.formatArgs=e4t;lp.save=r4t;lp.load=kMe;lp.useColors=QMt;lp.storage=typeof chrome!="undefined"&&typeof chrome.storage!="undefined"?chrome.storage.local:i4t();lp.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"];function QMt(){return typeof window!="undefined"&&window.process&&window.process.type==="renderer"?!0:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined
|
|||
|
|
|||
|
`),F4t=n4e("IHDR");a4e.exports=function(e){if(!(e.length<24)&&r4e(e,0,z4t)&&r4e(e,12,F4t))return{width:i4e(e,16),height:i4e(e,20),type:"png",mime:"image/png",wUnits:"px",hUnits:"px"}}});var u4e=ye((Gcr,l4e)=>{"use strict";var q4t=Eu().str2arr,O4t=Eu().sliceEq,s4e=Eu().readUInt32BE,B4t=q4t("8BPS\0");l4e.exports=function(e){if(!(e.length<22)&&O4t(e,0,B4t))return{width:s4e(e,18),height:s4e(e,14),type:"psd",mime:"image/vnd.adobe.photoshop",wUnits:"px",hUnits:"px"}}});var h4e=ye((jcr,f4e)=>{"use strict";function N4t(e){return e===32||e===9||e===13||e===10}function m5(e){return typeof e=="number"&&isFinite(e)&&e>0}function U4t(e){var t=0,r=e.length;for(e[0]===239&&e[1]===187&&e[2]===191&&(t=3);t<r&&N4t(e[t]);)t++;return t===r?!1:e[t]===60}var V4t=/<[-_.:a-zA-Z0-9][^>]*>/,H4t=/^<([-_.:a-zA-Z0-9]+:)?svg\s/,G4t=/[^-]\bwidth="([^%]+?)"|[^-]\bwidth='([^%]+?)'/,j4t=/\bheight="([^%]+?)"|\bheight='([^%]+?)'/,W4t=/\bview[bB]ox="(.+?)"|\bview[bB]ox='(.+?)'/,c4e=/in$|mm$|cm$|pt$|pc$|px$|em$|ex$/;function Z4t(e){var t=e.match(G4t),r=e.match(j4t),n=e.match(W4t);return{width:t&&(t[1]||t[2]),height:r&&(r[1]||r[2]),viewbox:n&&(n[1]||n[2])}}function Nm(e){return c4e.test(e)?e.match(c4e)[0]:"px"}f4e.exports=function(e){if(U4t(e)){for(var t="",r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);var n=(t.match(V4t)||[""])[0];if(H4t.test(n)){var i=Z4t(n),a=parseFloat(i.width),o=parseFloat(i.height);if(i.width&&i.height)return!m5(a)||!m5(o)?void 0:{width:a,height:o,type:"svg",mime:"image/svg+xml",wUnits:Nm(i.width),hUnits:Nm(i.height)};var s=(i.viewbox||"").split(" "),l={width:s[2],height:s[3]},u=parseFloat(l.width),c=parseFloat(l.height);if(!(!m5(u)||!m5(c))&&Nm(l.width)===Nm(l.height)){var f=u/c;return i.width?m5(a)?{width:a,height:a/f,type:"svg",mime:"image/svg+xml",wUnits:Nm(i.width),hUnits:Nm(i.width)}:void 0:i.height?m5(o)?{width:o*f,height:o,type:"svg",mime:"image/svg+xml",wUnits:Nm(i.height),hUnits:Nm(i.height)}:void 0:{width:u,height:c,type:"svg",mime:"image/svg+xml",wUnits:Nm(l.width),hUnits:Nm(l.height)}}}}}});var m4e=ye((Wcr,g4e)=>{"use strict";var p4e=Eu().str2arr,d4e=Eu().sliceEq,X4t=Eu().readUInt16LE,Y4t=Eu().readUInt16BE,K4t=Eu().readUInt32LE,J4t=Eu().readUInt32BE,$4t=p4e("II*\0"),Q4t=p4e("MM\0*");function aD(e,t,r){return r?Y4t(e,t):X4t(e,t)}function Jj(e,t,r){return r?J4t(e,t):K4t(e,t)}function v4e(e,t,r){var n=aD(e,t+2,r),i=Jj(e,t+4,r);return i!==1||n!==3&&n!==4?null:n===3?aD(e,t+8,r):Jj(e,t+8,r)}g4e.exports=function(e){if(!(e.length<8)&&!(!d4e(e,0,$4t)&&!d4e(e,0,Q4t))){var t=e[0]===77,r=Jj(e,4,t)-8;if(!(r<0)){var n=r+8;if(!(e.length-n<2)){var i=aD(e,n+0,t)*12;if(!(i<=0)&&(n+=2,!(e.length-n<i))){var a,o,s,l;for(a=0;a<i;a+=12)l=aD(e,n+a,t),l===256?o=v4e(e,n+a,t):l===257&&(s=v4e(e,n+a,t));if(o&&s)return{width:o,height:s,type:"tiff",mime:"image/tiff",wUnits:"px",hUnits:"px"}}}}}}});var w4e=ye((Zcr,b4e)=>{"use strict";var x4e=Eu().str2arr,y4e=Eu().sliceEq,_4e=Eu().readUInt16LE,$j=Eu().readUInt32LE,eEt=iD(),tEt=x4e("RIFF"),rEt=x4e("WEBP");function iEt(e,t){if(!(e[t+3]!==157||e[t+4]!==1||e[t+5]!==42))return{width:_4e(e,t+6)&16383,height:_4e(e,t+8)&16383,type:"webp",mime:"image/webp",wUnits:"px",hUnits:"px"}}function nEt(e,t){if(e[t]===47){var r=$j(e,t+1);return{width:(r&16383)+1,height:(r>>14&16383)+1,type:"webp",mime:"image/webp",wUnits:"px",hUnits:"px"}}}function aEt(e,t){return{width:(e[t+6]<<16|e[t+5]<<8|e[t+4])+1,height:(e[t+9]<<t|e[t+8]<<8|e[t+7])+1,type:"webp",mime:"image/webp",wUnits:"px",hUnits:"px"}}b4e.exports=function(e){if(!(e.length<16)&&!(!y4e(e,0,tEt)&&!y4e(e,8,rEt))){var t=12,r=null,n=0,i=$j(e,4)+8;if(!(i>e.length)){for(;t+8<i;){if(e[t]===0){t++;continue}var a=String.fromCharCode.apply(null,e.slice(t,t+4)),o=$j(e,t+4);a==="VP8 "&&o>=10?r=r||iEt(e,t+8):a==="VP8L"&&o>=9?r=r||nEt(e,t+8):a==="VP8X"&&o>=10?r=r||aEt(e,t+8):a==="EXIF"&&(n=eEt.get_orientation(e.slice(t+8,t+8+o)),t=1/0),t+=8+o}if(r)return n>0&&(r.orientation=n),r}}}});var A4e=ye((Xcr,T4e)=>{"use strict";T4e.exports={avif:VMe(),bmp:jMe(),gif:KMe(),ico:QMe(),jpeg:t4e(),png:o4e(),psd:u4e(),svg:h4e(),tiff:m4e(),webp:w4e()}});var S4e=ye((Ycr,eW)=>{"use strict";var Qj=
|
|||
|
parent value =`,W,`
|
|||
|
children sum =`,re].join(" "))}G.value=W});break}else XEe(T,t,{branches:t.count.indexOf("branches")!==-1,leaves:t.count.indexOf("leaves")!==-1});if(!F){t.sort&&T.sort(function(G,N){return N.value-G.value});var q,V,H=t.marker.colors||[],X=!!H.length;return t._hasColorscale?(X||(H=l?t.values:t._values),Skt(e,t,{vals:H,containerStr:"marker",cLetter:"c"}),V=wkt(t.marker)):q=Tkt(r["_"+t.type+"colormap"]),T.each(function(G){var N=G.data.data;N.color=t._hasColorscale?V(H[N.i]):q(H[N.i],N.id)}),u[0].hierarchy=T,u}};ME._runCrossTraceCalc=function(e,t){var r=t._fullLayout,n=t.calcdata,i=r[e+"colorway"],a=r["_"+e+"colormap"];r["extend"+e+"colors"]&&(i=Akt(i,e==="icicle"?Ckt:e==="treemap"?kkt:Ekt));var o=0,s;function l(h){var d=h.data.data,v=d.id;d.color===!1&&(a[v]?d.color=a[v]:h.parent?h.parent.parent?d.color=h.parent.data.data.color:(a[v]=d.color=i[o%i.length],o++):d.color=s)}for(var u=0;u<n.length;u++){var c=n[u],f=c[0];f.trace.type===e&&f.hierarchy&&(s=f.trace.root.color,f.hierarchy.each(l))}};ME.crossTraceCalc=function(e){return ME._runCrossTraceCalc("sunburst",e)};function XEe(e,t,r){var n=0,i=e.children;if(i){for(var a=i.length,o=0;o<a;o++)n+=XEe(i[o],t,r);r.branches&&n++}else r.leaves&&n++;return e.value=e.data.data.value=n,t._values||(t._values=[]),t._values[e.data.data.i]=n,n}});function Xy(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function G_(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}var pD=Ll(()=>{});function Vm(){}function KEe(){return this.rgb().formatHex()}function qkt(){return this.rgb().formatHex8()}function Okt(){return ike(this).formatHsl()}function JEe(){return this.rgb().formatRgb()}function W_(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=Lkt.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?$Ee(t):r===3?new hd(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?gD(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?gD(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Pkt.exec(e))?new hd(t[1],t[2],t[3],1):(t=Ikt.exec(e))?new hd(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Rkt.exec(e))?gD(t[1],t[2],t[3],t[4]):(t=Dkt.exec(e))?gD(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=zkt.exec(e))?tke(t[1],t[2]/100,t[3]/100,1):(t=Fkt.exec(e))?tke(t[1],t[2]/100,t[3]/100,t[4]):YEe.hasOwnProperty(e)?$Ee(YEe[e]):e==="transparent"?new hd(NaN,NaN,NaN,0):null}function $Ee(e){return new hd(e>>16&255,e>>8&255,e&255,1)}function gD(e,t,r,n){return n<=0&&(e=t=r=NaN),new hd(e,t,r,n)}function CE(e){return e instanceof Vm||(e=W_(e)),e?(e=e.rgb(),new hd(e.r,e.g,e.b,e.opacity)):new hd}function T5(e,t,r,n){return arguments.length===1?CE(e):new hd(e,t,r,n==null?1:n)}function hd(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}function QEe(){return`#${M2(this.r)}${M2(this.g)}${M2(this.b)}`}function Bkt(){return`#${M2(this.r)}${M2(this.g)}${M2(this.b)}${M2((isNaN(this.opacity)?1:this.opacity)*255)}`}function eke(){let e=yD(this.opacity);return`${e===1?"rgb(":"rgba("}${E2(this.r)}, ${E2(this.g)}, ${E2(this.b)}${e===1?")":`, ${e})`}`}function yD(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function E2(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function M2(e){return e=E2(e),(e<16?"0":"")+e.toString(16)}function tke(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new Zg(e,t,r,n)}function ike(e){if(e instanceof Zg)return new Zg(e.h,e.s,e.l,e.opacity);if(e instanceof Vm||(e=W_(e)),!e)return new Zg;if(e instanceof Zg)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),a=Math.max(t,r,n),o=NaN,s=a-i,l=(a+i)/2;return s?(t===a?o=(r-n)/s+(r<n)*6:r===a?o=(n-t)/s+2:o=(t-r)/s+4,s/=l<.5?a+i:2-a-i,o*=60):s=l>0&&l<1?0:o,new Zg(o,s,l,e.opacity)}function LE(e,t,r,n){return arguments.length===1?ike(e):new Zg(e,t,r,n==null?1:n)}function Zg(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}function rke(e){return e=(e||0)%360,e<0?e+360:e}function mD(e){return Math.max(0,Math.min(1,e||0))}function oW(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}var j_,k2,w5,kE,Um,Lkt,Pkt,Ikt,Rkt,Dkt,zkt,Fkt,YEe,_D=Ll(()=>{pD();j
|
|||
|
`)}},3952:function(i,a,o){"use strict";i.exports=u;var s=o(3250);function l(c,f){for(var h=new Array(f+1),d=0;d<c.length;++d)h[d]=c[d];for(var d=0;d<=c.length;++d){for(var v=c.length;v<=f;++v){for(var x=new Array(f),b=0;b<f;++b)x[b]=Math.pow(v+1-d,b);h[v]=x}var p=s.apply(void 0,h);if(p)return!0}return!1}function u(c){var f=c.length;if(f===0)return[];if(f===1)return[0];for(var h=c[0].length,d=[c[0]],v=[0],x=1;x<f;++x){if(d.push(c[x]),!l(d,h)){d.pop();continue}if(v.push(x),v.length===h+1)return v}return v}},5995:function(i,a,o){"use strict";i.exports=u;var s=o(7642),l=o(6037);function u(c,f){return s(f).filter(function(h){for(var d=new Array(h.length),v=0;v<h.length;++v)d[v]=f[h[v]];return l(d)*c<1})}},3502:function(i,a,o){i.exports=u;var s=o(5995),l=o(9127);function u(c,f){return l(s(c,f))}},6468:function(i){i.exports=function(o){return atob(o)}},2642:function(i,a,o){"use strict";i.exports=u;var s=o(727);function l(c){for(var f=0,h=0;h<c.length;++h)f+=c[h];return f}function u(c,f){for(var h=f.length,d=new Array(h+1),v=0;v<h;++v){for(var x=new Array(h+1),b=0;b<=h;++b)x[b]=c[b][v];d[v]=x}d[h]=new Array(h+1);for(var v=0;v<=h;++v)d[h][v]=1;for(var p=new Array(h+1),v=0;v<h;++v)p[v]=f[v];p[h]=1;var E=s(d,p),k=l(E[h+1]);k===0&&(k=1);for(var A=new Array(h+1),v=0;v<=h;++v)A[v]=l(E[v])/k;return A}},7507:function(i,a){"use strict";a.byteLength=d,a.toByteArray=x,a.fromByteArray=E;for(var o=[],s=[],l=typeof Uint8Array!="undefined"?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=0,f=u.length;c<f;++c)o[c]=u[c],s[u.charCodeAt(c)]=c;s[45]=62,s[95]=63;function h(k){var A=k.length;if(A%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var L=k.indexOf("=");L===-1&&(L=A);var _=L===A?0:4-L%4;return[L,_]}function d(k){var A=h(k),L=A[0],_=A[1];return(L+_)*3/4-_}function v(k,A,L){return(A+L)*3/4-L}function x(k){var A,L=h(k),_=L[0],C=L[1],M=new l(v(k,_,C)),g=0,P=C>0?_-4:_,T;for(T=0;T<P;T+=4)A=s[k.charCodeAt(T)]<<18|s[k.charCodeAt(T+1)]<<12|s[k.charCodeAt(T+2)]<<6|s[k.charCodeAt(T+3)],M[g++]=A>>16&255,M[g++]=A>>8&255,M[g++]=A&255;return C===2&&(A=s[k.charCodeAt(T)]<<2|s[k.charCodeAt(T+1)]>>4,M[g++]=A&255),C===1&&(A=s[k.charCodeAt(T)]<<10|s[k.charCodeAt(T+1)]<<4|s[k.charCodeAt(T+2)]>>2,M[g++]=A>>8&255,M[g++]=A&255),M}function b(k){return o[k>>18&63]+o[k>>12&63]+o[k>>6&63]+o[k&63]}function p(k,A,L){for(var _,C=[],M=A;M<L;M+=3)_=(k[M]<<16&16711680)+(k[M+1]<<8&65280)+(k[M+2]&255),C.push(b(_));return C.join("")}function E(k){for(var A,L=k.length,_=L%3,C=[],M=16383,g=0,P=L-_;g<P;g+=M)C.push(p(k,g,g+M>P?P:g+M));return _===1?(A=k[L-1],C.push(o[A>>2]+o[A<<4&63]+"==")):_===2&&(A=(k[L-2]<<8)+k[L-1],C.push(o[A>>10]+o[A>>4&63]+o[A<<2&63]+"=")),C.join("")}},3865:function(i,a,o){"use strict";var s=o(869);i.exports=l;function l(u,c){return s(u[0].mul(c[1]).add(c[0].mul(u[1])),u[1].mul(c[1]))}},1318:function(i){"use strict";i.exports=a;function a(o,s){return o[0].mul(s[1]).cmp(s[0].mul(o[1]))}},8697:function(i,a,o){"use strict";var s=o(869);i.exports=l;function l(u,c){return s(u[0].mul(c[1]),u[1].mul(c[0]))}},7842:function(i,a,o){"use strict";var s=o(6330),l=o(1533),u=o(2651),c=o(6768),f=o(869),h=o(8697);i.exports=d;function d(v,x){if(s(v))return x?h(v,d(x)):[v[0].clone(),v[1].clone()];var b=0,p,E;if(l(v))p=v.clone();else if(typeof v=="string")p=c(v);else{if(v===0)return[u(0),u(1)];if(v===Math.floor(v))p=u(v);else{for(;v!==Math.floor(v);)v=v*Math.pow(2,256),b-=256;p=u(v)}}if(s(x))p.mul(x[1]),E=x[0].clone();else if(l(x))E=x.clone();else if(typeof x=="string")E=c(x);else if(!x)E=u(1);else if(x===Math.floor(x))E=u(x);else{for(;x!==Math.floor(x);)x=x*Math.pow(2,256),b+=256;E=u(x)}return b>0?p=p.ushln(b):b<0&&(E=E.ushln(-b)),f(p,E)}},6330:function(i,a,o){"use strict";var s=o(1533);i.exports=l;function l(u){return Array.isArray(u)&&u.length===2&&s(u[0])&&s(u[1])}},5716:function(i,a,o){"use strict";var s=o(6859);i.exports=l;function l(u){return u.cmp(new s(0))}},1369:function(i,a,o){"use strict";var s=o(5716);i.exports=l;function l(u){var c=u.length,f=u.words,h=0;if(c===1)h=f[0];else if(c===2)h=f[0]+f[1]*6710886
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
attribute vec3 position;
|
|||
|
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
uniform vec3 offset, majorAxis, minorAxis, screenAxis;
|
|||
|
uniform float lineWidth;
|
|||
|
uniform vec2 screenShape;
|
|||
|
|
|||
|
vec3 project(vec3 p) {
|
|||
|
vec4 pp = projection * (view * (model * vec4(p, 1.0)));
|
|||
|
return pp.xyz / max(pp.w, 0.0001);
|
|||
|
}
|
|||
|
|
|||
|
void main() {
|
|||
|
vec3 major = position.x * majorAxis;
|
|||
|
vec3 minor = position.y * minorAxis;
|
|||
|
|
|||
|
vec3 vPosition = major + minor + offset;
|
|||
|
vec3 pPosition = project(vPosition);
|
|||
|
vec3 offset = project(vPosition + screenAxis * position.z);
|
|||
|
|
|||
|
vec2 screen = normalize((offset - pPosition).xy * screenShape) / screenShape;
|
|||
|
|
|||
|
gl_Position = vec4(pPosition + vec3(0.5 * screen * lineWidth, 0), 1.0);
|
|||
|
}
|
|||
|
`]),c=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
uniform vec4 color;
|
|||
|
void main() {
|
|||
|
gl_FragColor = color;
|
|||
|
}`]);a.n=function(x){return l(x,u,c,null,[{name:"position",type:"vec3"}])};var f=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
attribute vec3 position;
|
|||
|
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
uniform vec3 offset, axis, alignDir, alignOpt;
|
|||
|
uniform float scale, angle, pixelScale;
|
|||
|
uniform vec2 resolution;
|
|||
|
|
|||
|
vec3 project(vec3 p) {
|
|||
|
vec4 pp = projection * (view * (model * vec4(p, 1.0)));
|
|||
|
return pp.xyz / max(pp.w, 0.0001);
|
|||
|
}
|
|||
|
|
|||
|
float computeViewAngle(vec3 a, vec3 b) {
|
|||
|
vec3 A = project(a);
|
|||
|
vec3 B = project(b);
|
|||
|
|
|||
|
return atan(
|
|||
|
(B.y - A.y) * resolution.y,
|
|||
|
(B.x - A.x) * resolution.x
|
|||
|
);
|
|||
|
}
|
|||
|
|
|||
|
const float PI = 3.141592;
|
|||
|
const float TWO_PI = 2.0 * PI;
|
|||
|
const float HALF_PI = 0.5 * PI;
|
|||
|
const float ONE_AND_HALF_PI = 1.5 * PI;
|
|||
|
|
|||
|
int option = int(floor(alignOpt.x + 0.001));
|
|||
|
float hv_ratio = alignOpt.y;
|
|||
|
bool enableAlign = (alignOpt.z != 0.0);
|
|||
|
|
|||
|
float mod_angle(float a) {
|
|||
|
return mod(a, PI);
|
|||
|
}
|
|||
|
|
|||
|
float positive_angle(float a) {
|
|||
|
return mod_angle((a < 0.0) ?
|
|||
|
a + TWO_PI :
|
|||
|
a
|
|||
|
);
|
|||
|
}
|
|||
|
|
|||
|
float look_upwards(float a) {
|
|||
|
float b = positive_angle(a);
|
|||
|
return ((b > HALF_PI) && (b <= ONE_AND_HALF_PI)) ?
|
|||
|
b - PI :
|
|||
|
b;
|
|||
|
}
|
|||
|
|
|||
|
float look_horizontal_or_vertical(float a, float ratio) {
|
|||
|
// ratio controls the ratio between being horizontal to (vertical + horizontal)
|
|||
|
// if ratio is set to 0.5 then it is 50%, 50%.
|
|||
|
// when using a higher ratio e.g. 0.75 the result would
|
|||
|
// likely be more horizontal than vertical.
|
|||
|
|
|||
|
float b = positive_angle(a);
|
|||
|
|
|||
|
return
|
|||
|
(b < ( ratio) * HALF_PI) ? 0.0 :
|
|||
|
(b < (2.0 - ratio) * HALF_PI) ? -HALF_PI :
|
|||
|
(b < (2.0 + ratio) * HALF_PI) ? 0.0 :
|
|||
|
(b < (4.0 - ratio) * HALF_PI) ? HALF_PI :
|
|||
|
0.0;
|
|||
|
}
|
|||
|
|
|||
|
float roundTo(float a, float b) {
|
|||
|
return float(b * floor((a + 0.5 * b) / b));
|
|||
|
}
|
|||
|
|
|||
|
float look_round_n_directions(float a, int n) {
|
|||
|
float b = positive_angle(a);
|
|||
|
float div = TWO_PI / float(n);
|
|||
|
float c = roundTo(b, div);
|
|||
|
return look_upwards(c);
|
|||
|
}
|
|||
|
|
|||
|
float applyAlignOption(float rawAngle, float delta) {
|
|||
|
return
|
|||
|
(option > 2) ? look_round_n_directions(rawAngle + delta, option) : // option 3-n: round to n directions
|
|||
|
(option == 2) ? look_horizontal_or_vertical(rawAngle + delta, hv_ratio) : // horizontal or vertical
|
|||
|
(option == 1) ? rawAngle + delta : // use free angle, and flip to align with one direction of the axis
|
|||
|
(option == 0) ? look_upwards(rawAngle) : // use free angle, and stay upwards
|
|||
|
(option ==-1) ? 0.0 : // useful for backward compatibility, all texts remains horizontal
|
|||
|
rawAngle; // otherwise return back raw input angle
|
|||
|
}
|
|||
|
|
|||
|
bool isAxisTitle = (axis.x == 0.0) &&
|
|||
|
(axis.y == 0.0) &&
|
|||
|
(axis.z == 0.0);
|
|||
|
|
|||
|
void main() {
|
|||
|
//Compute world offset
|
|||
|
float axisDistance = position.z;
|
|||
|
vec3 dataPosition = axisDistance * axis + offset;
|
|||
|
|
|||
|
float beta = angle; // i.e. user defined attributes for each tick
|
|||
|
|
|||
|
float axisAngle;
|
|||
|
float clipAngle;
|
|||
|
float flip;
|
|||
|
|
|||
|
if (enableAlign) {
|
|||
|
axisAngle = (isAxisTitle) ? HALF_PI :
|
|||
|
computeViewAngle(dataPosition, dataPosition + axis);
|
|||
|
clipAngle = computeViewAngle(dataPosition, dataPosition + alignDir);
|
|||
|
|
|||
|
axisAngle += (sin(axisAngle) < 0.0) ? PI : 0.0;
|
|||
|
clipAngle += (sin(clipAngle) < 0.0) ? PI : 0.0;
|
|||
|
|
|||
|
flip = (dot(vec2(cos(axisAngle), sin(axisAngle)),
|
|||
|
vec2(sin(clipAngle),-cos(clipAngle))) > 0.0) ? 1.0 : 0.0;
|
|||
|
|
|||
|
beta += applyAlignOption(clipAngle, flip * PI);
|
|||
|
}
|
|||
|
|
|||
|
//Compute plane offset
|
|||
|
vec2 planeCoord = position.xy * pixelScale;
|
|||
|
|
|||
|
mat2 planeXform = scale * mat2(
|
|||
|
cos(beta), sin(beta),
|
|||
|
-sin(beta), cos(beta)
|
|||
|
);
|
|||
|
|
|||
|
vec2 viewOffset = 2.0 * planeXform * planeCoord / resolution;
|
|||
|
|
|||
|
//Compute clip position
|
|||
|
vec3 clipPosition = project(dataPosition);
|
|||
|
|
|||
|
//Apply text offset in clip coordinates
|
|||
|
clipPosition += vec3(viewOffset, 0.0);
|
|||
|
|
|||
|
//Done
|
|||
|
gl_Position = vec4(clipPosition, 1.0);
|
|||
|
}
|
|||
|
`]),h=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
uniform vec4 color;
|
|||
|
void main() {
|
|||
|
gl_FragColor = color;
|
|||
|
}`]);a.Q=function(x){return l(x,f,h,null,[{name:"position",type:"vec3"}])};var d=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
attribute vec3 position;
|
|||
|
attribute vec3 normal;
|
|||
|
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
uniform vec3 enable;
|
|||
|
uniform vec3 bounds[2];
|
|||
|
|
|||
|
varying vec3 colorChannel;
|
|||
|
|
|||
|
void main() {
|
|||
|
|
|||
|
vec3 signAxis = sign(bounds[1] - bounds[0]);
|
|||
|
|
|||
|
vec3 realNormal = signAxis * normal;
|
|||
|
|
|||
|
if(dot(realNormal, enable) > 0.0) {
|
|||
|
vec3 minRange = min(bounds[0], bounds[1]);
|
|||
|
vec3 maxRange = max(bounds[0], bounds[1]);
|
|||
|
vec3 nPosition = mix(minRange, maxRange, 0.5 * (position + 1.0));
|
|||
|
gl_Position = projection * (view * (model * vec4(nPosition, 1.0)));
|
|||
|
} else {
|
|||
|
gl_Position = vec4(0,0,0,0);
|
|||
|
}
|
|||
|
|
|||
|
colorChannel = abs(realNormal);
|
|||
|
}
|
|||
|
`]),v=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
uniform vec4 colors[3];
|
|||
|
|
|||
|
varying vec3 colorChannel;
|
|||
|
|
|||
|
void main() {
|
|||
|
gl_FragColor = colorChannel.x * colors[0] +
|
|||
|
colorChannel.y * colors[1] +
|
|||
|
colorChannel.z * colors[2];
|
|||
|
}`]);a.bg=function(x){return l(x,d,v,null,[{name:"position",type:"vec3"},{name:"normal",type:"vec3"}])}},4935:function(i,a,o){"use strict";i.exports=E;var s=o(2762),l=o(8116),u=o(4359),c=o(1879).Q,f=window||process.global||{},h=f.__TEXT_CACHE||{};f.__TEXT_CACHE={};var d=3;function v(k,A,L,_){this.gl=k,this.shader=A,this.buffer=L,this.vao=_,this.tickOffset=this.tickCount=this.labelOffset=this.labelCount=null}var x=v.prototype,b=[0,0];x.bind=function(k,A,L,_){this.vao.bind(),this.shader.bind();var C=this.shader.uniforms;C.model=k,C.view=A,C.projection=L,C.pixelScale=_,b[0]=this.gl.drawingBufferWidth,b[1]=this.gl.drawingBufferHeight,this.shader.uniforms.resolution=b},x.unbind=function(){this.vao.unbind()},x.update=function(k,A,L,_,C){var M=[];function g(W,re,ae,_e,Me,ke){var ge=[ae.style,ae.weight,ae.variant,ae.family].join("_"),ie=h[ge];ie||(ie=h[ge]={});var Te=ie[re];Te||(Te=ie[re]=p(re,{triangles:!0,font:ae.family,fontStyle:ae.style,fontWeight:ae.weight,fontVariant:ae.variant,textAlign:"center",textBaseline:"middle",lineSpacing:Me,styletags:ke}));for(var Ee=(_e||12)/12,Ae=Te.positions,ze=Te.cells,Ce=0,me=ze.length;Ce<me;++Ce)for(var Re=ze[Ce],ce=2;ce>=0;--ce){var Ge=Ae[Re[ce]];M.push(Ee*Ge[0],-Ee*Ge[1],W)}}for(var P=[0,0,0],T=[0,0,0],F=[0,0,0],q=[0,0,0],V=1.25,H={breaklines:!0,bolds:!0,italics:!0,subscripts:!0,superscripts:!0},X=0;X<3;++X){F[X]=M.length/d|0,g(.5*(k[0][X]+k[1][X]),A[X],L[X],12,V,H),q[X]=(M.length/d|0)-F[X],P[X]=M.length/d|0;for(var G=0;G<_[X].length;++G)if(_[X][G].text){var N={family:_[X][G].font||C[X].family,style:C[X].fontStyle||C[X].style,weight:C[X].fontWeight||C[X].weight,variant:C[X].fontVariant||C[X].variant};g(_[X][G].x,_[X][G].text,N,_[X][G].fontSize||12,V,H)}T[X]=(M.length/d|0)-P[X]}this.buffer.update(M),this.tickOffset=P,this.tickCount=T,this.labelOffset=F,this.labelCount=q},x.drawTicks=function(k,A,L,_,C,M,g,P){this.tickCount[k]&&(this.shader.uniforms.axis=M,this.shader.uniforms.color=C,this.shader.uniforms.angle=L,this.shader.uniforms.scale=A,this.shader.uniforms.offset=_,this.shader.uniforms.alignDir=g,this.shader.uniforms.alignOpt=P,this.vao.draw(this.gl.TRIANGLES,this.tickCount[k],this.tickOffset[k]))},x.drawLabel=function(k,A,L,_,C,M,g,P){this.labelCount[k]&&(this.shader.uniforms.axis=M,this.shader.uniforms.color=C,this.shader.uniforms.angle=L,this.shader.uniforms.scale=A,this.shader.uniforms.offset=_,this.shader.uniforms.alignDir=g,this.shader.uniforms.alignOpt=P,this.vao.draw(this.gl.TRIANGLES,this.labelCount[k],this.labelOffset[k]))},x.dispose=function(){this.shader.dispose(),this.vao.dispose(),this.buffer.dispose()};function p(k,A){try{return u(k,A)}catch(L){return console.warn('error vectorizing text:"'+k+'" error:',L),{cells:[],positions:[]}}}function E(k,A,L,_,C,M){var g=s(k),P=l(k,[{buffer:g,size:3}]),T=c(k);T.attributes.position.location=0;var F=new v(k,T,g,P);return F.update(A,L,_,C,M),F}},6444:function(i,a){"use strict";a.create=s,a.equal=l;function o(u,c){var f=u+"",h=f.indexOf("."),d=0;h>=0&&(d=f.length-h-1);var v=Math.pow(10,d),x=Math.round(u*c*v),b=x+"";if(b.indexOf("e")>=0)return b;var p=x/v,E=x%v;x<0?(p=-Math.ceil(p)|0,E=-E|0):(p=Math.floor(p)|0,E=E|0);var k=""+p;if(x<0&&(k="-"+k),d){for(var A=""+E;A.length<d;)A="0"+A;return k+"."+A}else return k}function s(u,c){for(var f=[],h=0;h<3;++h){for(var d=[],v=.5*(u[0][h]+u[1][h]),x=0;x*c[h]<=u[1][h];++x)d.push({x:x*c[h],text:o(c[h],x)});for(var x=-1;x*c[h]>=u[0][h];--x)d.push({x:x*c[h],text:o(c[h],x)});f.push(d)}return f}function l(u,c){for(var f=0;f<3;++f){if(u[f].length!==c[f].length)return!1;for(var h=0;h<u[f].length;++h){var d=u[f][h],v=c[f][h];if(d.x!==v.x||d.text!==v.text||d.font!==v.font||d.fontColor!==v.fontColor||d.fontSize!==v.fontSize||d.dx!==v.dx||d.dy!==v.dy)return!1}}return!0}},5445:function(i,a,o){"use strict";i.exports=L;var s=o(5033),l=o(5202),u=o(6429),c=o(6760),f=o(5665),h=o(5352),d=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),v=new Float32Array(16);function x(_,C,M){this.lo=_,this.hi=C,this.pixelsPerDataUnit=M}var b=[0,0,0,1],p=[0,0,0,1];function E(_,C,M,g,P){for(var T=0;T<3;++T){for(var F=b,q=p,V=0;V
|
|||
|
|
|||
|
precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
vec3 getOrthogonalVector(vec3 v) {
|
|||
|
// Return up-vector for only-z vector.
|
|||
|
// Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).
|
|||
|
// From the above if-statement we have ||a|| > 0 U ||b|| > 0.
|
|||
|
// Assign z = 0, x = -b, y = a:
|
|||
|
// a*-b + b*a + c*0 = -ba + ba + 0 = 0
|
|||
|
if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {
|
|||
|
return normalize(vec3(-v.y, v.x, 0.0));
|
|||
|
} else {
|
|||
|
return normalize(vec3(0.0, v.z, -v.y));
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// Calculate the cone vertex and normal at the given index.
|
|||
|
//
|
|||
|
// The returned vertex is for a cone with its top at origin and height of 1.0,
|
|||
|
// pointing in the direction of the vector attribute.
|
|||
|
//
|
|||
|
// Each cone is made up of a top vertex, a center base vertex and base perimeter vertices.
|
|||
|
// These vertices are used to make up the triangles of the cone by the following:
|
|||
|
// segment + 0 top vertex
|
|||
|
// segment + 1 perimeter vertex a+1
|
|||
|
// segment + 2 perimeter vertex a
|
|||
|
// segment + 3 center base vertex
|
|||
|
// segment + 4 perimeter vertex a
|
|||
|
// segment + 5 perimeter vertex a+1
|
|||
|
// Where segment is the number of the radial segment * 6 and a is the angle at that radial segment.
|
|||
|
// To go from index to segment, floor(index / 6)
|
|||
|
// To go from segment to angle, 2*pi * (segment/segmentCount)
|
|||
|
// To go from index to segment index, index - (segment*6)
|
|||
|
//
|
|||
|
vec3 getConePosition(vec3 d, float rawIndex, float coneOffset, out vec3 normal) {
|
|||
|
|
|||
|
const float segmentCount = 8.0;
|
|||
|
|
|||
|
float index = rawIndex - floor(rawIndex /
|
|||
|
(segmentCount * 6.0)) *
|
|||
|
(segmentCount * 6.0);
|
|||
|
|
|||
|
float segment = floor(0.001 + index/6.0);
|
|||
|
float segmentIndex = index - (segment*6.0);
|
|||
|
|
|||
|
normal = -normalize(d);
|
|||
|
|
|||
|
if (segmentIndex > 2.99 && segmentIndex < 3.01) {
|
|||
|
return mix(vec3(0.0), -d, coneOffset);
|
|||
|
}
|
|||
|
|
|||
|
float nextAngle = (
|
|||
|
(segmentIndex > 0.99 && segmentIndex < 1.01) ||
|
|||
|
(segmentIndex > 4.99 && segmentIndex < 5.01)
|
|||
|
) ? 1.0 : 0.0;
|
|||
|
float angle = 2.0 * 3.14159 * ((segment + nextAngle) / segmentCount);
|
|||
|
|
|||
|
vec3 v1 = mix(d, vec3(0.0), coneOffset);
|
|||
|
vec3 v2 = v1 - d;
|
|||
|
|
|||
|
vec3 u = getOrthogonalVector(d);
|
|||
|
vec3 v = normalize(cross(u, d));
|
|||
|
|
|||
|
vec3 x = u * cos(angle) * length(d)*0.25;
|
|||
|
vec3 y = v * sin(angle) * length(d)*0.25;
|
|||
|
vec3 v3 = v2 + x + y;
|
|||
|
if (segmentIndex < 3.0) {
|
|||
|
vec3 tx = u * sin(angle);
|
|||
|
vec3 ty = v * -cos(angle);
|
|||
|
vec3 tangent = tx + ty;
|
|||
|
normal = normalize(cross(v3 - v1, tangent));
|
|||
|
}
|
|||
|
|
|||
|
if (segmentIndex == 0.0) {
|
|||
|
return mix(d, vec3(0.0), coneOffset);
|
|||
|
}
|
|||
|
return v3;
|
|||
|
}
|
|||
|
|
|||
|
attribute vec3 vector;
|
|||
|
attribute vec4 color, position;
|
|||
|
attribute vec2 uv;
|
|||
|
|
|||
|
uniform float vectorScale, coneScale, coneOffset;
|
|||
|
uniform mat4 model, view, projection, inverseModel;
|
|||
|
uniform vec3 eyePosition, lightPosition;
|
|||
|
|
|||
|
varying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position;
|
|||
|
varying vec4 f_color;
|
|||
|
varying vec2 f_uv;
|
|||
|
|
|||
|
void main() {
|
|||
|
// Scale the vector magnitude to stay constant with
|
|||
|
// model & view changes.
|
|||
|
vec3 normal;
|
|||
|
vec3 XYZ = getConePosition(mat3(model) * ((vectorScale * coneScale) * vector), position.w, coneOffset, normal);
|
|||
|
vec4 conePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);
|
|||
|
|
|||
|
//Lighting geometry parameters
|
|||
|
vec4 cameraCoordinate = view * conePosition;
|
|||
|
cameraCoordinate.xyz /= cameraCoordinate.w;
|
|||
|
f_lightDirection = lightPosition - cameraCoordinate.xyz;
|
|||
|
f_eyeDirection = eyePosition - cameraCoordinate.xyz;
|
|||
|
f_normal = normalize((vec4(normal, 0.0) * inverseModel).xyz);
|
|||
|
|
|||
|
// vec4 m_position = model * vec4(conePosition, 1.0);
|
|||
|
vec4 t_position = view * conePosition;
|
|||
|
gl_Position = projection * t_position;
|
|||
|
|
|||
|
f_color = color;
|
|||
|
f_data = conePosition.xyz;
|
|||
|
f_position = position.xyz;
|
|||
|
f_uv = uv;
|
|||
|
}
|
|||
|
`]),u=s([`#extension GL_OES_standard_derivatives : enable
|
|||
|
|
|||
|
precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
float beckmannDistribution(float x, float roughness) {
|
|||
|
float NdotH = max(x, 0.0001);
|
|||
|
float cos2Alpha = NdotH * NdotH;
|
|||
|
float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;
|
|||
|
float roughness2 = roughness * roughness;
|
|||
|
float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;
|
|||
|
return exp(tan2Alpha / roughness2) / denom;
|
|||
|
}
|
|||
|
|
|||
|
float cookTorranceSpecular(
|
|||
|
vec3 lightDirection,
|
|||
|
vec3 viewDirection,
|
|||
|
vec3 surfaceNormal,
|
|||
|
float roughness,
|
|||
|
float fresnel) {
|
|||
|
|
|||
|
float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);
|
|||
|
float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);
|
|||
|
|
|||
|
//Half angle vector
|
|||
|
vec3 H = normalize(lightDirection + viewDirection);
|
|||
|
|
|||
|
//Geometric term
|
|||
|
float NdotH = max(dot(surfaceNormal, H), 0.0);
|
|||
|
float VdotH = max(dot(viewDirection, H), 0.000001);
|
|||
|
float LdotH = max(dot(lightDirection, H), 0.000001);
|
|||
|
float G1 = (2.0 * NdotH * VdotN) / VdotH;
|
|||
|
float G2 = (2.0 * NdotH * LdotN) / LdotH;
|
|||
|
float G = min(1.0, min(G1, G2));
|
|||
|
|
|||
|
//Distribution term
|
|||
|
float D = beckmannDistribution(NdotH, roughness);
|
|||
|
|
|||
|
//Fresnel term
|
|||
|
float F = pow(1.0 - VdotN, fresnel);
|
|||
|
|
|||
|
//Multiply terms and done
|
|||
|
return G * F * D / max(3.14159265 * VdotN, 0.000001);
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
uniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;
|
|||
|
uniform sampler2D texture;
|
|||
|
|
|||
|
varying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position;
|
|||
|
varying vec4 f_color;
|
|||
|
varying vec2 f_uv;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;
|
|||
|
vec3 N = normalize(f_normal);
|
|||
|
vec3 L = normalize(f_lightDirection);
|
|||
|
vec3 V = normalize(f_eyeDirection);
|
|||
|
|
|||
|
if(gl_FrontFacing) {
|
|||
|
N = -N;
|
|||
|
}
|
|||
|
|
|||
|
float specular = min(1.0, max(0.0, cookTorranceSpecular(L, V, N, roughness, fresnel)));
|
|||
|
float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);
|
|||
|
|
|||
|
vec4 surfaceColor = f_color * texture2D(texture, f_uv);
|
|||
|
vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);
|
|||
|
|
|||
|
gl_FragColor = litColor * opacity;
|
|||
|
}
|
|||
|
`]),c=s([`precision highp float;
|
|||
|
|
|||
|
precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
vec3 getOrthogonalVector(vec3 v) {
|
|||
|
// Return up-vector for only-z vector.
|
|||
|
// Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).
|
|||
|
// From the above if-statement we have ||a|| > 0 U ||b|| > 0.
|
|||
|
// Assign z = 0, x = -b, y = a:
|
|||
|
// a*-b + b*a + c*0 = -ba + ba + 0 = 0
|
|||
|
if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {
|
|||
|
return normalize(vec3(-v.y, v.x, 0.0));
|
|||
|
} else {
|
|||
|
return normalize(vec3(0.0, v.z, -v.y));
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// Calculate the cone vertex and normal at the given index.
|
|||
|
//
|
|||
|
// The returned vertex is for a cone with its top at origin and height of 1.0,
|
|||
|
// pointing in the direction of the vector attribute.
|
|||
|
//
|
|||
|
// Each cone is made up of a top vertex, a center base vertex and base perimeter vertices.
|
|||
|
// These vertices are used to make up the triangles of the cone by the following:
|
|||
|
// segment + 0 top vertex
|
|||
|
// segment + 1 perimeter vertex a+1
|
|||
|
// segment + 2 perimeter vertex a
|
|||
|
// segment + 3 center base vertex
|
|||
|
// segment + 4 perimeter vertex a
|
|||
|
// segment + 5 perimeter vertex a+1
|
|||
|
// Where segment is the number of the radial segment * 6 and a is the angle at that radial segment.
|
|||
|
// To go from index to segment, floor(index / 6)
|
|||
|
// To go from segment to angle, 2*pi * (segment/segmentCount)
|
|||
|
// To go from index to segment index, index - (segment*6)
|
|||
|
//
|
|||
|
vec3 getConePosition(vec3 d, float rawIndex, float coneOffset, out vec3 normal) {
|
|||
|
|
|||
|
const float segmentCount = 8.0;
|
|||
|
|
|||
|
float index = rawIndex - floor(rawIndex /
|
|||
|
(segmentCount * 6.0)) *
|
|||
|
(segmentCount * 6.0);
|
|||
|
|
|||
|
float segment = floor(0.001 + index/6.0);
|
|||
|
float segmentIndex = index - (segment*6.0);
|
|||
|
|
|||
|
normal = -normalize(d);
|
|||
|
|
|||
|
if (segmentIndex > 2.99 && segmentIndex < 3.01) {
|
|||
|
return mix(vec3(0.0), -d, coneOffset);
|
|||
|
}
|
|||
|
|
|||
|
float nextAngle = (
|
|||
|
(segmentIndex > 0.99 && segmentIndex < 1.01) ||
|
|||
|
(segmentIndex > 4.99 && segmentIndex < 5.01)
|
|||
|
) ? 1.0 : 0.0;
|
|||
|
float angle = 2.0 * 3.14159 * ((segment + nextAngle) / segmentCount);
|
|||
|
|
|||
|
vec3 v1 = mix(d, vec3(0.0), coneOffset);
|
|||
|
vec3 v2 = v1 - d;
|
|||
|
|
|||
|
vec3 u = getOrthogonalVector(d);
|
|||
|
vec3 v = normalize(cross(u, d));
|
|||
|
|
|||
|
vec3 x = u * cos(angle) * length(d)*0.25;
|
|||
|
vec3 y = v * sin(angle) * length(d)*0.25;
|
|||
|
vec3 v3 = v2 + x + y;
|
|||
|
if (segmentIndex < 3.0) {
|
|||
|
vec3 tx = u * sin(angle);
|
|||
|
vec3 ty = v * -cos(angle);
|
|||
|
vec3 tangent = tx + ty;
|
|||
|
normal = normalize(cross(v3 - v1, tangent));
|
|||
|
}
|
|||
|
|
|||
|
if (segmentIndex == 0.0) {
|
|||
|
return mix(d, vec3(0.0), coneOffset);
|
|||
|
}
|
|||
|
return v3;
|
|||
|
}
|
|||
|
|
|||
|
attribute vec4 vector;
|
|||
|
attribute vec4 position;
|
|||
|
attribute vec4 id;
|
|||
|
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
uniform float vectorScale, coneScale, coneOffset;
|
|||
|
|
|||
|
varying vec3 f_position;
|
|||
|
varying vec4 f_id;
|
|||
|
|
|||
|
void main() {
|
|||
|
vec3 normal;
|
|||
|
vec3 XYZ = getConePosition(mat3(model) * ((vectorScale * coneScale) * vector.xyz), position.w, coneOffset, normal);
|
|||
|
vec4 conePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);
|
|||
|
gl_Position = projection * (view * conePosition);
|
|||
|
f_id = id;
|
|||
|
f_position = position.xyz;
|
|||
|
}
|
|||
|
`]),f=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
uniform float pickId;
|
|||
|
|
|||
|
varying vec3 f_position;
|
|||
|
varying vec4 f_id;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;
|
|||
|
|
|||
|
gl_FragColor = vec4(pickId, f_id.xyz);
|
|||
|
}`]);a.meshShader={vertex:l,fragment:u,attributes:[{name:"position",type:"vec4"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"vector",type:"vec3"}]},a.pickShader={vertex:c,fragment:f,attributes:[{name:"position",type:"vec4"},{name:"id",type:"vec4"},{name:"vector",type:"vec3"}]}},737:function(i){i.exports={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34e3:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",3407
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
attribute vec3 position, offset;
|
|||
|
attribute vec4 color;
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
uniform float capSize;
|
|||
|
varying vec4 fragColor;
|
|||
|
varying vec3 fragPosition;
|
|||
|
|
|||
|
void main() {
|
|||
|
vec4 worldPosition = model * vec4(position, 1.0);
|
|||
|
worldPosition = (worldPosition / worldPosition.w) + vec4(capSize * offset, 0.0);
|
|||
|
gl_Position = projection * (view * worldPosition);
|
|||
|
fragColor = color;
|
|||
|
fragPosition = position;
|
|||
|
}`]),c=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
uniform float opacity;
|
|||
|
varying vec3 fragPosition;
|
|||
|
varying vec4 fragColor;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (
|
|||
|
outOfRange(clipBounds[0], clipBounds[1], fragPosition) ||
|
|||
|
fragColor.a * opacity == 0.
|
|||
|
) discard;
|
|||
|
|
|||
|
gl_FragColor = opacity * fragColor;
|
|||
|
}`]);i.exports=function(f){return l(f,u,c,null,[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"offset",type:"vec3"}])}},2260:function(i,a,o){"use strict";var s=o(7766);i.exports=C;var l=null,u,c,f,h;function d(M){var g=M.getParameter(M.FRAMEBUFFER_BINDING),P=M.getParameter(M.RENDERBUFFER_BINDING),T=M.getParameter(M.TEXTURE_BINDING_2D);return[g,P,T]}function v(M,g){M.bindFramebuffer(M.FRAMEBUFFER,g[0]),M.bindRenderbuffer(M.RENDERBUFFER,g[1]),M.bindTexture(M.TEXTURE_2D,g[2])}function x(M,g){var P=M.getParameter(g.MAX_COLOR_ATTACHMENTS_WEBGL);l=new Array(P+1);for(var T=0;T<=P;++T){for(var F=new Array(P),q=0;q<T;++q)F[q]=M.COLOR_ATTACHMENT0+q;for(var q=T;q<P;++q)F[q]=M.NONE;l[T]=F}}function b(M){switch(M){case u:throw new Error("gl-fbo: Framebuffer unsupported");case c:throw new Error("gl-fbo: Framebuffer incomplete attachment");case f:throw new Error("gl-fbo: Framebuffer incomplete dimensions");case h:throw new Error("gl-fbo: Framebuffer incomplete missing attachment");default:throw new Error("gl-fbo: Framebuffer failed for unspecified reason")}}function p(M,g,P,T,F,q){if(!T)return null;var V=s(M,g,P,F,T);return V.magFilter=M.NEAREST,V.minFilter=M.NEAREST,V.mipSamples=1,V.bind(),M.framebufferTexture2D(M.FRAMEBUFFER,q,M.TEXTURE_2D,V.handle,0),V}function E(M,g,P,T,F){var q=M.createRenderbuffer();return M.bindRenderbuffer(M.RENDERBUFFER,q),M.renderbufferStorage(M.RENDERBUFFER,T,g,P),M.framebufferRenderbuffer(M.FRAMEBUFFER,F,M.RENDERBUFFER,q),q}function k(M){var g=d(M.gl),P=M.gl,T=M.handle=P.createFramebuffer(),F=M._shape[0],q=M._shape[1],V=M.color.length,H=M._ext,X=M._useStencil,G=M._useDepth,N=M._colorType;P.bindFramebuffer(P.FRAMEBUFFER,T);for(var W=0;W<V;++W)M.color[W]=p(P,F,q,N,P.RGBA,P.COLOR_ATTACHMENT0+W);V===0?(M._color_rb=E(P,F,q,P.RGBA4,P.COLOR_ATTACHMENT0),H&&H.drawBuffersWEBGL(l[0])):V>1&&H.drawBuffersWEBGL(l[V]);var re=P.getExtension("WEBGL_depth_texture");re?X?M.depth=p(P,F,q,re.UNSIGNED_INT_24_8_WEBGL,P.DEPTH_STENCIL,P.DEPTH_STENCIL_ATTACHMENT):G&&(M.depth=p(P,F,q,P.UNSIGNED_SHORT,P.DEPTH_COMPONENT,P.DEPTH_ATTACHMENT)):G&&X?M._depth_rb=E(P,F,q,P.DEPTH_STENCIL,P.DEPTH_STENCIL_ATTACHMENT):G?M._depth_rb=E(P,F,q,P.DEPTH_COMPONENT16,P.DEPTH_ATTACHMENT):X&&(M._depth_rb=E(P,F,q,P.STENCIL_INDEX,P.STENCIL_ATTACHMENT));var ae=P.checkFramebufferStatus(P.FRAMEBUFFER);if(ae!==P.FRAMEBUFFER_COMPLETE){M._destroyed=!0,P.bindFramebuffer(P.FRAMEBUFFER,null),P.deleteFramebuffer(M.handle),M.handle=null,M.depth&&(M.depth.dispose(),M.depth=null),M._depth_rb&&(P.deleteRenderbuffer(M._depth_rb),M._depth_rb=null);for(var W=0;W<M.color.length;++W)M.color[W].dispose(),M.color[W]=null;M._color_rb&&(P.deleteRenderbuffer(M._color_rb),M._color_rb=null),v(P,g),b(ae)}v(P,g)}function A(M,g,P,T,F,q,V,H){this.gl=M,this._shape=[g|0,P|0],this._destroyed=!1,this._ext=H,this.color=new Array(F);for(var X=0;X<F;++X)this.color[X]=null;this._color_rb=null,this.depth=null,this._depth_rb=null,this._colorType=T,this._useDepth=q,this._useStencil=V;var G=this,N=[g|0,P|0];Object.defineProperties(N,{0:{get:function(){return G._shape[0]},set:function(W){return G.width=W}},1:{get:function(){return G._shape[1]},set:function(W){return G.height=W}}}),this._shapeVector=N,k(this)}var L=A.prototype;function _(M,g,P){if(M._destroyed)throw new Error("gl-fbo: Can't resize destroyed FBO");if(!(M._shape[0]===g&&M._shape[1]===P)){var T=M.gl,F=T.getParameter(T.MAX_RENDERBUFFER_SIZE);if(g<0||g>F||P<0||P>F)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");M._shape[0]=g,M._shape[1]=P;for(var q=d(T),V=0;V<M.color.length;++V)M.color[V].shape=M._shape;M._color_rb&&(T.bindRenderbuffer(T.RENDERBUFFER,M._color_rb),T.renderbufferStorage(T.RENDERBUFFER,T.RGBA4,M._shape[0],M._shape[1])),M.depth&&(M.depth.shape=M._shape),M._depth_rb&&(T.bindRenderbuffer(T.RENDERBUFFER,M._depth_rb),M._useDepth&&M._useStencil?T.renderbufferStorage(T.RENDERBUFFER,T.DEPTH_STENCIL,M._shape[0],M._shape[1]):M._useDepth?T.renderbufferStorage(T.RENDERBUFFER,T.DEPTH_COMPONENT16,M._shape[0],M._shape[1]):M._useStencil&&T.renderbufferStorage(T.RENDERBUFFER,T.STENCIL_INDEX,M._shape[0],M._s
|
|||
|
`,b,x),E=s("%s%s",p,h),k=h.split(`
|
|||
|
`),A={},L=0;L<k.length;L++){var _=k[L];if(!(_===""||_==="\0")){var C=parseInt(_.split(":")[2]);if(isNaN(C))throw new Error(s("Could not parse error: %s",_));A[C]=_}}for(var M=c(d).split(`
|
|||
|
`),L=0;L<M.length;L++)if(!(!A[L+3]&&!A[L+2]&&!A[L+1])){var g=M[L];if(p+=g+`
|
|||
|
`,A[L+1]){var P=A[L+1];P=P.substr(P.split(":",3).join(":").length+1).trim(),p+=s(`^^^ %s
|
|||
|
|
|||
|
`,P)}}return{long:p.trim(),short:E.trim()}}},7319:function(i,a,o){var s=o(3236),l=o(9405),u=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
attribute vec3 position, nextPosition;
|
|||
|
attribute float arcLength, lineWidth;
|
|||
|
attribute vec4 color;
|
|||
|
|
|||
|
uniform vec2 screenShape;
|
|||
|
uniform float pixelRatio;
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
|
|||
|
varying vec4 fragColor;
|
|||
|
varying vec3 worldPosition;
|
|||
|
varying float pixelArcLength;
|
|||
|
|
|||
|
vec4 project(vec3 p) {
|
|||
|
return projection * (view * (model * vec4(p, 1.0)));
|
|||
|
}
|
|||
|
|
|||
|
void main() {
|
|||
|
vec4 startPoint = project(position);
|
|||
|
vec4 endPoint = project(nextPosition);
|
|||
|
|
|||
|
vec2 A = startPoint.xy / startPoint.w;
|
|||
|
vec2 B = endPoint.xy / endPoint.w;
|
|||
|
|
|||
|
float clipAngle = atan(
|
|||
|
(B.y - A.y) * screenShape.y,
|
|||
|
(B.x - A.x) * screenShape.x
|
|||
|
);
|
|||
|
|
|||
|
vec2 offset = 0.5 * pixelRatio * lineWidth * vec2(
|
|||
|
sin(clipAngle),
|
|||
|
-cos(clipAngle)
|
|||
|
) / screenShape;
|
|||
|
|
|||
|
gl_Position = vec4(startPoint.xy + startPoint.w * offset, startPoint.zw);
|
|||
|
|
|||
|
worldPosition = position;
|
|||
|
pixelArcLength = arcLength;
|
|||
|
fragColor = color;
|
|||
|
}
|
|||
|
`]),c=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
uniform sampler2D dashTexture;
|
|||
|
uniform float dashScale;
|
|||
|
uniform float opacity;
|
|||
|
|
|||
|
varying vec3 worldPosition;
|
|||
|
varying float pixelArcLength;
|
|||
|
varying vec4 fragColor;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (
|
|||
|
outOfRange(clipBounds[0], clipBounds[1], worldPosition) ||
|
|||
|
fragColor.a * opacity == 0.
|
|||
|
) discard;
|
|||
|
|
|||
|
float dashWeight = texture2D(dashTexture, vec2(dashScale * pixelArcLength, 0)).r;
|
|||
|
if(dashWeight < 0.5) {
|
|||
|
discard;
|
|||
|
}
|
|||
|
gl_FragColor = fragColor * opacity;
|
|||
|
}
|
|||
|
`]),f=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
#define FLOAT_MAX 1.70141184e38
|
|||
|
#define FLOAT_MIN 1.17549435e-38
|
|||
|
|
|||
|
// https://github.com/mikolalysenko/glsl-read-float/blob/master/index.glsl
|
|||
|
vec4 packFloat(float v) {
|
|||
|
float av = abs(v);
|
|||
|
|
|||
|
//Handle special cases
|
|||
|
if(av < FLOAT_MIN) {
|
|||
|
return vec4(0.0, 0.0, 0.0, 0.0);
|
|||
|
} else if(v > FLOAT_MAX) {
|
|||
|
return vec4(127.0, 128.0, 0.0, 0.0) / 255.0;
|
|||
|
} else if(v < -FLOAT_MAX) {
|
|||
|
return vec4(255.0, 128.0, 0.0, 0.0) / 255.0;
|
|||
|
}
|
|||
|
|
|||
|
vec4 c = vec4(0,0,0,0);
|
|||
|
|
|||
|
//Compute exponent and mantissa
|
|||
|
float e = floor(log2(av));
|
|||
|
float m = av * pow(2.0, -e) - 1.0;
|
|||
|
|
|||
|
//Unpack mantissa
|
|||
|
c[1] = floor(128.0 * m);
|
|||
|
m -= c[1] / 128.0;
|
|||
|
c[2] = floor(32768.0 * m);
|
|||
|
m -= c[2] / 32768.0;
|
|||
|
c[3] = floor(8388608.0 * m);
|
|||
|
|
|||
|
//Unpack exponent
|
|||
|
float ebias = e + 127.0;
|
|||
|
c[0] = floor(ebias / 2.0);
|
|||
|
ebias -= c[0] * 2.0;
|
|||
|
c[1] += floor(ebias) * 128.0;
|
|||
|
|
|||
|
//Unpack sign bit
|
|||
|
c[0] += 128.0 * step(0.0, -v);
|
|||
|
|
|||
|
//Scale back to range
|
|||
|
return c / 255.0;
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
uniform float pickId;
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
|
|||
|
varying vec3 worldPosition;
|
|||
|
varying float pixelArcLength;
|
|||
|
varying vec4 fragColor;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (outOfRange(clipBounds[0], clipBounds[1], worldPosition)) discard;
|
|||
|
|
|||
|
gl_FragColor = vec4(pickId/255.0, packFloat(pixelArcLength).xyz);
|
|||
|
}`]),h=[{name:"position",type:"vec3"},{name:"nextPosition",type:"vec3"},{name:"arcLength",type:"float"},{name:"lineWidth",type:"float"},{name:"color",type:"vec4"}];a.createShader=function(d){return l(d,u,c,null,h)},a.createPickShader=function(d){return l(d,u,f,null,h)}},5714:function(i,a,o){"use strict";i.exports=M;var s=o(2762),l=o(8116),u=o(7766),c=new Uint8Array(4),f=new Float32Array(c.buffer);function h(g,P,T,F){return c[0]=F,c[1]=T,c[2]=P,c[3]=g,f[0]}var d=o(2478),v=o(9618),x=o(7319),b=x.createShader,p=x.createPickShader,E=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function k(g,P){for(var T=0,F=0;F<3;++F){var q=g[F]-P[F];T+=q*q}return Math.sqrt(T)}function A(g){for(var P=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],T=0;T<3;++T)P[0][T]=Math.max(g[0][T],P[0][T]),P[1][T]=Math.min(g[1][T],P[1][T]);return P}function L(g,P,T,F){this.arcLength=g,this.position=P,this.index=T,this.dataCoordinate=F}function _(g,P,T,F,q,V){this.gl=g,this.shader=P,this.pickShader=T,this.buffer=F,this.vao=q,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.points=[],this.arcLength=[],this.vertexCount=0,this.bounds=[[0,0,0],[0,0,0]],this.pickId=0,this.lineWidth=1,this.texture=V,this.dashScale=1,this.opacity=1,this.hasAlpha=!1,this.dirty=!0,this.pixelRatio=1}var C=_.prototype;C.isTransparent=function(){return this.hasAlpha},C.isOpaque=function(){return!this.hasAlpha},C.pickSlots=1,C.setPickBase=function(g){this.pickId=g},C.drawTransparent=C.draw=function(g){if(this.vertexCount){var P=this.gl,T=this.shader,F=this.vao;T.bind(),T.uniforms={model:g.model||E,view:g.view||E,projection:g.projection||E,clipBounds:A(this.clipBounds),dashTexture:this.texture.bind(),dashScale:this.dashScale/this.arcLength[this.arcLength.length-1],opacity:this.opacity,screenShape:[P.drawingBufferWidth,P.drawingBufferHeight],pixelRatio:this.pixelRatio},F.bind(),F.draw(P.TRIANGLE_STRIP,this.vertexCount),F.unbind()}},C.drawPick=function(g){if(this.vertexCount){var P=this.gl,T=this.pickShader,F=this.vao;T.bind(),T.uniforms={model:g.model||E,view:g.view||E,projection:g.projection||E,pickId:this.pickId,clipBounds:A(this.clipBounds),screenShape:[P.drawingBufferWidth,P.drawingBufferHeight],pixelRatio:this.pixelRatio},F.bind(),F.draw(P.TRIANGLE_STRIP,this.vertexCount),F.unbind()}},C.update=function(g){var P,T;this.dirty=!0;var F=!!g.connectGaps;"dashScale"in g&&(this.dashScale=g.dashScale),this.hasAlpha=!1,"opacity"in g&&(this.opacity=+g.opacity,this.opacity<1&&(this.hasAlpha=!0));var q=[],V=[],H=[],X=0,G=0,N=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],W=g.position||g.positions;if(W){var re=g.color||g.colors||[0,0,0,1],ae=g.lineWidth||1,_e=!1;e:for(P=1;P<W.length;++P){var Me=W[P-1],ke=W[P];for(V.push(X),H.push(Me.slice()),T=0;T<3;++T){if(isNaN(Me[T])||isNaN(ke[T])||!isFinite(Me[T])||!isFinite(ke[T])){if(!F&&q.length>0){for(var ge=0;ge<24;++ge)q.push(q[q.length-12]);G+=2,_e=!0}continue e}N[0][T]=Math.min(N[0][T],Me[T],ke[T]),N[1][T]=Math.max(N[1][T],Me[T],ke[T])}var ie,Te;Array.isArray(re[0])?(ie=re.length>P-1?re[P-1]:re.length>0?re[re.length-1]:[0,0,0,1],Te=re.length>P?re[P]:re.length>0?re[re.length-1]:[0,0,0,1]):ie=Te=re,ie.length===3&&(ie=[ie[0],ie[1],ie[2],1]),Te.length===3&&(Te=[Te[0],Te[1],Te[2],1]),!this.hasAlpha&&ie[3]<1&&(this.hasAlpha=!0);var Ee;Array.isArray(ae)?Ee=ae.length>P-1?ae[P-1]:ae.length>0?ae[ae.length-1]:[0,0,0,1]:Ee=ae;var Ae=X;if(X+=k(Me,ke),_e){for(T=0;T<2;++T)q.push(Me[0],Me[1],Me[2],ke[0],ke[1],ke[2],Ae,Ee,ie[0],ie[1],ie[2],ie[3]);G+=2,_e=!1}q.push(Me[0],Me[1],Me[2],ke[0],ke[1],ke[2],Ae,Ee,ie[0],ie[1],ie[2],ie[3],Me[0],Me[1],Me[2],ke[0],ke[1],ke[2],Ae,-Ee,ie[0],ie[1],ie[2],ie[3],ke[0],ke[1],ke[2],Me[0],Me[1],Me[2],X,-Ee,Te[0],Te[1],Te[2],Te[3],ke[0],ke[1],ke[2],Me[0],Me[1],Me[2],X,Ee,Te[0],Te[1],Te[2],Te[3]),G+=4}}if(this.buffer.update(q),V.push(X),H.push(W[W.length-1].slice()),this.bounds=N,this.vertexCount=G,this.points=H,this.arcLength=V,"dashes"in g){var ze=g.dashes,Ce=ze.slice();for(Ce.unshift(0),P=1;P<Ce.length;++P)Ce[P]=Ce[P-1]+Ce[P];var me=v(new Array(256*4),[256,1,4]);for(P=0;P<256;++P){for(T=0;T<4;++T)me.set(P,0,T,0);d.le(Ce,Ce[Ce.length-1]*P/255)&1?me.set(P,0,0,0):me.set(P,0,
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
attribute vec3 position, normal;
|
|||
|
attribute vec4 color;
|
|||
|
attribute vec2 uv;
|
|||
|
|
|||
|
uniform mat4 model
|
|||
|
, view
|
|||
|
, projection
|
|||
|
, inverseModel;
|
|||
|
uniform vec3 eyePosition
|
|||
|
, lightPosition;
|
|||
|
|
|||
|
varying vec3 f_normal
|
|||
|
, f_lightDirection
|
|||
|
, f_eyeDirection
|
|||
|
, f_data;
|
|||
|
varying vec4 f_color;
|
|||
|
varying vec2 f_uv;
|
|||
|
|
|||
|
vec4 project(vec3 p) {
|
|||
|
return projection * (view * (model * vec4(p, 1.0)));
|
|||
|
}
|
|||
|
|
|||
|
void main() {
|
|||
|
gl_Position = project(position);
|
|||
|
|
|||
|
//Lighting geometry parameters
|
|||
|
vec4 cameraCoordinate = view * vec4(position , 1.0);
|
|||
|
cameraCoordinate.xyz /= cameraCoordinate.w;
|
|||
|
f_lightDirection = lightPosition - cameraCoordinate.xyz;
|
|||
|
f_eyeDirection = eyePosition - cameraCoordinate.xyz;
|
|||
|
f_normal = normalize((vec4(normal, 0.0) * inverseModel).xyz);
|
|||
|
|
|||
|
f_color = color;
|
|||
|
f_data = position;
|
|||
|
f_uv = uv;
|
|||
|
}
|
|||
|
`]),u=s([`#extension GL_OES_standard_derivatives : enable
|
|||
|
|
|||
|
precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
float beckmannDistribution(float x, float roughness) {
|
|||
|
float NdotH = max(x, 0.0001);
|
|||
|
float cos2Alpha = NdotH * NdotH;
|
|||
|
float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;
|
|||
|
float roughness2 = roughness * roughness;
|
|||
|
float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;
|
|||
|
return exp(tan2Alpha / roughness2) / denom;
|
|||
|
}
|
|||
|
|
|||
|
float cookTorranceSpecular(
|
|||
|
vec3 lightDirection,
|
|||
|
vec3 viewDirection,
|
|||
|
vec3 surfaceNormal,
|
|||
|
float roughness,
|
|||
|
float fresnel) {
|
|||
|
|
|||
|
float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);
|
|||
|
float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);
|
|||
|
|
|||
|
//Half angle vector
|
|||
|
vec3 H = normalize(lightDirection + viewDirection);
|
|||
|
|
|||
|
//Geometric term
|
|||
|
float NdotH = max(dot(surfaceNormal, H), 0.0);
|
|||
|
float VdotH = max(dot(viewDirection, H), 0.000001);
|
|||
|
float LdotH = max(dot(lightDirection, H), 0.000001);
|
|||
|
float G1 = (2.0 * NdotH * VdotN) / VdotH;
|
|||
|
float G2 = (2.0 * NdotH * LdotN) / LdotH;
|
|||
|
float G = min(1.0, min(G1, G2));
|
|||
|
|
|||
|
//Distribution term
|
|||
|
float D = beckmannDistribution(NdotH, roughness);
|
|||
|
|
|||
|
//Fresnel term
|
|||
|
float F = pow(1.0 - VdotN, fresnel);
|
|||
|
|
|||
|
//Multiply terms and done
|
|||
|
return G * F * D / max(3.14159265 * VdotN, 0.000001);
|
|||
|
}
|
|||
|
|
|||
|
//#pragma glslify: beckmann = require(glsl-specular-beckmann) // used in gl-surface3d
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
uniform float roughness
|
|||
|
, fresnel
|
|||
|
, kambient
|
|||
|
, kdiffuse
|
|||
|
, kspecular;
|
|||
|
uniform sampler2D texture;
|
|||
|
|
|||
|
varying vec3 f_normal
|
|||
|
, f_lightDirection
|
|||
|
, f_eyeDirection
|
|||
|
, f_data;
|
|||
|
varying vec4 f_color;
|
|||
|
varying vec2 f_uv;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (f_color.a == 0.0 ||
|
|||
|
outOfRange(clipBounds[0], clipBounds[1], f_data)
|
|||
|
) discard;
|
|||
|
|
|||
|
vec3 N = normalize(f_normal);
|
|||
|
vec3 L = normalize(f_lightDirection);
|
|||
|
vec3 V = normalize(f_eyeDirection);
|
|||
|
|
|||
|
if(gl_FrontFacing) {
|
|||
|
N = -N;
|
|||
|
}
|
|||
|
|
|||
|
float specular = min(1.0, max(0.0, cookTorranceSpecular(L, V, N, roughness, fresnel)));
|
|||
|
//float specular = max(0.0, beckmann(L, V, N, roughness)); // used in gl-surface3d
|
|||
|
|
|||
|
float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);
|
|||
|
|
|||
|
vec4 surfaceColor = vec4(f_color.rgb, 1.0) * texture2D(texture, f_uv);
|
|||
|
vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);
|
|||
|
|
|||
|
gl_FragColor = litColor * f_color.a;
|
|||
|
}
|
|||
|
`]),c=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
attribute vec3 position;
|
|||
|
attribute vec4 color;
|
|||
|
attribute vec2 uv;
|
|||
|
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
|
|||
|
varying vec4 f_color;
|
|||
|
varying vec3 f_data;
|
|||
|
varying vec2 f_uv;
|
|||
|
|
|||
|
void main() {
|
|||
|
gl_Position = projection * (view * (model * vec4(position, 1.0)));
|
|||
|
f_color = color;
|
|||
|
f_data = position;
|
|||
|
f_uv = uv;
|
|||
|
}`]),f=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
uniform sampler2D texture;
|
|||
|
uniform float opacity;
|
|||
|
|
|||
|
varying vec4 f_color;
|
|||
|
varying vec3 f_data;
|
|||
|
varying vec2 f_uv;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (outOfRange(clipBounds[0], clipBounds[1], f_data)) discard;
|
|||
|
|
|||
|
gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;
|
|||
|
}`]),h=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
attribute vec3 position;
|
|||
|
attribute vec4 color;
|
|||
|
attribute vec2 uv;
|
|||
|
attribute float pointSize;
|
|||
|
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
|
|||
|
varying vec4 f_color;
|
|||
|
varying vec2 f_uv;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (outOfRange(clipBounds[0], clipBounds[1], position)) {
|
|||
|
|
|||
|
gl_Position = vec4(0.0, 0.0 ,0.0 ,0.0);
|
|||
|
} else {
|
|||
|
gl_Position = projection * (view * (model * vec4(position, 1.0)));
|
|||
|
}
|
|||
|
gl_PointSize = pointSize;
|
|||
|
f_color = color;
|
|||
|
f_uv = uv;
|
|||
|
}`]),d=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
uniform sampler2D texture;
|
|||
|
uniform float opacity;
|
|||
|
|
|||
|
varying vec4 f_color;
|
|||
|
varying vec2 f_uv;
|
|||
|
|
|||
|
void main() {
|
|||
|
vec2 pointR = gl_PointCoord.xy - vec2(0.5, 0.5);
|
|||
|
if(dot(pointR, pointR) > 0.25) {
|
|||
|
discard;
|
|||
|
}
|
|||
|
gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;
|
|||
|
}`]),v=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
attribute vec3 position;
|
|||
|
attribute vec4 id;
|
|||
|
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
|
|||
|
varying vec3 f_position;
|
|||
|
varying vec4 f_id;
|
|||
|
|
|||
|
void main() {
|
|||
|
gl_Position = projection * (view * (model * vec4(position, 1.0)));
|
|||
|
f_id = id;
|
|||
|
f_position = position;
|
|||
|
}`]),x=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
uniform float pickId;
|
|||
|
|
|||
|
varying vec3 f_position;
|
|||
|
varying vec4 f_id;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;
|
|||
|
|
|||
|
gl_FragColor = vec4(pickId, f_id.xyz);
|
|||
|
}`]),b=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
attribute vec3 position;
|
|||
|
attribute float pointSize;
|
|||
|
attribute vec4 id;
|
|||
|
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
|
|||
|
varying vec3 f_position;
|
|||
|
varying vec4 f_id;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (outOfRange(clipBounds[0], clipBounds[1], position)) {
|
|||
|
|
|||
|
gl_Position = vec4(0.0, 0.0, 0.0, 0.0);
|
|||
|
} else {
|
|||
|
gl_Position = projection * (view * (model * vec4(position, 1.0)));
|
|||
|
gl_PointSize = pointSize;
|
|||
|
}
|
|||
|
f_id = id;
|
|||
|
f_position = position;
|
|||
|
}`]),p=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
attribute vec3 position;
|
|||
|
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
|
|||
|
void main() {
|
|||
|
gl_Position = projection * (view * (model * vec4(position, 1.0)));
|
|||
|
}`]),E=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
uniform vec3 contourColor;
|
|||
|
|
|||
|
void main() {
|
|||
|
gl_FragColor = vec4(contourColor, 1.0);
|
|||
|
}
|
|||
|
`]);a.meshShader={vertex:l,fragment:u,attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},a.wireShader={vertex:c,fragment:f,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},a.pointShader={vertex:h,fragment:d,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},a.pickShader={vertex:v,fragment:x,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},a.pointPickShader={vertex:b,fragment:x,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},a.contourShader={vertex:p,fragment:E,attributes:[{name:"position",type:"vec3"}]}},7201:function(i,a,o){"use strict";var s=1e-6,l=1e-6,u=o(9405),c=o(2762),f=o(8116),h=o(7766),d=o(8406),v=o(6760),x=o(7608),b=o(9618),p=o(6729),E=o(7765),k=o(1888),A=o(840),L=o(7626),_=A.meshShader,C=A.wireShader,M=A.pointShader,g=A.pickShader,P=A.pointPickShader,T=A.contourShader,F=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function q(ge,ie,Te,Ee,Ae,ze,Ce,me,Re,ce,Ge,nt,ct,qt,rt,ot,Rt,kt,Ct,Yt,xr,er,Ke,xt,bt,Lt,St){this.gl=ge,this.pixelRatio=1,this.cells=[],this.positions=[],this.intensity=[],this.texture=ie,this.dirty=!0,this.triShader=Te,this.lineShader=Ee,this.pointShader=Ae,this.pickShader=ze,this.pointPickShader=Ce,this.contourShader=me,this.trianglePositions=Re,this.triangleColors=Ge,this.triangleNormals=ct,this.triangleUVs=nt,this.triangleIds=ce,this.triangleVAO=qt,this.triangleCount=0,this.lineWidth=1,this.edgePositions=rt,this.edgeColors=Rt,this.edgeUVs=kt,this.edgeIds=ot,this.edgeVAO=Ct,this.edgeCount=0,this.pointPositions=Yt,this.pointColors=er,this.pointUVs=Ke,this.pointSizes=xt,this.pointIds=xr,this.pointVAO=bt,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=Lt,this.contourVAO=St,this.contourCount=0,this.contourColor=[0,0,0],this.contourEnable=!0,this.pickVertex=!0,this.pickId=1,this.bounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.lightPosition=[1e5,1e5,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.opacity=1,this.hasAlpha=!1,this.opacityscale=!1,this._model=F,this._view=F,this._projection=F,this._resolution=[1,1]}var V=q.prototype;V.isOpaque=function(){return!this.hasAlpha},V.isTransparent=function(){return this.hasAlpha},V.pickSlots=1,V.setPickBase=function(ge){this.pickId=ge};function H(ge,ie){if(!ie||!ie.length)return 1;for(var Te=0;Te<ie.length;++Te){if(ie.length<2)return 1;if(ie[Te][0]===ge)return ie[Te][1];if(ie[Te][0]>ge&&Te>0){var Ee=(ie[Te][0]-ge)/(ie[Te][0]-ie[Te-1][0]);return ie[Te][1]*(1-Ee)+Ee*ie[Te-1][1]}}return 1}function X(ge,ie){for(var Te=p({colormap:ge,nshades:256,format:"rgba"}),Ee=new Uint8Array(256*4),Ae=0;Ae<256;++Ae){for(var ze=Te[Ae],Ce=0;Ce<3;++Ce)Ee[4*Ae+Ce]=ze[Ce];ie?Ee[4*Ae+3]=255*H(Ae/255,ie):Ee[4*Ae+3]=255*ze[3]}return b(Ee,[256,256,4],[4,0,1])}function G(ge){for(var ie=ge.length,Te=new Array(ie),Ee=0;Ee<ie;++Ee)Te[Ee]=ge[Ee][2];return Te}V.highlight=function(ge){if(!ge||!this.contourEnable){this.contourCount=0;return}for(var ie=E(this.cells,this.intensity,ge.intensity),Te=ie.cells,Ee=ie.vertexIds,Ae=ie.vertexWeights,ze=Te.length,Ce=k.mallocFloat32(2*3*ze),me=0,Re=0;Re<ze;++Re)for(var ce=Te[Re],Ge=0;Ge<2;++Ge){var nt=ce[0];ce.length===2&&(nt=ce[Ge]);for(var ct=Ee[nt][0],qt=Ee[nt][1],rt=Ae[nt],ot=1-rt,Rt=this.positions[ct],kt=this.positions[qt],Ct=0;Ct<3;++Ct)Ce[me++]=rt*Rt[Ct]+ot*kt[Ct]}this.contourCount=me/3|0,this.contourPositions.update(Ce.subarray(0,me)),k.free(Ce)},V.update=function(ge){ge=ge||{};var ie=this.gl;this.dirty=!0,"contourEnable"in ge&&(this.contourEnable=ge.contourEnable),"contourColor"in ge&&(this.contourColor=ge.contourColor),"lineWidth"in ge&&(this.lineWidth=ge.lineWidth),"lightPosition"in ge&&(this.lightPosition=ge.lightPosition),this.hasAlpha=!1,"opacity"in ge&&(this.opacity=ge.opacity,this.opacity<1&&(this.hasAlpha=!0)),"opacityscale"in ge&&(this.opacityscale=ge.opacityscale,this.hasA
|
|||
|
#define GLSLIFY 1
|
|||
|
attribute vec2 position;
|
|||
|
varying vec2 uv;
|
|||
|
void main() {
|
|||
|
uv = position;
|
|||
|
gl_Position = vec4(position, 0, 1);
|
|||
|
}`]),c=s([`precision mediump float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
uniform sampler2D accumBuffer;
|
|||
|
varying vec2 uv;
|
|||
|
|
|||
|
void main() {
|
|||
|
vec4 accum = texture2D(accumBuffer, 0.5 * (uv + 1.0));
|
|||
|
gl_FragColor = min(vec4(1,1,1,1), accum);
|
|||
|
}`]);i.exports=function(f){return l(f,u,c,null,[{name:"position",type:"vec2"}])}},4100:function(i,a,o){"use strict";var s=o(4437),l=o(3837),u=o(5445),c=o(4449),f=o(3589),h=o(2260),d=o(7169),v=o(351),x=o(4772),b=o(4040),p=o(799),E=o(9216)({tablet:!0,featureDetect:!0});i.exports={createScene:C,createCamera:s};function k(){this.mouse=[-1,-1],this.screen=null,this.distance=1/0,this.index=null,this.dataCoordinate=null,this.dataPosition=null,this.object=null,this.data=null}function A(g,P){var T=null;try{T=g.getContext("webgl",P),T||(T=g.getContext("experimental-webgl",P))}catch(F){return null}return T}function L(g){var P=Math.round(Math.log(Math.abs(g))/Math.log(10));if(P<0){var T=Math.round(Math.pow(10,-P));return Math.ceil(g*T)/T}else if(P>0){var T=Math.round(Math.pow(10,P));return Math.ceil(g/T)*T}return Math.ceil(g)}function _(g){return typeof g=="boolean"?g:!0}function C(g){g=g||{},g.camera=g.camera||{};var P=g.canvas;if(!P)if(P=document.createElement("canvas"),g.container){var T=g.container;T.appendChild(P)}else document.body.appendChild(P);var F=g.gl;if(F||(g.glOptions&&(E=!!g.glOptions.preserveDrawingBuffer),F=A(P,g.glOptions||{premultipliedAlpha:!0,antialias:!0,preserveDrawingBuffer:E})),!F)throw new Error("webgl not supported");var q=g.bounds||[[-10,-10,-10],[10,10,10]],V=new k,H=h(F,F.drawingBufferWidth,F.drawingBufferHeight,{preferFloat:!E}),X=p(F),G=g.cameraObject&&g.cameraObject._ortho===!0||g.camera.projection&&g.camera.projection.type==="orthographic"||!1,N={eye:g.camera.eye||[2,0,0],center:g.camera.center||[0,0,0],up:g.camera.up||[0,1,0],zoomMin:g.camera.zoomMax||.1,zoomMax:g.camera.zoomMin||100,mode:g.camera.mode||"turntable",_ortho:G},W=g.axes||{},re=l(F,W);re.enable=!W.disable;var ae=g.spikes||{},_e=c(F,ae),Me=[],ke=[],ge=[],ie=[],Te=!0,Ce=!0,Ee=new Array(16),Ae=new Array(16),ze={view:null,projection:Ee,model:Ae,_ortho:!1},Ce=!0,me=[F.drawingBufferWidth,F.drawingBufferHeight],Re=g.cameraObject||s(P,N),ce={gl:F,contextLost:!1,pixelRatio:g.pixelRatio||1,canvas:P,selection:V,camera:Re,axes:re,axesPixels:null,spikes:_e,bounds:q,objects:Me,shape:me,aspect:g.aspectRatio||[1,1,1],pickRadius:g.pickRadius||10,zNear:g.zNear||.01,zFar:g.zFar||1e3,fovy:g.fovy||Math.PI/4,clearColor:g.clearColor||[0,0,0,0],autoResize:_(g.autoResize),autoBounds:_(g.autoBounds),autoScale:!!g.autoScale,autoCenter:_(g.autoCenter),clipToBounds:_(g.clipToBounds),snapToData:!!g.snapToData,onselect:g.onselect||null,onrender:g.onrender||null,onclick:g.onclick||null,cameraParams:ze,oncontextloss:null,mouseListener:null,_stopped:!1,getAspectratio:function(){return{x:this.aspect[0],y:this.aspect[1],z:this.aspect[2]}},setAspectratio:function(Yt){this.aspect[0]=Yt.x,this.aspect[1]=Yt.y,this.aspect[2]=Yt.z,Ce=!0},setBounds:function(Yt,xr){this.bounds[0][Yt]=xr.min,this.bounds[1][Yt]=xr.max},setClearColor:function(Yt){this.clearColor=Yt},clearRGBA:function(){this.gl.clearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT)}},Ge=[F.drawingBufferWidth/ce.pixelRatio|0,F.drawingBufferHeight/ce.pixelRatio|0];function nt(){if(!ce._stopped&&ce.autoResize){var Yt=P.parentNode,xr=1,er=1;Yt&&Yt!==document.body?(xr=Yt.clientWidth,er=Yt.clientHeight):(xr=window.innerWidth,er=window.innerHeight);var Ke=Math.ceil(xr*ce.pixelRatio)|0,xt=Math.ceil(er*ce.pixelRatio)|0;if(Ke!==P.width||xt!==P.height){P.width=Ke,P.height=xt;var bt=P.style;bt.position=bt.position||"absolute",bt.left="0px",bt.top="0px",bt.width=xr+"px",bt.height=er+"px",Te=!0}}}ce.autoResize&&nt(),window.addEventListener("resize",nt);function ct(){for(var Yt=Me.length,xr=ie.length,er=0;er<xr;++er)ge[er]=0;e:for(var er=0;er<Yt;++er){var Ke=Me[er],xt=Ke.pickSlots;if(!xt){ke[er]=-1;continue}for(var bt=0;bt<xr;++bt)if(ge[bt]+xt<255){ke[er]=bt,Ke.setPickBase(ge[bt]+1),ge[bt]+=xt;continue e}var Lt=f(F,me);ke[er]=xr,ie.push(Lt),ge.push(xt),Ke.setPickBase(1),xr+=1}for(;xr>0&&ge[xr-1]===0;)ge.pop(),ie.pop().dispose()}ce.update=function(Yt){ce._stopped||(Yt=Yt||{},Te=!0,Ce=!0)},ce.add=function(Yt){ce._stopped||(Yt.axes=re,
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
attribute vec3 position;
|
|||
|
attribute vec4 color;
|
|||
|
attribute vec2 glyph;
|
|||
|
attribute vec4 id;
|
|||
|
|
|||
|
uniform vec4 highlightId;
|
|||
|
uniform float highlightScale;
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
|
|||
|
varying vec4 interpColor;
|
|||
|
varying vec4 pickId;
|
|||
|
varying vec3 dataCoordinate;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (outOfRange(clipBounds[0], clipBounds[1], position)) {
|
|||
|
|
|||
|
gl_Position = vec4(0,0,0,0);
|
|||
|
} else {
|
|||
|
float scale = 1.0;
|
|||
|
if(distance(highlightId, id) < 0.0001) {
|
|||
|
scale = highlightScale;
|
|||
|
}
|
|||
|
|
|||
|
vec4 worldPosition = model * vec4(position, 1);
|
|||
|
vec4 viewPosition = view * worldPosition;
|
|||
|
viewPosition = viewPosition / viewPosition.w;
|
|||
|
vec4 clipPosition = projection * (viewPosition + scale * vec4(glyph.x, -glyph.y, 0, 0));
|
|||
|
|
|||
|
gl_Position = clipPosition;
|
|||
|
interpColor = color;
|
|||
|
pickId = id;
|
|||
|
dataCoordinate = position;
|
|||
|
}
|
|||
|
}`]),c=l([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
attribute vec3 position;
|
|||
|
attribute vec4 color;
|
|||
|
attribute vec2 glyph;
|
|||
|
attribute vec4 id;
|
|||
|
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
uniform vec2 screenSize;
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
uniform float highlightScale, pixelRatio;
|
|||
|
uniform vec4 highlightId;
|
|||
|
|
|||
|
varying vec4 interpColor;
|
|||
|
varying vec4 pickId;
|
|||
|
varying vec3 dataCoordinate;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (outOfRange(clipBounds[0], clipBounds[1], position)) {
|
|||
|
|
|||
|
gl_Position = vec4(0,0,0,0);
|
|||
|
} else {
|
|||
|
float scale = pixelRatio;
|
|||
|
if(distance(highlightId.bgr, id.bgr) < 0.001) {
|
|||
|
scale *= highlightScale;
|
|||
|
}
|
|||
|
|
|||
|
vec4 worldPosition = model * vec4(position, 1.0);
|
|||
|
vec4 viewPosition = view * worldPosition;
|
|||
|
vec4 clipPosition = projection * viewPosition;
|
|||
|
clipPosition /= clipPosition.w;
|
|||
|
|
|||
|
gl_Position = clipPosition + vec4(screenSize * scale * vec2(glyph.x, -glyph.y), 0.0, 0.0);
|
|||
|
interpColor = color;
|
|||
|
pickId = id;
|
|||
|
dataCoordinate = position;
|
|||
|
}
|
|||
|
}`]),f=l([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
attribute vec3 position;
|
|||
|
attribute vec4 color;
|
|||
|
attribute vec2 glyph;
|
|||
|
attribute vec4 id;
|
|||
|
|
|||
|
uniform float highlightScale;
|
|||
|
uniform vec4 highlightId;
|
|||
|
uniform vec3 axes[2];
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
uniform vec2 screenSize;
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
uniform float scale, pixelRatio;
|
|||
|
|
|||
|
varying vec4 interpColor;
|
|||
|
varying vec4 pickId;
|
|||
|
varying vec3 dataCoordinate;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (outOfRange(clipBounds[0], clipBounds[1], position)) {
|
|||
|
|
|||
|
gl_Position = vec4(0,0,0,0);
|
|||
|
} else {
|
|||
|
float lscale = pixelRatio * scale;
|
|||
|
if(distance(highlightId, id) < 0.0001) {
|
|||
|
lscale *= highlightScale;
|
|||
|
}
|
|||
|
|
|||
|
vec4 clipCenter = projection * (view * (model * vec4(position, 1)));
|
|||
|
vec3 dataPosition = position + 0.5*lscale*(axes[0] * glyph.x + axes[1] * glyph.y) * clipCenter.w * screenSize.y;
|
|||
|
vec4 clipPosition = projection * (view * (model * vec4(dataPosition, 1)));
|
|||
|
|
|||
|
gl_Position = clipPosition;
|
|||
|
interpColor = color;
|
|||
|
pickId = id;
|
|||
|
dataCoordinate = dataPosition;
|
|||
|
}
|
|||
|
}
|
|||
|
`]),h=l([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
uniform vec3 fragClipBounds[2];
|
|||
|
uniform float opacity;
|
|||
|
|
|||
|
varying vec4 interpColor;
|
|||
|
varying vec3 dataCoordinate;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (
|
|||
|
outOfRange(fragClipBounds[0], fragClipBounds[1], dataCoordinate) ||
|
|||
|
interpColor.a * opacity == 0.
|
|||
|
) discard;
|
|||
|
gl_FragColor = interpColor * opacity;
|
|||
|
}
|
|||
|
`]),d=l([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
uniform vec3 fragClipBounds[2];
|
|||
|
uniform float pickGroup;
|
|||
|
|
|||
|
varying vec4 pickId;
|
|||
|
varying vec3 dataCoordinate;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (outOfRange(fragClipBounds[0], fragClipBounds[1], dataCoordinate)) discard;
|
|||
|
|
|||
|
gl_FragColor = vec4(pickGroup, pickId.bgr);
|
|||
|
}`]),v=[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"glyph",type:"vec2"},{name:"id",type:"vec4"}],x={vertex:u,fragment:h,attributes:v},b={vertex:c,fragment:h,attributes:v},p={vertex:f,fragment:h,attributes:v},E={vertex:u,fragment:d,attributes:v},k={vertex:c,fragment:d,attributes:v},A={vertex:f,fragment:d,attributes:v};function L(_,C){var M=s(_,C),g=M.attributes;return g.position.location=0,g.color.location=1,g.glyph.location=2,g.id.location=3,M}a.createPerspective=function(_){return L(_,x)},a.createOrtho=function(_){return L(_,b)},a.createProject=function(_){return L(_,p)},a.createPickPerspective=function(_){return L(_,E)},a.createPickOrtho=function(_){return L(_,k)},a.createPickProject=function(_){return L(_,A)}},8418:function(i,a,o){"use strict";var s=o(5219),l=o(2762),u=o(8116),c=o(1888),f=o(6760),h=o(1283),d=o(9366),v=o(5964),x=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],b=ArrayBuffer,p=DataView;function E(Ae){return b.isView(Ae)&&!(Ae instanceof p)}function k(Ae){return Array.isArray(Ae)||E(Ae)}i.exports=Ee;function A(Ae,ze){var Ce=Ae[0],me=Ae[1],Re=Ae[2],ce=Ae[3];return Ae[0]=ze[0]*Ce+ze[4]*me+ze[8]*Re+ze[12]*ce,Ae[1]=ze[1]*Ce+ze[5]*me+ze[9]*Re+ze[13]*ce,Ae[2]=ze[2]*Ce+ze[6]*me+ze[10]*Re+ze[14]*ce,Ae[3]=ze[3]*Ce+ze[7]*me+ze[11]*Re+ze[15]*ce,Ae}function L(Ae,ze,Ce,me){return A(me,me,Ce),A(me,me,ze),A(me,me,Ae)}function _(Ae,ze){this.index=Ae,this.dataCoordinate=this.position=ze}function C(Ae){return Ae===!0||Ae>1?1:Ae}function M(Ae,ze,Ce,me,Re,ce,Ge,nt,ct,qt,rt,ot){this.gl=Ae,this.pixelRatio=1,this.shader=ze,this.orthoShader=Ce,this.projectShader=me,this.pointBuffer=Re,this.colorBuffer=ce,this.glyphBuffer=Ge,this.idBuffer=nt,this.vao=ct,this.vertexCount=0,this.lineVertexCount=0,this.opacity=1,this.hasAlpha=!1,this.lineWidth=0,this.projectScale=[.6666666666666666,.6666666666666666,.6666666666666666],this.projectOpacity=[1,1,1],this.projectHasAlpha=!1,this.pickId=0,this.pickPerspectiveShader=qt,this.pickOrthoShader=rt,this.pickProjectShader=ot,this.points=[],this._selectResult=new _(0,[0,0,0]),this.useOrtho=!0,this.bounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.axesProject=[!0,!0,!0],this.axesBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.highlightId=[1,1,1,1],this.highlightScale=2,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.dirty=!0}var g=M.prototype;g.pickSlots=1,g.setPickBase=function(Ae){this.pickId=Ae},g.isTransparent=function(){if(this.hasAlpha)return!0;for(var Ae=0;Ae<3;++Ae)if(this.axesProject[Ae]&&this.projectHasAlpha)return!0;return!1},g.isOpaque=function(){if(!this.hasAlpha)return!0;for(var Ae=0;Ae<3;++Ae)if(this.axesProject[Ae]&&!this.projectHasAlpha)return!0;return!1};var P=[0,0],T=[0,0,0],F=[0,0,0],q=[0,0,0,1],V=[0,0,0,1],H=x.slice(),X=[0,0,0],G=[[0,0,0],[0,0,0]];function N(Ae){return Ae[0]=Ae[1]=Ae[2]=0,Ae}function W(Ae,ze){return Ae[0]=ze[0],Ae[1]=ze[1],Ae[2]=ze[2],Ae[3]=1,Ae}function re(Ae,ze,Ce,me){return Ae[0]=ze[0],Ae[1]=ze[1],Ae[2]=ze[2],Ae[Ce]=me,Ae}function ae(Ae){for(var ze=G,Ce=0;Ce<2;++Ce)for(var me=0;me<3;++me)ze[Ce][me]=Math.max(Math.min(Ae[Ce][me],1e8),-1e8);return ze}function _e(Ae,ze,Ce,me){var Re=ze.axesProject,ce=ze.gl,Ge=Ae.uniforms,nt=Ce.model||x,ct=Ce.view||x,qt=Ce.projection||x,rt=ze.axesBounds,ot=ae(ze.clipBounds),Rt;ze.axes&&ze.axes.lastCubeProps?Rt=ze.axes.lastCubeProps.axis:Rt=[1,1,1],P[0]=2/ce.drawingBufferWidth,P[1]=2/ce.drawingBufferHeight,Ae.bind(),Ge.view=ct,Ge.projection=qt,Ge.screenSize=P,Ge.highlightId=ze.highlightId,Ge.highlightScale=ze.highlightScale,Ge.clipBounds=ot,Ge.pickGroup=ze.pickId/255,Ge.pixelRatio=me;for(var kt=0;kt<3;++kt)if(Re[kt]){Ge.scale=ze.projectScale[kt],Ge.opacity=ze.projectOpacity[kt];for(var Ct=H,Yt=0;Yt<16;++Yt)Ct[Yt]=0;for(var Yt=0;Yt<4;++Yt)Ct[5*Yt]=1;Ct[5*kt]=0,Rt[kt]<0?Ct[12+kt]=rt[0][kt]:Ct[12+kt]=rt[1][kt],f(Ct,nt,Ct),Ge.model=Ct;var xr=(kt+1)%3,er=(kt+2)%3,Ke=N(T),xt=N(F);Ke[xr]=1,xt[er]=1;var bt=L(qt,ct,nt,W(q,Ke)),Lt=L(qt,ct,nt,W(V,xt));if(Math.abs(bt[1])>Math.abs(Lt[1])){var St=bt;bt=Lt,Lt=St,St=Ke,Ke=xt,xt=St;var Et=xr;xr=er,er=Et}bt[0]<0&&(Ke[xr]=-1),Lt[1]>0&&(xt[er]=-1);for(var dt=0,Ht=0,Yt=0;Yt<4;++Yt)dt+=Math.pow(nt
|
|||
|
`+l:""),this.stack=new Error().stack}a.prototype=new Error,a.prototype.name="GLError",a.prototype.constructor=a,i.exports=a},8731:function(i,a,o){"use strict";i.exports=d;var s=o(8866);function l(v,x,b,p,E,k){this._gl=v,this._wrapper=x,this._index=b,this._locations=p,this._dimension=E,this._constFunc=k}var u=l.prototype;u.pointer=function(x,b,p,E){var k=this,A=k._gl,L=k._locations[k._index];A.vertexAttribPointer(L,k._dimension,x||A.FLOAT,!!b,p||0,E||0),A.enableVertexAttribArray(L)},u.set=function(v,x,b,p){return this._constFunc(this._locations[this._index],v,x,b,p)},Object.defineProperty(u,"location",{get:function(){return this._locations[this._index]},set:function(v){return v!==this._locations[this._index]&&(this._locations[this._index]=v|0,this._wrapper.program=null),v|0}});var c=[function(v,x,b){return b.length===void 0?v.vertexAttrib1f(x,b):v.vertexAttrib1fv(x,b)},function(v,x,b,p){return b.length===void 0?v.vertexAttrib2f(x,b,p):v.vertexAttrib2fv(x,b)},function(v,x,b,p,E){return b.length===void 0?v.vertexAttrib3f(x,b,p,E):v.vertexAttrib3fv(x,b)},function(v,x,b,p,E,k){return b.length===void 0?v.vertexAttrib4f(x,b,p,E,k):v.vertexAttrib4fv(x,b)}];function f(v,x,b,p,E,k,A){var L=c[E],_=new l(v,x,b,p,E,L);Object.defineProperty(k,A,{set:function(C){return v.disableVertexAttribArray(p[b]),L(v,p[b],C),C},get:function(){return _},enumerable:!0})}function h(v,x,b,p,E,k,A){for(var L=new Array(E),_=new Array(E),C=0;C<E;++C)f(v,x,b[C],p,E,L,C),_[C]=L[C];Object.defineProperty(L,"location",{set:function(P){if(Array.isArray(P))for(var T=0;T<E;++T)_[T].location=P[T];else for(var T=0;T<E;++T)_[T].location=P+T;return P},get:function(){for(var P=new Array(E),T=0;T<E;++T)P[T]=p[b[T]];return P},enumerable:!0}),L.pointer=function(P,T,F,q){P=P||v.FLOAT,T=!!T,F=F||E*E,q=q||0;for(var V=0;V<E;++V){var H=p[b[V]];v.vertexAttribPointer(H,E,P,T,F,q+V*E),v.enableVertexAttribArray(H)}};var M=new Array(E),g=v["vertexAttrib"+E+"fv"];Object.defineProperty(k,A,{set:function(P){for(var T=0;T<E;++T){var F=p[b[T]];if(v.disableVertexAttribArray(F),Array.isArray(P[0]))g.call(v,F,P[T]);else{for(var q=0;q<E;++q)M[q]=P[E*T+q];g.call(v,F,M)}}return P},get:function(){return L},enumerable:!0})}function d(v,x,b,p){for(var E={},k=0,A=b.length;k<A;++k){var L=b[k],_=L.name,C=L.type,M=L.locations;switch(C){case"bool":case"int":case"float":f(v,x,M[0],p,1,E,_);break;default:if(C.indexOf("vec")>=0){var g=C.charCodeAt(C.length-1)-48;if(g<2||g>4)throw new s("","Invalid data type for attribute "+_+": "+C);f(v,x,M[0],p,g,E,_)}else if(C.indexOf("mat")>=0){var g=C.charCodeAt(C.length-1)-48;if(g<2||g>4)throw new s("","Invalid data type for attribute "+_+": "+C);h(v,x,M,p,g,E,_)}else throw new s("","Unknown data type for attribute "+_+": "+C);break}}return E}},3327:function(i,a,o){"use strict";var s=o(216),l=o(8866);i.exports=f;function u(h){return function(){return h}}function c(h,d){for(var v=new Array(h),x=0;x<h;++x)v[x]=d;return v}function f(h,d,v,x){function b(C){return function(M,g,P){return M.getUniform(g.program,P[C])}}function p(C){return function(g){for(var P=E("",C),T=0;T<P.length;++T){var F=P[T],q=F[0],V=F[1];if(x[V]){var H=g;if(typeof q=="string"&&(q.indexOf(".")===0||q.indexOf("[")===0)){var X=q;if(q.indexOf(".")===0&&(X=q.slice(1)),X.indexOf("]")===X.length-1){var G=X.indexOf("["),N=X.slice(0,G),W=X.slice(G+1,X.length-1);H=N?g[N][W]:g[W]}else H=g[X]}var re=v[V].type,ae;switch(re){case"bool":case"int":case"sampler2D":case"samplerCube":h.uniform1i(x[V],H);break;case"float":h.uniform1f(x[V],H);break;default:var _e=re.indexOf("vec");if(0<=_e&&_e<=1&&re.length===4+_e){if(ae=re.charCodeAt(re.length-1)-48,ae<2||ae>4)throw new l("","Invalid data type");switch(re.charAt(0)){case"b":case"i":h["uniform"+ae+"iv"](x[V],H);break;case"v":h["uniform"+ae+"fv"](x[V],H);break;default:throw new l("","Unrecognized data type for vector "+name+": "+re)}}else if(re.indexOf("mat")===0&&re.length===4){if(ae=re.charCodeAt(re.length-1)-48,ae<2||ae>4)throw new l("","Invalid uniform dimension type for matrix "+name+": "+re);h["uniformMatrix"+ae+"fv"](x[V],!1,H);break}else throw new l("","Unkn
|
|||
|
`+M)}throw new s(M,g.short,g.long)}return C}v.getShaderReference=function(A,L){var _=this.gl,C=this.shaders[A===_.FRAGMENT_SHADER|0],M=C[L];if(!M||!_.isShader(M.shader)){var g=x(_,A,L);M=C[L]=new h(f++,L,A,g,[],1,this)}else M.count+=1;return M};function b(A,L,_,C,M){var g=A.createProgram();A.attachShader(g,L),A.attachShader(g,_);for(var P=0;P<C.length;++P)A.bindAttribLocation(g,M[P],C[P]);if(A.linkProgram(g),!A.getProgramParameter(g,A.LINK_STATUS)){var T=A.getProgramInfoLog(g);throw new s(T,"Error linking program: "+T)}return g}v.getProgram=function(A,L,_,C){var M=[A.id,L.id,_.join(":"),C.join(":")].join("@"),g=this.programs[M];return(!g||!this.gl.isProgram(g))&&(this.programs[M]=g=b(this.gl,A.shader,L.shader,_,C),A.programs.push(M),L.programs.push(M)),g};function p(A){var L=c.get(A);return L||(L=new d(A),c.set(A,L)),L}function E(A,L,_){return p(A).getShaderReference(L,_)}function k(A,L,_,C,M){return p(A).getProgram(L,_,C,M)}},1493:function(i,a,o){"use strict";var s=o(3236),l=o(9405),u=s([`precision mediump float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
attribute vec3 position, color;
|
|||
|
attribute float weight;
|
|||
|
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
uniform vec3 coordinates[3];
|
|||
|
uniform vec4 colors[3];
|
|||
|
uniform vec2 screenShape;
|
|||
|
uniform float lineWidth;
|
|||
|
|
|||
|
varying vec4 fragColor;
|
|||
|
|
|||
|
void main() {
|
|||
|
vec3 vertexPosition = mix(coordinates[0],
|
|||
|
mix(coordinates[2], coordinates[1], 0.5 * (position + 1.0)), abs(position));
|
|||
|
|
|||
|
vec4 clipPos = projection * (view * (model * vec4(vertexPosition, 1.0)));
|
|||
|
vec2 clipOffset = (projection * (view * (model * vec4(color, 0.0)))).xy;
|
|||
|
vec2 delta = weight * clipOffset * screenShape;
|
|||
|
vec2 lineOffset = normalize(vec2(delta.y, -delta.x)) / screenShape;
|
|||
|
|
|||
|
gl_Position = vec4(clipPos.xy + clipPos.w * 0.5 * lineWidth * lineOffset, clipPos.z, clipPos.w);
|
|||
|
fragColor = color.x * colors[0] + color.y * colors[1] + color.z * colors[2];
|
|||
|
}
|
|||
|
`]),c=s([`precision mediump float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
varying vec4 fragColor;
|
|||
|
|
|||
|
void main() {
|
|||
|
gl_FragColor = fragColor;
|
|||
|
}`]);i.exports=function(f){return l(f,u,c,null,[{name:"position",type:"vec3"},{name:"color",type:"vec3"},{name:"weight",type:"float"}])}},4449:function(i,a,o){"use strict";var s=o(2762),l=o(8116),u=o(1493);i.exports=b;var c=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function f(p,E,k,A){this.gl=p,this.buffer=E,this.vao=k,this.shader=A,this.pixelRatio=1,this.bounds=[[-1e3,-1e3,-1e3],[1e3,1e3,1e3]],this.position=[0,0,0],this.lineWidth=[2,2,2],this.colors=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.enabled=[!0,!0,!0],this.drawSides=[!0,!0,!0],this.axes=null}var h=f.prototype,d=[0,0,0],v=[0,0,0],x=[0,0];h.isTransparent=function(){return!1},h.drawTransparent=function(p){},h.draw=function(p){var E=this.gl,k=this.vao,A=this.shader;k.bind(),A.bind();var L=p.model||c,_=p.view||c,C=p.projection||c,M;this.axes&&(M=this.axes.lastCubeProps.axis);for(var g=d,P=v,T=0;T<3;++T)M&&M[T]<0?(g[T]=this.bounds[0][T],P[T]=this.bounds[1][T]):(g[T]=this.bounds[1][T],P[T]=this.bounds[0][T]);x[0]=E.drawingBufferWidth,x[1]=E.drawingBufferHeight,A.uniforms.model=L,A.uniforms.view=_,A.uniforms.projection=C,A.uniforms.coordinates=[this.position,g,P],A.uniforms.colors=this.colors,A.uniforms.screenShape=x;for(var T=0;T<3;++T)A.uniforms.lineWidth=this.lineWidth[T]*this.pixelRatio,this.enabled[T]&&(k.draw(E.TRIANGLES,6,6*T),this.drawSides[T]&&k.draw(E.TRIANGLES,12,18+12*T));k.unbind()},h.update=function(p){p&&("bounds"in p&&(this.bounds=p.bounds),"position"in p&&(this.position=p.position),"lineWidth"in p&&(this.lineWidth=p.lineWidth),"colors"in p&&(this.colors=p.colors),"enabled"in p&&(this.enabled=p.enabled),"drawSides"in p&&(this.drawSides=p.drawSides))},h.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()};function b(p,E){var k=[];function A(g,P,T,F,q,V){var H=[g,P,T,0,0,0,1];H[F+3]=1,H[F]=q,k.push.apply(k,H),H[6]=-1,k.push.apply(k,H),H[F]=V,k.push.apply(k,H),k.push.apply(k,H),H[6]=1,k.push.apply(k,H),H[F]=q,k.push.apply(k,H)}A(0,0,0,0,0,1),A(0,0,0,1,0,1),A(0,0,0,2,0,1),A(1,0,0,1,-1,1),A(1,0,0,2,-1,1),A(0,1,0,0,-1,1),A(0,1,0,2,-1,1),A(0,0,1,0,-1,1),A(0,0,1,1,-1,1);var L=s(p,k),_=l(p,[{type:p.FLOAT,buffer:L,size:3,offset:0,stride:28},{type:p.FLOAT,buffer:L,size:3,offset:12,stride:28},{type:p.FLOAT,buffer:L,size:1,offset:24,stride:28}]),C=u(p);C.attributes.position.location=0,C.attributes.color.location=1,C.attributes.weight.location=2;var M=new f(p,L,_,C);return M.update(E),M}},6740:function(i,a,o){var s=o(3236),l=s([`precision highp float;
|
|||
|
|
|||
|
precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
vec3 getOrthogonalVector(vec3 v) {
|
|||
|
// Return up-vector for only-z vector.
|
|||
|
// Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).
|
|||
|
// From the above if-statement we have ||a|| > 0 U ||b|| > 0.
|
|||
|
// Assign z = 0, x = -b, y = a:
|
|||
|
// a*-b + b*a + c*0 = -ba + ba + 0 = 0
|
|||
|
if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {
|
|||
|
return normalize(vec3(-v.y, v.x, 0.0));
|
|||
|
} else {
|
|||
|
return normalize(vec3(0.0, v.z, -v.y));
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// Calculate the tube vertex and normal at the given index.
|
|||
|
//
|
|||
|
// The returned vertex is for a tube ring with its center at origin, radius of length(d), pointing in the direction of d.
|
|||
|
//
|
|||
|
// Each tube segment is made up of a ring of vertices.
|
|||
|
// These vertices are used to make up the triangles of the tube by connecting them together in the vertex array.
|
|||
|
// The indexes of tube segments run from 0 to 8.
|
|||
|
//
|
|||
|
vec3 getTubePosition(vec3 d, float index, out vec3 normal) {
|
|||
|
float segmentCount = 8.0;
|
|||
|
|
|||
|
float angle = 2.0 * 3.14159 * (index / segmentCount);
|
|||
|
|
|||
|
vec3 u = getOrthogonalVector(d);
|
|||
|
vec3 v = normalize(cross(u, d));
|
|||
|
|
|||
|
vec3 x = u * cos(angle) * length(d);
|
|||
|
vec3 y = v * sin(angle) * length(d);
|
|||
|
vec3 v3 = x + y;
|
|||
|
|
|||
|
normal = normalize(v3);
|
|||
|
|
|||
|
return v3;
|
|||
|
}
|
|||
|
|
|||
|
attribute vec4 vector;
|
|||
|
attribute vec4 color, position;
|
|||
|
attribute vec2 uv;
|
|||
|
|
|||
|
uniform float vectorScale, tubeScale;
|
|||
|
uniform mat4 model, view, projection, inverseModel;
|
|||
|
uniform vec3 eyePosition, lightPosition;
|
|||
|
|
|||
|
varying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position;
|
|||
|
varying vec4 f_color;
|
|||
|
varying vec2 f_uv;
|
|||
|
|
|||
|
void main() {
|
|||
|
// Scale the vector magnitude to stay constant with
|
|||
|
// model & view changes.
|
|||
|
vec3 normal;
|
|||
|
vec3 XYZ = getTubePosition(mat3(model) * (tubeScale * vector.w * normalize(vector.xyz)), position.w, normal);
|
|||
|
vec4 tubePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);
|
|||
|
|
|||
|
//Lighting geometry parameters
|
|||
|
vec4 cameraCoordinate = view * tubePosition;
|
|||
|
cameraCoordinate.xyz /= cameraCoordinate.w;
|
|||
|
f_lightDirection = lightPosition - cameraCoordinate.xyz;
|
|||
|
f_eyeDirection = eyePosition - cameraCoordinate.xyz;
|
|||
|
f_normal = normalize((vec4(normal, 0.0) * inverseModel).xyz);
|
|||
|
|
|||
|
// vec4 m_position = model * vec4(tubePosition, 1.0);
|
|||
|
vec4 t_position = view * tubePosition;
|
|||
|
gl_Position = projection * t_position;
|
|||
|
|
|||
|
f_color = color;
|
|||
|
f_data = tubePosition.xyz;
|
|||
|
f_position = position.xyz;
|
|||
|
f_uv = uv;
|
|||
|
}
|
|||
|
`]),u=s([`#extension GL_OES_standard_derivatives : enable
|
|||
|
|
|||
|
precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
float beckmannDistribution(float x, float roughness) {
|
|||
|
float NdotH = max(x, 0.0001);
|
|||
|
float cos2Alpha = NdotH * NdotH;
|
|||
|
float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;
|
|||
|
float roughness2 = roughness * roughness;
|
|||
|
float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;
|
|||
|
return exp(tan2Alpha / roughness2) / denom;
|
|||
|
}
|
|||
|
|
|||
|
float cookTorranceSpecular(
|
|||
|
vec3 lightDirection,
|
|||
|
vec3 viewDirection,
|
|||
|
vec3 surfaceNormal,
|
|||
|
float roughness,
|
|||
|
float fresnel) {
|
|||
|
|
|||
|
float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);
|
|||
|
float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);
|
|||
|
|
|||
|
//Half angle vector
|
|||
|
vec3 H = normalize(lightDirection + viewDirection);
|
|||
|
|
|||
|
//Geometric term
|
|||
|
float NdotH = max(dot(surfaceNormal, H), 0.0);
|
|||
|
float VdotH = max(dot(viewDirection, H), 0.000001);
|
|||
|
float LdotH = max(dot(lightDirection, H), 0.000001);
|
|||
|
float G1 = (2.0 * NdotH * VdotN) / VdotH;
|
|||
|
float G2 = (2.0 * NdotH * LdotN) / LdotH;
|
|||
|
float G = min(1.0, min(G1, G2));
|
|||
|
|
|||
|
//Distribution term
|
|||
|
float D = beckmannDistribution(NdotH, roughness);
|
|||
|
|
|||
|
//Fresnel term
|
|||
|
float F = pow(1.0 - VdotN, fresnel);
|
|||
|
|
|||
|
//Multiply terms and done
|
|||
|
return G * F * D / max(3.14159265 * VdotN, 0.000001);
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
uniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;
|
|||
|
uniform sampler2D texture;
|
|||
|
|
|||
|
varying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position;
|
|||
|
varying vec4 f_color;
|
|||
|
varying vec2 f_uv;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;
|
|||
|
vec3 N = normalize(f_normal);
|
|||
|
vec3 L = normalize(f_lightDirection);
|
|||
|
vec3 V = normalize(f_eyeDirection);
|
|||
|
|
|||
|
if(gl_FrontFacing) {
|
|||
|
N = -N;
|
|||
|
}
|
|||
|
|
|||
|
float specular = min(1.0, max(0.0, cookTorranceSpecular(L, V, N, roughness, fresnel)));
|
|||
|
float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);
|
|||
|
|
|||
|
vec4 surfaceColor = f_color * texture2D(texture, f_uv);
|
|||
|
vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);
|
|||
|
|
|||
|
gl_FragColor = litColor * opacity;
|
|||
|
}
|
|||
|
`]),c=s([`precision highp float;
|
|||
|
|
|||
|
precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
vec3 getOrthogonalVector(vec3 v) {
|
|||
|
// Return up-vector for only-z vector.
|
|||
|
// Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).
|
|||
|
// From the above if-statement we have ||a|| > 0 U ||b|| > 0.
|
|||
|
// Assign z = 0, x = -b, y = a:
|
|||
|
// a*-b + b*a + c*0 = -ba + ba + 0 = 0
|
|||
|
if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {
|
|||
|
return normalize(vec3(-v.y, v.x, 0.0));
|
|||
|
} else {
|
|||
|
return normalize(vec3(0.0, v.z, -v.y));
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// Calculate the tube vertex and normal at the given index.
|
|||
|
//
|
|||
|
// The returned vertex is for a tube ring with its center at origin, radius of length(d), pointing in the direction of d.
|
|||
|
//
|
|||
|
// Each tube segment is made up of a ring of vertices.
|
|||
|
// These vertices are used to make up the triangles of the tube by connecting them together in the vertex array.
|
|||
|
// The indexes of tube segments run from 0 to 8.
|
|||
|
//
|
|||
|
vec3 getTubePosition(vec3 d, float index, out vec3 normal) {
|
|||
|
float segmentCount = 8.0;
|
|||
|
|
|||
|
float angle = 2.0 * 3.14159 * (index / segmentCount);
|
|||
|
|
|||
|
vec3 u = getOrthogonalVector(d);
|
|||
|
vec3 v = normalize(cross(u, d));
|
|||
|
|
|||
|
vec3 x = u * cos(angle) * length(d);
|
|||
|
vec3 y = v * sin(angle) * length(d);
|
|||
|
vec3 v3 = x + y;
|
|||
|
|
|||
|
normal = normalize(v3);
|
|||
|
|
|||
|
return v3;
|
|||
|
}
|
|||
|
|
|||
|
attribute vec4 vector;
|
|||
|
attribute vec4 position;
|
|||
|
attribute vec4 id;
|
|||
|
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
uniform float tubeScale;
|
|||
|
|
|||
|
varying vec3 f_position;
|
|||
|
varying vec4 f_id;
|
|||
|
|
|||
|
void main() {
|
|||
|
vec3 normal;
|
|||
|
vec3 XYZ = getTubePosition(mat3(model) * (tubeScale * vector.w * normalize(vector.xyz)), position.w, normal);
|
|||
|
vec4 tubePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);
|
|||
|
|
|||
|
gl_Position = projection * (view * tubePosition);
|
|||
|
f_id = id;
|
|||
|
f_position = position.xyz;
|
|||
|
}
|
|||
|
`]),f=s([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
uniform float pickId;
|
|||
|
|
|||
|
varying vec3 f_position;
|
|||
|
varying vec4 f_id;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;
|
|||
|
|
|||
|
gl_FragColor = vec4(pickId, f_id.xyz);
|
|||
|
}`]);a.meshShader={vertex:l,fragment:u,attributes:[{name:"position",type:"vec4"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"vector",type:"vec4"}]},a.pickShader={vertex:c,fragment:f,attributes:[{name:"position",type:"vec4"},{name:"id",type:"vec4"},{name:"vector",type:"vec4"}]}},7815:function(i,a,o){"use strict";var s=o(2931),l=o(9970),u=["xyz","xzy","yxz","yzx","zxy","zyx"],c=function(A,L,_,C){for(var M=A.points,g=A.velocities,P=A.divergences,T=[],F=[],q=[],V=[],H=[],X=[],G=0,N=0,W=l.create(),re=l.create(),ae=8,_e=0;_e<M.length;_e++){var Me=M[_e],ke=g[_e],ge=P[_e];L===0&&(ge=_*.05),N=s.length(ke)/C,W=l.create(),s.copy(W,ke),W[3]=ge;for(var ie=0;ie<ae;ie++)H[ie]=[Me[0],Me[1],Me[2],ie];if(V.length>0)for(var ie=0;ie<ae;ie++){var Te=(ie+1)%ae;T.push(V[ie],H[ie],H[Te],H[Te],V[Te],V[ie]),q.push(re,W,W,W,re,re),X.push(G,N,N,N,G,G);var Ee=T.length;F.push([Ee-6,Ee-5,Ee-4],[Ee-3,Ee-2,Ee-1])}var Ae=V;V=H,H=Ae;var ze=re;re=W,W=ze;var Ce=G;G=N,N=Ce}return{positions:T,cells:F,vectors:q,vertexIntensity:X}},f=function(A,L,_,C){for(var M=0,g=0;g<A.length;g++)for(var P=A[g].velocities,T=0;T<P.length;T++)M=Math.max(M,s.length(P[T]));for(var F=A.map(function(_e){return c(_e,_,C,M)}),q=[],V=[],H=[],X=[],g=0;g<F.length;g++){var G=F[g],N=q.length;q=q.concat(G.positions),H=H.concat(G.vectors),X=X.concat(G.vertexIntensity);for(var T=0;T<G.cells.length;T++){var W=G.cells[T],re=[];V.push(re);for(var ae=0;ae<W.length;ae++)re.push(W[ae]+N)}}return{positions:q,cells:V,vectors:H,vertexIntensity:X,colormap:L}},h=function(A,L){var _=A.length,C;for(C=0;C<_;C++){var M=A[C];if(M===L)return C;if(M>L)return C-1}return C},d=function(A,L,_){return A<L?L:A>_?_:A},v=function(A,L,_){var C=L.vectors,M=L.meshgrid,g=A[0],P=A[1],T=A[2],F=M[0].length,q=M[1].length,V=M[2].length,H=h(M[0],g),X=h(M[1],P),G=h(M[2],T),N=H+1,W=X+1,re=G+1;if(H=d(H,0,F-1),N=d(N,0,F-1),X=d(X,0,q-1),W=d(W,0,q-1),G=d(G,0,V-1),re=d(re,0,V-1),H<0||X<0||G<0||N>F-1||W>q-1||re>V-1)return s.create();var ae=M[0][H],_e=M[0][N],Me=M[1][X],ke=M[1][W],ge=M[2][G],ie=M[2][re],Te=(g-ae)/(_e-ae),Ee=(P-Me)/(ke-Me),Ae=(T-ge)/(ie-ge);isFinite(Te)||(Te=.5),isFinite(Ee)||(Ee=.5),isFinite(Ae)||(Ae=.5);var ze,Ce,me,Re,ce,Ge;switch(_.reversedX&&(H=F-1-H,N=F-1-N),_.reversedY&&(X=q-1-X,W=q-1-W),_.reversedZ&&(G=V-1-G,re=V-1-re),_.filled){case 5:ce=G,Ge=re,me=X*V,Re=W*V,ze=H*V*q,Ce=N*V*q;break;case 4:ce=G,Ge=re,ze=H*V,Ce=N*V,me=X*V*F,Re=W*V*F;break;case 3:me=X,Re=W,ce=G*q,Ge=re*q,ze=H*q*V,Ce=N*q*V;break;case 2:me=X,Re=W,ze=H*q,Ce=N*q,ce=G*q*F,Ge=re*q*F;break;case 1:ze=H,Ce=N,ce=G*F,Ge=re*F,me=X*F*V,Re=W*F*V;break;default:ze=H,Ce=N,me=X*F,Re=W*F,ce=G*F*q,Ge=re*F*q;break}var nt=C[ze+me+ce],ct=C[ze+me+Ge],qt=C[ze+Re+ce],rt=C[ze+Re+Ge],ot=C[Ce+me+ce],Rt=C[Ce+me+Ge],kt=C[Ce+Re+ce],Ct=C[Ce+Re+Ge],Yt=s.create(),xr=s.create(),er=s.create(),Ke=s.create();s.lerp(Yt,nt,ot,Te),s.lerp(xr,ct,Rt,Te),s.lerp(er,qt,kt,Te),s.lerp(Ke,rt,Ct,Te);var xt=s.create(),bt=s.create();s.lerp(xt,Yt,er,Ee),s.lerp(bt,xr,Ke,Ee);var Lt=s.create();return s.lerp(Lt,xt,bt,Ae),Lt},x=function(A,L){var _=L[0],C=L[1],M=L[2];return A[0]=_<0?-_:_,A[1]=C<0?-C:C,A[2]=M<0?-M:M,A},b=function(A){var L=1/0;A.sort(function(g,P){return g-P});for(var _=A.length,C=1;C<_;C++){var M=Math.abs(A[C]-A[C-1]);M<L&&(L=M)}return L},p=function(A){for(var L=[],_=[],C=[],M={},g={},P={},T=A.length,F=0;F<T;F++){var q=A[F],V=q[0],H=q[1],X=q[2];M[V]||(L.push(V),M[V]=!0),g[H]||(_.push(H),g[H]=!0),P[X]||(C.push(X),P[X]=!0)}var G=b(L),N=b(_),W=b(C),re=Math.min(G,N,W);return isFinite(re)?re:1};i.exports=function(A,L){var _=A.startingPositions,C=A.maxLength||1e3,M=A.tubeSize||1,g=A.absoluteTubeSize,P=A.gridFill||"+x+y+z",T={};P.indexOf("-x")!==-1&&(T.reversedX=!0),P.indexOf("-y")!==-1&&(T.reversedY=!0),P.indexOf("-z")!==-1&&(T.reversedZ=!0),T.filled=u.indexOf(P.replace(/-/g,"").replace(/\+/g,""));var F=A.getVelocity||function(Rt){return v(Rt,A,T)},q=A.getDivergence||function(Rt,kt){var Ct=s.create(),Yt=1e-4;s.add(Ct,Rt,[Yt,0,0]);var xr=F(Ct);s.subtract(xr,xr,kt),s.scale(xr,xr,1/Yt),s.add(Ct,Rt,[0,Yt,0]);var er=F(Ct);s.subtract(er,er,kt),s.scale(er,er,1/Yt),s.add(Ct,Rt,[0,0,Yt]);va
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
attribute vec4 uv;
|
|||
|
attribute vec3 f;
|
|||
|
attribute vec3 normal;
|
|||
|
|
|||
|
uniform vec3 objectOffset;
|
|||
|
uniform mat4 model, view, projection, inverseModel;
|
|||
|
uniform vec3 lightPosition, eyePosition;
|
|||
|
uniform sampler2D colormap;
|
|||
|
|
|||
|
varying float value, kill;
|
|||
|
varying vec3 worldCoordinate;
|
|||
|
varying vec2 planeCoordinate;
|
|||
|
varying vec3 lightDirection, eyeDirection, surfaceNormal;
|
|||
|
varying vec4 vColor;
|
|||
|
|
|||
|
void main() {
|
|||
|
vec3 localCoordinate = vec3(uv.zw, f.x);
|
|||
|
worldCoordinate = objectOffset + localCoordinate;
|
|||
|
mat4 objectOffsetTranslation = mat4(1.0) + mat4(vec4(0), vec4(0), vec4(0), vec4(objectOffset, 0));
|
|||
|
vec4 worldPosition = (model * objectOffsetTranslation) * vec4(localCoordinate, 1.0);
|
|||
|
vec4 clipPosition = projection * (view * worldPosition);
|
|||
|
gl_Position = clipPosition;
|
|||
|
kill = f.y;
|
|||
|
value = f.z;
|
|||
|
planeCoordinate = uv.xy;
|
|||
|
|
|||
|
vColor = texture2D(colormap, vec2(value, value));
|
|||
|
|
|||
|
//Lighting geometry parameters
|
|||
|
vec4 cameraCoordinate = view * worldPosition;
|
|||
|
cameraCoordinate.xyz /= cameraCoordinate.w;
|
|||
|
lightDirection = lightPosition - cameraCoordinate.xyz;
|
|||
|
eyeDirection = eyePosition - cameraCoordinate.xyz;
|
|||
|
surfaceNormal = normalize((vec4(normal,0) * inverseModel).xyz);
|
|||
|
}
|
|||
|
`]),c=l([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
float beckmannDistribution(float x, float roughness) {
|
|||
|
float NdotH = max(x, 0.0001);
|
|||
|
float cos2Alpha = NdotH * NdotH;
|
|||
|
float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;
|
|||
|
float roughness2 = roughness * roughness;
|
|||
|
float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;
|
|||
|
return exp(tan2Alpha / roughness2) / denom;
|
|||
|
}
|
|||
|
|
|||
|
float beckmannSpecular(
|
|||
|
vec3 lightDirection,
|
|||
|
vec3 viewDirection,
|
|||
|
vec3 surfaceNormal,
|
|||
|
float roughness) {
|
|||
|
return beckmannDistribution(dot(surfaceNormal, normalize(lightDirection + viewDirection)), roughness);
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
uniform vec3 lowerBound, upperBound;
|
|||
|
uniform float contourTint;
|
|||
|
uniform vec4 contourColor;
|
|||
|
uniform sampler2D colormap;
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
uniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;
|
|||
|
uniform float vertexColor;
|
|||
|
|
|||
|
varying float value, kill;
|
|||
|
varying vec3 worldCoordinate;
|
|||
|
varying vec3 lightDirection, eyeDirection, surfaceNormal;
|
|||
|
varying vec4 vColor;
|
|||
|
|
|||
|
void main() {
|
|||
|
if (
|
|||
|
kill > 0.0 ||
|
|||
|
vColor.a == 0.0 ||
|
|||
|
outOfRange(clipBounds[0], clipBounds[1], worldCoordinate)
|
|||
|
) discard;
|
|||
|
|
|||
|
vec3 N = normalize(surfaceNormal);
|
|||
|
vec3 V = normalize(eyeDirection);
|
|||
|
vec3 L = normalize(lightDirection);
|
|||
|
|
|||
|
if(gl_FrontFacing) {
|
|||
|
N = -N;
|
|||
|
}
|
|||
|
|
|||
|
float specular = max(beckmannSpecular(L, V, N, roughness), 0.);
|
|||
|
float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);
|
|||
|
|
|||
|
//decide how to interpolate color \u2014 in vertex or in fragment
|
|||
|
vec4 surfaceColor =
|
|||
|
step(vertexColor, .5) * texture2D(colormap, vec2(value, value)) +
|
|||
|
step(.5, vertexColor) * vColor;
|
|||
|
|
|||
|
vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);
|
|||
|
|
|||
|
gl_FragColor = mix(litColor, contourColor, contourTint) * opacity;
|
|||
|
}
|
|||
|
`]),f=l([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
attribute vec4 uv;
|
|||
|
attribute float f;
|
|||
|
|
|||
|
uniform vec3 objectOffset;
|
|||
|
uniform mat3 permutation;
|
|||
|
uniform mat4 model, view, projection;
|
|||
|
uniform float height, zOffset;
|
|||
|
uniform sampler2D colormap;
|
|||
|
|
|||
|
varying float value, kill;
|
|||
|
varying vec3 worldCoordinate;
|
|||
|
varying vec2 planeCoordinate;
|
|||
|
varying vec3 lightDirection, eyeDirection, surfaceNormal;
|
|||
|
varying vec4 vColor;
|
|||
|
|
|||
|
void main() {
|
|||
|
vec3 dataCoordinate = permutation * vec3(uv.xy, height);
|
|||
|
worldCoordinate = objectOffset + dataCoordinate;
|
|||
|
mat4 objectOffsetTranslation = mat4(1.0) + mat4(vec4(0), vec4(0), vec4(0), vec4(objectOffset, 0));
|
|||
|
vec4 worldPosition = (model * objectOffsetTranslation) * vec4(dataCoordinate, 1.0);
|
|||
|
|
|||
|
vec4 clipPosition = projection * (view * worldPosition);
|
|||
|
clipPosition.z += zOffset;
|
|||
|
|
|||
|
gl_Position = clipPosition;
|
|||
|
value = f + objectOffset.z;
|
|||
|
kill = -1.0;
|
|||
|
planeCoordinate = uv.zw;
|
|||
|
|
|||
|
vColor = texture2D(colormap, vec2(value, value));
|
|||
|
|
|||
|
//Don't do lighting for contours
|
|||
|
surfaceNormal = vec3(1,0,0);
|
|||
|
eyeDirection = vec3(0,1,0);
|
|||
|
lightDirection = vec3(0,0,1);
|
|||
|
}
|
|||
|
`]),h=l([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
bool outOfRange(float a, float b, float p) {
|
|||
|
return ((p > max(a, b)) ||
|
|||
|
(p < min(a, b)));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec2 a, vec2 b, vec2 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec3 a, vec3 b, vec3 p) {
|
|||
|
return (outOfRange(a.x, b.x, p.x) ||
|
|||
|
outOfRange(a.y, b.y, p.y) ||
|
|||
|
outOfRange(a.z, b.z, p.z));
|
|||
|
}
|
|||
|
|
|||
|
bool outOfRange(vec4 a, vec4 b, vec4 p) {
|
|||
|
return outOfRange(a.xyz, b.xyz, p.xyz);
|
|||
|
}
|
|||
|
|
|||
|
uniform vec2 shape;
|
|||
|
uniform vec3 clipBounds[2];
|
|||
|
uniform float pickId;
|
|||
|
|
|||
|
varying float value, kill;
|
|||
|
varying vec3 worldCoordinate;
|
|||
|
varying vec2 planeCoordinate;
|
|||
|
varying vec3 surfaceNormal;
|
|||
|
|
|||
|
vec2 splitFloat(float v) {
|
|||
|
float vh = 255.0 * v;
|
|||
|
float upper = floor(vh);
|
|||
|
float lower = fract(vh);
|
|||
|
return vec2(upper / 255.0, floor(lower * 16.0) / 16.0);
|
|||
|
}
|
|||
|
|
|||
|
void main() {
|
|||
|
if ((kill > 0.0) ||
|
|||
|
(outOfRange(clipBounds[0], clipBounds[1], worldCoordinate))) discard;
|
|||
|
|
|||
|
vec2 ux = splitFloat(planeCoordinate.x / shape.x);
|
|||
|
vec2 uy = splitFloat(planeCoordinate.y / shape.y);
|
|||
|
gl_FragColor = vec4(pickId, ux.x, uy.x, ux.y + (uy.y/16.0));
|
|||
|
}
|
|||
|
`]);a.createShader=function(d){var v=s(d,u,c,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return v.attributes.uv.location=0,v.attributes.f.location=1,v.attributes.normal.location=2,v},a.createPickShader=function(d){var v=s(d,u,h,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return v.attributes.uv.location=0,v.attributes.f.location=1,v.attributes.normal.location=2,v},a.createContourShader=function(d){var v=s(d,f,c,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return v.attributes.uv.location=0,v.attributes.f.location=1,v},a.createPickContourShader=function(d){var v=s(d,f,h,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return v.attributes.uv.location=0,v.attributes.f.location=1,v}},9499:function(i,a,o){"use strict";i.exports=ze;var s=o(8828),l=o(2762),u=o(8116),c=o(7766),f=o(1888),h=o(6729),d=o(5298),v=o(9994),x=o(9618),b=o(3711),p=o(6760),E=o(7608),k=o(2478),A=o(6199),L=o(990),_=L.createShader,C=L.createContourShader,M=L.createPickShader,g=L.createPickContourShader,P=4*10,T=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],F=[[0,0],[0,1],[1,0],[1,1],[1,0],[0,1]],q=[[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0]];(function(){for(var Ce=0;Ce<3;++Ce){var me=q[Ce],Re=(Ce+1)%3,ce=(Ce+2)%3;me[Re+0]=1,me[ce+3]=1,me[Ce+6]=1}})();function V(Ce,me,Re,ce,Ge){this.position=Ce,this.index=me,this.uv=Re,this.level=ce,this.dataCoordinate=Ge}var H=256;function X(Ce,me,Re,ce,Ge,nt,ct,qt,rt,ot,Rt,kt,Ct,Yt,xr){this.gl=Ce,this.shape=me,this.bounds=Re,this.objectOffset=xr,this.intensityBounds=[],this._shader=ce,this._pickShader=Ge,this._coordinateBuffer=nt,this._vao=ct,this._colorMap=qt,this._contourShader=rt,this._contourPickShader=ot,this._contourBuffer=Rt,this._contourVAO=kt,this._contourOffsets=[[],[],[]],this._contourCounts=[[],[],[]],this._vertexCount=0,this._pickResult=new V([0,0,0],[0,0],[0,0],[0,0,0],[0,0,0]),this._dynamicBuffer=Ct,this._dynamicVAO=Yt,this._dynamicOffsets=[0,0,0],this._dynamicCounts=[0,0,0],this.contourWidth=[1,1,1],this.contourLevels=[[1],[1],[1]],this.contourTint=[0,0,0],this.contourColor=[[.5,.5,.5,1],[.5,.5,.5,1],[.5,.5,.5,1]],this.showContour=!0,this.showSurface=!0,this.enableHighlight=[!0,!0,!0],this.highlightColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.highlightTint=[1,1,1],this.highlightLevel=[-1,-1,-1],this.enableDynamic=[!0,!0,!0],this.dynamicLevel=[NaN,NaN,NaN],this.dynamicColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.dynamicTint=[1,1,1],this.dynamicWidth=[1,1,1],this.axesBounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.surfaceProject=[!1,!1,!1],this.contourProject=[[!1,!1,!1],[!1,!1,!1],[!1,!1,!1]],this.colorBounds=[!1,!1],this._field=[x(f.mallocFloat(1024),[0,0]),x(f.mallocFloat(1024),[0,0]),x(f.mallocFloat(1024),[0,0])],this.pickId=1,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.snapToData=!1,this.pixelRatio=1,this.opacity=1,this.lightPosition=[10,1e4,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.vertexColor=0,this.dirty=!0}var G=X.prototype;G.genColormap=function(Ce,me){var Re=!1,ce=v([h({colormap:Ce,nshades:H,format:"rgba"}).map(function(Ge,nt){var ct=me?N(nt/255,me):Ge[3];return ct<1&&(Re=!0),[Ge[0],Ge[1],Ge[2],255*ct]})]);return d.divseq(ce,255),this.hasAlphaScale=Re,ce},G.isTransparent=function(){return this.opacity<1||this.hasAlphaScale},G.isOpaque=function(){return!this.isTransparent()},G.pickSlots=1,G.setPickBase=function(Ce){this.pickId=Ce};function N(Ce,me){if(!me||!me.length)return 1;for(var Re=0;Re<me.length;++Re){if(me.length<2)return 1;if(me[Re][0]===Ce)return me[Re][1];if(me[Re][0]>Ce&&Re>0){var ce=(me[Re][0]-Ce)/(me[Re][0]-me[Re-1][0]);return me[Re][1]*(1-ce)+ce*me[Re-1][1]}}return 1}var W=[0,0,0],re={showSurface:!1,showContour:!1,projections:[T.slice(),T.slice(),T.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]};function ae(Ce,me){var Re,ce,Ge,nt=me.axes&&me.axes.lastCubeProps.axis||W,ct=me.showSurface,qt=me.showContour;for(Re=0;Re<3;++Re)for(ct=ct||me.surfaceProject[Re],ce=0;ce<3;++ce)qt=qt||me.contourProject[R
|
|||
|
`),Ee=Te.length;for(var xt;X=Te[q],q<Ee;){switch(xt=q,H){case v:q=ot();break;case x:q=rt();break;case b:q=qt();break;case p:q=Rt();break;case E:q=Yt();break;case g:q=Ct();break;case k:q=xr();break;case d:q=er();break;case C:q=ct();break;case h:q=nt();break}if(xt!==q)switch(Te[xt]){case`
|
|||
|
`:Me=0,++_e;break;default:++Me;break}}return V+=q,Te=Te.slice(q),W}function Ge(Ke){return N.length&&Re(N.join("")),H=M,Re("(eof)"),W}function nt(){return N=N.length?[]:N,G==="/"&&X==="*"?(ke=V+q-1,H=v,G=X,q+1):G==="/"&&X==="/"?(ke=V+q-1,H=x,G=X,q+1):X==="#"?(H=b,ke=V+q,q):/\s/.test(X)?(H=C,ke=V+q,q):(ge=/\d/.test(X),ie=/[^\w_]/.test(X),ke=V+q,H=ge?E:ie?p:d,q)}function ct(){return/[^\s]/g.test(X)?(Re(N.join("")),H=h,q):(N.push(X),G=X,q+1)}function qt(){return(X==="\r"||X===`
|
|||
|
`)&&G!=="\\"?(Re(N.join("")),H=h,q):(N.push(X),G=X,q+1)}function rt(){return qt()}function ot(){return X==="/"&&G==="*"?(N.push(X),Re(N.join("")),H=h,q+1):(N.push(X),G=X,q+1)}function Rt(){if(G==="."&&/\d/.test(X))return H=k,q;if(G==="/"&&X==="*")return H=v,q;if(G==="/"&&X==="/")return H=x,q;if(X==="."&&N.length){for(;kt(N););return H=k,q}if(X===";"||X===")"||X==="("){if(N.length)for(;kt(N););return Re(X),H=h,q+1}var Ke=N.length===2&&X!=="=";if(/[\w_\d\s]/.test(X)||Ke){for(;kt(N););return H=h,q}return N.push(X),G=X,q+1}function kt(Ke){var xt=0,bt,Lt;do{if(bt=l.indexOf(Ke.slice(0,Ke.length+xt).join("")),Lt=l[bt],bt===-1){if(xt--+Ke.length>0)continue;Lt=Ke.slice(0,1).join("")}return Re(Lt),ke+=Lt.length,N=N.slice(Lt.length),N.length}while(!0)}function Ct(){return/[^a-fA-F0-9]/.test(X)?(Re(N.join("")),H=h,q):(N.push(X),G=X,q+1)}function Yt(){return X==="."||/[eE]/.test(X)?(N.push(X),H=k,G=X,q+1):X==="x"&&N.length===1&&N[0]==="0"?(H=g,N.push(X),G=X,q+1):/[^\d]/.test(X)?(Re(N.join("")),H=h,q):(N.push(X),G=X,q+1)}function xr(){return X==="f"&&(N.push(X),G=X,q+=1),/[eE]/.test(X)||(X==="-"||X==="+")&&/[eE]/.test(G)?(N.push(X),G=X,q+1):/[^\d]/.test(X)?(Re(N.join("")),H=h,q):(N.push(X),G=X,q+1)}function er(){if(/[^\d\w_]/.test(X)){var Ke=N.join("");return me[Ke]?H=_:Ce[Ke]?H=L:H=A,Re(N.join("")),H=h,q}return N.push(X),G=X,q+1}}},3508:function(i,a,o){var s=o(6852);s=s.slice().filter(function(l){return!/^(gl\_|texture)/.test(l)}),i.exports=s.concat(["gl_VertexID","gl_InstanceID","gl_Position","gl_PointSize","gl_FragCoord","gl_FrontFacing","gl_FragDepth","gl_PointCoord","gl_MaxVertexAttribs","gl_MaxVertexUniformVectors","gl_MaxVertexOutputVectors","gl_MaxFragmentInputVectors","gl_MaxVertexTextureImageUnits","gl_MaxCombinedTextureImageUnits","gl_MaxTextureImageUnits","gl_MaxFragmentUniformVectors","gl_MaxDrawBuffers","gl_MinProgramTexelOffset","gl_MaxProgramTexelOffset","gl_DepthRangeParameters","gl_DepthRange","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"])},6852:function(i){i.exports=["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_Obje
|
|||
|
`):X=X.replace(/\<br\>/g," ");var re="",ae=[];for(me=0;me<X.length;++me)ae[me]=re;W.bolds===!0&&(ae=C(d,v,X,ae)),W.italics===!0&&(ae=C(x,b,X,ae)),W.superscripts===!0&&(ae=C(p,k,X,ae)),W.subscripts===!0&&(ae=C(A,_,X,ae));var _e=[],Me="";for(me=0;me<X.length;++me)ae[me]!==null&&(Me+=X[me],_e.push(ae[me]));var ke=Me.split(`
|
|||
|
`),ge=ke.length,ie=Math.round(N*G),Te=G,Ee=G*2,Ae=0,ze=ge*ie+Ee;V.height<ze&&(V.height=ze),H.fillStyle="#000",H.fillRect(0,0,V.width,V.height),H.fillStyle="#fff";var Ce,me,Re,ce,Ge,nt=0,ct="";function qt(){if(ct!==""){var Ke=H.measureText(ct).width;H.fillText(ct,Te+Re,Ee+ce),Re+=Ke}}function rt(){return""+Math.round(Ge)+"px "}function ot(Ke,xt){var bt=""+H.font;if(W.subscripts===!0){var Lt=Ke.indexOf(L),St=xt.indexOf(L),Et=Lt>-1?parseInt(Ke[1+Lt]):0,dt=St>-1?parseInt(xt[1+St]):0;Et!==dt&&(bt=bt.replace(rt(),"?px "),Ge*=Math.pow(.75,dt-Et),bt=bt.replace("?px ",rt())),ce+=.25*ie*(dt-Et)}if(W.superscripts===!0){var Ht=Ke.indexOf(E),$t=xt.indexOf(E),fr=Ht>-1?parseInt(Ke[1+Ht]):0,_r=$t>-1?parseInt(xt[1+$t]):0;fr!==_r&&(bt=bt.replace(rt(),"?px "),Ge*=Math.pow(.75,_r-fr),bt=bt.replace("?px ",rt())),ce-=.25*ie*(_r-fr)}if(W.bolds===!0){var Br=Ke.indexOf(v)>-1,Or=xt.indexOf(v)>-1;!Br&&Or&&(Nr?bt=bt.replace("italic ","italic bold "):bt="bold "+bt),Br&&!Or&&(bt=bt.replace("bold ",""))}if(W.italics===!0){var Nr=Ke.indexOf(b)>-1,ut=xt.indexOf(b)>-1;!Nr&&ut&&(bt="italic "+bt),Nr&&!ut&&(bt=bt.replace("italic ",""))}H.font=bt}for(Ce=0;Ce<ge;++Ce){var Rt=ke[Ce]+`
|
|||
|
`;for(Re=0,ce=Ce*ie,Ge=G,ct="",me=0;me<Rt.length;++me){var kt=me+nt<_e.length?_e[me+nt]:_e[_e.length-1];re===kt?ct+=Rt[me]:(qt(),ct=Rt[me],kt!==void 0&&(ot(re,kt),re=kt))}qt(),nt+=Rt.length;var Ct=Math.round(Re+2*Te)|0;Ae<Ct&&(Ae=Ct)}var Yt=Ae,xr=Ee+ie*ge,er=l(H.getImageData(0,0,Yt,xr).data,[xr,Yt,4]);return er.pick(-1,-1,0).transpose(1,0)}function P(V,H){var X=s(V,128);return H?u(X.cells,X.positions,.25):{edges:X.cells,positions:X.positions}}function T(V,H,X,G){var N=P(V,G),W=M(N.positions,H,X),re=N.edges,ae=H.orientation==="ccw";if(c(W,re),H.polygons||H.polygon||H.polyline){for(var _e=h(re,W),Me=new Array(_e.length),ke=0;ke<_e.length;++ke){for(var ge=_e[ke],ie=new Array(ge.length),Te=0;Te<ge.length;++Te){for(var Ee=ge[Te],Ae=new Array(Ee.length),ze=0;ze<Ee.length;++ze)Ae[ze]=W[Ee[ze]].slice();ae&&Ae.reverse(),ie[Te]=Ae}Me[ke]=ie}return Me}else return H.triangles||H.triangulate||H.triangle?{cells:f(W,re,{delaunay:!1,exterior:!1,interior:!0}),positions:W}:{edges:re,positions:W}}function F(V,H,X){try{return T(V,H,X,!0)}catch(G){}try{return T(V,H,X,!1)}catch(G){}return H.polygons||H.polyline||H.polygon?[]:H.triangles||H.triangulate||H.triangle?{cells:[],positions:[]}:{edges:[],positions:[]}}function q(V,H,X,G){var N=64,W=1.25,re={breaklines:!1,bolds:!1,italics:!1,subscripts:!1,superscripts:!1};G&&(G.size&&G.size>0&&(N=G.size),G.lineSpacing&&G.lineSpacing>0&&(W=G.lineSpacing),G.styletags&&G.styletags.breaklines&&(re.breaklines=!!G.styletags.breaklines),G.styletags&&G.styletags.bolds&&(re.bolds=!!G.styletags.bolds),G.styletags&&G.styletags.italics&&(re.italics=!!G.styletags.italics),G.styletags&&G.styletags.subscripts&&(re.subscripts=!!G.styletags.subscripts),G.styletags&&G.styletags.superscripts&&(re.superscripts=!!G.styletags.superscripts)),X.font=[G.fontStyle,G.fontVariant,G.fontWeight,N+"px",G.font].filter(function(_e){return _e}).join(" "),X.textAlign="start",X.textBaseline="alphabetic",X.direction="ltr";var ae=g(H,X,V,N,W,re);return F(ae,G,N)}},1538:function(i){(function(){"use strict";if(typeof ses!="undefined"&&ses.ok&&!ses.ok())return;function o(T){T.permitHostObjects___&&T.permitHostObjects___(o)}typeof ses!="undefined"&&(ses.weakMapPermitHostObjects=o);var s=!1;if(typeof WeakMap=="function"){var l=WeakMap;if(!(typeof navigator!="undefined"&&/Firefox/.test(navigator.userAgent))){var u=new l,c=Object.freeze({});if(u.set(c,1),u.get(c)!==1)s=!0;else{i.exports=WeakMap;return}}}var f=Object.prototype.hasOwnProperty,h=Object.getOwnPropertyNames,d=Object.defineProperty,v=Object.isExtensible,x="weakmap:",b=x+"ident:"+Math.random()+"___";if(typeof crypto!="undefined"&&typeof crypto.getRandomValues=="function"&&typeof ArrayBuffer=="function"&&typeof Uint8Array=="function"){var p=new ArrayBuffer(25),E=new Uint8Array(p);crypto.getRandomValues(E),b=x+"rand:"+Array.prototype.map.call(E,function(T){return(T%36).toString(36)}).join("")+"___"}function k(T){return!(T.substr(0,x.length)==x&&T.substr(T.length-3)==="___")}if(d(Object,"getOwnPropertyNames",{value:function(F){return h(F).filter(k)}}),"getPropertyNames"in Object){var A=Object.getPropertyNames;d(Object,"getPropertyNames",{value:function(F){return A(F).filter(k)}})}function L(T){if(T!==Object(T))throw new TypeError("Not an object: "+T);var F=T[b];if(F&&F.key===T)return F;if(v(T)){F={key:T};try{return d(T,b,{value:F,writable:!1,enumerable:!1,configurable:!1}),F}catch(q){return}}}(function(){var T=Object.freeze;d(Object,"freeze",{value:function(H){return L(H),T(H)}});var F=Object.seal;d(Object,"seal",{value:function(H){return L(H),F(H)}});var q=Object.preventExtensions;d(Object,"preventExtensions",{value:function(H){return L(H),q(H)}})})();function _(T){return T.prototype=null,Object.freeze(T)}var C=!1;function M(){!C&&typeof console!="undefined"&&(C=!0,console.warn("WeakMap should be invoked as new WeakMap(), not WeakMap(). This will be an error in the future."))}var g=0,P=function(){this instanceof P||M();var T=[],F=[],q=g++;function V(N,W){var re,ae=L(N);return ae?q in ae?ae[q]:W:(re=T.indexOf(N),re>=0?F[re]:W)}function H(N){var W=L(N);return W?q in W:T.indexOf(N)>=0}func
|
|||
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function C7t(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|||
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var L7t=$_(),P7t=j2(),I7t=jze(),R7t=Oz(),K2=bh(),Yz=Yze(),D7t=Zm(),z7t=JX(),F7t=W2(),eFe=$ze(),Kz=Xz(),q7t=Q5(),O7t=rv;function rv(e,t){var r=this;if(!(this instanceof rv))return new rv(e,t);typeof e=="function"?(t||(t={}),t.regl=e):(t=e,e=null),t&&t.length&&(t.positions=t),e=t.regl;var n=e._gl,i,a=[],o={},s=[],l=[null],u=[null],c=255,f=100;this.tooManyColors=eFe,i=e.texture({data:new Uint8Array(c*4),width:c,height:1,type:"uint8",format:"rgba",wrapS:"clamp",wrapT:"clamp",mag:"nearest",min:"nearest"}),K2(this,{regl:e,gl:n,groups:s,markerCache:u,markerTextures:l,palette:a,paletteIds:o,paletteTexture:i,maxColors:c,maxSize:f,canvas:n.canvas}),this.update(t);var h={uniforms:{constPointSize:!!t.constPointSize,opacity:e.prop("opacity"),paletteSize:function(b,p){return[r.tooManyColors?0:c,i.height]},pixelRatio:e.context("pixelRatio"),scale:e.prop("scale"),scaleFract:e.prop("scaleFract"),translate:e.prop("translate"),translateFract:e.prop("translateFract"),markerTexture:e.prop("markerTexture"),paletteTexture:i},attributes:{x:function(b,p){return p.xAttr||{buffer:p.positionBuffer,stride:8,offset:0}},y:function(b,p){return p.yAttr||{buffer:p.positionBuffer,stride:8,offset:4}},xFract:function(b,p){return p.xAttr?{constant:[0,0]}:{buffer:p.positionFractBuffer,stride:8,offset:0}},yFract:function(b,p){return p.yAttr?{constant:[0,0]}:{buffer:p.positionFractBuffer,stride:8,offset:4}},size:function(b,p){return p.size.length?{buffer:p.sizeBuffer,stride:2,offset:0}:{constant:[Math.round(p.size*255/r.maxSize)]}},borderSize:function(b,p){return p.borderSize.length?{buffer:p.sizeBuffer,stride:2,offset:1}:{constant:[Math.round(p.borderSize*255/r.maxSize)]}},colorId:function(b,p){return p.color.length?{buffer:p.colorBuffer,stride:r.tooManyColors?8:4,offset:0}:{constant:r.tooManyColors?a.slice(p.color*4,p.color*4+4):[p.color]}},borderColorId:function(b,p){return p.borderColor.length?{buffer:p.colorBuffer,stride:r.tooManyColors?8:4,offset:r.tooManyColors?4:2}:{constant:r.tooManyColors?a.slice(p.borderColor*4,p.borderColor*4+4):[p.borderColor]}},isActive:function(b,p){return p.activation===!0?{constant:[1]}:p.activation?p.activation:{constant:[0]}}},blend:{enable:!0,color:[0,0,0,1],func:{srcRGB:"src alpha",dstRGB:"one minus src alpha",srcAlpha:"one minus dst alpha",dstAlpha:"one"}},scissor:{enable:!0,box:e.prop("viewport")},viewport:e.prop("viewport"),stencil:{enable:!1},depth:{enable:!1},elements:e.prop("elements"),count:e.prop("count"),offset:e.prop("offset"),primitive:"points"},d=K2({},h);d.frag=Yz([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
uniform float opacity;
|
|||
|
uniform sampler2D markerTexture;
|
|||
|
|
|||
|
varying vec4 fragColor, fragBorderColor;
|
|||
|
varying float fragWidth, fragBorderColorLevel, fragColorLevel;
|
|||
|
|
|||
|
float smoothStep(float x, float y) {
|
|||
|
return 1.0 / (1.0 + exp(50.0*(x - y)));
|
|||
|
}
|
|||
|
|
|||
|
void main() {
|
|||
|
float dist = texture2D(markerTexture, gl_PointCoord).r, delta = fragWidth;
|
|||
|
|
|||
|
// max-distance alpha
|
|||
|
if (dist < 0.003) discard;
|
|||
|
|
|||
|
// null-border case
|
|||
|
if (fragBorderColorLevel == fragColorLevel || fragBorderColor.a == 0.) {
|
|||
|
float colorAmt = smoothstep(.5 - delta, .5 + delta, dist);
|
|||
|
gl_FragColor = vec4(fragColor.rgb, colorAmt * fragColor.a * opacity);
|
|||
|
}
|
|||
|
else {
|
|||
|
float borderColorAmt = smoothstep(fragBorderColorLevel - delta, fragBorderColorLevel + delta, dist);
|
|||
|
float colorAmt = smoothstep(fragColorLevel - delta, fragColorLevel + delta, dist);
|
|||
|
|
|||
|
vec4 color = fragBorderColor;
|
|||
|
color.a *= borderColorAmt;
|
|||
|
color = mix(color, fragColor, colorAmt);
|
|||
|
color.a *= opacity;
|
|||
|
|
|||
|
gl_FragColor = color;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
`]),d.vert=Yz([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
attribute float x, y, xFract, yFract;
|
|||
|
attribute float size, borderSize;
|
|||
|
attribute vec4 colorId, borderColorId;
|
|||
|
attribute float isActive;
|
|||
|
|
|||
|
// \`invariant\` effectively turns off optimizations for the position.
|
|||
|
// We need this because -fast-math on M1 Macs is re-ordering
|
|||
|
// floating point operations in a way that causes floating point
|
|||
|
// precision limits to put points in the wrong locations.
|
|||
|
invariant gl_Position;
|
|||
|
|
|||
|
uniform bool constPointSize;
|
|||
|
uniform float pixelRatio;
|
|||
|
uniform vec2 scale, scaleFract, translate, translateFract, paletteSize;
|
|||
|
uniform sampler2D paletteTexture;
|
|||
|
|
|||
|
const float maxSize = 100.;
|
|||
|
const float borderLevel = .5;
|
|||
|
|
|||
|
varying vec4 fragColor, fragBorderColor;
|
|||
|
varying float fragPointSize, fragBorderRadius, fragWidth, fragBorderColorLevel, fragColorLevel;
|
|||
|
|
|||
|
float pointSizeScale = (constPointSize) ? 2. : pixelRatio;
|
|||
|
|
|||
|
bool isDirect = (paletteSize.x < 1.);
|
|||
|
|
|||
|
vec4 getColor(vec4 id) {
|
|||
|
return isDirect ? id / 255. : texture2D(paletteTexture,
|
|||
|
vec2(
|
|||
|
(id.x + .5) / paletteSize.x,
|
|||
|
(id.y + .5) / paletteSize.y
|
|||
|
)
|
|||
|
);
|
|||
|
}
|
|||
|
|
|||
|
void main() {
|
|||
|
// ignore inactive points
|
|||
|
if (isActive == 0.) return;
|
|||
|
|
|||
|
vec2 position = vec2(x, y);
|
|||
|
vec2 positionFract = vec2(xFract, yFract);
|
|||
|
|
|||
|
vec4 color = getColor(colorId);
|
|||
|
vec4 borderColor = getColor(borderColorId);
|
|||
|
|
|||
|
float size = size * maxSize / 255.;
|
|||
|
float borderSize = borderSize * maxSize / 255.;
|
|||
|
|
|||
|
gl_PointSize = 2. * size * pointSizeScale;
|
|||
|
fragPointSize = size * pixelRatio;
|
|||
|
|
|||
|
vec2 pos = (position + translate) * scale
|
|||
|
+ (positionFract + translateFract) * scale
|
|||
|
+ (position + translate) * scaleFract
|
|||
|
+ (positionFract + translateFract) * scaleFract;
|
|||
|
|
|||
|
gl_Position = vec4(pos * 2. - 1., 0., 1.);
|
|||
|
|
|||
|
fragColor = color;
|
|||
|
fragBorderColor = borderColor;
|
|||
|
fragWidth = 1. / gl_PointSize;
|
|||
|
|
|||
|
fragBorderColorLevel = clamp(borderLevel - borderLevel * borderSize / size, 0., 1.);
|
|||
|
fragColorLevel = clamp(borderLevel + (1. - borderLevel) * borderSize / size, 0., 1.);
|
|||
|
}
|
|||
|
`]),this.drawMarker=e(d);var v=K2({},h);v.frag=Yz([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
varying vec4 fragColor, fragBorderColor;
|
|||
|
varying float fragBorderRadius, fragWidth;
|
|||
|
|
|||
|
uniform float opacity;
|
|||
|
|
|||
|
float smoothStep(float edge0, float edge1, float x) {
|
|||
|
float t;
|
|||
|
t = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
|
|||
|
return t * t * (3.0 - 2.0 * t);
|
|||
|
}
|
|||
|
|
|||
|
void main() {
|
|||
|
float radius, alpha = 1.0, delta = fragWidth;
|
|||
|
|
|||
|
radius = length(2.0 * gl_PointCoord.xy - 1.0);
|
|||
|
|
|||
|
if (radius > 1.0 + delta) {
|
|||
|
discard;
|
|||
|
}
|
|||
|
|
|||
|
alpha -= smoothstep(1.0 - delta, 1.0 + delta, radius);
|
|||
|
|
|||
|
float borderRadius = fragBorderRadius;
|
|||
|
float ratio = smoothstep(borderRadius - delta, borderRadius + delta, radius);
|
|||
|
vec4 color = mix(fragColor, fragBorderColor, ratio);
|
|||
|
color.a *= alpha * opacity;
|
|||
|
gl_FragColor = color;
|
|||
|
}
|
|||
|
`]),v.vert=Yz([`precision highp float;
|
|||
|
#define GLSLIFY 1
|
|||
|
|
|||
|
attribute float x, y, xFract, yFract;
|
|||
|
attribute float size, borderSize;
|
|||
|
attribute vec4 colorId, borderColorId;
|
|||
|
attribute float isActive;
|
|||
|
|
|||
|
// \`invariant\` effectively turns off optimizations for the position.
|
|||
|
// We need this because -fast-math on M1 Macs is re-ordering
|
|||
|
// floating point operations in a way that causes floating point
|
|||
|
// precision limits to put points in the wrong locations.
|
|||
|
invariant gl_Position;
|
|||
|
|
|||
|
uniform bool constPointSize;
|
|||
|
uniform float pixelRatio;
|
|||
|
uniform vec2 paletteSize, scale, scaleFract, translate, translateFract;
|
|||
|
uniform sampler2D paletteTexture;
|
|||
|
|
|||
|
const float maxSize = 100.;
|
|||
|
|
|||
|
varying vec4 fragColor, fragBorderColor;
|
|||
|
varying float fragBorderRadius, fragWidth;
|
|||
|
|
|||
|
float pointSizeScale = (constPointSize) ? 2. : pixelRatio;
|
|||
|
|
|||
|
bool isDirect = (paletteSize.x < 1.);
|
|||
|
|
|||
|
vec4 getColor(vec4 id) {
|
|||
|
return isDirect ? id / 255. : texture2D(paletteTexture,
|
|||
|
vec2(
|
|||
|
(id.x + .5) / paletteSize.x,
|
|||
|
(id.y + .5) / paletteSize.y
|
|||
|
)
|
|||
|
);
|
|||
|
}
|
|||
|
|
|||
|
void main() {
|
|||
|
// ignore inactive points
|
|||
|
if (isActive == 0.) return;
|
|||
|
|
|||
|
vec2 position = vec2(x, y);
|
|||
|
vec2 positionFract = vec2(xFract, yFract);
|
|||
|
|
|||
|
vec4 color = getColor(colorId);
|
|||
|
vec4 borderColor = getColor(borderColorId);
|
|||
|
|
|||
|
float size = size * maxSize / 255.;
|
|||
|
float borderSize = borderSize * maxSize / 255.;
|
|||
|
|
|||
|
gl_PointSize = (size + borderSize) * pointSizeScale;
|
|||
|
|
|||
|
vec2 pos = (position + translate) * scale
|
|||
|
+ (positionFract + translateFract) * scale
|
|||
|
+ (position + translate) * scaleFract
|
|||
|
+ (positionFract + translateFract) * scaleFract;
|
|||
|
|
|||
|
gl_Position = vec4(pos * 2. - 1., 0., 1.);
|
|||
|
|
|||
|
fragBorderRadius = 1. - 2. * borderSize / (size + borderSize);
|
|||
|
fragColor = color;
|
|||
|
fragBorderColor = borderColor.a == 0. || borderSize == 0. ? vec4(color.rgb, 0.) : borderColor;
|
|||
|
fragWidth = 1. / gl_PointSize;
|
|||
|
}
|
|||
|
`]),eFe&&(v.frag=v.frag.replace("smoothstep","smoothStep"),d.frag=d.frag.replace("smoothstep","smoothStep")),this.drawCircle=e(v)}rv.defaults={color:"black",borderColor:"transparent",borderSize:0,size:12,opacity:1,marker:void 0,viewport:null,range:null,pixelSize:null,count:0,offset:0,bounds:null,positions:[],snap:1e4};rv.prototype.render=function(){return arguments.length&&this.update.apply(this,arguments),this.draw(),this};rv.prototype.draw=function(){for(var e=this,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var i=this.groups;if(r.length===1&&Array.isArray(r[0])&&(r[0][0]===null||Array.isArray(r[0][0]))&&(r=r[0]),this.regl._refresh(),r.length)for(var a=0;a<r.length;a++)this.drawItem(a,r[a]);else i.forEach(function(o,s){e.drawItem(s)});return this};rv.prototype.drawItem=function(e,t){var r=this.groups,n=r[e];if(typeof t=="number"&&(e=t,n=r[t],t=null),!!(n&&n.count&&n.opacity)){n.activation[0]&&this.drawCircle(this.getMarkerDrawOptions(0,n,t));for(var i=[],a=1;a<n.activation.length;a++)!n.activation[a]||n.activation[a]!==!0&&!n.activation[a].data.length||i.push.apply(i,A7t(this.getMarkerDrawOptions(a,n,t)));i.length&&this.drawMarker(i)}};rv.prototype.getMarkerDrawOptions=function(e,t,r){var n=t.range,i=t.tree,a=t.viewport,o=t.activation,s=t.selectionBuffer,l=t.count,u=this.regl;if(!i)return r?[K2({},t,{markerTexture:this.markerTextures[e],activation:o[e],count:r.length,elements:r,offset:0})]:[K2({},t,{markerTexture:this.markerTextures[e],activation:o[e],offset:0})];var c=[],f=i.range(n,{lod:!0,px:[(n[2]-n[0])/a.width,(n[3]-n[1])/a.height]});if(r){for(var h=o[e],d=h.data,v=new Uint8Array(l),x=0;x<r.length;x++){var b=r[x];v[b]=d?d[b]:1}s.subdata(v)}for(var p=f.length;p--;){var E=T7t(f[p],2),k=E[0],A=E[1];c.push(K2({},t,{markerTexture:this.markerTextures[e],activation:r?s:o[e],offset:k,count:A-k}))}return c};rv.prototype.update=function(){for(var e=this,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];if(r.length){r.length===1&&Array.isArray(r[0])&&(r=r[0]);var i=this.groups,a=this.gl,o=this.regl,s=this.maxSize,l=this.maxColors,u=this.palette;this.groups=i=r.map(function(c,f){var h=i[f];if(c===void 0)return h;c===null?c={positions:null}:typeof c=="function"?c={ondraw:c}:typeof c[0]=="number"&&(c={positions:c}),c=D7t(c,{positions:"positions data points",snap:"snap cluster lod tree",size:"sizes size radius",borderSize:"borderSizes borderSize border-size bordersize borderWidth borderWidths border-width borderwidth stroke-width strokeWidth strokewidth outline",color:"colors color fill fill-color fillColor",borderColor:"borderColors borderColor stroke stroke-color strokeColor",marker:"markers marker shape",range:"range dataBox databox",viewport:"viewport viewPort viewBox viewbox",opacity:"opacity alpha transparency",bounds:"bound bounds boundaries limits",tooManyColors:"tooManyColors palette paletteMode optimizePalette enablePalette"}),c.positions===null&&(c.positions=[]),c.tooManyColors!=null&&(e.tooManyColors=c.tooManyColors),h||(i[f]=h={id:f,scale:null,translate:null,scaleFract:null,translateFract:null,activation:[],selectionBuffer:o.buffer({data:new Uint8Array(0),usage:"stream",type:"uint8"}),sizeBuffer:o.buffer({data:new Uint8Array(0),usage:"dynamic",type:"uint8"}),colorBuffer:o.buffer({data:new Uint8Array(0),usage:"dynamic",type:"uint8"}),positionBuffer:o.buffer({data:new Uint8Array(0),usage:"dynamic",type:"float"}),positionFractBuffer:o.buffer({data:new Uint8Array(0),usage:"dynamic",type:"float"})},c=K2({},rv.defaults,c)),c.positions&&!("marker"in c)&&(c.marker=h.marker,delete h.marker),c.marker&&!("positions"in c)&&(c.positions=h.positions,delete h.positions);var d=0,v=0;if(z7t(h,c,[{snap:!0,size:function(G,N){return G==null&&(G=rv.defaults.size),d+=G&&G.length?1:0,G},borderSize:function(G,N){return G==null&&(G=rv.defaults.borderSize),d+=G&&G.length?1:0,G},opacity:parseFloat,color:function(G,N){return G==null&&(G=rv.defaults.color),G=e.updateColor(G),v++,G},borderColor:function(G,N){return G==null&&(G=rv.defaults.borderColor),G=e.updateColor(G),v++,G},bounds:function(G,N,W){return"rang
|
|||
|
`:return"\\n";case"\r":return"\\r";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw new Error("Unexpected character")}}),t)}});var gY=ye((Egr,U7e)=>{"use strict";var B7e=$2(),eqt=nF(),tqt=D7e(),rqt=O7e(),N7e=function(e,t){return e.replace("%v",rqt(t))};U7e.exports=function(e,t,r){if(!eqt(r))throw new TypeError(N7e(t,e));if(!B7e(e)){if("default"in r)return r.default;if(r.isOptional)return null}var n=tqt(r.errorMessage);throw B7e(n)||(n=t),new TypeError(N7e(n,e))}});var H7e=ye((kgr,V7e)=>{"use strict";var iqt=gY(),nqt=$2();V7e.exports=function(e){return nqt(e)?e:iqt(e,"Cannot use %v",arguments[1])}});var j7e=ye((Cgr,G7e)=>{"use strict";var aqt=gY(),oqt=lY();G7e.exports=function(e){return oqt(e)?e:aqt(e,"%v is not a plain function",arguments[1])}});var Z7e=ye((Lgr,W7e)=>{"use strict";W7e.exports=function(){var e=Array.from,t,r;return typeof e!="function"?!1:(t=["raz","dwa"],r=e(t),!!(r&&r!==t&&r[1]==="dwa"))}});var Y7e=ye((Pgr,X7e)=>{"use strict";var sqt=Object.prototype.toString,lqt=RegExp.prototype.test.bind(/^[object [A-Za-z0-9]*Function]$/);X7e.exports=function(e){return typeof e=="function"&&lqt(sqt.call(e))}});var J7e=ye((Igr,K7e)=>{"use strict";K7e.exports=function(){var e=Math.sign;return typeof e!="function"?!1:e(10)===1&&e(-20)===-1}});var Q7e=ye((Rgr,$7e)=>{"use strict";$7e.exports=function(e){return e=Number(e),isNaN(e)||e===0?e:e>0?1:-1}});var t9e=ye((Dgr,e9e)=>{"use strict";e9e.exports=J7e()()?Math.sign:Q7e()});var i9e=ye((zgr,r9e)=>{"use strict";var uqt=t9e(),cqt=Math.abs,fqt=Math.floor;r9e.exports=function(e){return isNaN(e)?0:(e=Number(e),e===0||!isFinite(e)?e:uqt(e)*fqt(cqt(e)))}});var a9e=ye((Fgr,n9e)=>{"use strict";var hqt=i9e(),dqt=Math.max;n9e.exports=function(e){return dqt(0,hqt(e))}});var u9e=ye((qgr,l9e)=>{"use strict";var vqt=ux().iterator,pqt=fk(),gqt=Y7e(),mqt=a9e(),o9e=lA(),yqt=i1(),_qt=lx(),xqt=hk(),s9e=Array.isArray,mY=Function.prototype.call,Q2={configurable:!0,enumerable:!0,writable:!0,value:null},yY=Object.defineProperty;l9e.exports=function(e){var t=arguments[1],r=arguments[2],n,i,a,o,s,l,u,c,f,h;if(e=Object(yqt(e)),_qt(t)&&o9e(t),!this||this===Array||!gqt(this)){if(!t){if(pqt(e))return s=e.length,s!==1?Array.apply(null,e):(o=new Array(1),o[0]=e[0],o);if(s9e(e)){for(o=new Array(s=e.length),i=0;i<s;++i)o[i]=e[i];return o}}o=[]}else n=this;if(!s9e(e)){if((f=e[vqt])!==void 0){for(u=o9e(f).call(e),n&&(o=new n),c=u.next(),i=0;!c.done;)h=t?mY.call(t,r,c.value,i):c.value,n?(Q2.value=h,yY(o,i,Q2)):o[i]=h,c=u.next(),++i;s=i}else if(xqt(e)){for(s=e.length,n&&(o=new n),i=0,a=0;i<s;++i)h=e[i],i+1<s&&(l=h.charCodeAt(0),l>=55296&&l<=56319&&(h+=e[++i])),h=t?mY.call(t,r,h,a):h,n?(Q2.value=h,yY(o,a,Q2)):o[a]=h,++a;s=a}}if(s===void 0)for(s=mqt(e.length),n&&(o=new n(s)),i=0;i<s;++i)h=t?mY.call(t,r,e[i],i):e[i],n?(Q2.value=h,yY(o,i,Q2)):o[i]=h;return n&&(Q2.value=null,o.length=s),o}});var f9e=ye((Ogr,c9e)=>{"use strict";c9e.exports=Z7e()()?Array.from:u9e()});var d9e=ye((Bgr,h9e)=>{"use strict";var bqt=f9e(),wqt=aF(),Tqt=i1();h9e.exports=function(e){var t=Object(Tqt(e)),r=arguments[1],n=Object(arguments[2]);if(t!==e&&!r)return t;var i={};return r?bqt(r,function(a){(n.ensure||a in e)&&(i[a]=e[a])}):wqt(i,e),i}});var g9e=ye((Ngr,p9e)=>{"use strict";var Aqt=lA(),Sqt=i1(),Mqt=Function.prototype.bind,v9e=Function.prototype.call,Eqt=Object.keys,kqt=Object.prototype.propertyIsEnumerable;p9e.exports=function(e,t){return function(r,n){var i,a=arguments[2],o=arguments[3];return r=Object(Sqt(r)),Aqt(n),i=Eqt(r),o&&i.sort(typeof o=="function"?Mqt.call(o,r):void 0),typeof e!="function"&&(e=i[e]),v9e.call(e,i,function(s,l){return kqt.call(r,s)?v9e.call(n,a,r[s],s,r,l):t})}}});var y9e=ye((Ugr,m9e)=>{"use strict";m9e.exports=g9e()("forEach")});var x9e=ye((Vgr,_9e)=>{"use strict";var Cqt=lA(),Lqt=y9e(),Pqt=Function.prototype.call;_9e.exports=function(e,t){var r={},n=arguments[2];return Cqt(t),Lqt(e,function(i,a,o,s){r[a]=Pqt.call(t,n,i,a,o,s)}),r}});var A9e=ye((Hgr,T9e)=>{"use strict";var Iqt=$2(),Rqt=H7e(),b9e=j7e(),Dqt=d9e(),zqt=uY(),Fqt=x9e(),qqt=Function.prototype.bind,Oqt=Object.defineProperty,Bqt=
|
|||
|
precision highp float;
|
|||
|
|
|||
|
attribute vec2 aCoord, bCoord, aCoordFract, bCoordFract;
|
|||
|
attribute vec4 color;
|
|||
|
attribute float lineEnd, lineTop;
|
|||
|
|
|||
|
uniform vec2 scale, scaleFract, translate, translateFract;
|
|||
|
uniform float thickness, pixelRatio, id, depth;
|
|||
|
uniform vec4 viewport;
|
|||
|
|
|||
|
varying vec4 fragColor;
|
|||
|
varying vec2 tangent;
|
|||
|
|
|||
|
vec2 project(vec2 position, vec2 positionFract, vec2 scale, vec2 scaleFract, vec2 translate, vec2 translateFract) {
|
|||
|
// the order is important
|
|||
|
return position * scale + translate
|
|||
|
+ positionFract * scale + translateFract
|
|||
|
+ position * scaleFract
|
|||
|
+ positionFract * scaleFract;
|
|||
|
}
|
|||
|
|
|||
|
void main() {
|
|||
|
float lineStart = 1. - lineEnd;
|
|||
|
float lineOffset = lineTop * 2. - 1.;
|
|||
|
|
|||
|
vec2 diff = (bCoord + bCoordFract - aCoord - aCoordFract);
|
|||
|
tangent = normalize(diff * scale * viewport.zw);
|
|||
|
vec2 normal = vec2(-tangent.y, tangent.x);
|
|||
|
|
|||
|
vec2 position = project(aCoord, aCoordFract, scale, scaleFract, translate, translateFract) * lineStart
|
|||
|
+ project(bCoord, bCoordFract, scale, scaleFract, translate, translateFract) * lineEnd
|
|||
|
|
|||
|
+ thickness * normal * .5 * lineOffset / viewport.zw;
|
|||
|
|
|||
|
gl_Position = vec4(position * 2.0 - 1.0, depth, 1);
|
|||
|
|
|||
|
fragColor = color / 255.;
|
|||
|
}
|
|||
|
`,SOt=`
|
|||
|
precision highp float;
|
|||
|
|
|||
|
uniform float dashLength, pixelRatio, thickness, opacity, id;
|
|||
|
uniform sampler2D dashTexture;
|
|||
|
|
|||
|
varying vec4 fragColor;
|
|||
|
varying vec2 tangent;
|
|||
|
|
|||
|
void main() {
|
|||
|
float alpha = 1.;
|
|||
|
|
|||
|
float t = fract(dot(tangent, gl_FragCoord.xy) / dashLength) * .5 + .25;
|
|||
|
float dash = texture2D(dashTexture, vec2(t, .5)).r;
|
|||
|
|
|||
|
gl_FragColor = fragColor;
|
|||
|
gl_FragColor.a *= alpha * opacity * dash;
|
|||
|
}
|
|||
|
`,MOt=`
|
|||
|
precision highp float;
|
|||
|
|
|||
|
attribute vec2 position, positionFract;
|
|||
|
|
|||
|
uniform vec4 color;
|
|||
|
uniform vec2 scale, scaleFract, translate, translateFract;
|
|||
|
uniform float pixelRatio, id;
|
|||
|
uniform vec4 viewport;
|
|||
|
uniform float opacity;
|
|||
|
|
|||
|
varying vec4 fragColor;
|
|||
|
|
|||
|
const float MAX_LINES = 256.;
|
|||
|
|
|||
|
void main() {
|
|||
|
float depth = (MAX_LINES - 4. - id) / (MAX_LINES);
|
|||
|
|
|||
|
vec2 position = position * scale + translate
|
|||
|
+ positionFract * scale + translateFract
|
|||
|
+ position * scaleFract
|
|||
|
+ positionFract * scaleFract;
|
|||
|
|
|||
|
gl_Position = vec4(position * 2.0 - 1.0, depth, 1);
|
|||
|
|
|||
|
fragColor = color / 255.;
|
|||
|
fragColor.a *= opacity;
|
|||
|
}
|
|||
|
`,EOt=`
|
|||
|
precision highp float;
|
|||
|
varying vec4 fragColor;
|
|||
|
|
|||
|
void main() {
|
|||
|
gl_FragColor = fragColor;
|
|||
|
}
|
|||
|
`,kOt=`
|
|||
|
precision highp float;
|
|||
|
|
|||
|
attribute vec2 aCoord, bCoord, nextCoord, prevCoord;
|
|||
|
attribute vec4 aColor, bColor;
|
|||
|
attribute float lineEnd, lineTop;
|
|||
|
|
|||
|
uniform vec2 scale, translate;
|
|||
|
uniform float thickness, pixelRatio, id, depth;
|
|||
|
uniform vec4 viewport;
|
|||
|
uniform float miterLimit, miterMode;
|
|||
|
|
|||
|
varying vec4 fragColor;
|
|||
|
varying vec4 startCutoff, endCutoff;
|
|||
|
varying vec2 tangent;
|
|||
|
varying vec2 startCoord, endCoord;
|
|||
|
varying float enableStartMiter, enableEndMiter;
|
|||
|
|
|||
|
const float REVERSE_THRESHOLD = -.875;
|
|||
|
const float MIN_DIFF = 1e-6;
|
|||
|
|
|||
|
// TODO: possible optimizations: avoid overcalculating all for vertices and calc just one instead
|
|||
|
// TODO: precalculate dot products, normalize things beforehead etc.
|
|||
|
// TODO: refactor to rectangular algorithm
|
|||
|
|
|||
|
float distToLine(vec2 p, vec2 a, vec2 b) {
|
|||
|
vec2 diff = b - a;
|
|||
|
vec2 perp = normalize(vec2(-diff.y, diff.x));
|
|||
|
return dot(p - a, perp);
|
|||
|
}
|
|||
|
|
|||
|
bool isNaN( float val ){
|
|||
|
return ( val < 0.0 || 0.0 < val || val == 0.0 ) ? false : true;
|
|||
|
}
|
|||
|
|
|||
|
void main() {
|
|||
|
vec2 aCoord = aCoord, bCoord = bCoord, prevCoord = prevCoord, nextCoord = nextCoord;
|
|||
|
|
|||
|
vec2 adjustedScale;
|
|||
|
adjustedScale.x = (abs(scale.x) < MIN_DIFF) ? MIN_DIFF : scale.x;
|
|||
|
adjustedScale.y = (abs(scale.y) < MIN_DIFF) ? MIN_DIFF : scale.y;
|
|||
|
|
|||
|
vec2 scaleRatio = adjustedScale * viewport.zw;
|
|||
|
vec2 normalWidth = thickness / scaleRatio;
|
|||
|
|
|||
|
float lineStart = 1. - lineEnd;
|
|||
|
float lineBot = 1. - lineTop;
|
|||
|
|
|||
|
fragColor = (lineStart * aColor + lineEnd * bColor) / 255.;
|
|||
|
|
|||
|
if (isNaN(aCoord.x) || isNaN(aCoord.y) || isNaN(bCoord.x) || isNaN(bCoord.y)) return;
|
|||
|
|
|||
|
if (aCoord == prevCoord) prevCoord = aCoord + normalize(bCoord - aCoord);
|
|||
|
if (bCoord == nextCoord) nextCoord = bCoord - normalize(bCoord - aCoord);
|
|||
|
|
|||
|
|
|||
|
vec2 prevDiff = aCoord - prevCoord;
|
|||
|
vec2 currDiff = bCoord - aCoord;
|
|||
|
vec2 nextDiff = nextCoord - bCoord;
|
|||
|
|
|||
|
vec2 prevTangent = normalize(prevDiff * scaleRatio);
|
|||
|
vec2 currTangent = normalize(currDiff * scaleRatio);
|
|||
|
vec2 nextTangent = normalize(nextDiff * scaleRatio);
|
|||
|
|
|||
|
vec2 prevNormal = vec2(-prevTangent.y, prevTangent.x);
|
|||
|
vec2 currNormal = vec2(-currTangent.y, currTangent.x);
|
|||
|
vec2 nextNormal = vec2(-nextTangent.y, nextTangent.x);
|
|||
|
|
|||
|
vec2 startJoinDirection = normalize(prevTangent - currTangent);
|
|||
|
vec2 endJoinDirection = normalize(currTangent - nextTangent);
|
|||
|
|
|||
|
// collapsed/unidirectional segment cases
|
|||
|
// FIXME: there should be more elegant solution
|
|||
|
vec2 prevTanDiff = abs(prevTangent - currTangent);
|
|||
|
vec2 nextTanDiff = abs(nextTangent - currTangent);
|
|||
|
if (max(prevTanDiff.x, prevTanDiff.y) < MIN_DIFF) {
|
|||
|
startJoinDirection = currNormal;
|
|||
|
}
|
|||
|
if (max(nextTanDiff.x, nextTanDiff.y) < MIN_DIFF) {
|
|||
|
endJoinDirection = currNormal;
|
|||
|
}
|
|||
|
if (aCoord == bCoord) {
|
|||
|
endJoinDirection = startJoinDirection;
|
|||
|
currNormal = prevNormal;
|
|||
|
currTangent = prevTangent;
|
|||
|
}
|
|||
|
|
|||
|
tangent = currTangent;
|
|||
|
|
|||
|
//calculate join shifts relative to normals
|
|||
|
float startJoinShift = dot(currNormal, startJoinDirection);
|
|||
|
float endJoinShift = dot(currNormal, endJoinDirection);
|
|||
|
|
|||
|
float startMiterRatio = abs(1. / startJoinShift);
|
|||
|
float endMiterRatio = abs(1. / endJoinShift);
|
|||
|
|
|||
|
vec2 startJoin = startJoinDirection * startMiterRatio;
|
|||
|
vec2 endJoin = endJoinDirection * endMiterRatio;
|
|||
|
|
|||
|
vec2 startTopJoin, startBotJoin, endTopJoin, endBotJoin;
|
|||
|
startTopJoin = sign(startJoinShift) * startJoin * .5;
|
|||
|
startBotJoin = -startTopJoin;
|
|||
|
|
|||
|
endTopJoin = sign(endJoinShift) * endJoin * .5;
|
|||
|
endBotJoin = -endTopJoin;
|
|||
|
|
|||
|
vec2 aTopCoord = aCoord + normalWidth * startTopJoin;
|
|||
|
vec2 bTopCoord = bCoord + normalWidth * endTopJoin;
|
|||
|
vec2 aBotCoord = aCoord + normalWidth * startBotJoin;
|
|||
|
vec2 bBotCoord = bCoord + normalWidth * endBotJoin;
|
|||
|
|
|||
|
//miter anti-clipping
|
|||
|
float baClipping = distToLine(bCoord, aCoord, aBotCoord) / dot(normalize(normalWidth * endBotJoin), normalize(normalWidth.yx * vec2(-startBotJoin.y, startBotJoin.x)));
|
|||
|
float abClipping = distToLine(aCoord, bCoord, bTopCoord) / dot(normalize(normalWidth * startBotJoin), normalize(normalWidth.yx * vec2(-endBotJoin.y, endBotJoin.x)));
|
|||
|
|
|||
|
//prevent close to reverse direction switch
|
|||
|
bool prevReverse = dot(currTangent, prevTangent) <= REVERSE_THRESHOLD && abs(dot(currTangent, prevNormal)) * min(length(prevDiff), length(currDiff)) < length(normalWidth * currNormal);
|
|||
|
bool nextReverse = dot(currTangent, nextTangent) <= REVERSE_THRESHOLD && abs(dot(currTangent, nextNormal)) * min(length(nextDiff), length(currDiff)) < length(normalWidth * currNormal);
|
|||
|
|
|||
|
if (prevReverse) {
|
|||
|
//make join rectangular
|
|||
|
vec2 miterShift = normalWidth * startJoinDirection * miterLimit * .5;
|
|||
|
float normalAdjust = 1. - min(miterLimit / startMiterRatio, 1.);
|
|||
|
aBotCoord = aCoord + miterShift - normalAdjust * normalWidth * currNormal * .5;
|
|||
|
aTopCoord = aCoord + miterShift + normalAdjust * normalWidth * currNormal * .5;
|
|||
|
}
|
|||
|
else if (!nextReverse && baClipping > 0. && baClipping < length(normalWidth * endBotJoin)) {
|
|||
|
//handle miter clipping
|
|||
|
bTopCoord -= normalWidth * endTopJoin;
|
|||
|
bTopCoord += normalize(endTopJoin * normalWidth) * baClipping;
|
|||
|
}
|
|||
|
|
|||
|
if (nextReverse) {
|
|||
|
//make join rectangular
|
|||
|
vec2 miterShift = normalWidth * endJoinDirection * miterLimit * .5;
|
|||
|
float normalAdjust = 1. - min(miterLimit / endMiterRatio, 1.);
|
|||
|
bBotCoord = bCoord + miterShift - normalAdjust * normalWidth * currNormal * .5;
|
|||
|
bTopCoord = bCoord + miterShift + normalAdjust * normalWidth * currNormal * .5;
|
|||
|
}
|
|||
|
else if (!prevReverse && abClipping > 0. && abClipping < length(normalWidth * startBotJoin)) {
|
|||
|
//handle miter clipping
|
|||
|
aBotCoord -= normalWidth * startBotJoin;
|
|||
|
aBotCoord += normalize(startBotJoin * normalWidth) * abClipping;
|
|||
|
}
|
|||
|
|
|||
|
vec2 aTopPosition = (aTopCoord) * adjustedScale + translate;
|
|||
|
vec2 aBotPosition = (aBotCoord) * adjustedScale + translate;
|
|||
|
|
|||
|
vec2 bTopPosition = (bTopCoord) * adjustedScale + translate;
|
|||
|
vec2 bBotPosition = (bBotCoord) * adjustedScale + translate;
|
|||
|
|
|||
|
//position is normalized 0..1 coord on the screen
|
|||
|
vec2 position = (aTopPosition * lineTop + aBotPosition * lineBot) * lineStart + (bTopPosition * lineTop + bBotPosition * lineBot) * lineEnd;
|
|||
|
|
|||
|
startCoord = aCoord * scaleRatio + translate * viewport.zw + viewport.xy;
|
|||
|
endCoord = bCoord * scaleRatio + translate * viewport.zw + viewport.xy;
|
|||
|
|
|||
|
gl_Position = vec4(position * 2.0 - 1.0, depth, 1);
|
|||
|
|
|||
|
enableStartMiter = step(dot(currTangent, prevTangent), .5);
|
|||
|
enableEndMiter = step(dot(currTangent, nextTangent), .5);
|
|||
|
|
|||
|
//bevel miter cutoffs
|
|||
|
if (miterMode == 1.) {
|
|||
|
if (enableStartMiter == 1.) {
|
|||
|
vec2 startMiterWidth = vec2(startJoinDirection) * thickness * miterLimit * .5;
|
|||
|
startCutoff = vec4(aCoord, aCoord);
|
|||
|
startCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio;
|
|||
|
startCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;
|
|||
|
startCutoff += viewport.xyxy;
|
|||
|
startCutoff += startMiterWidth.xyxy;
|
|||
|
}
|
|||
|
|
|||
|
if (enableEndMiter == 1.) {
|
|||
|
vec2 endMiterWidth = vec2(endJoinDirection) * thickness * miterLimit * .5;
|
|||
|
endCutoff = vec4(bCoord, bCoord);
|
|||
|
endCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio;
|
|||
|
endCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;
|
|||
|
endCutoff += viewport.xyxy;
|
|||
|
endCutoff += endMiterWidth.xyxy;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//round miter cutoffs
|
|||
|
else if (miterMode == 2.) {
|
|||
|
if (enableStartMiter == 1.) {
|
|||
|
vec2 startMiterWidth = vec2(startJoinDirection) * thickness * abs(dot(startJoinDirection, currNormal)) * .5;
|
|||
|
startCutoff = vec4(aCoord, aCoord);
|
|||
|
startCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio;
|
|||
|
startCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;
|
|||
|
startCutoff += viewport.xyxy;
|
|||
|
startCutoff += startMiterWidth.xyxy;
|
|||
|
}
|
|||
|
|
|||
|
if (enableEndMiter == 1.) {
|
|||
|
vec2 endMiterWidth = vec2(endJoinDirection) * thickness * abs(dot(endJoinDirection, currNormal)) * .5;
|
|||
|
endCutoff = vec4(bCoord, bCoord);
|
|||
|
endCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio;
|
|||
|
endCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;
|
|||
|
endCutoff += viewport.xyxy;
|
|||
|
endCutoff += endMiterWidth.xyxy;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
`,COt=`
|
|||
|
precision highp float;
|
|||
|
|
|||
|
uniform float dashLength, pixelRatio, thickness, opacity, id, miterMode;
|
|||
|
uniform sampler2D dashTexture;
|
|||
|
|
|||
|
varying vec4 fragColor;
|
|||
|
varying vec2 tangent;
|
|||
|
varying vec4 startCutoff, endCutoff;
|
|||
|
varying vec2 startCoord, endCoord;
|
|||
|
varying float enableStartMiter, enableEndMiter;
|
|||
|
|
|||
|
float distToLine(vec2 p, vec2 a, vec2 b) {
|
|||
|
vec2 diff = b - a;
|
|||
|
vec2 perp = normalize(vec2(-diff.y, diff.x));
|
|||
|
return dot(p - a, perp);
|
|||
|
}
|
|||
|
|
|||
|
void main() {
|
|||
|
float alpha = 1., distToStart, distToEnd;
|
|||
|
float cutoff = thickness * .5;
|
|||
|
|
|||
|
//bevel miter
|
|||
|
if (miterMode == 1.) {
|
|||
|
if (enableStartMiter == 1.) {
|
|||
|
distToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw);
|
|||
|
if (distToStart < -1.) {
|
|||
|
discard;
|
|||
|
return;
|
|||
|
}
|
|||
|
alpha *= min(max(distToStart + 1., 0.), 1.);
|
|||
|
}
|
|||
|
|
|||
|
if (enableEndMiter == 1.) {
|
|||
|
distToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw);
|
|||
|
if (distToEnd < -1.) {
|
|||
|
discard;
|
|||
|
return;
|
|||
|
}
|
|||
|
alpha *= min(max(distToEnd + 1., 0.), 1.);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// round miter
|
|||
|
else if (miterMode == 2.) {
|
|||
|
if (enableStartMiter == 1.) {
|
|||
|
distToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw);
|
|||
|
if (distToStart < 0.) {
|
|||
|
float radius = length(gl_FragCoord.xy - startCoord);
|
|||
|
|
|||
|
if(radius > cutoff + .5) {
|
|||
|
discard;
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
alpha -= smoothstep(cutoff - .5, cutoff + .5, radius);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if (enableEndMiter == 1.) {
|
|||
|
distToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw);
|
|||
|
if (distToEnd < 0.) {
|
|||
|
float radius = length(gl_FragCoord.xy - endCoord);
|
|||
|
|
|||
|
if(radius > cutoff + .5) {
|
|||
|
discard;
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
alpha -= smoothstep(cutoff - .5, cutoff + .5, radius);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
float t = fract(dot(tangent, gl_FragCoord.xy) / dashLength) * .5 + .25;
|
|||
|
float dash = texture2D(dashTexture, vec2(t, .5)).r;
|
|||
|
|
|||
|
gl_FragColor = fragColor;
|
|||
|
gl_FragColor.a *= alpha * opacity * dash;
|
|||
|
}
|
|||
|
`;iqe.exports=uc;function uc(e,t){if(!(this instanceof uc))return new uc(e,t);if(typeof e=="function"?(t||(t={}),t.regl=e):t=e,t.length&&(t.positions=t),e=t.regl,!e.hasExtension("ANGLE_instanced_arrays"))throw Error("regl-error2d: `ANGLE_instanced_arrays` extension should be enabled");this.gl=e._gl,this.regl=e,this.passes=[],this.shaders=uc.shaders.has(e)?uc.shaders.get(e):uc.shaders.set(e,uc.createShaders(e)).get(e),this.update(t)}uc.dashMult=2;uc.maxPatternLength=256;uc.precisionThreshold=3e6;uc.maxPoints=1e4;uc.maxLines=2048;uc.shaders=new wOt;uc.createShaders=function(e){let t=e.buffer({usage:"static",type:"float",data:[0,1,0,0,1,1,1,0]}),r={primitive:"triangle strip",instances:e.prop("count"),count:4,offset:0,uniforms:{miterMode:(o,s)=>s.join==="round"?2:1,miterLimit:e.prop("miterLimit"),scale:e.prop("scale"),scaleFract:e.prop("scaleFract"),translateFract:e.prop("translateFract"),translate:e.prop("translate"),thickness:e.prop("thickness"),dashTexture:e.prop("dashTexture"),opacity:e.prop("opacity"),pixelRatio:e.context("pixelRatio"),id:e.prop("id"),dashLength:e.prop("dashLength"),viewport:(o,s)=>[s.viewport.x,s.viewport.y,o.viewportWidth,o.viewportHeight],depth:e.prop("depth")},blend:{enable:!0,color:[0,0,0,0],equation:{rgb:"add",alpha:"add"},func:{srcRGB:"src alpha",dstRGB:"one minus src alpha",srcAlpha:"one minus dst alpha",dstAlpha:"one"}},depth:{enable:(o,s)=>!s.overlay},stencil:{enable:!1},scissor:{enable:!0,box:e.prop("viewport")},viewport:e.prop("viewport")},n=e(CY({vert:AOt,frag:SOt,attributes:{lineEnd:{buffer:t,divisor:0,stride:8,offset:0},lineTop:{buffer:t,divisor:0,stride:8,offset:4},aCoord:{buffer:e.prop("positionBuffer"),stride:8,offset:8,divisor:1},bCoord:{buffer:e.prop("positionBuffer"),stride:8,offset:16,divisor:1},aCoordFract:{buffer:e.prop("positionFractBuffer"),stride:8,offset:8,divisor:1},bCoordFract:{buffer:e.prop("positionFractBuffer"),stride:8,offset:16,divisor:1},color:{buffer:e.prop("colorBuffer"),stride:4,offset:0,divisor:1}}},r)),i;try{i=e(CY({cull:{enable:!0,face:"back"},vert:kOt,frag:COt,attributes:{lineEnd:{buffer:t,divisor:0,stride:8,offset:0},lineTop:{buffer:t,divisor:0,stride:8,offset:4},aColor:{buffer:e.prop("colorBuffer"),stride:4,offset:0,divisor:1},bColor:{buffer:e.prop("colorBuffer"),stride:4,offset:4,divisor:1},prevCoord:{buffer:e.prop("positionBuffer"),stride:8,offset:0,divisor:1},aCoord:{buffer:e.prop("positionBuffer"),stride:8,offset:8,divisor:1},bCoord:{buffer:e.prop("positionBuffer"),stride:8,offset:16,divisor:1},nextCoord:{buffer:e.prop("positionBuffer"),stride:8,offset:24,divisor:1}}},r))}catch(o){i=n}return{fill:e({primitive:"triangle",elements:(o,s)=>s.triangles,offset:0,vert:MOt,frag:EOt,uniforms:{scale:e.prop("scale"),color:e.prop("fill"),scaleFract:e.prop("scaleFract"),translateFract:e.prop("translateFract"),translate:e.prop("translate"),opacity:e.prop("opacity"),pixelRatio:e.context("pixelRatio"),id:e.prop("id"),viewport:(o,s)=>[s.viewport.x,s.viewport.y,o.viewportWidth,o.viewportHeight]},attributes:{position:{buffer:e.prop("positionBuffer"),stride:8,offset:8},positionFract:{buffer:e.prop("positionFractBuffer"),stride:8,offset:8}},blend:r.blend,depth:{enable:!1},scissor:r.scissor,stencil:r.stencil,viewport:r.viewport}),rect:n,miter:i}};uc.defaults={dashes:null,join:"miter",miterLimit:1,thickness:10,cap:"square",color:"black",opacity:1,overlay:!1,viewport:null,range:null,close:!1,fill:null};uc.prototype.render=function(...e){e.length&&this.update(...e),this.draw()};uc.prototype.draw=function(...e){return(e.length?e:this.passes).forEach((t,r)=>{if(t&&Array.isArray(t))return this.draw(...t);typeof t=="number"&&(t=this.passes[t]),t&&t.count>1&&t.opacity&&(this.regl._refresh(),t.fill&&t.triangles&&t.triangles.length>2&&this.shaders.fill(t),t.thickness&&(t.scale[0]*t.viewport.width>uc.precisionThreshold||t.scale[1]*t.viewport.height>uc.precisionThreshold?this.shaders.rect(t):t.join==="rect"||!t.join&&(t.thickness<=2||t.count>=uc.maxPoints)?this.shaders.rect(t):this.shaders.miter(t)))}),this};uc.prototype.update=function(e){if(!e)return;e.length!=null?typeof e[0]=="number
|
|||
|
precision highp float;
|
|||
|
|
|||
|
attribute vec2 position, positionFract;
|
|||
|
attribute vec4 error;
|
|||
|
attribute vec4 color;
|
|||
|
|
|||
|
attribute vec2 direction, lineOffset, capOffset;
|
|||
|
|
|||
|
uniform vec4 viewport;
|
|||
|
uniform float lineWidth, capSize;
|
|||
|
uniform vec2 scale, scaleFract, translate, translateFract;
|
|||
|
|
|||
|
varying vec4 fragColor;
|
|||
|
|
|||
|
void main() {
|
|||
|
fragColor = color / 255.;
|
|||
|
|
|||
|
vec2 pixelOffset = lineWidth * lineOffset + (capSize + lineWidth) * capOffset;
|
|||
|
|
|||
|
vec2 dxy = -step(.5, direction.xy) * error.xz + step(direction.xy, vec2(-.5)) * error.yw;
|
|||
|
|
|||
|
vec2 position = position + dxy;
|
|||
|
|
|||
|
vec2 pos = (position + translate) * scale
|
|||
|
+ (positionFract + translateFract) * scale
|
|||
|
+ (position + translate) * scaleFract
|
|||
|
+ (positionFract + translateFract) * scaleFract;
|
|||
|
|
|||
|
pos += pixelOffset / viewport.zw;
|
|||
|
|
|||
|
gl_Position = vec4(pos * 2. - 1., 0, 1);
|
|||
|
}
|
|||
|
`,frag:`
|
|||
|
precision highp float;
|
|||
|
|
|||
|
varying vec4 fragColor;
|
|||
|
|
|||
|
uniform float opacity;
|
|||
|
|
|||
|
void main() {
|
|||
|
gl_FragColor = fragColor;
|
|||
|
gl_FragColor.a *= opacity;
|
|||
|
}
|
|||
|
`,uniforms:{range:e.prop("range"),lineWidth:e.prop("lineWidth"),capSize:e.prop("capSize"),opacity:e.prop("opacity"),scale:e.prop("scale"),translate:e.prop("translate"),scaleFract:e.prop("scaleFract"),translateFract:e.prop("translateFract"),viewport:(b,p)=>[p.viewport.x,p.viewport.y,b.viewportWidth,b.viewportHeight]},attributes:{color:{buffer:o,offset:(b,p)=>p.offset*4,divisor:1},position:{buffer:i,offset:(b,p)=>p.offset*8,divisor:1},positionFract:{buffer:a,offset:(b,p)=>p.offset*8,divisor:1},error:{buffer:s,offset:(b,p)=>p.offset*16,divisor:1},direction:{buffer:l,stride:24,offset:0},lineOffset:{buffer:l,stride:24,offset:8},capOffset:{buffer:l,stride:24,offset:16}},primitive:"triangles",blend:{enable:!0,color:[0,0,0,0],equation:{rgb:"add",alpha:"add"},func:{srcRGB:"src alpha",dstRGB:"one minus src alpha",srcAlpha:"one minus dst alpha",dstAlpha:"one"}},depth:{enable:!1},scissor:{enable:!0,box:e.prop("viewport")},viewport:e.prop("viewport"),stencil:!1,instances:e.prop("count"),count:oqe.length}),nqe(f,{update:v,draw:h,destroy:x,regl:e,gl:r,canvas:r.canvas,groups:c}),f;function f(b){b?v(b):b===null&&x(),h()}function h(b){if(typeof b=="number")return d(b);b&&!Array.isArray(b)&&(b=[b]),e._refresh(),c.forEach((p,E)=>{if(p){if(b&&(b[E]?p.draw=!0:p.draw=!1),!p.draw){p.draw=!0;return}d(E)}})}function d(b){typeof b=="number"&&(b=c[b]),b!=null&&b&&b.count&&b.color&&b.opacity&&b.positions&&b.positions.length>1&&(b.scaleRatio=[b.scale[0]*b.viewport.width,b.scale[1]*b.viewport.height],n(b),b.after&&b.after(b))}function v(b){if(!b)return;b.length!=null?typeof b[0]=="number"&&(b=[{positions:b}]):Array.isArray(b)||(b=[b]);let p=0,E=0;if(f.groups=c=b.map((L,_)=>{let C=c[_];if(L)typeof L=="function"?L={after:L}:typeof L[0]=="number"&&(L={positions:L});else return C;return L=ROt(L,{color:"color colors fill",capSize:"capSize cap capsize cap-size",lineWidth:"lineWidth line-width width line thickness",opacity:"opacity alpha",range:"range dataBox",viewport:"viewport viewBox",errors:"errors error",positions:"positions position data points"}),C||(c[_]=C={id:_,scale:null,translate:null,scaleFract:null,translateFract:null,draw:!0},L=nqe({},u,L)),IOt(C,L,[{lineWidth:M=>+M*.5,capSize:M=>+M*.5,opacity:parseFloat,errors:M=>(M=aqe(M),E+=M.length,M),positions:(M,g)=>(M=aqe(M,"float64"),g.count=Math.floor(M.length/2),g.bounds=LOt(M,2),g.offset=p,p+=g.count,M)},{color:(M,g)=>{let P=g.count;if(M||(M="transparent"),!Array.isArray(M)||typeof M[0]=="number"){let F=M;M=Array(P);for(let q=0;q<P;q++)M[q]=F}if(M.length<P)throw Error("Not enough colors");let T=new Uint8Array(P*4);for(let F=0;F<P;F++){let q=POt(M[F],"uint8");T.set(q,F*4)}return T},range:(M,g,P)=>{let T=g.bounds;return M||(M=T),g.scale=[1/(M[2]-M[0]),1/(M[3]-M[1])],g.translate=[-M[0],-M[1]],g.scaleFract=PY(g.scale),g.translateFract=PY(g.translate),M},viewport:M=>{let g;return Array.isArray(M)?g={x:M[0],y:M[1],width:M[2]-M[0],height:M[3]-M[1]}:M?(g={x:M.x||M.left||0,y:M.y||M.top||0},M.right?g.width=M.right-g.x:g.width=M.w||M.width||0,M.bottom?g.height=M.bottom-g.y:g.height=M.h||M.height||0):g={x:0,y:0,width:r.drawingBufferWidth,height:r.drawingBufferHeight},g}}]),C}),p||E){let L=c.reduce((g,P,T)=>g+(P?P.count:0),0),_=new Float64Array(L*2),C=new Uint8Array(L*4),M=new Float32Array(L*4);c.forEach((g,P)=>{if(!g)return;let{positions:T,count:F,offset:q,color:V,errors:H}=g;F&&(C.set(V,q*4),M.set(H,q*4),_.set(T,q*2))});var k=DOt(_);i(k);var A=PY(_,k);a(A),o(C),s(M)}}function x(){i.destroy(),a.destroy(),o.destroy(),s.destroy(),l.destroy()}}});var fqe=ye((imr,cqe)=>{var uqe=/[\'\"]/;cqe.exports=function(t){return t?(uqe.test(t.charAt(0))&&(t=t.substr(1)),uqe.test(t.charAt(t.length-1))&&(t=t.substr(0,t.length-1)),t):""}});var IY=ye(()=>{});var RY=ye(()=>{});var DY=ye(()=>{});var zY=ye(()=>{});var FY=ye(()=>{});var pqe=ye((vmr,vqe)=>{"use strict";function hqe(e,t){if(typeof e!="string")return[e];var r=[e];typeof t=="string"||Array.isArray(t)?t={brackets:t}:t||(t={});var n=t.brackets?Array.isArray(t.brackets)?t.brackets:[t.brackets]:["{}","[]","()"],i=t.escape||"___",a=!!t.flat;n.forEach(function(l){var u=new Re
|
|||
|
`).replace(/}/g,`}
|
|||
|
`).replace(/{/g,`{
|
|||
|
`),ji;if(Er&&(ji=Rc(Ai),Er[ji]))return Er[ji].apply(null,Ui);var Ln=Function.apply(null,wi.concat(Ai));return Er&&(Er[ji]=Ln),Ln.apply(null,Ui)}return{global:yn,link:Bi,block:cn,proc:Rn,scope:On,cond:Bn,compile:Dn}}var Ma="xyzw".split(""),Ta=5121,Ea=1,qa=2,Cn=0,sn=1,Ua=2,mo=3,Xo=4,Ts=5,Qo=6,ys="dither",Bo="blend.enable",yl="blend.color",Gs="blend.equation",Rs="blend.func",ia="depth.enable",Ka="depth.func",vs="depth.range",Ko="depth.mask",nu="colorMask",Ru="cull.enable",ac="cull.face",mf="frontFace",bu="lineWidth",Kc="polygonOffset.enable",Du="polygonOffset.offset",Dc="sample.alpha",Da="sample.enable",eo="sample.coverage",Jc="stencil.enable",yc="stencil.mask",_c="stencil.func",le="stencil.opFront",w="stencil.opBack",B="scissor.enable",Q="scissor.box",ee="viewport",se="profile",qe="framebuffer",je="vert",it="frag",yt="elements",Ot="primitive",Nt="count",hr="offset",Sr="instances",he="vao",be="Width",Pe="Height",Oe=qe+be,Je=qe+Pe,He=ee+be,et=ee+Pe,Mt="drawingBuffer",Dt=Mt+be,Ut=Mt+Pe,tr=[Rs,Gs,_c,le,w,eo,ee,Q,Du],mr=34962,Rr=34963,zr=2884,Xr=3042,di=3024,Li=2960,Ci=2929,Qi=3089,Mn=32823,pa=32926,ea=32928,Ga=5126,To=35664,Wa=35665,co=35666,Ro=5124,Ds=35667,As=35668,yo=35669,po=35670,_l=35671,Hl=35672,Zu=35673,cu=35674,el=35675,au=35676,zc=35678,zl=35680,Fl=4,Z=1028,oe=1029,we=2304,Be=2305,Ue=32775,We=32776,wt=519,tt=7680,zt=0,or=1,lr=32774,Dr=513,Ir=36160,oi=36064,ui={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},qr={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},Kr={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},ii={cw:we,ccw:Be};function vi(At){return Array.isArray(At)||Or(At)||Nr(At)}function ci(At){return At.sort(function(Er,Wr){return Er===ee?-1:Wr===ee?1:Er<Wr?-1:1})}function Jr(At,Er,Wr,wi){this.thisDep=At,this.contextDep=Er,this.propDep=Wr,this.append=wi}function un(At){return At&&!(At.thisDep||At.contextDep||At.propDep)}function dn(At){return new Jr(!1,!1,!1,At)}function En(At,Er){var Wr=At.type;if(Wr===Cn){var wi=At.data.length;return new Jr(!0,wi>=1,wi>=2,Er)}else if(Wr===Xo){var Ui=At.data;return new Jr(Ui.thisDep,Ui.contextDep,Ui.propDep,Er)}else{if(Wr===Ts)return new Jr(!1,!1,!1,Er);if(Wr===Qo){for(var Oi=!1,Bi=!1,cn=!1,On=0;On<At.data.length;++On){var Bn=At.data[On];if(Bn.type===sn)cn=!0;else if(Bn.type===Ua)Bi=!0;else if(Bn.type===mo)Oi=!0;else if(Bn.type===Cn){Oi=!0;var yn=Bn.data;yn>=1&&(Bi=!0),yn>=2&&(cn=!0)}else Bn.type===Xo&&(Oi=Oi||Bn.data.thisDep,Bi=Bi||Bn.data.contextDep,cn=cn||Bn.data.propDep)}return new Jr(Oi,Bi,cn,Er)}else return new Jr(Wr===mo,Wr===Ua,Wr===sn,Er)}}var Nn=new Jr(!1,!1,!1,function(){});function ga(At,Er,Wr,wi,Ui,Oi,Bi,cn,On,Bn,yn,to,Rn,Dn,fn,Ai){var ji=Bn.Record,Ln={add:32774,subtract:32778,"reverse subtract":32779};Wr.ext_blend_minmax&&(Ln.min=Ue,Ln.max=We);var Un=Wr.angle_instanced_arrays,gn=Wr.webgl_draw_buffers,ca=Wr.oes_vertex_array_object,Kn={dirty:!0,profile:Ai.profile},Za={},wn=[],vn={},Aa={};function aa(vt){return vt.replace(".","_")}function Xn(vt,Pt,Wt){var rr=aa(vt);wn.push(vt),Za[rr]=Kn[rr]=!!Wt,vn[rr]=Pt}function Vn(vt,Pt,Wt){var rr=aa(vt);wn.push(vt),Array.isArray(Wt)?(Kn[rr]=Wt.slice(),Za[rr]=Wt.slice()):Kn[rr]=Za[rr]=Wt,Aa[rr]=Pt}function ma(vt){return!!isNaN(vt)}Xn(ys,di),Xn(Bo,Xr),Vn(yl,"blendColor",[0,0,0,0]),Vn(Gs,"blendEquationSeparate",[lr,lr]),Vn(Rs,"blendFuncSeparate",[or,zt,or,zt]),Xn(ia,Ci,!0),Vn(Ka,"depthFunc",Dr),Vn(vs,"depthRange",[0,1]),Vn(Ko,"depthMask",!0),Vn(nu,nu,[!0,!0,!0,!0]),Xn(Ru,zr),Vn(ac,"cullFace",oe),Vn(mf,mf,Be),Vn(bu,bu,1),Xn(Kc,Mn),Vn(Du,"polygonOffset",[0,0]),Xn(Dc,pa),Xn(Da,ea),Vn(eo,"sampleCoverage",[1,!1]),Xn(Jc,Li),Vn(yc,"stencilMask",-1),Vn(_c,"stencilFunc",[wt,
|
|||
|
precision highp float;
|
|||
|
attribute float width, charOffset, char;
|
|||
|
attribute vec2 position;
|
|||
|
uniform float fontSize, charStep, em, align, baseline;
|
|||
|
uniform vec4 viewport;
|
|||
|
uniform vec4 color;
|
|||
|
uniform vec2 atlasSize, atlasDim, scale, translate, positionOffset;
|
|||
|
varying vec2 charCoord, charId;
|
|||
|
varying float charWidth;
|
|||
|
varying vec4 fontColor;
|
|||
|
void main () {
|
|||
|
vec2 offset = floor(em * (vec2(align + charOffset, baseline)
|
|||
|
+ vec2(positionOffset.x, -positionOffset.y)))
|
|||
|
/ (viewport.zw * scale.xy);
|
|||
|
|
|||
|
vec2 position = (position + translate) * scale;
|
|||
|
position += offset * scale;
|
|||
|
|
|||
|
charCoord = position * viewport.zw + viewport.xy;
|
|||
|
|
|||
|
gl_Position = vec4(position * 2. - 1., 0, 1);
|
|||
|
|
|||
|
gl_PointSize = charStep;
|
|||
|
|
|||
|
charId.x = mod(char, atlasDim.x);
|
|||
|
charId.y = floor(char / atlasDim.x);
|
|||
|
|
|||
|
charWidth = width * em;
|
|||
|
|
|||
|
fontColor = color / 255.;
|
|||
|
}`,frag:`
|
|||
|
precision highp float;
|
|||
|
uniform float fontSize, charStep, opacity;
|
|||
|
uniform vec2 atlasSize;
|
|||
|
uniform vec4 viewport;
|
|||
|
uniform sampler2D atlas;
|
|||
|
varying vec4 fontColor;
|
|||
|
varying vec2 charCoord, charId;
|
|||
|
varying float charWidth;
|
|||
|
|
|||
|
float lightness(vec4 color) {
|
|||
|
return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
|
|||
|
}
|
|||
|
|
|||
|
void main () {
|
|||
|
vec2 uv = gl_FragCoord.xy - charCoord + charStep * .5;
|
|||
|
float halfCharStep = floor(charStep * .5 + .5);
|
|||
|
|
|||
|
// invert y and shift by 1px (FF expecially needs that)
|
|||
|
uv.y = charStep - uv.y;
|
|||
|
|
|||
|
// ignore points outside of character bounding box
|
|||
|
float halfCharWidth = ceil(charWidth * .5);
|
|||
|
if (floor(uv.x) > halfCharStep + halfCharWidth ||
|
|||
|
floor(uv.x) < halfCharStep - halfCharWidth) return;
|
|||
|
|
|||
|
uv += charId * charStep;
|
|||
|
uv = uv / atlasSize;
|
|||
|
|
|||
|
vec4 color = fontColor;
|
|||
|
vec4 mask = texture2D(atlas, uv);
|
|||
|
|
|||
|
float maskY = lightness(mask);
|
|||
|
// float colorY = lightness(color);
|
|||
|
color.a *= maskY;
|
|||
|
color.a *= opacity;
|
|||
|
|
|||
|
// color.a += .1;
|
|||
|
|
|||
|
// antialiasing, see yiq color space y-channel formula
|
|||
|
// color.rgb += (1. - color.rgb) * (1. - mask.rgb);
|
|||
|
|
|||
|
gl_FragColor = color;
|
|||
|
}`}),n={};return{regl:t,draw:r,atlas:n}};Vu.prototype.update=function(t){var r=this;if(typeof t=="string")t={text:t};else if(!t)return;t=pBt(t,{position:"position positions coord coords coordinates",font:"font fontFace fontface typeface cssFont css-font family fontFamily",fontSize:"fontSize fontsize size font-size",text:"text texts chars characters value values symbols",align:"align alignment textAlign textbaseline",baseline:"baseline textBaseline textbaseline",direction:"dir direction textDirection",color:"color colour fill fill-color fillColor textColor textcolor",kerning:"kerning kern",range:"range dataBox",viewport:"vp viewport viewBox viewbox viewPort",opacity:"opacity alpha transparency visible visibility opaque",offset:"offset positionOffset padding shift indent indentation"},!0),t.opacity!=null&&(Array.isArray(t.opacity)?this.opacity=t.opacity.map(function(ke){return parseFloat(ke)}):this.opacity=parseFloat(t.opacity)),t.viewport!=null&&(this.viewport=xBt(t.viewport),this.viewportArray=[this.viewport.x,this.viewport.y,this.viewport.width,this.viewport.height]),this.viewport==null&&(this.viewport={x:0,y:0,width:this.gl.drawingBufferWidth,height:this.gl.drawingBufferHeight},this.viewportArray=[this.viewport.x,this.viewport.y,this.viewport.width,this.viewport.height]),t.kerning!=null&&(this.kerning=t.kerning),t.offset!=null&&(typeof t.offset=="number"&&(t.offset=[t.offset,0]),this.positionOffset=EBt(t.offset)),t.direction&&(this.direction=t.direction),t.range&&(this.range=t.range,this.scale=[1/(t.range[2]-t.range[0]),1/(t.range[3]-t.range[1])],this.translate=[-t.range[0],-t.range[1]]),t.scale&&(this.scale=t.scale),t.translate&&(this.translate=t.translate),this.scale||(this.scale=[1/this.viewport.width,1/this.viewport.height]),this.translate||(this.translate=[0,0]),!this.font.length&&!t.font&&(t.font=Vu.baseFontSize+"px sans-serif");var n=!1,i=!1;if(t.font&&(Array.isArray(t.font)?t.font:[t.font]).forEach(function(ke,ge){if(typeof ke=="string")try{ke=fA.parse(ke)}catch(Ge){ke=fA.parse(Vu.baseFontSize+"px "+ke)}else{var ie=ke.style,Te=ke.weight,Ee=ke.stretch,Ae=ke.variant;ke=fA.parse(fA.stringify(ke)),ie&&(ke.style=ie),Te&&(ke.weight=Te),Ee&&(ke.stretch=Ee),Ae&&(ke.variant=Ae)}var ze=fA.stringify({size:Vu.baseFontSize,family:ke.family,stretch:_F?ke.stretch:void 0,variant:ke.variant,weight:ke.weight,style:ke.style}),Ce=wBt(ke.size),me=Math.round(Ce[0]*TBt(Ce[1]));if(me!==r.fontSize[ge]&&(i=!0,r.fontSize[ge]=me),(!r.font[ge]||ze!=r.font[ge].baseString)&&(n=!0,r.font[ge]=Vu.fonts[ze],!r.font[ge])){var Re=ke.family.join(", "),ce=[ke.style];ke.style!=ke.variant&&ce.push(ke.variant),ke.variant!=ke.weight&&ce.push(ke.weight),_F&&ke.weight!=ke.stretch&&ce.push(ke.stretch),r.font[ge]={baseString:ze,family:Re,weight:ke.weight,stretch:ke.stretch,style:ke.style,variant:ke.variant,width:{},kerning:{},metrics:MBt(Re,{origin:"top",fontSize:Vu.baseFontSize,fontStyle:ce.join(" ")})},Vu.fonts[ze]=r.font[ge]}}),(n||i)&&this.font.forEach(function(ke,ge){var ie=fA.stringify({size:r.fontSize[ge],family:ke.family,stretch:_F?ke.stretch:void 0,variant:ke.variant,weight:ke.weight,style:ke.style});if(r.fontAtlas[ge]=r.shader.atlas[ie],!r.fontAtlas[ge]){var Te=ke.metrics;r.shader.atlas[ie]=r.fontAtlas[ge]={fontString:ie,step:Math.ceil(r.fontSize[ge]*Te.bottom*.5)*2,em:r.fontSize[ge],cols:0,rows:0,height:0,width:0,chars:[],ids:{},texture:r.regl.texture()}}t.text==null&&(t.text=r.text)}),typeof t.text=="string"&&t.position&&t.position.length>2){for(var a=Array(t.position.length*.5),o=0;o<a.length;o++)a[o]=t.text;t.text=a}var s;if(t.text!=null||n){if(this.textOffsets=[0],Array.isArray(t.text)){this.count=t.text[0].length,this.counts=[this.count];for(var l=1;l<t.text.length;l++)this.textOffsets[l]=this.textOffsets[l-1]+t.text[l-1].length,this.count+=t.text[l].length,this.counts.push(t.text[l].length);this.text=t.text.join("")}else this.text=t.text,this.count=this.text.length,this.counts=[this.count];s=[],this.font.forEach(function(ke,ge){Vu.atlasContext.font=ke.baseString;for(var ie=r.fontAtlas[ge],Te=0;Te<r.text.length;Te++){var Ee=r.text.charAt
|
|||
|
`),vUt=["precision highp float;","","varying vec4 fragColor;","","void main() {"," gl_FragColor = fragColor;","}"].join(`
|
|||
|
`),Mk=Ak().maxDimensionCount,oNe=Mr(),tNe=1e-6,zF=2048,pUt=new Uint8Array(4),rNe=new Uint8Array(4),iNe={shape:[256,1],format:"rgba",type:"uint8",mag:"nearest",min:"nearest"};function gUt(e){e.read({x:0,y:0,width:1,height:1,data:pUt})}function sNe(e,t,r,n,i){var a=e._gl;a.enable(a.SCISSOR_TEST),a.scissor(t,r,n,i),e.clear({color:[0,0,0,0],depth:1})}function mUt(e,t,r,n,i,a){var o=a.key;function s(l){var u=Math.min(n,i-l*n);l===0&&(window.cancelAnimationFrame(r.currentRafs[o]),delete r.currentRafs[o],sNe(e,a.scissorX,a.scissorY,a.scissorWidth,a.viewBoxSize[1])),!r.clearOnly&&(a.count=2*u,a.offset=2*l*n,t(a),l*n+u<i&&(r.currentRafs[o]=window.requestAnimationFrame(function(){s(l+1)})),r.drawCompleted=!1)}r.drawCompleted||(gUt(e),r.drawCompleted=!0),s(0)}function yUt(e){return Math.max(tNe,Math.min(1-tNe,e))}function _Ut(e,t){for(var r=new Array(256),n=0;n<256;n++)r[n]=e(n/255).concat(t);return r}function _K(e,t){return(e>>>8*t)%256/255}function xUt(e,t,r){for(var n=new Array(e*(Mk+4)),i=0,a=0;a<e;a++){for(var o=0;o<Mk;o++)n[i++]=o<t.length?t[o].paddedUnitValues[a]:.5;n[i++]=_K(a,2),n[i++]=_K(a,1),n[i++]=_K(a,0),n[i++]=yUt(r[a])}return n}function bUt(e,t,r){for(var n=new Array(t*8),i=0,a=0;a<t;a++)for(var o=0;o<2;o++)for(var s=0;s<4;s++){var l=e*4+s,u=r[a*64+l];l===63&&o===0&&(u*=-1),n[i++]=u}return n}function nNe(e){var t="0"+e;return t.substr(t.length-2)}function lNe(e){return e<Mk?"p"+nNe(e+1)+"_"+nNe(e+4):"colors"}function wUt(e,t,r){for(var n=0;n<=Mk;n+=4)e[lNe(n)](bUt(n/4,t,r))}function TUt(e){for(var t={},r=0;r<=Mk;r+=4)t[lNe(r)]=e.buffer({usage:"dynamic",type:"float",data:new Uint8Array(0)});return t}function AUt(e,t,r,n,i,a,o,s,l,u,c,f,h,d){for(var v=[[],[]],x=0;x<64;x++)v[0][x]=x===i?1:0,v[1][x]=x===a?1:0;o*=d,s*=d,l*=d,u*=d;var b=e.lines.canvasOverdrag*d,p=e.domain,E=e.canvasWidth*d,k=e.canvasHeight*d,A=e.pad.l*d,L=e.pad.b*d,_=e.layoutHeight*d,C=e.layoutWidth*d,M=e.deselectedLines.color,g=e.deselectedLines.opacity,P=oNe.extendFlat({key:c,resolution:[E,k],viewBoxPos:[o+b,s],viewBoxSize:[l,u],i0:i,i1:a,dim0A:v[0].slice(0,16),dim0B:v[0].slice(16,32),dim0C:v[0].slice(32,48),dim0D:v[0].slice(48,64),dim1A:v[1].slice(0,16),dim1B:v[1].slice(16,32),dim1C:v[1].slice(32,48),dim1D:v[1].slice(48,64),drwLayer:f,contextColor:[M[0]/255,M[1]/255,M[2]/255,g!=="auto"?M[3]*g:Math.max(1/255,Math.pow(1/e.lines.color.length,1/3))],scissorX:(n===t?0:o+b)+(A-b)+C*p.x[0],scissorWidth:(n===r?E-o+b:l+.5)+(n===t?o+b:0),scissorY:s+L+_*p.y[0],scissorHeight:u,viewportX:A-b+C*p.x[0],viewportY:L+_*p.y[0],viewportWidth:E,viewportHeight:k},h);return P}function aNe(e){var t=zF-1,r=Math.max(0,Math.floor(e[0]*t),0),n=Math.min(t,Math.ceil(e[1]*t),t);return[Math.min(r,n),Math.max(r,n)]}uNe.exports=function(e,t){var r=t.context,n=t.pick,i=t.regl,a=i._gl,o=a.getParameter(a.ALIASED_LINE_WIDTH_RANGE),s=Math.max(o[0],Math.min(o[1],t.viewModel.plotGlPixelRatio)),l={currentRafs:{},drawCompleted:!0,clearOnly:!1},u,c,f,h,d=TUt(i),v,x=i.texture(iNe),b=[];E(t);var p=i({profile:!1,blend:{enable:r,func:{srcRGB:"src alpha",dstRGB:"one minus src alpha",srcAlpha:1,dstAlpha:1},equation:{rgb:"add",alpha:"add"},color:[0,0,0,0]},depth:{enable:!r,mask:!0,func:"less",range:[0,1]},cull:{enable:!0,face:"back"},scissor:{enable:!0,box:{x:i.prop("scissorX"),y:i.prop("scissorY"),width:i.prop("scissorWidth"),height:i.prop("scissorHeight")}},viewport:{x:i.prop("viewportX"),y:i.prop("viewportY"),width:i.prop("viewportWidth"),height:i.prop("viewportHeight")},dither:!1,vert:dUt,frag:vUt,primitive:"lines",lineWidth:s,attributes:d,uniforms:{resolution:i.prop("resolution"),viewBoxPos:i.prop("viewBoxPos"),viewBoxSize:i.prop("viewBoxSize"),dim0A:i.prop("dim0A"),dim1A:i.prop("dim1A"),dim0B:i.prop("dim0B"),dim1B:i.prop("dim1B"),dim0C:i.prop("dim0C"),dim1C:i.prop("dim1C"),dim0D:i.prop("dim0D"),dim1D:i.prop("dim1D"),loA:i.prop("loA"),hiA:i.prop("hiA"),loB:i.prop("loB"),hiB:i.prop("hiB"),loC:i.prop("loC"),hiC:i.prop("hiC"),loD:i.prop("loD"),hiD:i.prop("hiD"),palette:x,contextColor:i.prop("contextColor"),maskTexture:i.prop("maskTexture"),drwLayer:i.prop("drwLayer"),maskHeight:i.prop("maskHeight")},
|
|||
|
`),noAccessTokenErrorMsg:["Missing Mapbox access token.","Mapbox trace type require a Mapbox access token to be registered.","For example:"," Plotly.newPlot(gd, data, layout, { mapboxAccessToken: 'my-access-token' });","More info here: https://www.mapbox.com/help/define-access-token/"].join(`
|
|||
|
`),missingStyleErrorMsg:["No valid mapbox style found, please set `mapbox.style` to one of:",hUe.join(", "),"or register a Mapbox access token to use a Mapbox-served style."].join(`
|
|||
|
`),multipleTokensErrorMsg:["Set multiple mapbox access token across different mapbox subplot,","using first token found as mapbox-gl does not allow multipleaccess tokens on the same page."].join(`
|
|||
|
`),mapOnErrorMsg:"Mapbox error.",mapboxLogo:{path0:"m 10.5,1.24 c -5.11,0 -9.25,4.15 -9.25,9.25 0,5.1 4.15,9.25 9.25,9.25 5.1,0 9.25,-4.15 9.25,-9.25 0,-5.11 -4.14,-9.25 -9.25,-9.25 z m 4.39,11.53 c -1.93,1.93 -4.78,2.31 -6.7,2.31 -0.7,0 -1.41,-0.05 -2.1,-0.16 0,0 -1.02,-5.64 2.14,-8.81 0.83,-0.83 1.95,-1.28 3.13,-1.28 1.27,0 2.49,0.51 3.39,1.42 1.84,1.84 1.89,4.75 0.14,6.52 z",path1:"M 10.5,-0.01 C 4.7,-0.01 0,4.7 0,10.49 c 0,5.79 4.7,10.5 10.5,10.5 5.8,0 10.5,-4.7 10.5,-10.5 C 20.99,4.7 16.3,-0.01 10.5,-0.01 Z m 0,19.75 c -5.11,0 -9.25,-4.15 -9.25,-9.25 0,-5.1 4.14,-9.26 9.25,-9.26 5.11,0 9.25,4.15 9.25,9.25 0,5.13 -4.14,9.26 -9.25,9.26 z",path2:"M 14.74,6.25 C 12.9,4.41 9.98,4.35 8.23,6.1 5.07,9.27 6.09,14.91 6.09,14.91 c 0,0 5.64,1.02 8.81,-2.14 C 16.64,11 16.59,8.09 14.74,6.25 Z m -2.27,4.09 -0.91,1.87 -0.9,-1.87 -1.86,-0.91 1.86,-0.9 0.9,-1.87 0.91,1.87 1.86,0.9 z",polygon:"11.56,12.21 10.66,10.34 8.8,9.43 10.66,8.53 11.56,6.66 12.47,8.53 14.33,9.43 12.47,10.34"},styleRules:{map:"overflow:hidden;position:relative;","missing-css":"display:none;",canary:"background-color:salmon;","ctrl-bottom-left":"position: absolute; pointer-events: none; z-index: 2; bottom: 0; left: 0;","ctrl-bottom-right":"position: absolute; pointer-events: none; z-index: 2; right: 0; bottom: 0;",ctrl:"clear: both; pointer-events: auto; transform: translate(0, 0);","ctrl-attrib.mapboxgl-compact .mapboxgl-ctrl-attrib-inner":"display: none;","ctrl-attrib.mapboxgl-compact:hover .mapboxgl-ctrl-attrib-inner":"display: block; margin-top:2px","ctrl-attrib.mapboxgl-compact:hover":"padding: 2px 24px 2px 4px; visibility: visible; margin-top: 6px;","ctrl-attrib.mapboxgl-compact::after":`content: ""; cursor: pointer; position: absolute; background-image: url('data:image/svg+xml;charset=utf-8,%3Csvg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"%3E %3Cpath fill="%23333333" fill-rule="evenodd" d="M4,10a6,6 0 1,0 12,0a6,6 0 1,0 -12,0 M9,7a1,1 0 1,0 2,0a1,1 0 1,0 -2,0 M9,10a1,1 0 1,1 2,0l0,3a1,1 0 1,1 -2,0"/%3E %3C/svg%3E'); background-color: rgba(255, 255, 255, 0.5); width: 24px; height: 24px; box-sizing: border-box; border-radius: 12px;`,"ctrl-attrib.mapboxgl-compact":"min-height: 20px; padding: 0; margin: 10px; position: relative; background-color: #fff; border-radius: 3px 12px 12px 3px;","ctrl-bottom-right > .mapboxgl-ctrl-attrib.mapboxgl-compact::after":"bottom: 0; right: 0","ctrl-bottom-left > .mapboxgl-ctrl-attrib.mapboxgl-compact::after":"bottom: 0; left: 0","ctrl-bottom-left .mapboxgl-ctrl":"margin: 0 0 10px 10px; float: left;","ctrl-bottom-right .mapboxgl-ctrl":"margin: 0 10px 10px 0; float: right;","ctrl-attrib":"color: rgba(0, 0, 0, 0.75); text-decoration: none; font-size: 12px","ctrl-attrib a":"color: rgba(0, 0, 0, 0.75); text-decoration: none; font-size: 12px","ctrl-attrib a:hover":"color: inherit; text-decoration: underline;","ctrl-attrib .mapbox-improve-map":"font-weight: bold; margin-left: 2px;","attrib-empty":"display: none;","ctrl-logo":`display:block; width: 21px; height: 21px; background-image: url('data:image/svg+xml;charset=utf-8,%3C?xml version="1.0" encoding="utf-8"?%3E %3Csvg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 21 21" style="enable-background:new 0 0 21 21;" xml:space="preserve"%3E%3Cg transform="translate(0,0.01)"%3E%3Cpath d="m 10.5,1.24 c -5.11,0 -9.25,4.15 -9.25,9.25 0,5.1 4.15,9.25 9.25,9.25 5.1,0 9.25,-4.15 9.25,-9.25 0,-5.11 -4.14,-9.25 -9.25,-9.25 z m 4.39,11.53 c -1.93,1.93 -4.78,2.31 -6.7,2.31 -0.7,0 -1.41,-0.05 -2.1,-0.16 0,0 -1.02,-5.64 2.14,-8.81 0.83,-0.83 1.95,-1.28 3.13,-1.28 1.27,0 2.49,0.51 3.39,1.42 1.84,1.84 1.89,4.75 0.14,6.52 z" style="opacity:0.9;fill:%23ffffff;enable-background:new" class="st0"/%3E%3Cpath d="M 10.5,-0.01 C 4.7,-0.01 0,4.7 0,10.49 c 0,5.79 4.7,10.5 10.5,10.5 5.8,0 10.5,-4.7 10.5,-10.5 C 20.99,4.7 16.3,-0.01 10.5,-0.01 Z m 0,19.75 c -5.11,0 -9.25,-4.15 -9.25,-9.25 0,-5.1 4.14,-9.26 9.25,-9.26 5.11,0 9.25,4.15 9.25,9.25 0,5.13 -4.14,9.26 -9.25,9.26 z" style="opacity:0.35;enable-background:new"
|
|||
|
`)),c.push({type:"Feature",geometry:{type:"Point",coordinates:h.lonlat},properties:{symbol:s(f),angle:l(f),text:v}})}}return{type:"FeatureCollection",features:c}}function GK(e,t){return iv.isArrayOrTypedArray(e)?t?function(r){return RUe(e[r])?+e[r]:0}:function(r){return e[r]}:e?function(){return e}:GF}function GF(){return""}function DUe(e){return e[0]===uHt}function jK(e,t){var r;if(iv.isArrayOrTypedArray(e)&&iv.isArrayOrTypedArray(t)){r=["step",["get","point_count"],e[0]];for(var n=1;n<e.length;n++)r.push(t[n-1],e[n])}else r=e;return r}function IUe(e){var t=e.textfont,r=t.family,n=t.style,i=t.weight,a=r.split(" "),o=a[a.length-1]==="Italic";o&&a.pop(),o=o||n==="italic";var s=a.join(" ");i==="bold"&&a.indexOf("Bold")===-1?s+=" Bold":i<=1e3&&(a[0]==="Metropolis"?(s="Metropolis",i>850?s+=" Black":i>750?s+=" Extra Bold":i>650?s+=" Bold":i>550?s+=" Semi Bold":i>450?s+=" Medium":i>350?s+=" Regular":i>250?s+=" Light":i>150?s+=" Extra Light":s+=" Thin"):a.slice(0,2).join(" ")==="Open Sans"?(s="Open Sans",i>750?s+=" Extrabold":i>650?s+=" Bold":i>550?s+=" Semibold":i>350?s+=" Regular":s+=" Light"):a.slice(0,3).join(" ")==="Klokantech Noto Sans"&&(s="Klokantech Noto Sans",a[3]==="CJK"&&(s+=" CJK"),s+=i>500?" Bold":" Regular")),o&&(s+=" Italic"),s==="Open Sans Regular Italic"?s="Open Sans Italic":s==="Open Sans Regular Bold"?s="Open Sans Bold":s==="Open Sans Regular Bold Italic"?s="Open Sans Bold Italic":s==="Klokantech Noto Sans Regular Italic"&&(s="Klokantech Noto Sans Italic"),hHt(s)||(s=r);var l=s.split(", ");return l}});var NUe=ye((zyr,BUe)=>{"use strict";var _Ht=Mr(),qUe=FUe(),bA=c1().traceLayerPrefix,rg={cluster:["cluster","clusterCount","circle"],nonCluster:["fill","line","circle","symbol"]};function OUe(e,t,r,n){this.type="scattermapbox",this.subplot=e,this.uid=t,this.clusterEnabled=r,this.isHidden=n,this.sourceIds={fill:"source-"+t+"-fill",line:"source-"+t+"-line",circle:"source-"+t+"-circle",symbol:"source-"+t+"-symbol",cluster:"source-"+t+"-circle",clusterCount:"source-"+t+"-circle"},this.layerIds={fill:bA+t+"-fill",line:bA+t+"-line",circle:bA+t+"-circle",symbol:bA+t+"-symbol",cluster:bA+t+"-cluster",clusterCount:bA+t+"-cluster-count"},this.below=null}var Fk=OUe.prototype;Fk.addSource=function(e,t,r){var n={type:"geojson",data:t.geojson};r&&r.enabled&&_Ht.extendFlat(n,{cluster:!0,clusterMaxZoom:r.maxzoom});var i=this.subplot.map.getSource(this.sourceIds[e]);i?i.setData(t.geojson):this.subplot.map.addSource(this.sourceIds[e],n)};Fk.setSourceData=function(e,t){this.subplot.map.getSource(this.sourceIds[e]).setData(t.geojson)};Fk.addLayer=function(e,t,r){var n={type:t.type,id:this.layerIds[e],source:this.sourceIds[e],layout:t.layout,paint:t.paint};t.filter&&(n.filter=t.filter);for(var i=this.layerIds[e],a,o=this.subplot.getMapLayers(),s=0;s<o.length;s++)if(o[s].id===i){a=!0;break}a?(this.subplot.setOptions(i,"setLayoutProperty",n.layout),n.layout.visibility==="visible"&&this.subplot.setOptions(i,"setPaintProperty",n.paint)):this.subplot.addLayer(n,r)};Fk.update=function(t){var r=t[0].trace,n=this.subplot,i=n.map,a=qUe(n.gd,t),o=n.belowLookup["trace-"+this.uid],s=!!(r.cluster&&r.cluster.enabled),l=!!this.clusterEnabled,u=this;function c(k){k||u.addSource("circle",a.circle,r.cluster);for(var A=rg.cluster,L=0;L<A.length;L++){var _=A[L],C=a[_];u.addLayer(_,C,o)}}function f(k){for(var A=rg.cluster,L=A.length-1;L>=0;L--){var _=A[L];i.removeLayer(u.layerIds[_])}k||i.removeSource(u.sourceIds.circle)}function h(k){for(var A=rg.nonCluster,L=0;L<A.length;L++){var _=A[L],C=a[_];k||u.addSource(_,C),u.addLayer(_,C,o)}}function d(k){for(var A=rg.nonCluster,L=A.length-1;L>=0;L--){var _=A[L];i.removeLayer(u.layerIds[_]),k||i.removeSource(u.sourceIds[_])}}function v(k){l?f(k):d(k)}function x(k){s?c(k):h(k)}function b(){for(var k=s?rg.cluster:rg.nonCluster,A=0;A<k.length;A++){var L=k[A],_=a[L];_&&(n.setOptions(u.layerIds[L],"setLayoutProperty",_.layout),_.layout.visibility==="visible"&&(L!=="cluster"&&u.setSourceData(L,_),n.setOptions(u.layerIds[L],"setPaintProperty",_.paint)))}}var p=this.isHidden,E=r.visible!==!0;E?p||v():p?E||x():l!==s?(v
|
|||
|
precision mediump float;
|
|||
|
#else
|
|||
|
#if !defined(lowp)
|
|||
|
#define lowp
|
|||
|
#endif
|
|||
|
#if !defined(mediump)
|
|||
|
#define mediump
|
|||
|
#endif
|
|||
|
#if !defined(highp)
|
|||
|
#define highp
|
|||
|
#endif
|
|||
|
#endif`,Gc=`#ifdef GL_ES
|
|||
|
precision highp float;
|
|||
|
#else
|
|||
|
#if !defined(lowp)
|
|||
|
#define lowp
|
|||
|
#endif
|
|||
|
#if !defined(mediump)
|
|||
|
#define mediump
|
|||
|
#endif
|
|||
|
#if !defined(highp)
|
|||
|
#define highp
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
|
|||
|
);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}`,vd=`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,Bf="attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}",ss=`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,ff="uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}",ih=`varying vec3 v_data;
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define mediump float radius
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define highp vec4 stroke_color
|
|||
|
#pragma mapbox: define mediump float stroke_width
|
|||
|
#pragma mapbox: define lowp float stroke_opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize mediump float radius
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize highp vec4 stroke_color
|
|||
|
#pragma mapbox: initialize mediump float stroke_width
|
|||
|
#pragma mapbox: initialize lowp float stroke_opacity
|
|||
|
vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,Vl=`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define mediump float radius
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define highp vec4 stroke_color
|
|||
|
#pragma mapbox: define mediump float stroke_width
|
|||
|
#pragma mapbox: define lowp float stroke_opacity
|
|||
|
void main(void) {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize mediump float radius
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize highp vec4 stroke_color
|
|||
|
#pragma mapbox: initialize mediump float stroke_width
|
|||
|
#pragma mapbox: initialize lowp float stroke_opacity
|
|||
|
vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,0,1);} else {gl_Position=u_matrix*vec4(circle_center,0,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`,Js="void main() {gl_FragColor=vec4(1.0);}",hc="attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}",Cc=`uniform highp float u_intensity;varying vec2 v_extrude;
|
|||
|
#pragma mapbox: define highp float weight
|
|||
|
#define GAUSS_COEF 0.3989422804014327
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp float weight
|
|||
|
float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,ws=`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;
|
|||
|
#pragma mapbox: define highp float weight
|
|||
|
#pragma mapbox: define mediump float radius
|
|||
|
const highp float ZERO=1.0/255.0/16.0;
|
|||
|
#define GAUSS_COEF 0.3989422804014327
|
|||
|
void main(void) {
|
|||
|
#pragma mapbox: initialize highp float weight
|
|||
|
#pragma mapbox: initialize mediump float radius
|
|||
|
vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`,$s=`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(0.0);
|
|||
|
#endif
|
|||
|
}`,hs="uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}",Ms="varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}",dc="attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,0.0,1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}",Sl="varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}",ec="attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}",Ps="uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}",ov="attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,0,1);}",wo=`#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
gl_FragColor=color*opacity;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,Od=`attribute vec2 a_pos;uniform mat4 u_matrix;
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
gl_Position=u_matrix*vec4(a_pos,0,1);}`,$o=`varying vec2 v_pos;
|
|||
|
#pragma mapbox: define highp vec4 outline_color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 outline_color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,Ja=`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
|
|||
|
#pragma mapbox: define highp vec4 outline_color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 outline_color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`,Ef=`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,tc=`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_to
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|||
|
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`,uu=`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,Mh=`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_to
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|||
|
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`,jc=`varying vec4 v_color;void main() {gl_FragColor=v_color;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,kf=`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec4 v_color;
|
|||
|
#pragma mapbox: define highp float base
|
|||
|
#pragma mapbox: define highp float height
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp float base
|
|||
|
#pragma mapbox: initialize highp float height
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
vec3 normal=a_normal_ed.xyz;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`,Ml=`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
|
|||
|
#pragma mapbox: define lowp float base
|
|||
|
#pragma mapbox: define lowp float height
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_to
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float base
|
|||
|
#pragma mapbox: initialize lowp float height
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|||
|
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,Yh=`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
|
|||
|
#pragma mapbox: define lowp float base
|
|||
|
#pragma mapbox: define lowp float height
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_to
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float base
|
|||
|
#pragma mapbox: initialize lowp float height
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|||
|
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
|
|||
|
? a_pos
|
|||
|
: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`,Eh=`#ifdef GL_ES
|
|||
|
precision highp float;
|
|||
|
#endif
|
|||
|
uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,nh="uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}",hf=`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
|
|||
|
#define PI 3.141592653589793
|
|||
|
void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,kh="uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}",Kh=`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,rc=`
|
|||
|
#define scale 0.015873016
|
|||
|
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define mediump float gapwidth
|
|||
|
#pragma mapbox: define lowp float offset
|
|||
|
#pragma mapbox: define mediump float width
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump float gapwidth
|
|||
|
#pragma mapbox: initialize lowp float offset
|
|||
|
#pragma mapbox: initialize mediump float width
|
|||
|
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}`,ah=`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,Wc=`
|
|||
|
#define scale 0.015873016
|
|||
|
attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define mediump float gapwidth
|
|||
|
#pragma mapbox: define lowp float offset
|
|||
|
#pragma mapbox: define mediump float width
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump float gapwidth
|
|||
|
#pragma mapbox: initialize lowp float offset
|
|||
|
#pragma mapbox: initialize mediump float width
|
|||
|
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}`,df=`uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_to
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,Cu=`
|
|||
|
#define scale 0.015873016
|
|||
|
#define LINE_DISTANCE_SCALE 2.0
|
|||
|
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp float offset
|
|||
|
#pragma mapbox: define mediump float gapwidth
|
|||
|
#pragma mapbox: define mediump float width
|
|||
|
#pragma mapbox: define lowp float floorwidth
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_to
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize lowp float offset
|
|||
|
#pragma mapbox: initialize mediump float gapwidth
|
|||
|
#pragma mapbox: initialize mediump float width
|
|||
|
#pragma mapbox: initialize lowp float floorwidth
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|||
|
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`,Nf=`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define mediump float width
|
|||
|
#pragma mapbox: define lowp float floorwidth
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump float width
|
|||
|
#pragma mapbox: initialize lowp float floorwidth
|
|||
|
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,Zc=`
|
|||
|
#define scale 0.015873016
|
|||
|
#define LINE_DISTANCE_SCALE 2.0
|
|||
|
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define mediump float gapwidth
|
|||
|
#pragma mapbox: define lowp float offset
|
|||
|
#pragma mapbox: define mediump float width
|
|||
|
#pragma mapbox: define lowp float floorwidth
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump float gapwidth
|
|||
|
#pragma mapbox: initialize lowp float offset
|
|||
|
#pragma mapbox: initialize mediump float width
|
|||
|
#pragma mapbox: initialize lowp float floorwidth
|
|||
|
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`,ds=`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,Ch="uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}",Bd=`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,Jh=`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|||
|
camera_to_anchor_distance/u_camera_to_center_distance :
|
|||
|
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),0.0,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));}`,Cf=`#define SDF_PX 8.0
|
|||
|
uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;
|
|||
|
#pragma mapbox: define highp vec4 fill_color
|
|||
|
#pragma mapbox: define highp vec4 halo_color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp float halo_width
|
|||
|
#pragma mapbox: define lowp float halo_blur
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 fill_color
|
|||
|
#pragma mapbox: initialize highp vec4 halo_color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize lowp float halo_width
|
|||
|
#pragma mapbox: initialize lowp float halo_blur
|
|||
|
float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,pd=`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;
|
|||
|
#pragma mapbox: define highp vec4 fill_color
|
|||
|
#pragma mapbox: define highp vec4 halo_color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp float halo_width
|
|||
|
#pragma mapbox: define lowp float halo_blur
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 fill_color
|
|||
|
#pragma mapbox: initialize highp vec4 halo_color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize lowp float halo_width
|
|||
|
#pragma mapbox: initialize lowp float halo_blur
|
|||
|
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|||
|
camera_to_anchor_distance/u_camera_to_center_distance :
|
|||
|
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`,Lu=`#define SDF_PX 8.0
|
|||
|
#define SDF 1.0
|
|||
|
#define ICON 0.0
|
|||
|
uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;
|
|||
|
#pragma mapbox: define highp vec4 fill_color
|
|||
|
#pragma mapbox: define highp vec4 halo_color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp float halo_width
|
|||
|
#pragma mapbox: define lowp float halo_blur
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 fill_color
|
|||
|
#pragma mapbox: initialize highp vec4 halo_color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize lowp float halo_width
|
|||
|
#pragma mapbox: initialize lowp float halo_blur
|
|||
|
float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,$h=`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;
|
|||
|
#pragma mapbox: define highp vec4 fill_color
|
|||
|
#pragma mapbox: define highp vec4 halo_color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp float halo_width
|
|||
|
#pragma mapbox: define lowp float halo_blur
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 fill_color
|
|||
|
#pragma mapbox: initialize highp vec4 halo_color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize lowp float halo_width
|
|||
|
#pragma mapbox: initialize lowp float halo_blur
|
|||
|
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|||
|
camera_to_anchor_distance/u_camera_to_center_distance :
|
|||
|
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`,tu=Is(Of,Gc),Pu=Is(vd,Bf),Lc=Is(ss,ff),fl=Is(ih,Vl),Xc=Is(Js,hc),ic=Is(Cc,ws),yu=Is($s,hs),Qs=Is(Ms,dc),Qh=Is(Sl,ec),gd=Is(Ps,ov),Gu=Is(wo,Od),Pc=Is($o,Ja),vc=Is(Ef,tc),sv=Is(uu,Mh),Lf=Is(jc,kf),Uf=Is(Ml,Yh),Iu=Is(Eh,nh),oh=Is(hf,kh),ru=Is(Kh,rc),vf=Is(ah,Wc),md=Is(df,Cu),sh=Is(Nf,Zc),Fs=Is(ds,Ch),_u=Is(Bd,Jh),xu=Is(Cf,pd),Lh=Is(Lu,$h);function Is(Y,z){var K=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,O=z.match(/attribute ([\w]+) ([\w]+)/g),$=Y.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),pe=z.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),de=pe?pe.concat($):$,Ie={};return Y=Y.replace(K,function($e,pt,Kt,ir,Jt){return Ie[Jt]=!0,pt==="define"?`
|
|||
|
#ifndef HAS_UNIFORM_u_`+Jt+`
|
|||
|
varying `+Kt+" "+ir+" "+Jt+`;
|
|||
|
#else
|
|||
|
uniform `+Kt+" "+ir+" u_"+Jt+`;
|
|||
|
#endif
|
|||
|
`:`
|
|||
|
#ifdef HAS_UNIFORM_u_`+Jt+`
|
|||
|
`+Kt+" "+ir+" "+Jt+" = u_"+Jt+`;
|
|||
|
#endif
|
|||
|
`}),z=z.replace(K,function($e,pt,Kt,ir,Jt){var vt=ir==="float"?"vec2":"vec4",Pt=Jt.match(/color/)?"color":vt;return Ie[Jt]?pt==="define"?`
|
|||
|
#ifndef HAS_UNIFORM_u_`+Jt+`
|
|||
|
uniform lowp float u_`+Jt+`_t;
|
|||
|
attribute `+Kt+" "+vt+" a_"+Jt+`;
|
|||
|
varying `+Kt+" "+ir+" "+Jt+`;
|
|||
|
#else
|
|||
|
uniform `+Kt+" "+ir+" u_"+Jt+`;
|
|||
|
#endif
|
|||
|
`:Pt==="vec4"?`
|
|||
|
#ifndef HAS_UNIFORM_u_`+Jt+`
|
|||
|
`+Jt+" = a_"+Jt+`;
|
|||
|
#else
|
|||
|
`+Kt+" "+ir+" "+Jt+" = u_"+Jt+`;
|
|||
|
#endif
|
|||
|
`:`
|
|||
|
#ifndef HAS_UNIFORM_u_`+Jt+`
|
|||
|
`+Jt+" = unpack_mix_"+Pt+"(a_"+Jt+", u_"+Jt+`_t);
|
|||
|
#else
|
|||
|
`+Kt+" "+ir+" "+Jt+" = u_"+Jt+`;
|
|||
|
#endif
|
|||
|
`:pt==="define"?`
|
|||
|
#ifndef HAS_UNIFORM_u_`+Jt+`
|
|||
|
uniform lowp float u_`+Jt+`_t;
|
|||
|
attribute `+Kt+" "+vt+" a_"+Jt+`;
|
|||
|
#else
|
|||
|
uniform `+Kt+" "+ir+" u_"+Jt+`;
|
|||
|
#endif
|
|||
|
`:Pt==="vec4"?`
|
|||
|
#ifndef HAS_UNIFORM_u_`+Jt+`
|
|||
|
`+Kt+" "+ir+" "+Jt+" = a_"+Jt+`;
|
|||
|
#else
|
|||
|
`+Kt+" "+ir+" "+Jt+" = u_"+Jt+`;
|
|||
|
#endif
|
|||
|
`:`
|
|||
|
#ifndef HAS_UNIFORM_u_`+Jt+`
|
|||
|
`+Kt+" "+ir+" "+Jt+" = unpack_mix_"+Pt+"(a_"+Jt+", u_"+Jt+`_t);
|
|||
|
#else
|
|||
|
`+Kt+" "+ir+" "+Jt+" = u_"+Jt+`;
|
|||
|
#endif
|
|||
|
`}),{fragmentSource:Y,vertexSource:z,staticAttributes:O,staticUniforms:de}}var Pf=Object.freeze({__proto__:null,prelude:tu,background:Pu,backgroundPattern:Lc,circle:fl,clippingMask:Xc,heatmap:ic,heatmapTexture:yu,collisionBox:Qs,collisionCircle:Qh,debug:gd,fill:Gu,fillOutline:Pc,fillOutlinePattern:vc,fillPattern:sv,fillExtrusion:Lf,fillExtrusionPattern:Uf,hillshadePrepare:Iu,hillshade:oh,line:ru,lineGradient:vf,linePattern:md,lineSDF:sh,raster:Fs,symbolIcon:_u,symbolSDF:xu,symbolTextAndIcon:Lh}),Ic=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null};Ic.prototype.bind=function(z,K,O,$,pe,de,Ie,$e){this.context=z;for(var pt=this.boundPaintVertexBuffers.length!==$.length,Kt=0;!pt&&Kt<$.length;Kt++)this.boundPaintVertexBuffers[Kt]!==$[Kt]&&(pt=!0);var ir=!this.vao||this.boundProgram!==K||this.boundLayoutVertexBuffer!==O||pt||this.boundIndexBuffer!==pe||this.boundVertexOffset!==de||this.boundDynamicVertexBuffer!==Ie||this.boundDynamicVertexBuffer2!==$e;!z.extVertexArrayObject||ir?this.freshBind(K,O,$,pe,de,Ie,$e):(z.bindVertexArrayOES.set(this.vao),Ie&&Ie.bind(),pe&&pe.dynamicDraw&&pe.bind(),$e&&$e.bind())},Ic.prototype.freshBind=function(z,K,O,$,pe,de,Ie){var $e,pt=z.numAttributes,Kt=this.context,ir=Kt.gl;if(Kt.extVertexArrayObject)this.vao&&this.destroy(),this.vao=Kt.extVertexArrayObject.createVertexArrayOES(),Kt.bindVertexArrayOES.set(this.vao),$e=0,this.boundProgram=z,this.boundLayoutVertexBuffer=K,this.boundPaintVertexBuffers=O,this.boundIndexBuffer=$,this.boundVertexOffset=pe,this.boundDynamicVertexBuffer=de,this.boundDynamicVertexBuffer2=Ie;else{$e=Kt.currentNumAttributes||0;for(var Jt=pt;Jt<$e;Jt++)ir.disableVertexAttribArray(Jt)}K.enableAttributes(ir,z);for(var vt=0,Pt=O;vt<Pt.length;vt+=1){var Wt=Pt[vt];Wt.enableAttributes(ir,z)}de&&de.enableAttributes(ir,z),Ie&&Ie.enableAttributes(ir,z),K.bind(),K.setVertexAttribPointers(ir,z,pe);for(var rr=0,dr=O;rr<dr.length;rr+=1){var pr=dr[rr];pr.bind(),pr.setVertexAttribPointers(ir,z,pe)}de&&(de.bind(),de.setVertexAttribPointers(ir,z,pe)),$&&$.bind(),Ie&&(Ie.bind(),Ie.setVertexAttribPointers(ir,z,pe)),Kt.currentNumAttributes=pt},Ic.prototype.destroy=function(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)};function ju(Y){for(var z=[],K=0;K<Y.length;K++)if(Y[K]!==null){var O=Y[K].split(" ");z.push(O.pop())}return z}var Vf=function(z,K,O,$,pe,de){var Ie=z.gl;this.program=Ie.createProgram();for(var $e=ju(O.staticAttributes),pt=$?$.getBinderAttributes():[],Kt=$e.concat(pt),ir=O.staticUniforms?ju(O.staticUniforms):[],Jt=$?$.getBinderUniforms():[],vt=ir.concat(Jt),Pt=[],Wt=0,rr=vt;Wt<rr.length;Wt+=1){var dr=rr[Wt];Pt.indexOf(dr)<0&&Pt.push(dr)}var pr=$?$.defines():[];de&&pr.push("#define OVERDRAW_INSPECTOR;");var kr=pr.concat(tu.fragmentSource,O.fragmentSource).join(`
|
|||
|
`),Ar=pr.concat(tu.vertexSource,O.vertexSource).join(`
|
|||
|
`),gr=Ie.createShader(Ie.FRAGMENT_SHADER);if(Ie.isContextLost()){this.failedToCreate=!0;return}Ie.shaderSource(gr,kr),Ie.compileShader(gr),Ie.attachShader(this.program,gr);var Cr=Ie.createShader(Ie.VERTEX_SHADER);if(Ie.isContextLost()){this.failedToCreate=!0;return}Ie.shaderSource(Cr,Ar),Ie.compileShader(Cr),Ie.attachShader(this.program,Cr),this.attributes={};var cr={};this.numAttributes=Kt.length;for(var Gr=0;Gr<this.numAttributes;Gr++)Kt[Gr]&&(Ie.bindAttribLocation(this.program,Gr,Kt[Gr]),this.attributes[Kt[Gr]]=Gr);Ie.linkProgram(this.program),Ie.deleteShader(Cr),Ie.deleteShader(gr);for(var ei=0;ei<Pt.length;ei++){var yi=Pt[ei];if(yi&&!cr[yi]){var tn=Ie.getUniformLocation(this.program,yi);tn&&(cr[yi]=tn)}}this.fixedUniforms=pe(z,cr),this.binderUniforms=$?$.getUniforms(z,cr):[]};Vf.prototype.draw=function(z,K,O,$,pe,de,Ie,$e,pt,Kt,ir,Jt,vt,Pt,Wt,rr){var dr,pr=z.gl;if(!this.failedToCreate){z.program.set(this.program),z.setDepthMode(O),z.setStencilMode($),z.setColorMode(pe),z.setCullFace(de);for(var kr in this.fixedUniforms)this.fixedUniforms[kr].set(Ie[kr]);Pt&&Pt.setUniforms(z,this.binderUniforms,Jt,{zoom:vt});for(var Ar=(dr={},dr[pr.LINES]=2,dr[pr.TRIANGLES]=3,dr[pr.LINE_STRIP]=1,dr)[K],gr=0,Cr=ir.get();gr<Cr.length;gr+=1){var cr=Cr[gr],Gr=cr.vaos||(cr.vaos={}),ei=Gr[$e]||(Gr[$e]=new Ic);ei.bind(z,this,pt,Pt?Pt.getPaintVertexBuffers():[],Kt,cr.vertexOffset,Wt,rr),pr.drawElements(K,cr.primitiveLength*Ar,pr.UNSIGNED_SHORT,cr.primitiveOffset*Ar*2)}}};function pc(Y,z,K){var O=1/Cs(K,1,z.transform.tileZoom),$=Math.pow(2,K.tileID.overscaledZ),pe=K.tileSize*Math.pow(2,z.transform.tileZoom)/$,de=pe*(K.tileID.canonical.x+K.tileID.wrap*$),Ie=pe*K.tileID.canonical.y;return{u_image:0,u_texsize:K.imageAtlasTexture.size,u_scale:[O,Y.fromScale,Y.toScale],u_fade:Y.t,u_pixel_coord_upper:[de>>16,Ie>>16],u_pixel_coord_lower:[de&65535,Ie&65535]}}function pf(Y,z,K,O){var $=K.imageManager.getPattern(Y.from.toString()),pe=K.imageManager.getPattern(Y.to.toString()),de=K.imageManager.getPixelSize(),Ie=de.width,$e=de.height,pt=Math.pow(2,O.tileID.overscaledZ),Kt=O.tileSize*Math.pow(2,K.transform.tileZoom)/pt,ir=Kt*(O.tileID.canonical.x+O.tileID.wrap*pt),Jt=Kt*O.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:$.tl,u_pattern_br_a:$.br,u_pattern_tl_b:pe.tl,u_pattern_br_b:pe.br,u_texsize:[Ie,$e],u_mix:z.t,u_pattern_size_a:$.displaySize,u_pattern_size_b:pe.displaySize,u_scale_a:z.fromScale,u_scale_b:z.toScale,u_tile_units_to_pixels:1/Cs(O,1,K.transform.tileZoom),u_pixel_coord_upper:[ir>>16,Jt>>16],u_pixel_coord_lower:[ir&65535,Jt&65535]}}var Ph=function(Y,z){return{u_matrix:new i.UniformMatrix4f(Y,z.u_matrix),u_lightpos:new i.Uniform3f(Y,z.u_lightpos),u_lightintensity:new i.Uniform1f(Y,z.u_lightintensity),u_lightcolor:new i.Uniform3f(Y,z.u_lightcolor),u_vertical_gradient:new i.Uniform1f(Y,z.u_vertical_gradient),u_opacity:new i.Uniform1f(Y,z.u_opacity)}},Dl=function(Y,z){return{u_matrix:new i.UniformMatrix4f(Y,z.u_matrix),u_lightpos:new i.Uniform3f(Y,z.u_lightpos),u_lightintensity:new i.Uniform1f(Y,z.u_lightintensity),u_lightcolor:new i.Uniform3f(Y,z.u_lightcolor),u_vertical_gradient:new i.Uniform1f(Y,z.u_vertical_gradient),u_height_factor:new i.Uniform1f(Y,z.u_height_factor),u_image:new i.Uniform1i(Y,z.u_image),u_texsize:new i.Uniform2f(Y,z.u_texsize),u_pixel_coord_upper:new i.Uniform2f(Y,z.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(Y,z.u_pixel_coord_lower),u_scale:new i.Uniform3f(Y,z.u_scale),u_fade:new i.Uniform1f(Y,z.u_fade),u_opacity:new i.Uniform1f(Y,z.u_opacity)}},Ih=function(Y,z,K,O){var $=z.style.light,pe=$.properties.get("position"),de=[pe.x,pe.y,pe.z],Ie=i.create$1();$.properties.get("anchor")==="viewport"&&i.fromRotation(Ie,-z.transform.angle),i.transformMat3(de,de,Ie);var $e=$.properties.get("color");return{u_matrix:Y,u_lightpos:de,u_lightintensity:$.properties.get("intensity"),u_lightcolor:[$e.r,$e.g,$e.b],u_vertical_gradient:+K,u_opacity:O}},Wu=function(Y,z,K,O,$,pe,de){return i.extend(Ih(Y,z,K,O),pc(pe,z,de),{u_height_factor:-Math.pow(2,$.overscaledZ)/de.tileSize/8})},Rc=function(Y,z){return{u_matrix:new i.UniformMa
|
|||
|
{name:nonlatin}`,"text-max-width":5,"text-rotation-alignment":"map","symbol-placement":"line","symbol-spacing":350,"text-letter-spacing":.2},paint:{"text-color":"#74aee9","text-halo-width":1.5,"text-halo-color":"rgba(255,255,255,0.7)"}},{id:"water-name-ocean",type:"symbol",source:"openmaptiles","source-layer":"water_name",filter:["all",["==","$type","Point"],["==","class","ocean"]],layout:{"text-font":["Noto Sans Italic"],"text-size":14,"text-field":"{name:latin}","text-max-width":5,"text-rotation-alignment":"map","symbol-placement":"point","symbol-spacing":350,"text-letter-spacing":.2},paint:{"text-color":"#74aee9","text-halo-width":1.5,"text-halo-color":"rgba(255,255,255,0.7)"}},{id:"water-name-other",type:"symbol",source:"openmaptiles","source-layer":"water_name",filter:["all",["==","$type","Point"],["!in","class","ocean"]],layout:{"text-font":["Noto Sans Italic"],"text-size":{stops:[[0,10],[6,14]]},"text-field":`{name:latin}
|
|||
|
{name:nonlatin}`,"text-max-width":5,"text-rotation-alignment":"map","symbol-placement":"point","symbol-spacing":350,"text-letter-spacing":.2,visibility:"visible"},paint:{"text-color":"#74aee9","text-halo-width":1.5,"text-halo-color":"rgba(255,255,255,0.7)"}},{id:"poi-level-3",type:"symbol",source:"openmaptiles","source-layer":"poi",minzoom:16,filter:["all",["==","$type","Point"],[">=","rank",25]],layout:{"text-padding":2,"text-font":["Noto Sans Regular"],"text-anchor":"top","icon-image":"{class}_11","text-field":`{name:latin}
|
|||
|
{name:nonlatin}`,"text-offset":[0,.6],"text-size":12,"text-max-width":9},paint:{"text-halo-blur":.5,"text-color":"#666","text-halo-width":1,"text-halo-color":"#ffffff"}},{id:"poi-level-2",type:"symbol",source:"openmaptiles","source-layer":"poi",minzoom:15,filter:["all",["==","$type","Point"],["<=","rank",24],[">=","rank",15]],layout:{"text-padding":2,"text-font":["Noto Sans Regular"],"text-anchor":"top","icon-image":"{class}_11","text-field":`{name:latin}
|
|||
|
{name:nonlatin}`,"text-offset":[0,.6],"text-size":12,"text-max-width":9},paint:{"text-halo-blur":.5,"text-color":"#666","text-halo-width":1,"text-halo-color":"#ffffff"}},{id:"poi-level-1",type:"symbol",source:"openmaptiles","source-layer":"poi",minzoom:14,filter:["all",["==","$type","Point"],["<=","rank",14],["has","name"]],layout:{"text-padding":2,"text-font":["Noto Sans Regular"],"text-anchor":"top","icon-image":"{class}_11","text-field":`{name:latin}
|
|||
|
{name:nonlatin}`,"text-offset":[0,.6],"text-size":11,"text-max-width":9},paint:{"text-halo-blur":.5,"text-color":"rgba(191, 228, 172, 1)","text-halo-width":1,"text-halo-color":"rgba(30, 29, 29, 1)"}},{id:"poi-railway",type:"symbol",source:"openmaptiles","source-layer":"poi",minzoom:13,filter:["all",["==","$type","Point"],["has","name"],["==","class","railway"],["==","subclass","station"]],layout:{"text-padding":2,"text-font":["Noto Sans Regular"],"text-anchor":"top","icon-image":"{class}_11","text-field":`{name:latin}
|
|||
|
{name:nonlatin}`,"text-offset":[0,.6],"text-size":12,"text-max-width":9,"icon-optional":!1,"icon-ignore-placement":!1,"icon-allow-overlap":!1,"text-ignore-placement":!1,"text-allow-overlap":!1,"text-optional":!0},paint:{"text-halo-blur":.5,"text-color":"#666","text-halo-width":1,"text-halo-color":"#ffffff"}},{id:"road_oneway",type:"symbol",source:"openmaptiles","source-layer":"transportation",minzoom:15,filter:["all",["==","oneway",1],["in","class","motorway","trunk","primary","secondary","tertiary","minor","service"]],layout:{"symbol-placement":"line","icon-image":"oneway","symbol-spacing":75,"icon-padding":2,"icon-rotation-alignment":"map","icon-rotate":90,"icon-size":{stops:[[15,.5],[19,1]]}},paint:{"icon-opacity":.5}},{id:"road_oneway_opposite",type:"symbol",source:"openmaptiles","source-layer":"transportation",minzoom:15,filter:["all",["==","oneway",-1],["in","class","motorway","trunk","primary","secondary","tertiary","minor","service"]],layout:{"symbol-placement":"line","icon-image":"oneway","symbol-spacing":75,"icon-padding":2,"icon-rotation-alignment":"map","icon-rotate":-90,"icon-size":{stops:[[15,.5],[19,1]]}},paint:{"icon-opacity":.5}},{id:"highway-name-path",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15.5,filter:["==","class","path"],layout:{"text-size":{base:1,stops:[[13,12],[14,13]]},"text-font":["Noto Sans Regular"],"text-field":"{name:latin} {name:nonlatin}","symbol-placement":"line","text-rotation-alignment":"map"},paint:{"text-halo-color":"#f8f4f0","text-color":"hsl(30, 23%, 62%)","text-halo-width":.5}},{id:"highway-name-minor",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15,filter:["all",["==","$type","LineString"],["in","class","minor","service","track"]],layout:{"text-size":{base:1,stops:[[13,12],[14,13]]},"text-font":["Noto Sans Regular"],"text-field":"{name:latin} {name:nonlatin}","symbol-placement":"line","text-rotation-alignment":"map"},paint:{"text-halo-blur":.5,"text-color":"#765","text-halo-width":1}},{id:"highway-name-major",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12.2,filter:["in","class","primary","secondary","tertiary","trunk"],layout:{"text-size":{base:1,stops:[[13,12],[14,13]]},"text-font":["Noto Sans Regular"],"text-field":"{name:latin} {name:nonlatin}","symbol-placement":"line","text-rotation-alignment":"map"},paint:{"text-halo-blur":.5,"text-color":"#765","text-halo-width":1}},{id:"highway-shield",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:8,filter:["all",["<=","ref_length",6],["==","$type","LineString"],["!in","network","us-interstate","us-highway","us-state"]],layout:{"text-size":10,"icon-image":"road_{ref_length}","icon-rotation-alignment":"viewport","symbol-spacing":200,"text-font":["Noto Sans Regular"],"symbol-placement":{base:1,stops:[[10,"point"],[11,"line"]]},"text-rotation-alignment":"viewport","icon-size":1,"text-field":"{ref}"},paint:{"text-opacity":1,"text-color":"rgba(20, 19, 19, 1)","text-halo-color":"rgba(230, 221, 221, 0)","text-halo-width":2,"icon-color":"rgba(183, 18, 18, 1)","icon-opacity":.3,"icon-halo-color":"rgba(183, 55, 55, 0)"}},{id:"highway-shield-us-interstate",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:7,filter:["all",["<=","ref_length",6],["==","$type","LineString"],["in","network","us-interstate"]],layout:{"text-size":10,"icon-image":"{network}_{ref_length}","icon-rotation-alignment":"viewport","symbol-spacing":200,"text-font":["Noto Sans Regular"],"symbol-placement":{base:1,stops:[[7,"point"],[7,"line"],[8,"line"]]},"text-rotation-alignment":"viewport","icon-size":1,"text-field":"{ref}"},paint:{"text-color":"rgba(0, 0, 0, 1)"}},{id:"highway-shield-us-other",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:9,filter:["all",["<=","ref_length",6],["==","$type","LineString"],["in","network","us-highway","us-state"]],layout:{"text-size":10,"icon-image":"{network}_{ref_length}","icon-rotation-alignment":"viewport","symbol-spacing":200,"text-
|
|||
|
{name:nonlatin}`,"text-transform":"uppercase","text-max-width":9,visibility:"visible"},paint:{"text-color":"rgba(255,255,255,1)","text-halo-width":1.2,"text-halo-color":"rgba(57, 28, 28, 1)"}},{id:"place-village",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",minzoom:10,filter:["==","class","village"],layout:{"text-font":["Noto Sans Regular"],"text-size":{base:1.2,stops:[[10,12],[15,16]]},"text-field":`{name:latin}
|
|||
|
{name:nonlatin}`,"text-max-width":8,visibility:"visible"},paint:{"text-color":"rgba(255, 255, 255, 1)","text-halo-width":1.2,"text-halo-color":"rgba(10, 9, 9, 0.8)"}},{id:"place-town",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",filter:["==","class","town"],layout:{"text-font":["Noto Sans Regular"],"text-size":{base:1.2,stops:[[10,14],[15,24]]},"text-field":`{name:latin}
|
|||
|
{name:nonlatin}`,"text-max-width":8,visibility:"visible"},paint:{"text-color":"rgba(255, 255, 255, 1)","text-halo-width":1.2,"text-halo-color":"rgba(22, 22, 22, 0.8)"}},{id:"place-city",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",filter:["all",["!=","capital",2],["==","class","city"]],layout:{"text-font":["Noto Sans Regular"],"text-size":{base:1.2,stops:[[7,14],[11,24]]},"text-field":`{name:latin}
|
|||
|
{name:nonlatin}`,"text-max-width":8,visibility:"visible"},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-width":1.2,"text-halo-color":"rgba(255,255,255,0.8)"}},{id:"place-city-capital",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",filter:["all",["==","capital",2],["==","class","city"]],layout:{"text-font":["Noto Sans Regular"],"text-size":{base:1.2,stops:[[7,14],[11,24]]},"text-field":`{name:latin}
|
|||
|
{name:nonlatin}`,"text-max-width":8,"icon-image":"star_11","text-offset":[.4,0],"icon-size":.8,"text-anchor":"left",visibility:"visible"},paint:{"text-color":"#333","text-halo-width":1.2,"text-halo-color":"rgba(255,255,255,0.8)"}},{id:"place-country-other",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",filter:["all",["==","class","country"],[">=","rank",3],["!has","iso_a2"]],layout:{"text-font":["Noto Sans Italic"],"text-field":"{name:latin}","text-size":{stops:[[3,11],[7,17]]},"text-transform":"uppercase","text-max-width":6.25,visibility:"visible"},paint:{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{id:"place-country-3",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",filter:["all",["==","class","country"],[">=","rank",3],["has","iso_a2"]],layout:{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":{stops:[[3,11],[7,17]]},"text-transform":"uppercase","text-max-width":6.25,visibility:"visible"},paint:{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{id:"place-country-2",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",filter:["all",["==","class","country"],["==","rank",2],["has","iso_a2"]],layout:{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":{stops:[[2,11],[5,17]]},"text-transform":"uppercase","text-max-width":6.25,visibility:"visible"},paint:{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{id:"place-country-1",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",filter:["all",["==","class","country"],["==","rank",1],["has","iso_a2"]],layout:{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":{stops:[[1,11],[4,17]]},"text-transform":"uppercase","text-max-width":6.25,visibility:"visible"},paint:{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{id:"place-continent",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",maxzoom:1,filter:["==","class","continent"],layout:{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":14,"text-max-width":6.25,"text-transform":"uppercase",visibility:"visible"},paint:{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}}],id:"qebnlkra6"}});var oHe=ye((c1r,aHe)=>{aHe.exports={version:8,name:"orto",metadata:{},center:[1.537786,41.837539],zoom:12,bearing:0,pitch:0,light:{anchor:"viewport",color:"white",intensity:.4,position:[1.15,45,30]},sources:{ortoEsri:{type:"raster",tiles:["https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"],tileSize:256,maxzoom:18,attribution:"ESRI © <a href='http://www.esri.com'>ESRI</a>"},ortoInstaMaps:{type:"raster",tiles:["https://tilemaps.icgc.cat/mapfactory/wmts/orto_8_12/CAT3857/{z}/{x}/{y}.png"],tileSize:256,maxzoom:13},ortoICGC:{type:"raster",tiles:["https://geoserveis.icgc.cat/icc_mapesmultibase/noutm/wmts/orto/GRID3857/{z}/{x}/{y}.jpeg"],tileSize:256,minzoom:13.1,maxzoom:20},openmaptiles:{type:"vector",url:"https://geoserveis.icgc.cat/contextmaps/basemap.json"}},sprite:"https://geoserveis.icgc.cat/contextmaps/sprites/sprite@1",glyphs:"https://geoserveis.icgc.cat/contextmaps/glyphs/{fontstack}/{range}.pbf",layers:[{id:"background",type:"background",paint:{"background-color":"#F4F9F4"}},{id:"ortoEsri",type:"raster",source:"ortoEsri",maxzoom:16,layout:{visibility:"visible"}},{id:"ortoICGC",type:"raster",source:"ortoICGC",minzoom:13.1,maxzoom:19,layout:{visibility:"visible"}},{id:"ortoInstaMaps",type:"raster",source:"ortoInstaMaps",maxzoom:13,layout:{visibility:"visible"}}]}});var wx=ye((f1r,fHe)=>{"use strict";var TGt=Y1(),AGt=nHe(),SGt=oHe(),MGt='\xA9 <a target="_blank" href="https://www.openst
|
|||
|
`),mapOnErrorMsg:"Map error."}});var Ok=ye((h1r,gHe)=>{"use strict";var hHe=Mr(),dHe=va().defaultLine,LGt=Ju().attributes,PGt=Su(),IGt=Uc().textposition,RGt=Bu().overrideAll,DGt=Vs().templatedArray,vHe=wx(),pHe=PGt({noFontVariant:!0,noFontShadow:!0,noFontLineposition:!0,noFontTextcase:!0});pHe.family.dflt="Open Sans Regular, Arial Unicode MS Regular";var zGt=gHe.exports=RGt({_arrayAttrRegexps:[hHe.counterRegex("map",".layers",!0)],domain:LGt({name:"map"}),style:{valType:"any",values:vHe.styleValuesMap,dflt:vHe.styleValueDflt},center:{lon:{valType:"number",dflt:0},lat:{valType:"number",dflt:0}},zoom:{valType:"number",dflt:1},bearing:{valType:"number",dflt:0},pitch:{valType:"number",dflt:0},bounds:{west:{valType:"number"},east:{valType:"number"},south:{valType:"number"},north:{valType:"number"}},layers:DGt("layer",{visible:{valType:"boolean",dflt:!0},sourcetype:{valType:"enumerated",values:["geojson","vector","raster","image"],dflt:"geojson"},source:{valType:"any"},sourcelayer:{valType:"string",dflt:""},sourceattribution:{valType:"string"},type:{valType:"enumerated",values:["circle","line","fill","symbol","raster"],dflt:"circle"},coordinates:{valType:"any"},below:{valType:"string"},color:{valType:"color",dflt:dHe},opacity:{valType:"number",min:0,max:1,dflt:1},minzoom:{valType:"number",min:0,max:24,dflt:0},maxzoom:{valType:"number",min:0,max:24,dflt:24},circle:{radius:{valType:"number",dflt:15}},line:{width:{valType:"number",dflt:2},dash:{valType:"data_array"}},fill:{outlinecolor:{valType:"color",dflt:dHe}},symbol:{icon:{valType:"string",dflt:"marker"},iconsize:{valType:"number",dflt:10},text:{valType:"string",dflt:""},placement:{valType:"enumerated",values:["point","line","line-center"],dflt:"point"},textfont:pHe,textposition:hHe.extendFlat({},IGt,{arrayOk:!1})}})},"plot","from-root");zGt.uirevision={valType:"any",editType:"none"}});var $F=ye((d1r,_He)=>{"use strict";var FGt=Wo().hovertemplateAttrs,qGt=Wo().texttemplateAttrs,OGt=Eg(),Bk=H2(),TA=Uc(),mHe=Ok(),BGt=vl(),NGt=Jl(),rw=no().extendFlat,UGt=Bu().overrideAll,VGt=Ok(),yHe=Bk.line,AA=Bk.marker;_He.exports=UGt({lon:Bk.lon,lat:Bk.lat,cluster:{enabled:{valType:"boolean"},maxzoom:rw({},VGt.layers.maxzoom,{}),step:{valType:"number",arrayOk:!0,dflt:-1,min:-1},size:{valType:"number",arrayOk:!0,dflt:20,min:0},color:{valType:"color",arrayOk:!0},opacity:rw({},AA.opacity,{dflt:1})},mode:rw({},TA.mode,{dflt:"markers"}),text:rw({},TA.text,{}),texttemplate:qGt({editType:"plot"},{keys:["lat","lon","text"]}),hovertext:rw({},TA.hovertext,{}),line:{color:yHe.color,width:yHe.width},connectgaps:TA.connectgaps,marker:rw({symbol:{valType:"string",dflt:"circle",arrayOk:!0},angle:{valType:"number",dflt:"auto",arrayOk:!0},allowoverlap:{valType:"boolean",dflt:!1},opacity:AA.opacity,size:AA.size,sizeref:AA.sizeref,sizemin:AA.sizemin,sizemode:AA.sizemode},NGt("marker")),fill:Bk.fill,fillcolor:OGt(),textfont:mHe.layers.symbol.textfont,textposition:mHe.layers.symbol.textposition,below:{valType:"string"},selected:{marker:TA.selected.marker},unselected:{marker:TA.unselected.marker},hoverinfo:rw({},BGt.hoverinfo,{flags:["lon","lat","text","name"]}),hovertemplate:FGt()},"calc","nested")});var lJ=ye((v1r,xHe)=>{"use strict";var HGt=["Metropolis Black Italic","Metropolis Black","Metropolis Bold Italic","Metropolis Bold","Metropolis Extra Bold Italic","Metropolis Extra Bold","Metropolis Extra Light Italic","Metropolis Extra Light","Metropolis Light Italic","Metropolis Light","Metropolis Medium Italic","Metropolis Medium","Metropolis Regular Italic","Metropolis Regular","Metropolis Semi Bold Italic","Metropolis Semi Bold","Metropolis Thin Italic","Metropolis Thin","Open Sans Bold Italic","Open Sans Bold","Open Sans Extrabold Italic","Open Sans Extrabold","Open Sans Italic","Open Sans Light Italic","Open Sans Light","Open Sans Regular","Open Sans Semibold Italic","Open Sans Semibold","Klokantech Noto Sans Bold","Klokantech Noto Sans CJK Bold","Klokantech Noto Sans CJK Regular","Klokantech Noto Sans Italic","Klokantech Noto Sans Regular"];xHe.exports={isSupportedFont:function(e){return HGt.indexOf(e)!==-1}
|
|||
|
`)),c.push({type:"Feature",geometry:{type:"Point",coordinates:h.lonlat},properties:{symbol:s(f),angle:l(f),text:v}})}}return{type:"FeatureCollection",features:c}}function hJ(e,t){return nv.isArrayOrTypedArray(e)?t?function(r){return LHe(e[r])?+e[r]:0}:function(r){return e[r]}:e?function(){return e}:r7}function r7(){return""}function PHe(e){return e[0]===KGt}function dJ(e,t){var r;if(nv.isArrayOrTypedArray(e)&&nv.isArrayOrTypedArray(t)){r=["step",["get","point_count"],e[0]];for(var n=1;n<e.length;n++)r.push(t[n-1],e[n])}else r=e;return r}function CHe(e){var t=e.textfont,r=t.family,n=t.style,i=t.weight,a=r.split(" "),o=a[a.length-1]==="Italic";o&&a.pop(),o=o||n==="italic";var s=a.join(" ");i==="bold"&&a.indexOf("Bold")===-1?s+=" Bold":i<=1e3&&(a[0]==="Metropolis"?(s="Metropolis",i>850?s+=" Black":i>750?s+=" Extra Bold":i>650?s+=" Bold":i>550?s+=" Semi Bold":i>450?s+=" Medium":i>350?s+=" Regular":i>250?s+=" Light":i>150?s+=" Extra Light":s+=" Thin"):a.slice(0,2).join(" ")==="Open Sans"?(s="Open Sans",i>750?s+=" Extrabold":i>650?s+=" Bold":i>550?s+=" Semibold":i>350?s+=" Regular":s+=" Light"):a.slice(0,3).join(" ")==="Klokantech Noto Sans"&&(s="Klokantech Noto Sans",a[3]==="CJK"&&(s+=" CJK"),s+=i>500?" Bold":" Regular")),o&&(s+=" Italic"),s==="Open Sans Regular Italic"?s="Open Sans Italic":s==="Open Sans Regular Bold"?s="Open Sans Bold":s==="Open Sans Regular Bold Italic"?s="Open Sans Bold Italic":s==="Klokantech Noto Sans Regular Italic"&&(s="Klokantech Noto Sans Italic"),QGt(s)||(s=r);var l=s.split(", ");return l}});var qHe=ye((_1r,FHe)=>{"use strict";var ojt=Mr(),DHe=RHe(),SA=wx().traceLayerPrefix,ng={cluster:["cluster","clusterCount","circle"],nonCluster:["fill","line","circle","symbol"]};function zHe(e,t,r,n){this.type="scattermap",this.subplot=e,this.uid=t,this.clusterEnabled=r,this.isHidden=n,this.sourceIds={fill:"source-"+t+"-fill",line:"source-"+t+"-line",circle:"source-"+t+"-circle",symbol:"source-"+t+"-symbol",cluster:"source-"+t+"-circle",clusterCount:"source-"+t+"-circle"},this.layerIds={fill:SA+t+"-fill",line:SA+t+"-line",circle:SA+t+"-circle",symbol:SA+t+"-symbol",cluster:SA+t+"-cluster",clusterCount:SA+t+"-cluster-count"},this.below=null}var Uk=zHe.prototype;Uk.addSource=function(e,t,r){var n={type:"geojson",data:t.geojson};r&&r.enabled&&ojt.extendFlat(n,{cluster:!0,clusterMaxZoom:r.maxzoom});var i=this.subplot.map.getSource(this.sourceIds[e]);i?i.setData(t.geojson):this.subplot.map.addSource(this.sourceIds[e],n)};Uk.setSourceData=function(e,t){this.subplot.map.getSource(this.sourceIds[e]).setData(t.geojson)};Uk.addLayer=function(e,t,r){var n={type:t.type,id:this.layerIds[e],source:this.sourceIds[e],layout:t.layout,paint:t.paint};t.filter&&(n.filter=t.filter);for(var i=this.layerIds[e],a,o=this.subplot.getMapLayers(),s=0;s<o.length;s++)if(o[s].id===i){a=!0;break}a?(this.subplot.setOptions(i,"setLayoutProperty",n.layout),n.layout.visibility==="visible"&&this.subplot.setOptions(i,"setPaintProperty",n.paint)):this.subplot.addLayer(n,r)};Uk.update=function(t){var r=t[0].trace,n=this.subplot,i=n.map,a=DHe(n.gd,t),o=n.belowLookup["trace-"+this.uid],s=!!(r.cluster&&r.cluster.enabled),l=!!this.clusterEnabled,u=this;function c(k){k||u.addSource("circle",a.circle,r.cluster);for(var A=ng.cluster,L=0;L<A.length;L++){var _=A[L],C=a[_];u.addLayer(_,C,o)}}function f(k){for(var A=ng.cluster,L=A.length-1;L>=0;L--){var _=A[L];i.removeLayer(u.layerIds[_])}k||i.removeSource(u.sourceIds.circle)}function h(k){for(var A=ng.nonCluster,L=0;L<A.length;L++){var _=A[L],C=a[_];k||u.addSource(_,C),u.addLayer(_,C,o)}}function d(k){for(var A=ng.nonCluster,L=A.length-1;L>=0;L--){var _=A[L];i.removeLayer(u.layerIds[_]),k||i.removeSource(u.sourceIds[_])}}function v(k){l?f(k):d(k)}function x(k){s?c(k):h(k)}function b(){for(var k=s?ng.cluster:ng.nonCluster,A=0;A<k.length;A++){var L=k[A],_=a[L];_&&(n.setOptions(u.layerIds[L],"setLayoutProperty",_.layout),_.layout.visibility==="visible"&&(L!=="cluster"&&u.setSourceData(L,_),n.setOptions(u.layerIds[L],"setPaintProperty",_.paint)))}}var p=this.isHidden,E=r.visible!==!0;E?p||v():p?E||x():l!==s?(v(),
|
|||
|
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(Ft[1])} }\`.`)];let Qt=[];return R.layerType==="symbol"&&(De==="text-field"&&te&&!te.glyphs&&Qt.push(new er(D,ve,'use of "text-field" requires a style "glyphs" property')),De==="text-font"&&Ch(_u(ve))&&Fs(ve.type)==="identity"&&Qt.push(new er(D,ve,'"text-font" does not support identity functions'))),Qt.concat(j({key:R.key,value:ve,valueSpec:Tt,style:te,styleSpec:ue,expressionContext:"property",propertyType:S,propertyKey:De}))}function Ph(R){return pf(R,"paint")}function Dl(R){return pf(R,"layout")}function Ih(R){let S=[],D=R.value,j=R.key,te=R.style,ue=R.styleSpec;D.type||D.ref||S.push(new er(j,D,'either "type" or "ref" is required'));let ve=Fs(D.type),De=Fs(D.ref);if(D.id){let Ze=Fs(D.id);for(let at=0;at<R.arrayIndex;at++){let Tt=te.layers[at];Fs(Tt.id)===Ze&&S.push(new er(j,D.id,`duplicate layer id "${D.id}", previously used at line ${Tt.id.__line__}`))}}if("ref"in D){let Ze;["type","source","source-layer","filter","layout"].forEach(at=>{at in D&&S.push(new er(j,D[at],`"${at}" is prohibited for ref layers`))}),te.layers.forEach(at=>{Fs(at.id)===De&&(Ze=at)}),Ze?Ze.ref?S.push(new er(j,D.ref,"ref cannot reference another ref layer")):ve=Fs(Ze.type):S.push(new er(j,D.ref,`ref layer "${De}" not found`))}else if(ve!=="background")if(D.source){let Ze=te.sources&&te.sources[D.source],at=Ze&&Fs(Ze.type);Ze?at==="vector"&&ve==="raster"?S.push(new er(j,D.source,`layer "${D.id}" requires a raster source`)):at!=="raster-dem"&&ve==="hillshade"?S.push(new er(j,D.source,`layer "${D.id}" requires a raster-dem source`)):at==="raster"&&ve!=="raster"?S.push(new er(j,D.source,`layer "${D.id}" requires a vector source`)):at!=="vector"||D["source-layer"]?at==="raster-dem"&&ve!=="hillshade"?S.push(new er(j,D.source,"raster-dem source can only be used with layer type 'hillshade'.")):ve!=="line"||!D.paint||!D.paint["line-gradient"]||at==="geojson"&&Ze.lineMetrics||S.push(new er(j,D,`layer "${D.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):S.push(new er(j,D,`layer "${D.id}" must specify a "source-layer"`)):S.push(new er(j,D.source,`source "${D.source}" not found`))}else S.push(new er(j,D,'missing required property "source"'));return S=S.concat(xu({key:j,value:D,valueSpec:ue.layer,style:R.style,styleSpec:R.styleSpec,validateSpec:R.validateSpec,objectElementValidators:{"*":()=>[],type:()=>R.validateSpec({key:`${j}.type`,value:D.type,valueSpec:ue.layer.type,style:R.style,styleSpec:R.styleSpec,validateSpec:R.validateSpec,object:D,objectKey:"type"}),filter:Vf,layout:Ze=>xu({layer:D,key:Ze.key,value:Ze.value,style:Ze.style,styleSpec:Ze.styleSpec,validateSpec:Ze.validateSpec,objectElementValidators:{"*":at=>Dl(Ke({layerType:ve},at))}}),paint:Ze=>xu({layer:D,key:Ze.key,value:Ze.value,style:Ze.style,styleSpec:Ze.styleSpec,validateSpec:Ze.validateSpec,objectElementValidators:{"*":at=>Ph(Ke({layerType:ve},at))}})}})),S}function Wu(R){let S=R.value,D=R.key,j=ds(S);return j!=="string"?[new er(D,S,`string expected, ${j} found`)]:[]}let Rc={promoteId:function({key:R,value:S}){if(ds(S)==="string")return Wu({key:R,value:S});{let D=[];for(let j in S)D.push(...Wu({key:`${R}.${j}`,value:S[j]}));return D}}};function gc(R){let S=R.value,D=R.key,j=R.styleSpec,te=R.style,ue=R.validateSpec;if(!S.type)return[new er(D,S,'"type" is required')];let ve=Fs(S.type),De;switch(ve){case"vector":case"raster":return De=xu({key:D,value:S,valueSpec:j[`source_${ve.replace("-","_")}`],style:R.style,styleSpec:j,objectElementValidators:Rc,validateSpec:ue}),De;case"raster-dem":return De=function(Ze){var at;let Tt=(at=Ze.sourceName)!==null&&at!==void 0?at:"",Ft=Ze.value,Qt=Ze.styleSpec,sr=Qt.source_raster_dem,Tr=Ze.style,Pr=[],$r=ds(Ft);if(Ft===void 0)return Pr;if($r!=="object")return Pr.push(new er("source_raster_dem",Ft,`object expected, ${$r} found`)),Pr;let ni=Fs(Ft.encoding)==="custom",Di=["redFactor","greenFactor","blueFactor","baseShift"],pi=Ze.value.encoding?`"${Ze.value.encoding}"`:"Default";for(let ki in Ft)!ni&&Di.includes(ki)?Pr.pu
|
|||
|
precision mediump float;
|
|||
|
#else
|
|||
|
#if !defined(lowp)
|
|||
|
#define lowp
|
|||
|
#endif
|
|||
|
#if !defined(mediump)
|
|||
|
#define mediump
|
|||
|
#endif
|
|||
|
#if !defined(highp)
|
|||
|
#define highp
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
`,`#ifdef GL_ES
|
|||
|
precision highp float;
|
|||
|
#else
|
|||
|
#if !defined(lowp)
|
|||
|
#define lowp
|
|||
|
#endif
|
|||
|
#if !defined(mediump)
|
|||
|
#define mediump
|
|||
|
#endif
|
|||
|
#if !defined(highp)
|
|||
|
#define highp
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
|
|||
|
);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}
|
|||
|
#ifdef TERRAIN3D
|
|||
|
uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;
|
|||
|
#endif
|
|||
|
const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {
|
|||
|
#ifdef TERRAIN3D
|
|||
|
highp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
|
|||
|
#else
|
|||
|
return 1.0;
|
|||
|
#endif
|
|||
|
}float calculate_visibility(vec4 pos) {
|
|||
|
#ifdef TERRAIN3D
|
|||
|
vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;
|
|||
|
#else
|
|||
|
return 1.0;
|
|||
|
#endif
|
|||
|
}float ele(vec2 pos) {
|
|||
|
#ifdef TERRAIN3D
|
|||
|
vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
|
|||
|
#else
|
|||
|
return 0.0;
|
|||
|
#endif
|
|||
|
}float get_elevation(vec2 pos) {
|
|||
|
#ifdef TERRAIN3D
|
|||
|
vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;
|
|||
|
#else
|
|||
|
return 0.0;
|
|||
|
#endif
|
|||
|
}`),background:_t(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:_t(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:_t(`varying vec3 v_data;varying float v_visibility;
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define mediump float radius
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define highp vec4 stroke_color
|
|||
|
#pragma mapbox: define mediump float stroke_width
|
|||
|
#pragma mapbox: define lowp float stroke_opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize mediump float radius
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize highp vec4 stroke_color
|
|||
|
#pragma mapbox: initialize mediump float stroke_width
|
|||
|
#pragma mapbox: initialize lowp float stroke_opacity
|
|||
|
vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define mediump float radius
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define highp vec4 stroke_color
|
|||
|
#pragma mapbox: define mediump float stroke_width
|
|||
|
#pragma mapbox: define lowp float stroke_opacity
|
|||
|
void main(void) {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize mediump float radius
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize highp vec4 stroke_color
|
|||
|
#pragma mapbox: initialize mediump float stroke_width
|
|||
|
#pragma mapbox: initialize lowp float stroke_opacity
|
|||
|
vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:_t("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:_t(`uniform highp float u_intensity;varying vec2 v_extrude;
|
|||
|
#pragma mapbox: define highp float weight
|
|||
|
#define GAUSS_COEF 0.3989422804014327
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp float weight
|
|||
|
float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;
|
|||
|
#pragma mapbox: define highp float weight
|
|||
|
#pragma mapbox: define mediump float radius
|
|||
|
const highp float ZERO=1.0/255.0/16.0;
|
|||
|
#define GAUSS_COEF 0.3989422804014327
|
|||
|
void main(void) {
|
|||
|
#pragma mapbox: initialize highp float weight
|
|||
|
#pragma mapbox: initialize mediump float radius
|
|||
|
vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,get_elevation(floor(a_pos*0.5)),1);gl_Position=u_matrix*pos;}`),heatmapTexture:_t(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(0.0);
|
|||
|
#endif
|
|||
|
}`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:_t("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_anchor_pos;attribute vec2 a_placed;attribute vec2 a_box_real;uniform mat4 u_matrix;uniform vec2 u_pixel_extrude_scale;varying float v_placed;varying float v_notUsed;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:_t("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:_t("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:_t(`#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
gl_FragColor=color*opacity;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`attribute vec2 a_pos;uniform mat4 u_matrix;
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:_t(`varying vec2 v_pos;
|
|||
|
#pragma mapbox: define highp vec4 outline_color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 outline_color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
|
|||
|
#pragma mapbox: define highp vec4 outline_color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 outline_color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:_t(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_to
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|||
|
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:_t(`#ifdef GL_ES
|
|||
|
precision highp float;
|
|||
|
#endif
|
|||
|
uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_to
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|||
|
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:_t(`varying vec4 v_color;void main() {gl_FragColor=v_color;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
|
|||
|
#ifdef TERRAIN3D
|
|||
|
attribute vec2 a_centroid;
|
|||
|
#endif
|
|||
|
varying vec4 v_color;
|
|||
|
#pragma mapbox: define highp float base
|
|||
|
#pragma mapbox: define highp float height
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp float base
|
|||
|
#pragma mapbox: initialize highp float height
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
vec3 normal=a_normal_ed.xyz;
|
|||
|
#ifdef TERRAIN3D
|
|||
|
float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
|
|||
|
#else
|
|||
|
float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
|
|||
|
#endif
|
|||
|
base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:_t(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
|
|||
|
#pragma mapbox: define lowp float base
|
|||
|
#pragma mapbox: define lowp float height
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_to
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float base
|
|||
|
#pragma mapbox: initialize lowp float height
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|||
|
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
|
|||
|
#ifdef TERRAIN3D
|
|||
|
attribute vec2 a_centroid;
|
|||
|
#endif
|
|||
|
varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
|
|||
|
#pragma mapbox: define lowp float base
|
|||
|
#pragma mapbox: define lowp float height
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_to
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float base
|
|||
|
#pragma mapbox: initialize lowp float height
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|||
|
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;
|
|||
|
#ifdef TERRAIN3D
|
|||
|
float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
|
|||
|
#else
|
|||
|
float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
|
|||
|
#endif
|
|||
|
base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
|
|||
|
? a_pos
|
|||
|
: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:_t(`#ifdef GL_ES
|
|||
|
precision highp float;
|
|||
|
#endif
|
|||
|
uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:_t(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
|
|||
|
#define PI 3.141592653589793
|
|||
|
void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:_t(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`
|
|||
|
#define scale 0.015873016
|
|||
|
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define mediump float gapwidth
|
|||
|
#pragma mapbox: define lowp float offset
|
|||
|
#pragma mapbox: define mediump float width
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump float gapwidth
|
|||
|
#pragma mapbox: initialize lowp float offset
|
|||
|
#pragma mapbox: initialize mediump float width
|
|||
|
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
|
|||
|
#ifdef TERRAIN3D
|
|||
|
v_gamma_scale=1.0;
|
|||
|
#else
|
|||
|
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|||
|
#endif
|
|||
|
v_width2=vec2(outset,inset);}`),lineGradient:_t(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`
|
|||
|
#define scale 0.015873016
|
|||
|
attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define mediump float gapwidth
|
|||
|
#pragma mapbox: define lowp float offset
|
|||
|
#pragma mapbox: define mediump float width
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump float gapwidth
|
|||
|
#pragma mapbox: initialize lowp float offset
|
|||
|
#pragma mapbox: initialize mediump float width
|
|||
|
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
|
|||
|
#ifdef TERRAIN3D
|
|||
|
v_gamma_scale=1.0;
|
|||
|
#else
|
|||
|
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|||
|
#endif
|
|||
|
v_width2=vec2(outset,inset);}`),linePattern:_t(`#ifdef GL_ES
|
|||
|
precision highp float;
|
|||
|
#endif
|
|||
|
uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_to
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`
|
|||
|
#define scale 0.015873016
|
|||
|
#define LINE_DISTANCE_SCALE 2.0
|
|||
|
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp float offset
|
|||
|
#pragma mapbox: define mediump float gapwidth
|
|||
|
#pragma mapbox: define mediump float width
|
|||
|
#pragma mapbox: define lowp float floorwidth
|
|||
|
#pragma mapbox: define lowp vec4 pattern_from
|
|||
|
#pragma mapbox: define lowp vec4 pattern_to
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: define lowp float pixel_ratio_to
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize lowp float offset
|
|||
|
#pragma mapbox: initialize mediump float gapwidth
|
|||
|
#pragma mapbox: initialize mediump float width
|
|||
|
#pragma mapbox: initialize lowp float floorwidth
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_from
|
|||
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|||
|
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|||
|
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
|
|||
|
#ifdef TERRAIN3D
|
|||
|
v_gamma_scale=1.0;
|
|||
|
#else
|
|||
|
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|||
|
#endif
|
|||
|
v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:_t(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define mediump float width
|
|||
|
#pragma mapbox: define lowp float floorwidth
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump float width
|
|||
|
#pragma mapbox: initialize lowp float floorwidth
|
|||
|
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`
|
|||
|
#define scale 0.015873016
|
|||
|
#define LINE_DISTANCE_SCALE 2.0
|
|||
|
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
|
|||
|
#pragma mapbox: define highp vec4 color
|
|||
|
#pragma mapbox: define lowp float blur
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define mediump float gapwidth
|
|||
|
#pragma mapbox: define lowp float offset
|
|||
|
#pragma mapbox: define mediump float width
|
|||
|
#pragma mapbox: define lowp float floorwidth
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 color
|
|||
|
#pragma mapbox: initialize lowp float blur
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize mediump float gapwidth
|
|||
|
#pragma mapbox: initialize lowp float offset
|
|||
|
#pragma mapbox: initialize mediump float width
|
|||
|
#pragma mapbox: initialize lowp float floorwidth
|
|||
|
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
|
|||
|
#ifdef TERRAIN3D
|
|||
|
v_gamma_scale=1.0;
|
|||
|
#else
|
|||
|
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|||
|
#endif
|
|||
|
v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:_t(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:_t(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_tex;varying float v_fade_opacity;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|||
|
camera_to_anchor_distance/u_camera_to_center_distance :
|
|||
|
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:_t(`#define SDF_PX 8.0
|
|||
|
uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;
|
|||
|
#pragma mapbox: define highp vec4 fill_color
|
|||
|
#pragma mapbox: define highp vec4 halo_color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp float halo_width
|
|||
|
#pragma mapbox: define lowp float halo_blur
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 fill_color
|
|||
|
#pragma mapbox: initialize highp vec4 halo_color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize lowp float halo_width
|
|||
|
#pragma mapbox: initialize lowp float halo_blur
|
|||
|
float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_data0;varying vec3 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
|
|||
|
#pragma mapbox: define highp vec4 fill_color
|
|||
|
#pragma mapbox: define highp vec4 halo_color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp float halo_width
|
|||
|
#pragma mapbox: define lowp float halo_blur
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 fill_color
|
|||
|
#pragma mapbox: initialize highp vec4 halo_color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize lowp float halo_width
|
|||
|
#pragma mapbox: initialize lowp float halo_blur
|
|||
|
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|||
|
camera_to_anchor_distance/u_camera_to_center_distance :
|
|||
|
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:_t(`#define SDF_PX 8.0
|
|||
|
#define SDF 1.0
|
|||
|
#define ICON 0.0
|
|||
|
uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;
|
|||
|
#pragma mapbox: define highp vec4 fill_color
|
|||
|
#pragma mapbox: define highp vec4 halo_color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp float halo_width
|
|||
|
#pragma mapbox: define lowp float halo_blur
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 fill_color
|
|||
|
#pragma mapbox: initialize highp vec4 halo_color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize lowp float halo_width
|
|||
|
#pragma mapbox: initialize lowp float halo_blur
|
|||
|
float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
|
|||
|
#ifdef OVERDRAW_INSPECTOR
|
|||
|
gl_FragColor=vec4(1.0);
|
|||
|
#endif
|
|||
|
}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec4 v_data0;varying vec4 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
|
|||
|
#pragma mapbox: define highp vec4 fill_color
|
|||
|
#pragma mapbox: define highp vec4 halo_color
|
|||
|
#pragma mapbox: define lowp float opacity
|
|||
|
#pragma mapbox: define lowp float halo_width
|
|||
|
#pragma mapbox: define lowp float halo_blur
|
|||
|
void main() {
|
|||
|
#pragma mapbox: initialize highp vec4 fill_color
|
|||
|
#pragma mapbox: initialize highp vec4 halo_color
|
|||
|
#pragma mapbox: initialize lowp float opacity
|
|||
|
#pragma mapbox: initialize lowp float halo_width
|
|||
|
#pragma mapbox: initialize lowp float halo_blur
|
|||
|
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|||
|
camera_to_anchor_distance/u_camera_to_center_distance :
|
|||
|
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:_t("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;varying vec2 v_texture_pos;varying float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture2D(u_texture,v_texture_pos);if (v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);gl_FragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {gl_FragColor=surface_color;}}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform mat4 u_fog_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:_t("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:_t("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec
|
|||
|
#ifndef HAS_UNIFORM_u_${hr}
|
|||
|
varying ${Ot} ${Nt} ${hr};
|
|||
|
#else
|
|||
|
uniform ${Ot} ${Nt} u_${hr};
|
|||
|
#endif
|
|||
|
`:`
|
|||
|
#ifdef HAS_UNIFORM_u_${hr}
|
|||
|
${Ot} ${Nt} ${hr} = u_${hr};
|
|||
|
#endif
|
|||
|
`)),vertexSource:w=w.replace(B,(it,yt,Ot,Nt,hr)=>{let Sr=Nt==="float"?"vec2":"vec4",he=hr.match(/color/)?"color":Sr;return je[hr]?yt==="define"?`
|
|||
|
#ifndef HAS_UNIFORM_u_${hr}
|
|||
|
uniform lowp float u_${hr}_t;
|
|||
|
attribute ${Ot} ${Sr} a_${hr};
|
|||
|
varying ${Ot} ${Nt} ${hr};
|
|||
|
#else
|
|||
|
uniform ${Ot} ${Nt} u_${hr};
|
|||
|
#endif
|
|||
|
`:he==="vec4"?`
|
|||
|
#ifndef HAS_UNIFORM_u_${hr}
|
|||
|
${hr} = a_${hr};
|
|||
|
#else
|
|||
|
${Ot} ${Nt} ${hr} = u_${hr};
|
|||
|
#endif
|
|||
|
`:`
|
|||
|
#ifndef HAS_UNIFORM_u_${hr}
|
|||
|
${hr} = unpack_mix_${he}(a_${hr}, u_${hr}_t);
|
|||
|
#else
|
|||
|
${Ot} ${Nt} ${hr} = u_${hr};
|
|||
|
#endif
|
|||
|
`:yt==="define"?`
|
|||
|
#ifndef HAS_UNIFORM_u_${hr}
|
|||
|
uniform lowp float u_${hr}_t;
|
|||
|
attribute ${Ot} ${Sr} a_${hr};
|
|||
|
#else
|
|||
|
uniform ${Ot} ${Nt} u_${hr};
|
|||
|
#endif
|
|||
|
`:he==="vec4"?`
|
|||
|
#ifndef HAS_UNIFORM_u_${hr}
|
|||
|
${Ot} ${Nt} ${hr} = a_${hr};
|
|||
|
#else
|
|||
|
${Ot} ${Nt} ${hr} = u_${hr};
|
|||
|
#endif
|
|||
|
`:`
|
|||
|
#ifndef HAS_UNIFORM_u_${hr}
|
|||
|
${Ot} ${Nt} ${hr} = unpack_mix_${he}(a_${hr}, u_${hr}_t);
|
|||
|
#else
|
|||
|
${Ot} ${Nt} ${hr} = u_${hr};
|
|||
|
#endif
|
|||
|
`}),staticAttributes:Q,staticUniforms:qe}}class br{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(w,B,Q,ee,se,qe,je,it,yt){this.context=w;let Ot=this.boundPaintVertexBuffers.length!==ee.length;for(let Nt=0;!Ot&&Nt<ee.length;Nt++)this.boundPaintVertexBuffers[Nt]!==ee[Nt]&&(Ot=!0);!this.vao||this.boundProgram!==B||this.boundLayoutVertexBuffer!==Q||Ot||this.boundIndexBuffer!==se||this.boundVertexOffset!==qe||this.boundDynamicVertexBuffer!==je||this.boundDynamicVertexBuffer2!==it||this.boundDynamicVertexBuffer3!==yt?this.freshBind(B,Q,ee,se,qe,je,it,yt):(w.bindVertexArray.set(this.vao),je&&je.bind(),se&&se.dynamicDraw&&se.bind(),it&&it.bind(),yt&&yt.bind())}freshBind(w,B,Q,ee,se,qe,je,it){let yt=w.numAttributes,Ot=this.context,Nt=Ot.gl;this.vao&&this.destroy(),this.vao=Ot.createVertexArray(),Ot.bindVertexArray.set(this.vao),this.boundProgram=w,this.boundLayoutVertexBuffer=B,this.boundPaintVertexBuffers=Q,this.boundIndexBuffer=ee,this.boundVertexOffset=se,this.boundDynamicVertexBuffer=qe,this.boundDynamicVertexBuffer2=je,this.boundDynamicVertexBuffer3=it,B.enableAttributes(Nt,w);for(let hr of Q)hr.enableAttributes(Nt,w);qe&&qe.enableAttributes(Nt,w),je&&je.enableAttributes(Nt,w),it&&it.enableAttributes(Nt,w),B.bind(),B.setVertexAttribPointers(Nt,w,se);for(let hr of Q)hr.bind(),hr.setVertexAttribPointers(Nt,w,se);qe&&(qe.bind(),qe.setVertexAttribPointers(Nt,w,se)),ee&&ee.bind(),je&&(je.bind(),je.setVertexAttribPointers(Nt,w,se)),it&&(it.bind(),it.setVertexAttribPointers(Nt,w,se)),Ot.currentNumAttributes=yt}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}let Hr=(le,w,B,Q,ee)=>({u_matrix:le,u_texture:0,u_ele_delta:w,u_fog_matrix:B,u_fog_color:Q?Q.properties.get("fog-color"):a.aM.white,u_fog_ground_blend:Q?Q.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:Q?Q.calculateFogBlendOpacity(ee):0,u_horizon_color:Q?Q.properties.get("horizon-color"):a.aM.white,u_horizon_fog_blend:Q?Q.properties.get("horizon-fog-blend"):1});function ti(le){let w=[];for(let B=0;B<le.length;B++){if(le[B]===null)continue;let Q=le[B].split(" ");w.push(Q.pop())}return w}class zi{constructor(w,B,Q,ee,se,qe){let je=w.gl;this.program=je.createProgram();let it=ti(B.staticAttributes),yt=Q?Q.getBinderAttributes():[],Ot=it.concat(yt),Nt=xn.prelude.staticUniforms?ti(xn.prelude.staticUniforms):[],hr=B.staticUniforms?ti(B.staticUniforms):[],Sr=Q?Q.getBinderUniforms():[],he=Nt.concat(hr).concat(Sr),be=[];for(let Dt of he)be.indexOf(Dt)<0&&be.push(Dt);let Pe=Q?Q.defines():[];se&&Pe.push("#define OVERDRAW_INSPECTOR;"),qe&&Pe.push("#define TERRAIN3D;");let Oe=Pe.concat(xn.prelude.fragmentSource,B.fragmentSource).join(`
|
|||
|
`),Je=Pe.concat(xn.prelude.vertexSource,B.vertexSource).join(`
|
|||
|
`),He=je.createShader(je.FRAGMENT_SHADER);if(je.isContextLost())return void(this.failedToCreate=!0);if(je.shaderSource(He,Oe),je.compileShader(He),!je.getShaderParameter(He,je.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${je.getShaderInfoLog(He)}`);je.attachShader(this.program,He);let et=je.createShader(je.VERTEX_SHADER);if(je.isContextLost())return void(this.failedToCreate=!0);if(je.shaderSource(et,Je),je.compileShader(et),!je.getShaderParameter(et,je.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${je.getShaderInfoLog(et)}`);je.attachShader(this.program,et),this.attributes={};let Mt={};this.numAttributes=Ot.length;for(let Dt=0;Dt<this.numAttributes;Dt++)Ot[Dt]&&(je.bindAttribLocation(this.program,Dt,Ot[Dt]),this.attributes[Ot[Dt]]=Dt);if(je.linkProgram(this.program),!je.getProgramParameter(this.program,je.LINK_STATUS))throw new Error(`Program failed to link: ${je.getProgramInfoLog(this.program)}`);je.deleteShader(et),je.deleteShader(He);for(let Dt=0;Dt<be.length;Dt++){let Ut=be[Dt];if(Ut&&!Mt[Ut]){let tr=je.getUniformLocation(this.program,Ut);tr&&(Mt[Ut]=tr)}}this.fixedUniforms=ee(w,Mt),this.terrainUniforms=((Dt,Ut)=>({u_depth:new a.aH(Dt,Ut.u_depth),u_terrain:new a.aH(Dt,Ut.u_terrain),u_terrain_dim:new a.aI(Dt,Ut.u_terrain_dim),u_terrain_matrix:new a.aJ(Dt,Ut.u_terrain_matrix),u_terrain_unpack:new a.aK(Dt,Ut.u_terrain_unpack),u_terrain_exaggeration:new a.aI(Dt,Ut.u_terrain_exaggeration)}))(w,Mt),this.binderUniforms=Q?Q.getUniforms(w,Mt):[]}draw(w,B,Q,ee,se,qe,je,it,yt,Ot,Nt,hr,Sr,he,be,Pe,Oe,Je){let He=w.gl;if(this.failedToCreate)return;if(w.program.set(this.program),w.setDepthMode(Q),w.setStencilMode(ee),w.setColorMode(se),w.setCullFace(qe),it){w.activeTexture.set(He.TEXTURE2),He.bindTexture(He.TEXTURE_2D,it.depthTexture),w.activeTexture.set(He.TEXTURE3),He.bindTexture(He.TEXTURE_2D,it.texture);for(let Mt in this.terrainUniforms)this.terrainUniforms[Mt].set(it[Mt])}for(let Mt in this.fixedUniforms)this.fixedUniforms[Mt].set(je[Mt]);be&&be.setUniforms(w,this.binderUniforms,Sr,{zoom:he});let et=0;switch(B){case He.LINES:et=2;break;case He.TRIANGLES:et=3;break;case He.LINE_STRIP:et=1}for(let Mt of hr.get()){let Dt=Mt.vaos||(Mt.vaos={});(Dt[yt]||(Dt[yt]=new br)).bind(w,this,Ot,be?be.getPaintVertexBuffers():[],Nt,Mt.vertexOffset,Pe,Oe,Je),He.drawElements(B,Mt.primitiveLength*et,He.UNSIGNED_SHORT,Mt.primitiveOffset*et*2)}}}function Yi(le,w,B){let Q=1/nn(B,1,w.transform.tileZoom),ee=Math.pow(2,B.tileID.overscaledZ),se=B.tileSize*Math.pow(2,w.transform.tileZoom)/ee,qe=se*(B.tileID.canonical.x+B.tileID.wrap*ee),je=se*B.tileID.canonical.y;return{u_image:0,u_texsize:B.imageAtlasTexture.size,u_scale:[Q,le.fromScale,le.toScale],u_fade:le.t,u_pixel_coord_upper:[qe>>16,je>>16],u_pixel_coord_lower:[65535&qe,65535&je]}}let an=(le,w,B,Q)=>{let ee=w.style.light,se=ee.properties.get("position"),qe=[se.x,se.y,se.z],je=function(){var yt=new a.A(9);return a.A!=Float32Array&&(yt[1]=0,yt[2]=0,yt[3]=0,yt[5]=0,yt[6]=0,yt[7]=0),yt[0]=1,yt[4]=1,yt[8]=1,yt}();ee.properties.get("anchor")==="viewport"&&function(yt,Ot){var Nt=Math.sin(Ot),hr=Math.cos(Ot);yt[0]=hr,yt[1]=Nt,yt[2]=0,yt[3]=-Nt,yt[4]=hr,yt[5]=0,yt[6]=0,yt[7]=0,yt[8]=1}(je,-w.transform.angle),function(yt,Ot,Nt){var hr=Ot[0],Sr=Ot[1],he=Ot[2];yt[0]=hr*Nt[0]+Sr*Nt[3]+he*Nt[6],yt[1]=hr*Nt[1]+Sr*Nt[4]+he*Nt[7],yt[2]=hr*Nt[2]+Sr*Nt[5]+he*Nt[8]}(qe,qe,je);let it=ee.properties.get("color");return{u_matrix:le,u_lightpos:qe,u_lightintensity:ee.properties.get("intensity"),u_lightcolor:[it.r,it.g,it.b],u_vertical_gradient:+B,u_opacity:Q}},hi=(le,w,B,Q,ee,se,qe)=>a.e(an(le,w,B,Q),Yi(se,w,qe),{u_height_factor:-Math.pow(2,ee.overscaledZ)/qe.tileSize/8}),Ji=le=>({u_matrix:le}),ua=(le,w,B,Q)=>a.e(Ji(le),Yi(B,w,Q)),Fn=(le,w)=>({u_matrix:le,u_world:w}),Sa=(le,w,B,Q,ee)=>a.e(ua(le,w,B,Q),{u_world:ee}),go=(le,w,B,Q)=>{let ee=le.transform,se,qe;if(Q.paint.get("circle-pitch-alignment")==="map"){let je=nn(B,1,ee.zoom);se=!0,qe=[je,je]}else se=!1,qe=ee.pixelsToGLUnits;return{u_camera_to_center_distance:ee.cameraToCenterDistance,u_scale_with_map:+(Q.paint.get("circle-pi
|
|||
|
/*!
|
|||
|
* The buffer module from node.js, for the browser.
|
|||
|
*
|
|||
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|||
|
* @license MIT
|
|||
|
*/
|
|||
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|||
|
/*!
|
|||
|
* Determine if an object is a Buffer
|
|||
|
*
|
|||
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|||
|
* @license MIT
|
|||
|
*/
|
|||
|
/*!
|
|||
|
* pad-left <https://github.com/jonschlinkert/pad-left>
|
|||
|
*
|
|||
|
* Copyright (c) 2014-2015, Jon Schlinkert.
|
|||
|
* Licensed under the MIT license.
|
|||
|
*/
|
|||
|
/*!
|
|||
|
* repeat-string <https://github.com/jonschlinkert/repeat-string>
|
|||
|
*
|
|||
|
* Copyright (c) 2014-2015, Jon Schlinkert.
|
|||
|
* Licensed under the MIT License.
|
|||
|
*/
|
|||
|
/*! Bundled license information:
|
|||
|
|
|||
|
native-promise-only/lib/npo.src.js:
|
|||
|
(*! Native Promise Only
|
|||
|
v0.8.1 (c) Kyle Simpson
|
|||
|
MIT License: http://getify.mit-license.org
|
|||
|
*)
|
|||
|
|
|||
|
polybooljs/index.js:
|
|||
|
(*
|
|||
|
* @copyright 2016 Sean Connelly (@voidqk), http://syntheti.cc
|
|||
|
* @license MIT
|
|||
|
* @preserve Project Home: https://github.com/voidqk/polybooljs
|
|||
|
*)
|
|||
|
|
|||
|
ieee754/index.js:
|
|||
|
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|||
|
|
|||
|
buffer/index.js:
|
|||
|
(*!
|
|||
|
* The buffer module from node.js, for the browser.
|
|||
|
*
|
|||
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|||
|
* @license MIT
|
|||
|
*)
|
|||
|
|
|||
|
safe-buffer/index.js:
|
|||
|
(*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|||
|
|
|||
|
assert/build/internal/util/comparisons.js:
|
|||
|
(*!
|
|||
|
* The buffer module from node.js, for the browser.
|
|||
|
*
|
|||
|
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|||
|
* @license MIT
|
|||
|
*)
|
|||
|
|
|||
|
object-assign/index.js:
|
|||
|
(*
|
|||
|
object-assign
|
|||
|
(c) Sindre Sorhus
|
|||
|
@license MIT
|
|||
|
*)
|
|||
|
|
|||
|
maplibre-gl/dist/maplibre-gl.js:
|
|||
|
(**
|
|||
|
* MapLibre GL JS
|
|||
|
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.7.1/LICENSE.txt
|
|||
|
*)
|
|||
|
*/
|
|||
|
|
|||
|
window.Plotly = Plotly;
|
|||
|
return Plotly;
|
|||
|
}));
|